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

[Solved] How to get the target of an active item

Status
Not open for further replies.
Level 5
Joined
Mar 27, 2017
Messages
106
I have a trigger that have as an event "an unit use an item"
I want to know what unit was targeted by the unit using an item.
How can I do that?
If that is not possible I will just do a trigger based on the cast skill.
(But then finding which kind of item was used will need the creation of one skill per item so I will need twice as much object editor data)
 
Well you could use OrderID's that way you could gain the itemslot which is used. (requiers custom script), that came just to me i didn't use that often.
Edit: Each Order in Warcraft has its own custom ID.
public constant integer useslot1=852008
public constant integer useslot2=852009
public constant integer useslot3=852010
public constant integer useslot4=852011
public constant integer useslot5=852012
public constant integer useslot6=852013
Order Ids | The Helper

Edit: Okay now i manged to get it work. The following trigger will check if a Item was used and gets the Slot in which it was while been used:
  • Starts Spell
    • Events
      • Unit - A unit Startet den Effect of a spell
    • Conditions
    • Aktionen
      • Custom script: set udg_OrderID = GetUnitCurrentOrder(GetTriggerUnit() )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • OrderID Greater Equal 852008
          • OrderID Smaller Equal 852013
        • Then - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Schleifen - Aktionen
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • OrderID Equal (852007 + (Integer A))
                • Then - Actions
                  • Set Slot_Used = (Integer A)
                • Else - Actions
          • Game - Display to (All players) the text: (Uses Item at Slot: + (String(Slot_Used)))
        • Else - Actions
          • Game - Display to (All players) the text: Casts a normal Spell
bumb @noob2
 

Attachments

  • Get Used Item.w3x
    17.2 KB · Views: 47
Last edited:
Status
Not open for further replies.
Top