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

Triggers for units carrying items?

Status
Not open for further replies.
Level 3
Joined
Jan 5, 2008
Messages
26
I can't seem to find a trigger that would fit my needs. Specifically, I'm trying to make a trigger that requires the peasant to carry a certain item in order to build a certain structure/unit. It will then remove the item from the peasant's inventory. But all item triggers seem to only be for heroes. Are there any triggers for UNITS with inventories? If not, is there any way I can make a trigger like this?

Thanks. :D
 
Level 6
Joined
Aug 22, 2008
Messages
123
The functions you can use to manipulate (drop, remove) items are not generally limited to heros, I myself was able to use those functions upon units that have had an inventory.
Having just those few lines of explanation, its hard to figure out what you are planning to do.
Depending on your imagination you could also use the "tiny buildings" item (tiny watchtower and so on) in order to make this peasant build your building.:wink:
 
Level 3
Joined
Jan 5, 2008
Messages
26
Uhh.. What I was trying to say was something like this:
If a peasant builds a town hall, (assume he's carrying a potion) the potion in his inventory will be removed. If he isn't carrying a potion, then he won't be able to build a town hall.

That's just an example. I'm planning on making all sorts of triggers where you remove items from a unit's inventory and also have conditions involving items in a unit's inventory.

Also, if I'm not mistaken, "tiny buildings" act like undead structures don't they? Like, your peasant can walk away after placing it down. I'm not entirely sure.

But anyways, I appreciate your help so far :grin:
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
This is very simple actually...Just add to the peasent the ability Hero Inventory which will allow him to carry items,and then go to Object Editor >Items,there is already an item to fit your needs.There are items that are used build the Human Altar of Heroes,Scout Towers,Town Halls for example(tiny buildings)and they disappear just change those!
 
Level 3
Joined
Jan 5, 2008
Messages
26
I've tried giving units the ability "Hero Inventory" before. For some reason, it crashes the map every time the unit holds an item for a while. But would giving them that ability make the triggers work for units?
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Well...if you want your peasent to carry an item you have to create an inventroy for him(you can put as many slots as you like from 1-6).Then try changing the standard(tiny buildings) items to fit your needs if you can't make them work,then make a trigger for what you need.The crash you are saying is weird...never had anything similar like this.
 
Level 3
Joined
Jan 5, 2008
Messages
26
Well, I've found the solution to what I wanted myself. I guess I'll share it with you guys :thumbs_up:

  • Example
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Repair (Human)
      • (Unit-type of (Target unit of ability being cast)) Equal to Battle Royal
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Casting unit) has an item of type Cheese) Equal to True
        • Then - Actions
          • Item - Remove (Item carried by (Casting unit) of type Cheese)
        • Else - Actions
          • Unit - Kill (Target unit of ability being cast)
          • Player - Add 100 to (Owner of (Constructing structure)) Current gold
The item triggers work appropriately :D
But thanks anyways guys. I appreciate your help.
 
Status
Not open for further replies.
Top