koeienboei
Member
- Reaction score
- 4
Code:
native GetMouseTerrainY takes nothing returns real
native GetMouseTerrainX takes nothing returns real
scope Dash
private struct Dash
real dx
real dy
unit subject
private method periodic takes nothing returns nothing
call SetUnitX(subject, GetUnitX(subject) + dx)
call SetUnitY(subject, GetUnitY(subject) + dy)
endmethod
implement T32x
private static method create takes unit which, real speed returns thistype
local thistype this = thistype.allocate()
set this.dx = speed*1000 * T32_PERIOD
set this.dy = (1-speed)*1000 * T32_PERIOD
set this.subject = which
call this.startPeriodic()
return thistype
endmethod
private method destroy takes nothing returns nothing
call this.stopPeriodic()
call this.deallocate()
endmethod
endstruct
private function Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A002' )
endfunction
private function Actions takes nothing returns nothing
call Slide.create(GetTriggerUnit(),(GetUnitX(u)-GetMouseTerrainX())/(GetUnitY(u)-GetMouseTerrainY()))
endfunction
//===========================================================================
function InitTrig_Dash takes nothing returns nothing
local trigger Dash = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Dash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Dash, Condition( function Conditions ) )
call TriggerAddAction( Dash, function Actions )
endfunction
endscope
This code uses T32 to make a unit move a unit towards cursor point when casting a spell.
Code:
call Slide.create(GetTriggerUnit(),(GetUnitX(u)-GetMouseTerrainX())/(GetUnitY(u)-GetMouseTerrainY()))
This is what causes the problem. You cant use slide with . syntax. I didnt write the code so im not sure how to rewrite it without . syntax.
Do you guys know how?