- Joined
- May 30, 2009
- Messages
- 829
I was practicing a really basic spell, and simply put, why does it not work?
Thanks in advance.
JASS:
library Shadowstep initializer Init
globals
private constant integer SPELL_ID = 'A000'
private constant integer DUMMY_ID = 'h000'
endglobals
//================================
//End of Configurables
//================================
private function Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == SPELL_ID ) ) then
return false
endif
return true
endfunction
private function Actions takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local unit t = GetSpellTargetUnit()
local real x
local real y
local real x2
local real y2
local location ul = GetUnitLoc(u)
local location ut = GetUnitLoc(t)
local real facing = GetUnitFacing(t)
local real angle = Atan2(y-y2,x-x2) * bj_RADTODEG
set x = GetUnitX(t)
set y = GetUnitY(t)
set x2 = (x + 200)
set y2 = (y + 200)
call SetUnitPosition(u, x2, y2)
call SetUnitFacing(u, facing)
call BJDebugMsg("Function actions has run!")
endfunction
//===========================================================================
private function Init takes nothing returns nothing
set gg_trg_Shadowstep = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadowstep, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Shadowstep, Condition( function Conditions ) )
call TriggerAddAction( gg_trg_Shadowstep, function Actions )
set bj_lastCreatedUnit = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), DUMMY_ID, 0, 0, 0)
call UnitAddAbility(bj_lastCreatedUnit, SPELL_ID)
call KillUnit(bj_lastCreatedUnit)
endfunction
endlibrary
Thanks in advance.