- Joined
- Feb 3, 2013
- Messages
- 277
JASS:
scope AS initializer Init
globals
private constant string EFFECT = "war3mapImported\\BlinkCaster.mdx" // The effect that will be displayed at the attacker's previous position
private constant integer ID = 'A000' // The ability's raw ID
endglobals
private function Register takes nothing returns nothing
call TriggerRegisterUnitEvent(GetTriggeringTrigger(), GetEnumUnit(), EVENT_UNIT_DAMAGED)
endfunction
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetEventDamageSource(), ID) > 0
endfunction
private function AS_Actions takes nothing returns nothing
local unit target = GetTriggerUnit()
local unit attacker = GetEventDamageSource()
local location attacker_point = GetUnitLoc(attacker)
local location temp_point = PolarProjectionBJ(GetUnitLoc(target), 100, GetRandomReal(0,360))
call SetUnitX(attacker, GetLocationX(temp_point))
call SetUnitY(attacker, GetLocationY(temp_point))
call DestroyEffect(AddSpecialEffectLoc(EFFECT, attacker_point))
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local group g = CreateGroup ()
set g = GetUnitsInRectAll(GetPlayableMapRect())
call ForGroup(g, function Register)
call TriggerAddCondition(t, Filter(function Conditions))
call TriggerAddAction(t, function AS_Actions)
endfunction
endscope
hi all, this is my first time trying to put together a vjass spell.
basically this trigger is supposed to let a unit blink to its attack target on attack. For some reason the code saves fine - but doesn't work in game. a little help would be appreciated. thanks in advance. (SOLVED THANKS, WaterKnight)
Last edited: