- Joined
- Nov 2, 2004
- Messages
- 1,993
I'm trying to order a unit to stop:
But it's not happening. Any idea why?
The abilities with "returnresources"/"harvest" are custom Channel abilities, TankerFltr just filters by unit type.
JASS:
private function TankerOrderCndAcn takes nothing returns boolean
local integer targetId = GetUnitTypeId(GetOrderTargetUnit())
local string orderStr = OrderId2String(GetIssuedOrderId())
local string targetStr = null
local unit tanker = null
if orderStr == "returnresources" and targetId != 'h000' then
set targetStr = "Refinery"
elseif orderStr == "harvest" and targetId != 'h001' then
set targetStr = "Platform"
endif
if targetStr != null then
set tanker = GetOrderedUnit()
call DisplayTextToPlayer(GetOwningPlayer(tanker), 1, 1, "|cffffcc00Must target an Oil "+targetStr+".|r")
call IssueImmediateOrder(tanker, "stop")
call BJDebugMsg(GetUnitName(tanker)) // Correctly shows unit's name
set tanker = null
endif
return false
endfunction
// .....
call TriggerRegisterPlayerUnitEvent(trgTankerOrder, plr, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, function TankerFltr)
call TriggerAddCondition(trgTankerOrder, function TankerOrderCndAcn)
But it's not happening. Any idea why?
The abilities with "returnresources"/"harvest" are custom Channel abilities, TankerFltr just filters by unit type.