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

[Trigger] Order unit to buy/sell items?

Status
Not open for further replies.
well ya that is not really faking anything... that is what the game does already click icon create item and move to inventor and then reduce gold/lumber but i think it would be the easiest way to get units to buy items.
 
To sell items you can use the give item comand in the unit section of the actions. just tell the unit you want to sell the item to give it to the shop.
 
well ya that is not really faking anything... that is what the game does already click icon create item and move to inventor and then reduce gold/lumber but i think it would be the easiest way to get units to buy items.

The game also reduce the current stock with 1 for the item-type you bought.

I am wondering how you can fake this. If there is a way I would be happy if anyone could tell me.
If there is a way to do it 'natural', I'd love to hear about it as well.

I need a trigger that reduce the current stock for an specific item-type with 1 in a shop.

If I use 'Neutral Building - Remove Item-Type (From Marketplace)', then 'Neutral Building - Add Item-Type (From Marketplace)'
where I adjust the current stock, the item will vanish when current stock gets to 0.
Players must be able to see that there is a item there while there is 0 left of it.
If I add the item-types to the shop using the Object Editor, they will be visible with the text 'Out of stock'.
 
Never mind. I just solved my problem in the previous post.

1. Shops start out empty with no item-types in them.
2. A trigger adds every item-type that they are supposed to have at Map Init with current/max stock whatever you want it to be.
3. Another trigger keeps track of the current stock for every item.
4. When a unit is supposed to buy an item through triggers, you just fake it. Create an item in it's inventory and subtract cost etc.
5. To reduce the current stock of that particular item-type by 1, you just remove that item-type, then add it again with current stock = current stock - 1 (you get the integer that the trigger in point 3 worked on) and max stock = what it was before.

When you get to current stock = 0, this will be displayed correctly in the shop.

So.. if you haven't solved it since you last posted, this is a solution that should work for the both of us :)
 
Status
Not open for further replies.
Back
Top