Hi again. I've been annoyed of this trigger some time. The problem is that the Triggering Unit doesn't respond to it.
At the beginning of the trigger, I declare the local unit variable u, and set it as "GetTriggerUnit()
At the end of the trigger, I first tries to get the unit to stop moving, and then to die. But it ignores it. How could?
At the beginning of the trigger, I declare the local unit variable u, and set it as "GetTriggerUnit()
At the end of the trigger, I first tries to get the unit to stop moving, and then to die. But it ignores it. How could?
JASS:
function Trig_Flytta_Torn_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetOrderedUnit()) == 039;emtg039; )
endfunction
function Trig_Flytta_Torn_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local rect r
local rect s
local location l = GetOrderPointLoc()
local location ss = GetUnitLoc(GetOrderedUnit())
local integer sx
local integer sy
local integer kx
local integer ky
set r = InWhichRegion(l)
set s = InWhichRegion(ss)
call IssueImmediateOrder(u, "stop")
set kx = R2I((GetRectCenterX(r) - 704)/256 * -1 + 1)
set ky = R2I((GetRectCenterY(r) + 960)/256 + 1)
set sx = R2I((GetRectCenterX(s) - 704)/256 * -1 + 1)
set sy = R2I((GetRectCenterY(s) + 960)/256 + 1)
call KillUnit(u)
endfunction
//===========================================================================
function InitTrig_Flytta_Torn takes nothing returns nothing
set gg_trg_Flytta_Torn = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Flytta_Torn, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
call TriggerAddCondition( gg_trg_Flytta_Torn, Condition( function Trig_Flytta_Torn_Conditions ) )
call TriggerAddAction( gg_trg_Flytta_Torn, function Trig_Flytta_Torn_Actions )
endfunction