HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Order id Catch up Function

01-23-2004, 02:48 PM#1
Vexorian
Certain abilities doesn't have order strings, and the only way to order a unit to cast those spells is by using either UMSWE's issue order actions that take Order id instead of strings or by JASS, but to know the orderid you first need an environment.

Have this in your map's custom script section:

Code:
function H2I takes handle a returns integer
    return a
    return 0
endfunction

function I2U takes integer a returns unit
    return a
    return null
endfunction

function I2P takes integer a returns player
    return a
    return null
endfunction

function I2G takes integer a returns group
    return a
    return null
endfunction


function OrderDebugTrigger takes nothing returns nothing
 local string o=""
    if GetOrderPointX() != null then
        set o="( "+R2S(GetOrderPointX())+", "+R2S(GetOrderPointY())+")"
    elseif GetOrderTarget() != null then
        if GetOrderTargetUnit() != null then
            set o=GetUnitName(GetOrderTargetUnit())
        elseif GetOrderTargetItem() != null then
            set o=GetItemName(GetOrderTargetItem())
        elseif GetOrderTargetDestructable() != null then
            set o=GetDestructableName( GetOrderTargetDestructable())
        else
            set o="Object"
        endif
        set o=o+" "+I2S(H2I(GetOrderTarget()))
    endif       
    if OrderId2StringBJ(GetIssuedOrderId()) != null and OrderId2StringBJ(GetIssuedOrderId()) != "" then
        set o= " (''"+OrderId2StringBJ(GetIssuedOrderId())+"'') "+o
    endif
    set o=GetUnitName(GetTriggerUnit())+" "+I2S(H2I(GetTriggerUnit()))+" is ordered to "+I2S(GetIssuedOrderId())+o
    call DisplayTimedTextToPlayer( GetOwningPlayer(GetTriggerUnit()),0,0,10,o)
endfunction

function CreateOrderDebugTrigger takes handle deb returns trigger
 local unit u=I2U( H2I(deb) )
 local group g=I2G( H2I(deb) )
 local player p=I2P( H2I(deb) )
 local trigger ordebug=CreateTrigger()
 local group a=CreateGroup()
    if IsPlayerInForce(p, bj_FORCE_ALL_PLAYERS) then
        call TriggerRegisterPlayerUnitEventSimple( ordebug, p, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
        call TriggerRegisterPlayerUnitEventSimple( ordebug, p, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
        call TriggerRegisterPlayerUnitEventSimple( ordebug, p, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    elseif FirstOfGroup(g) != null then
        call GroupAddGroup( g, a)
    elseif u != null then
        call GroupAddUnit( a, u)
    endif
    loop
        set u=FirstOfGroup(a)
        exitwhen u==null
        call GroupRemoveUnit( a, u)
        call TriggerRegisterUnitEvent( ordebug, u, EVENT_UNIT_ISSUED_TARGET_ORDER )
        call TriggerRegisterUnitEvent( ordebug, u, EVENT_UNIT_ISSUED_POINT_ORDER )
        call TriggerRegisterUnitEvent( ordebug, u, EVENT_UNIT_ISSUED_ORDER )
    endloop
    call TriggerAddAction( ordebug, function OrderDebugTrigger)
 call DestroyGroup(a)
 set a=null
 set u=null
 set p=null
 set g=null
 return ordebug
endfunction


Then when you feel like needing to know an order id have a custom script line in a trigger that reads:

Custom Script: call CreateOrderDebugTrigger( ConvertedPlayer(1))

If you want it to work for player 1's units

or

Custom Script: call CreateOrderDebugTrigger( udg_tempunit)

If you want it to work with the unit variable tempunit

or

Custom Script: call CreateOrderDebugTrigger( udg_tempgroup)

If you want it to work with the unit group variable tempgroup
01-25-2004, 07:00 PM#2
BlackSlash
Very useful... :D
01-31-2004, 05:44 PM#3
Extrarius
Is the only way to get an orderID to manually figure it out using such a trigger? In my map, I'm going to need a lot of ordering for different abilities and it would be nice if there was a way to get the order string/id without having to manually try each ability out.
01-31-2004, 06:27 PM#4
weaaddar
the orderstring for abilites is easy go into worldedit ability editor then scroll down to the bottom and it should be like
activiate order string-replenish
turn off autocast string-replenishoff

Unfortuantly all abilities based off one ability will have the same order id.