• 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.

[General] How do I order a unit to use an item?

Status
Not open for further replies.
Level 26
Joined
Aug 18, 2009
Messages
4,097
Hero - Use Item does work but you should pick the action variant with the correct target type your item can be applied on.

Also, items are not ordered via ability orders, instead a unique id is assigned to each inventory slot and it's numeric only, they have no string variant. You can test-wise print them out on event.

Code:
    Events
        Unit - <unit> Receives an order targeting an object
        Unit - <unit> Receives an order targeting a point
        Unit - <unit> Receives an order without target
    Actions
        Custom script:   call BJDebugMsg(I2S(GetIssuedOrderId()))

Then get the inventory slot of your item, find the belonging order id, insert it into one of the functions mckill2009 posted depending on the target type again. Those functions are not available in GUI.

@defskull: It's about using the item, not specific abilities as standalones that possess no order string. In addition, the 852274 is not to be written between apostrophes, those are for converting the ascii format, for example 'ABCD', to signalize that the expression is an integer in ascii system.
 
I know what you people are trying to say , but i just don't know what to put in

currently i use this(doesn't work)

(Instant Spell Cast)
  • Reload Via Ability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Reload
    • Actions
      • For each (Integer A) from 1 to TotalWeapons, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to WeaponUnit[(Integer A)]
              • ((Triggering unit) has an item of type WeaponTypes[(Integer A)]) Equal to True
            • Then - Actions
              • For each (Integer B) from 1 to 6, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WeaponTypes[(Integer A)] Equal to (Item-type of (Item carried by (Triggering unit) in slot (Integer B)))
                    • Then - Actions
                      • Hero - Order (Triggering unit) to use (Item carried by (Triggering unit) in slot (Integer B))
                    • Else - Actions
            • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top