• 🏆 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!

Issued Order Debugger

Status
Not open for further replies.
Level 3
Joined
Dec 6, 2005
Messages
67
Having problems with orders/abilities not working as you'd expect? Well this trigger will display some helpful information, namely
1. HandleID of triggering unit
2. Unit Type of triggering unit
3. Name of Triggering unit (much easier to recognize 'Dark Knight' than 'custom_z00o'
4. Order String
5. OrderID (useful for orders that don't have a string such as 'Cancel'
6. Target Type (object, point, none)
Target Type: Object
7. ObjectID
8. Object Unit Type
9. Object Name
Target Type: Point
7. Coordinates targeted

The only requirement is a variable 'order_analyze' of type String
  • Order Analyzer
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • (Issued order) Not equal to (Order(smart))
      • (Issued order) Not equal to (Order(attack))
    • Actions
      • Game - Display to (All players) the text:
      • Set order_analyze = (|Cffffcc00HandleID:|r + (String((Key (Triggering unit)))))
      • Set order_analyze = (order_analyze + ( |Cffffcc00UnitType:|r + (String((Unit-type of (Triggering unit))))))
      • Set order_analyze = (order_analyze + ( |Cffffcc00Name:|r + (Name of (Triggering unit))))
      • Game - Display to (All players) the text: order_analyze
      • Set order_analyze = (|Cffffcc00Order:|r + (String((Issued order))))
      • Custom script: set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00OrderID:|r " + I2S(GetIssuedOrderIdBJ())))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Target unit of issued order) Not equal to No unit
        • Then - Actions
          • Set order_analyze = (order_analyze + ( |Cffffcc00Target:|r + Object))
          • Game - Display to (All players) the text: order_analyze
          • Set order_analyze = (|Cffffcc00ObjectID:|r + (String((Key (Target unit of issued order)))))
          • Set order_analyze = (order_analyze + ( |Cffffcc00ObjectType:|r + (String((Unit-type of (Target unit of issued order))))))
          • Set order_analyze = (order_analyze + ( |Cffffcc00ObjectName:|r + (Name of (Target unit of issued order))))
          • Game - Display to (All players) the text: order_analyze
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (X of (Target point of issued order)) Not equal to 0.00
              • (Y of (Target point of issued order)) Not equal to 0.00
            • Then - Actions
              • Set order_analyze = (order_analyze + ( |Cffffcc00Target:|r + Point))
              • Set order_analyze = (order_analyze + ( |Cffffcc00Coord:|r + ((String((X of (Target point of issued order)))) + ( , + (String((Y of (Target point of issued order))))))))
              • Game - Display to (All players) the text: order_analyze
            • Else - Actions
              • Set order_analyze = (order_analyze + ( |Cffffcc00Target:|r + None))
              • Game - Display to (All players) the text: order_analyze
To keep it from displaying EVERYTHING you can put filters in the conditions, the above only displays info on commands done by Player1 and disregards move commands and attack commands.

Also in JASS if anyone wants to quickly add to their map
JASS:
function Trig_Order_Analyzer_Conditions takes nothing returns boolean
    if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(0) ) ) then
        return false
    endif
    if ( not ( GetIssuedOrderIdBJ() != String2OrderIdBJ("smart") ) ) then
        return false
    endif
    if ( not ( GetIssuedOrderIdBJ() != String2OrderIdBJ("attack") ) ) then
        return false
    endif
    return true
endfunction

function Trig_Order_Analyzer_Func011Func006C takes nothing returns boolean
    if ( not ( GetLocationX(GetOrderPointLoc()) != 0.00 ) ) then
        return false
    endif
    if ( not ( GetLocationY(GetOrderPointLoc()) != 0.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Order_Analyzer_Func011C takes nothing returns boolean
    if ( not ( GetOrderTargetUnit() != null ) ) then
        return false
    endif
    return true
endfunction

function Trig_Order_Analyzer_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_007" )
    set udg_order_analyze = ( "|Cffffcc00HandleID:|r " + I2S(GetHandleIdBJ(GetTriggerUnit())) )
    set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00UnitType:|r " + UnitId2StringBJ(GetUnitTypeId(GetTriggerUnit())) ) )
    set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00Name:|r " + GetUnitName(GetTriggerUnit()) ) )
    call DisplayTextToForce( GetPlayersAll(), udg_order_analyze )
    set udg_order_analyze = ( "|Cffffcc00Order:|r " + OrderId2StringBJ(GetIssuedOrderIdBJ()) )
    set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00OrderID:|r " + I2S(GetIssuedOrderIdBJ())))
    if ( Trig_Order_Analyzer_Func011C() ) then
        set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00Target:|r " + "Object" ) )
        call DisplayTextToForce( GetPlayersAll(), udg_order_analyze )
        set udg_order_analyze = ( "|Cffffcc00ObjectID:|r " + I2S(GetHandleIdBJ(GetOrderTargetUnit())) )
        set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00ObjectType:|r " + UnitId2StringBJ(GetUnitTypeId(GetOrderTargetUnit())) ) )
        set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00ObjectName:|r " + GetUnitName(GetOrderTargetUnit()) ) )
        call DisplayTextToForce( GetPlayersAll(), udg_order_analyze )
    else
        if ( Trig_Order_Analyzer_Func011Func006C() ) then
            set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00Target:|r " + "Point" ) )
            set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00Coord:|r " + ( R2S(GetLocationX(GetOrderPointLoc())) + ( " , " + R2S(GetLocationY(GetOrderPointLoc())) ) ) ) )
            call DisplayTextToForce( GetPlayersAll(), udg_order_analyze )
        else
            set udg_order_analyze = ( udg_order_analyze + ( " |Cffffcc00Target:|r " + "None" ) )
            call DisplayTextToForce( GetPlayersAll(), udg_order_analyze )
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Order_Analyzer takes nothing returns nothing
    set gg_trg_Order_Analyzer = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Order_Analyzer, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Order_Analyzer, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Order_Analyzer, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_Order_Analyzer, Condition( function Trig_Order_Analyzer_Conditions ) )
    call TriggerAddAction( gg_trg_Order_Analyzer, function Trig_Order_Analyzer_Actions )
endfunction
 

Attachments

  • screenshot.jpg
    screenshot.jpg
    322.6 KB · Views: 107
Last edited:
Status
Not open for further replies.
Top