Part 1
Create a trigger that should detect any order a unit does, and print the unit's name and the issued order id on screen.
Part 2
Now it should also print the order's equivalent string or the name of issued object id being ordered (in same line). For example 851983 should also print "attack", and 'hbar' should also print "Barracks", so the user can easily see which order is behind the id.
Create a trigger that should detect any order a unit does, and print the unit's name and the issued order id on screen.
Part 2
Now it should also print the order's equivalent string or the name of issued object id being ordered (in same line). For example 851983 should also print "attack", and 'hbar' should also print "Barracks", so the user can easily see which order is behind the id.
vJASS:
//! zinc
library OrderTracking {
private function onInit() {
trigger trgOrder = CreateTrigger();
integer Index = 0;
while( Index < bj_MAX_PLAYERS ) {
TriggerRegisterPlayerUnitEvent( trgOrder, Player( Index ), EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER, null );
TriggerRegisterPlayerUnitEvent( trgOrder, Player( Index ), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER, null );
TriggerRegisterPlayerUnitEvent( trgOrder, Player( Index ), EVENT_PLAYER_UNIT_ISSUED_ORDER, null );
Index = Index + 1;
}
TriggerAddAction( trgOrder, function(){
unit u = GetOrderedUnit();
integer orderId = GetIssuedOrderId();
ClearTextMessages();
DisplayTextToPlayer( GetLocalPlayer(), 0, 0,
"Unit Name: " + I2S( GetUnitTypeId( u ) ) + " | " + GetUnitName( u ) + "\n" +
"OrderID: " + I2S( orderId ) + " | " + OrderId2String( orderId )
);
u = null;
});
trgOrder = null;
}
}
//! endzinc