- Joined
- Oct 14, 2008
- Messages
- 340
I don't understand this.
The spell: shoots a missile at a target, upon impact the target is sent to where the caster is. Now, this spell works just fine as long as i don't issue the caster any orders after casting, but say i cast the spell, then walk away.. the target doesn't get teleported, anybody know why this is happening?
The spell: shoots a missile at a target, upon impact the target is sent to where the caster is. Now, this spell works just fine as long as i don't issue the caster any orders after casting, but say i cast the spell, then walk away.. the target doesn't get teleported, anybody know why this is happening?
JASS:
function Trig_Displace_cast_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A02S'
endfunction
function targetHasBuff takes nothing returns boolean
return ( UnitHasBuffBJ(GetSpellTargetUnit(), 'B00U') == true )
endfunction
function Trig_Displace_cast_Actions takes nothing returns nothing
local real x
local real y
local real x1
local real y1
loop
exitwhen ( targetHasBuff() )
call TriggerSleepAction(0.1)
endloop
set x = GetUnitX(GetTriggerUnit())
set y = GetUnitY(GetTriggerUnit())
set x1 = GetUnitX(GetSpellTargetUnit())
set y1 = GetUnitY(GetSpellTargetUnit())
call SetUnitPosition( GetSpellTargetUnit(), x+50.0, y+50.0 )
set x = GetUnitX(GetSpellTargetUnit())
set y = GetUnitY(GetSpellTargetUnit())
call AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", x, y)
call DestroyEffect(GetLastCreatedEffectBJ())
call AddSpecialEffect("Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl", x1, y1)
call DestroyEffect(GetLastCreatedEffectBJ())
endfunction
//===========================================================================
function InitTrig_Displace_cast takes nothing returns nothing
set gg_trg_Displace_cast = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Displace_cast, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Displace_cast, Condition( function Trig_Displace_cast_Conditions ) )
call TriggerAddAction( gg_trg_Displace_cast, function Trig_Displace_cast_Actions )
endfunction