• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Hashtable] Pre-saving unit orders

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello,

since it seems as if there is no way to use variables with an array to save specific unit orders, like SiphoonLoop or other spell orders,

is there a way to do so using hashtables and custom scripts ?
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
If you mean the orderstring like "thunderbolt", "attack", "stop", etc.
You can use OrderId(string) to get the equivalent integer of those orders. Use GetHandleId(unit) with OrderId(string) to save a specific order to a specific unit.
Something like SaveInteger(hash, handleid, 0, orderid) to save and LoadInteger(hash, handleid, 0) to load.
 
Each order has an id. The id is an integer.

constant native GetIssuedOrderId takes nothing returns integer returns the orderId on trigger events.

native GetUnitCurrentOrder takes unit whichUnit returns integer returns the orderId that a unit currently has.

constant native OrderId takes string orderIdString returns integer lets you get the orderId of oder strings, for example "attack", "stop", ... .
 

Ardenian

A

Ardenian

So, in GUI/ Custom Scripts this could look like:

Orb_OrderId[1] is an integer variable:

  • Custom Script: set Orb_OrderId[1] = OrderId(curse)
  • Hashtable - Save Orb_OrderId[i] as 0 of Orb_TempInteger in Hash_StackingOrbs
  • Hashtable - Load Orb_OrderId[i] as 0 of Orb_TempInteger in Hash_StackingOrbs
 

Ardenian

A

Ardenian

For the custom script ?

  • Custom Script: set Orb_OrderId[1] = OrderId("curse")
 
Status
Not open for further replies.
Top