HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting Orders and Such

10-02-2007, 06:24 AM#1
Pheonix-IV
I'm trying to make an ability which gives a unit a 100% bonus to move speed so long as it has an attack order targeting a unit within 400 distance. Presumably i'll need to do a periodic check to see if it has an attack order and is within range, but i'm not sure how to check what a unit's current order is.
Halp is appreciated.

-EDIT-

Also, is there a way to detect when a player hits the hero abilities button?
10-02-2007, 06:35 AM#2
sinners_la_b
You could use
Collapse JASS:
 EVENT_UNIT_ISSUED_ORDER 
(however i dont know if this would work as you only want your trigger to fire if it is issued the attack order)

HTH
10-02-2007, 07:37 AM#3
Pheonix-IV
Oh yeah, i need to do a periodic check to see if a given unit's current order is 'stop'

Same problem really, i need some way to check what the current order of a given unit is.
10-02-2007, 07:40 AM#4
cohadar
native GetUnitCurrentOrder takes unit whichUnit returns integer
10-02-2007, 07:51 AM#5
Pheonix-IV
Brilliant, now what does each return value mean :P
10-02-2007, 08:00 AM#6
cohadar
you know things like 82001, 83456, usual orderID's

Collapse JASS:
library OrderDisplayer

private function H2I takes handle h returns integer
    return h
    return 0
endfunction

function Trig_Order_Actions takes nothing returns nothing
    call DisplayTimedTextToForce( GetPlayersAll(), 30, ( "Order string: " + OrderId2StringBJ(GetIssuedOrderIdBJ()) ) )
    call DisplayTimedTextToForce( GetPlayersAll(), 30, ( "Order Id: " + I2S(GetIssuedOrderId()) ) )
    call DisplayTimedTextToForce( GetPlayersAll(), 30, ( "Item Id: " + I2S(H2I(GetOrderTargetItem())) ) )
endfunction

//===========================================================================
function InitTrig_Order takes nothing returns nothing
    set gg_trg_Order = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Order, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Order, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Order, EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddAction( gg_trg_Order, function Trig_Order_Actions )
endfunction

endlibrary
10-02-2007, 08:23 AM#7
Pheonix-IV
Pfft, of course. Silly me.
10-03-2007, 02:47 AM#8
botanic
or maby something simple like this?
Trigger:
Event - unit issued order targeting a unit
condition
issued order = attack
triggering unit within 400 of target unit
event
set triggering unit movespeed = current movespeed x 2
10-03-2007, 03:03 AM#9
Anopob
Also, if you're still wondering about the Hero Abilities button (read posts I guess you are), there should be an event saying how the "Hero Abilities" button is clicked.