- Joined
- Feb 20, 2013
- Messages
- 136
This is my first submission, hopefully is all alright.
Edit: Changed subscription to condition instead of action, as MyPad suggested
Edit: Changed subscription to condition instead of action, as MyPad suggested
JASS:
scope OrderTracking initializer Init
private function Action takes nothing returns boolean
local unit u = GetTriggerUnit()
local integer orderId = GetIssuedOrderId()
local string unitName = GetUnitName(u)
local string orderName = OrderId2String(orderId)
local string targetName = GetObjectName(orderId)
local string targetUnitName = GetUnitName(GetOrderTargetUnit())
// If orderName is empty, replace it with tragetName
if (orderName == "" and targetName != "Default string") then
set orderName = targetName
// If orderName is not empty, just append targetName
elseif (targetName != "Default string") then
set orderName = orderName + " " + GetObjectName(orderId)
// If remaining string is "Default string" then do not print it
elseif (orderName == "Default string") then
set orderName = ""
endif
// Always add targetUnitName if it exists
if (targetUnitName != "Default string") then
set orderName = orderName + " " + targetUnitName
endif
call BJDebugMsg(unitName + " - (" + I2S(orderId) + ") " + orderName)
set u = null
return TRUE
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER)
call TriggerAddCondition(t, Condition(function Action))
set t = null
endfunction
endscope
Attachments
Last edited: