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

One unit trigger gives item to hero , help ;-;

Status
Not open for further replies.
Level 3
Joined
Oct 20, 2017
Messages
52
I'm trying to create a trigger for a unit that has items in its inventory to deliver all items to the hero through an ability (as if it were the Dota mascot that delivers the items to the hero), but I'm not getting the the best I can do is deliver only one item in the inventory, but I wanted him to deliver all items in his inventory to the hero and then an order to return to base.
 
Level 3
Joined
Oct 20, 2017
Messages
52
It worked here, but now the unit delivers the item, no matter where it is on the map, and I don't want that. I wanted the unit to go to the hero and then deliver the items from its inventory, after which the unit delivers the items, the unit moves to a selected region on the map.
 
Level 3
Joined
Oct 20, 2017
Messages
52
Edited:
I managed to get the unit to go to the hero and deliver the items by creating 3 triggers. One is for the order to move to the hero, another is to deliver the items to the hero and the third that is not working is in case the player cancels the order to deliver the items. I am unable to understand why the third trigger does not work.


Variables used:
Hero - Unit [Array]
Unit Delivery - Unit [Array]
Unit Delivered - Boolean [Array]

Trigger 1
  • Unit Order
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Deliver Items (Custom Spell)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Item carried by (Triggering unit) in slot 1) Equal to No item
              • (Item carried by (Triggering unit) in slot 2) Equal to No item
              • (Item carried by (Triggering unit) in slot 3) Equal to No item
              • (Item carried by (Triggering unit) in slot 4) Equal to No item
              • (Item carried by (Triggering unit) in slot 5) Equal to No item
              • (Item carried by (Triggering unit) in slot 6) Equal to No item
        • Then - Actions
          • Unit - Order (Triggering unit) to Move To (Center of Region1 <gen>)
        • Else - Actions
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • Unit - Order (Triggering unit) to give (Item carried by (Triggering unit) in slot (Integer A)) to Hero[(Player number of (Triggering player))]
          • Set Unit Delivery[(Player number of (Triggering player))] = (Triggering unit)
          • Set Unit Delivered[(Player number of (Triggering player))] = True
Trigger 2
  • Delivery Unit
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • Unit Delivered[(Player number of (Triggering player))] Equal to True
          • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give (Item carried by Unit Delivery[(Player number of (Triggering player))] in slot (Integer A)) to Hero[(Player number of (Triggering player))]
      • Unit - Order Unit Delivery[(Player number of (Triggering player))] to Move To (Center of Region <gen>)
Trigger 3 (Is not working)
  • Delivery Canceled
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(move))
          • (Ordered unit) Equal to Unit Delivery[(Player number of (Triggering player))]
    • Actions
      • Set Unit Delivered[(Player number of (Triggering player))] = False
 
Status
Not open for further replies.
Top