• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

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