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

Add Items to Shops via Triggers

Status
Not open for further replies.
Level 4
Joined
Aug 8, 2011
Messages
84
Hello Hive,

I've managed to create a trigger that adds items to shops correctly, however, the items that are added in this way lose the color code on their basic tooltip.

For example, the tooltip is: "Purchase |cffac7b0bSteelskin|r"

However, the shop only displays it as white text. Is there any way around this?

Thank you!
 
Level 4
Joined
Aug 8, 2011
Messages
84
Target shop has no starting items sold.
Target shop has the following abilities: Asid,Aneu,Avul,Apit

Trigger code:

rand2 is from 5 to 11, btw.

JASS:
        loop
            exitwhen (i > rand2)
            //The first item gets a bonus to its roll, whereas every item after the second
            //has a penalty equal to i*5. 
            set rand = GetRandomInt(0, 100) - ((i - 2) * 5)
            
            if (rand > 85) then
                set rand = GetRandomInt(0, udg_LootTableUniqueSize)
                set utype = udg_LootTableUnique[rand]
            elseif (rand > 60 and rand <= 85) then
                set rand = GetRandomInt(0, udg_LootTableRareSize)
                set utype = udg_LootTableRare[rand]
            elseif (rand > 30 and rand <= 60) then
                set rand = GetRandomInt(0, udg_LootTableMagicSize)
                set utype = udg_LootTableMagic[rand]
            else
                set rand = GetRandomInt(0, udg_LootTableFineSize)
                set utype = udg_LootTableFine[rand]
            endif
            
            call AddItemToStock(u, utype, 1, 1)
            set i = i + 1
        endloop
 
Last edited:
Level 4
Joined
Aug 8, 2011
Messages
84
I've been trying to find a work-around for this, and it seems that color codes in general aren't working in the basic tooltip field for items added to shops via trigger.

Clearly I can just set the basic tooltip field to a space: " " and then add the basic tooltip information to the extended tooltip, but it obviously doesn't look completely right. So any help on this would be appreciated.
 
Level 4
Joined
Aug 8, 2011
Messages
84
Yes, they work with the basic tooltip fields under normal circumstances. The problem that I am experiencing is that they lose the coloration in the basic tooltip field after the item has been added to a shop via triggers.
 
Level 4
Joined
Aug 8, 2011
Messages
84
The actual tooltip text I use has no quotation marks.

But since you say that you are adding items to your shops via triggers and your color works fine, I'd be interested to know how your tooltips / shops are set up.
 
It's set up the normal way

sample:

|cff1e90ffRecipe:|n5 iron|n5 Leather|n7 Mysterious Essence|n3000 gold|r|cffffa500|n|nType:|n|r|cff00ffffBoots (usable by all)|r|cffffa500|n|nEffects:|n|r+30 damage reduction|n+50 Agility|n|n|cffee82eeRequired Level: |r|cffffff0020|n|r|n|cffc0c0c0A boots that enhances the movement of its wearer.|r

as for adding items, I use the function AddItemToStock()
 
Level 4
Joined
Aug 8, 2011
Messages
84
I really can't figure out what the problem is, my shop has those same abilities, I am adding the items in the same way, and my color codes are valid. Yet still the color codes for the purchase item part of the tooltip don't work when they're added to the shop via trigger.
 
Last edited:
Level 4
Joined
Aug 8, 2011
Messages
84
I've created another map just to test this, unfortunately I get exactly the same results. I have uploaded the test map. Any input would be appreciated.
 

Attachments

  • derp.w3m
    16.1 KB · Views: 63
Level 4
Joined
Aug 8, 2011
Messages
84
It's ok, but if you wouldn't mind, would you create a small test-map with a random shop/item that is set up the same you have it in your map?
 
Status
Not open for further replies.
Top