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

[Trigger] Order unit to buy/sell items?

Status
Not open for further replies.
Level 7
Joined
Dec 8, 2005
Messages
319
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.
 
Level 3
Joined
Jun 16, 2008
Messages
28
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.
 

Vex

Vex

Level 3
Joined
Dec 1, 2007
Messages
33
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'.
 

Vex

Vex

Level 3
Joined
Dec 1, 2007
Messages
33
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.
Top