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

Replacing items?

Status
Not open for further replies.
Level 8
Joined
May 9, 2010
Messages
266
Hello guys!
For example i have an item in my shop(it is spell, but it is not necessary).
I make some upgrade and this item are replacing with another item, such as upgraded spell. How can i do it?

Help pls, guys!
Edit: I know that there is trigger GUI function to do that, bit it isnt work for me, could you give me an example of using it?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
As you said: you can add/remove items from shops with these commands:
  • Neutral Building - Remove Item1 from all marketplaces
  • Neutral Building - Add Item2 to all marketplaces with 1 in stock and a max stock of 1
Base the shop on the Marketplace and it should work.

So for your system, you can either link these items (link the upgrade with the base and upgraded item) through hashtables, or with arrayed variables.
I would prefer hashtables in this case because it's an index lookup instead of a loop, but it does require a little JASS (because you can't really use Raw Id's properly in GUI).
Once the items are linked to the upgrades, you can look up the base item that needs to get removed (it's stored somewhere) and replace it with the upgraded one (which is also stored).

Would this be enough information for you to get started on the system? :)
 
Level 8
Joined
May 9, 2010
Messages
266
As you said: you can add/remove items from shops with these commands:
  • Neutral Building - Remove Item1 from all marketplaces
  • Neutral Building - Add Item2 to all marketplaces with 1 in stock and a max stock of 1
Base the shop on the Marketplace and it should work.

So for your system, you can either link these items (link the upgrade with the base and upgraded item) through hashtables, or with arrayed variables.
I would prefer hashtables in this case because it's an index lookup instead of a loop, but it does require a little JASS (because you can't really use Raw Id's properly in GUI).
Once the items are linked to the upgrades, you can look up the base item that needs to get removed (it's stored somewhere) and replace it with the upgraded one (which is also stored).

Would this be enough information for you to get started on the system? :)

Using indexing or hashtables is another question:) I dont know hashtables enough...
So, I set all variables of old "spells" and of new "spells", and if spell is upgraded, just use those two functions?=)
+ rep anyway:)

Or if it is spell you can upgrade/downgrade spell level. Set owner of shop (without color) to selecting player. Then you should have all what you need

Buying unit -> Casting unit
Sold item -> Casting spell

That is just alternative

I dont have any spells level in my map, spell can be upgraded once and there isnt any reason to downgrade spells, cuz after upgrade spell will be much stronger:)
However thanks for suggestion=)
 
Status
Not open for further replies.
Top