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

[Trigger] Selling items from a shop for other items

Status
Not open for further replies.
Level 6
Joined
Jan 8, 2009
Messages
140
I want to have the purchase cost of certain items to be other lower tier items, how would I go about triggering this?
 
Level 6
Joined
Oct 1, 2012
Messages
166
I believe that what you mean is, for an exaple:
Buying Claws of Attack +3 requires, let's say, Claws of Attack +2 and some gold, correct?

If so, the trigger is quite simple, but kinda long to write. I myself would do it with hashtables, saving Tier 1 item at index 1, then Tier 2 item at index 2 and so on. Then, when an unit wants to buy an item, the trigger checks whether it has the lower tier item in it's EQ and either removes the lower tier item or shows an error message and doesn't allow to buy the item.

It's 2:25 AM in my country, sorry for not-too-understandable way of putting things :D
 
Level 6
Joined
Jan 8, 2009
Messages
140
I believe that what you mean is, for an exaple:
Buying Claws of Attack +3 requires, let's say, Claws of Attack +2 and some gold, correct?

If so, the trigger is quite simple, but kinda long to write. I myself would do it with hashtables, saving Tier 1 item at index 1, then Tier 2 item at index 2 and so on. Then, when an unit wants to buy an item, the trigger checks whether it has the lower tier item in it's EQ and either removes the lower tier item or shows an error message and doesn't allow to buy the item.

It's 2:25 AM in my country, sorry for not-too-understandable way of putting things :D

yes this is what I meant. thinking about it i could simply just have a trigger for when the unit aquires the item, if they have the required items/gold then remove them or if they don't then remove the sold item. the only (minor) issue is the shop stock, can i reset the cooldown/stock of an item via triggers?
 
Level 6
Joined
Oct 1, 2012
Messages
166
Well, about stocks.

To my mind, there's no way to check how many items there are in stock, maybe by some custom functions, neither is there a way to add simply one item, i believe.

You can experiment with this:

AddItemToStock:

JASS:
native AddItemToStock               takes unit whichUnit, integer itemId, integer currentStock, integer stockMax returns nothing

It gives whichUnit the itemId to stock with currentStock number and makes it never recharge above stockMax. Maybe it is a bit different, but I used it only in a manner of adding one item to a shop with 1 stock and stock max of 1, so I don't have much experiece in 'the field'.

Still, I whish you good luck with it.
 
Status
Not open for further replies.
Top