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

Spell Add/Removal from Item Slots

Status
Not open for further replies.
Level 5
Joined
Dec 11, 2010
Messages
101
Hello, for the life of me i cant seem to find out what is wrong with my trigger.

What i'm trying to have accomplished is that the game will check every 0.10 seconds for the weapon i have in slot 1. In this example I have Sniper Range.

What it does is that when the Sniper item is in slot 1, i want it to increase my range (add ability to the person holding the item), but i can never seem to get the ability.

I have tried another way that does work, but if i try and swap the items with my mouse, the abilities will not be removed even if the item prior is in slot 2.

  • AquireSniper
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by (Hero manipulating item) in slot 1)) Equal to Sniper Rifle
        • Then - Actions
          • Unit - Add Sniper Range to (Hero manipulating item)
        • Else - Actions
If you need clarification, ill try my best
Thanks ^-^
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Hero Manipulating Item does not exists or refers to a random unit.

Try Pick every unit in (Unit Group) and do that for every unit or create a variable with the unit you want to check... depending on what map you have.
Make sure you know how to remove the unit group leak.

(Also remove the "Sniper Range" from picked unit in the else actions.)
 
Inventory orders are between 852001 and 852008.

852002 -> order on slot 1
852003 -> order on slot 2
...
852006 -> order on slot 6

  • Events
    • Unit - A Unit gets an order on an object
  • Actions
  • Custom script: set udg_i = GetIssuedOrder() - 852001
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (i > 0) and (i < 7)
    • Then - Actions
      • -------- It is an inventory order. --------
      • -------- "i" is the slot of order. --------
    • Else - Actions
      • -------- Other order. --------
 
Status
Not open for further replies.
Top