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

Variable with item Description

Status
Not open for further replies.
Level 6
Joined
Sep 4, 2007
Messages
157
oh ok then you can do this this will be a long trigger if you have lots of items but you can set a description for each item, you do that in a map int trigger then when a player picks up and item set it to another variable then make it look to see if that item is the same as the first variables you made then pick that one and and show it. if you want to know how it would look just let me know
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Doesn't need to be in Triggers, could use JASS also

I actually checked jass and ignored gui.

The "easiest" way you could do this is:

Create following global variables:
- Itemtypes (which is an item type array)
- Itemdescriptions (which is a string array)

At map initialization, you do this:
  • Set Itemtypes[0] = Potion of healing
  • Set Itemdescriptions[0] = "Heals a unit for 200 HP"
  • Set Itemtypes[1] = Potion of mana
  • Set Itemdescriptions[1] = "regenerates mana over time"
  • ...
  • Set Itemtypes[n] = The last item
  • Set Itemdescriptions[n] = The last description
When you need the description of an item, you do this:
  • For each Integer A from 0 to n do:
    • Loop - actions
      • If Itemtypes[Integer A] = Item type of (your item) then
        • Use Itemdescriptions[n] as the description
        • Skip remaining actions
n is the amount of items you needed in both triggers.
 
Level 11
Joined
Dec 8, 2006
Messages
334
This is technically what Schurke and b a d said if I understand well (only they didn't write that code as a sample)
What I am trying is to avoid Variabling every item one-by-one


Well, it seems like I have no other choice but do it that way
Anyway, thank you for your time with writting that reply
 
Status
Not open for further replies.
Top