Troll-Brain
You can change this now in User CP.
- Reaction score
- 85
I have the need to know if an issued order can interrupt the current order of an unit or not (like for example "defend" order doesn't interrupt current orders), i've found this solution.
Maybe it's not obvious for all, so i post this snippet.
But you should simply inline GetIssuedOrderId() == GetUnitCurrentOrder(GetOrderedUnit()), with an order event.
So, i dunno if it should go on graveyard or not, hmm maybe a "sample" ?
Also, as usual, i suppose the name of the library is lame, any better suggestion ?
Note : Obviously it will fail inside a TriggerRegister boolexpr, since it's not GetOrderedUnit(), but GetFilterUnit().
Also, it could just not work like that inside a such boolexpr, i don't care, i won't use them anyway.
Maybe it's not obvious for all, so i post this snippet.
But you should simply inline GetIssuedOrderId() == GetUnitCurrentOrder(GetOrderedUnit()), with an order event.
So, i dunno if it should go on graveyard or not, hmm maybe a "sample" ?
Also, as usual, i suppose the name of the library is lame, any better suggestion ?
JASS:
library IsIssuedOrderInterrupting
globals
private constant boolean SAFE_CHECK = true
endglobals
globals
private constant eventid EVD0 = EVENT_UNIT_ISSUED_ORDER
private constant eventid EVD1 = EVENT_UNIT_ISSUED_POINT_ORDER
private constant eventid EVD2 = EVENT_UNIT_ISSUED_TARGET_ORDER
private constant eventid EVD3 = EVENT_PLAYER_UNIT_ISSUED_ORDER
private constant eventid EVD4 = EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER
private constant eventid EVD5 = EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER
private constant eventid EVD6 = EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER // deprecated
endglobals
function IsIssuedOrderInterrupting takes nothing returns boolean
static if SAFE_CHECK then
local eventid evd = GetTriggerEventId()
if evd==EVD0 or evd==EVD1 or evd==EVD2 or evd==EVD3 or evd==EVD4 or evd==EVD5 or evd==EVD6 then
return GetIssuedOrderId() == GetUnitCurrentOrder(GetOrderedUnit())
else
debug call BJDebugMsg("IsIssuedOrderInterrupting : use this function with an order event only")
return false
endif
else
return GetIssuedOrderId() == GetUnitCurrentOrder(GetOrderedUnit())
endif
endfunction
endlibrary
Note : Obviously it will fail inside a TriggerRegister boolexpr, since it's not GetOrderedUnit(), but GetFilterUnit().
Also, it could just not work like that inside a such boolexpr, i don't care, i won't use them anyway.