• 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.

Buying a class based on items

Status
Not open for further replies.
I would like some help with a trigger. The point is to allow a worker class unit to purchase a weapon from a shop, changing the unit into another unit which in my case is a soldier. When the unit is replaced, the weapon would be in their inventory. If they drop and have no weapon, they get changed back into a worker. Same idea works with picking up weapons from the ground. Though I can't seem to get my trigger to work.

  • plasma rifle
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Matching item)) Equal to Resistance Plasma Rifle
      • (Unit-type of (Buying unit)) Equal to Resistance Fighter
    • Actions
      • Unit - Replace (Buying unit) with a Soldier using The old unit's relative life and mana
Nothing happens when the item is purchased. I even changed it around (acquires an item) to see if it would work if they picked it up but still no luck.

Ah fuck wrong section. Well this sort of has to do with getting started making these kinds of triggers.
 
Level 11
Joined
Oct 31, 2010
Messages
1,057
the trigger is wrong
firstly , the conditons should not be matching item but item being manuplated and does replacing the units make your warcraft 3 hang ? if it doesn't then you could use this and to give them the previous hero items.
You do
From every slot in integer A to 1 - 6,
do give item carried by buying unit ( last replaced unit) in slot integer A to last created unit
 
Still doesn't seem to be working. Perhaps something is going on with the event or unit condition? Because it doesn't even replace the unit.

  • plasma rifle
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Unit-type of (Buying unit)) Equal to Resistance Fighter
      • (Item-type of (Item being manipulated)) Equal to Resistance Plasma Rifle
    • Actions
      • Unit - Replace (Buying unit) with a Soldier using The old unit's relative life and mana
      • Hero - Give (Item carried by (Buying unit) in slot 1) to (Last created unit)
 
Level 11
Joined
Oct 31, 2010
Messages
1,057
instead of using buying the item what about using acquires the item ? does that help you or you only want it to be that it is brought from the shop ?
Edit : nvm i fixed the triggers uploading map right now
apparently the item being manuplated was supposed to be changed to sold item
 

Attachments

  • futurewar - item.w3x
    197.5 KB · Views: 47
Level 11
Joined
Oct 31, 2010
Messages
1,057
Sorry but i cant help with that because i dont use replace units >.< oh and by the way the item drop thing, for it to work , you have to change item type of sold item to item type of item being manuplated.
Edit : Whitewolf that does not work too O.O
 
Level 9
Joined
Aug 7, 2009
Messages
380
Nooo...
You all get it wrong. What made it goes wrong is this:
  • (Item-type of (Matching item)) Equal to Resistance Plasma Rifle
Though, it should be like this:
  • (Item-type of (Item being Manipulated)) Equal to Resistance Plasma Rifle
+Since the "Matching" here goes with something was being called before.
Like... pick X unit in Y area matching... there you can goes with "matching"
+And one more thing, Once you use the Replace unit, it will automatically give the item the last replaced unit has. So, creating item again will do nothing or even 1 more item
Though, the rest of the trigger you posted is fine
 
Level 11
Joined
Oct 31, 2010
Messages
1,057
Nooo...
Striker21 you get it wrong. What made yours go wrong is
Item type of item being manipulated equal to resistance plasma rifle
Though, it should be like this:
Item type of Sold Item equal to Resistance Plasma Rifle
Since Item being manipulated here goes with acquires or loses item..
But sold item goes with buying items
 
Thanks for the help everyone. Whitewolf8's triggers worked when it came to transferring the item, so I based the new one off his. Instead of having 3 triggers in total (one for buying, one for dropping, and one for picking up), I simplified to it just needing 2. I changed it from having the unit to acquire the item in order to do the replacing and item transferring, that way one trigger powers them being able to buy it OR pick it up.

  • plasma rifle
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • ((Hero manipulating item) is in (Units of type Resistance Fighter)) Equal to True
          • (Item-type of (Item being manipulated)) Equal to Resistance Plasma Rifle
    • Actions
      • Wait 0.01 seconds
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set InventoryDummy[(Integer A)] = (Item carried by (Hero manipulating item) in slot (Integer A))
      • Unit - Replace (Hero manipulating item) with a Soldier using The old unit's relative life and mana
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hero - Give InventoryDummy[(Integer A)] to (Last replaced unit)
 
Status
Not open for further replies.
Top