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

[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 22
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