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

[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.
 
Level 18
Joined
Dec 17, 2009
Messages
1,114
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