Name | Type | is_array | initial_value |
AddRush | force | No | |
AroundPos | location | No | |
Caster | unit | No | |
DlgBtn | button | Yes | |
facing | real | No | |
Grunt | unit | No | |
HaveBeenPicked | group | No | |
offset | location | No | |
Peasant | unit | No | |
Pos | location | No | |
Position | location | No | |
RndPoint | location | No | |
RndPos | location | No | |
RndPuwnd | integer | No | |
RndTerrain | integer | No | |
RushCaster | group | No | |
Score | integer | Yes | |
speed | real | No | |
To | location | Yes | |
Wins | integer | No | |
WinsToWin | dialog | No |
function Trig_Swap_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction
function Trig_Swap_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit target = GetSpellTargetUnit()
local real cx = GetUnitX(caster)
local real cy = GetUnitY(caster)
local real tx = GetUnitX(target)
local real ty = GetUnitY(target)
call SetUnitX(caster, tx) //this set the X of caster to target X
call SetUnitY(caster, ty) //same as above but for Y
call SetUnitX(target, cx) //this set X of target to caster X
call SetUnitY(target, cy) //same as above but for Y
set caster = null
set target = null
endfunction
//===========================================================================
function InitTrig_Swap takes nothing returns nothing
set gg_trg_Swap = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Swap, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Swap, Condition(function Trig_Swap_Conditions))
call TriggerAddAction(gg_trg_Swap, function Trig_Swap_Actions)
endfunction