• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Replace an Item in a units inventory

Status
Not open for further replies.
Level 5
Joined
Jun 27, 2009
Messages
134
Ok, what I need help with is replacing an item in a heroes inventory without dropping the item. I need it to happen, also, once two buildings are destroyed. I think I know how to do this, but that requires me using variables, and I've never used them before. So if someone could either tell me how to do it without variables, or tell me how to create the variable, then with the trigger, that would really be most helpful.
 
  • Trigger
  • Events
    • Unit - A unit dies
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Dying unit) Equal to x
        • (Dying unit) Equal to y
  • Actions
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions), else do (Actions)
          • If (Conditions)
            • (Item-type of (Item carried by (your unit) in slot (IntegerA)) Equal to Z
          • Then (Actions)
            • Hero - Drop (Item carried by (your unit) of type X)
            • Hero - Create Item and give it to (your unit)
 
1st. You don't need variables the way you described your problem.

2nd. Replace the "Hero - Drop item carried...." line with the following.
  • Item - Remove (Item carried by (Your Unit) in slot (Integer A))
@Dark_Axl
If the condition is set to "And" then it will check if the diying unit is (e.g.) a Farm And a Tower which can never be true. Using "Or" checks if the unit is one of those two which is what we want.
 
Ok, I used that trigger, but for some reason, once both of the units are killed, it makes six of the items. I tried bringing the integer number to be 1 to 1, but it just won't make any at all, and still takes away the old item. I tried two, but it makes three of the items, one in the inventory, and two outside of it. Could someone please help?
 
You probably messed up at something on this line (It's da Condition):
"(Item-type of (Item carried by (your unit) in slot (IntegerA)) Equal to Z"
So... check it. Did you make the change I mentioned above?

In case you try and at the end it won't work, you can upload your map to the Pastebin and post the link here so we can help you.
 
Status
Not open for further replies.
Back
Top