• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Universal - Order Tracking

Status
Not open for further replies.

NEL

NEL

Level 6
Joined
Mar 6, 2017
Messages
113
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.

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
 

Attachments

  • [Missions] Universal - Order Tracking.w3x
    24.7 KB · Views: 76
Status
Not open for further replies.
Top