HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Upgrading Items - Woe Is Me

05-05-2004, 04:24 PM#1
Dougin
Okay, I got a doozie. At least I think it is. You all are probably going to know in two seconds what I've done wrong. So here goes...

I want to be able to upgrade items. For example, if someone is holding a Ring of Protection +5, I want them to be able to upgrade it to +10 by paying a certain amount of gold in a certain region. Trouble is, I have roughly 50 items that I want upgradable, so here's what the triggers look like...

Title: Enter Triggering Region
Event - Unit - A unit enters Upgrade [a region]
Action - Set UpgradingUnit [a variable] = (Triggering Unit)
Dialog - Clear UpgradeMenu
Dialog - Change the title of UpgradeMenu to "Which item would you like to upgrade?"
Dialog - Create a dialog button titled Slot 1
Set Slot1 [a variable] = (Last created dialog button)
Dialog - Create a dialog button titled Slot 2
Set Slot2 = (Last created dialog button)
[and so forth for all the slots]
Dialog - Show UpgradeMenu to (Owner of (Triggering Unit))

That works. When I test it, I see the dialog box. Then things start to fall apart...

Title: Set Upgrade Variable
Event - A dialog button is clicked for UpgradeMenu
Action - If ((Clicked dialog button) Equal to Slot1) then do (Set UpgradeSlot=1) else do (Do Nothing)
If ((Clicked dialog button) Equal to Slot2) then do (Set UpgradeSlot=2) else do (Do Nothing)
[and so forth]

Title: Actual Upgrade
Event - A button is clicked for UpgradeMenu
Action - Wait 2 seconds [to allow variable to be set]
If all conditions are true, then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item carried by UpgradingUnit in slot UpgradeSlot)) Equal to Ring of Protection +5
Then - Actions
Hero - Drop item carried by UpgradingUnit from slot UpgradeSlot
Hero - Create Ring of Protection +10 and give it to UpgradingUnit
Player - Add -1000 to (Triggering Player) Current gold
Else - Actions
[another If/Then/Else using another item; the "Else" of this is another If/Then/Else and on and on until all items I want upgradable have been exhausted, at which point the Else is a message to the player saying "I'm sorry. You cannot upgrade that item."]

Sorry that was so long, but I think that's as long as it needs to be. Any ideas, ye WarCraft trigger gods?
05-05-2004, 05:32 PM#2
CynicalYouth
Your problem lies with the last trigger. Instead of having the event be:
Event - A button is clicked for UpgradeMenu and then waiting

you should use the Action Run Trigger (ignoring conditions) to call that trigger after it sets the variables from the dialog box.

The only other thing I noticed was that you dont check to see if the player has enough gold, so you need to add another condition to check for that and display a message if they do not. If that still doesnt fix your problem let me know cause i got it working for me.
05-05-2004, 07:19 PM#3
Dougin
I tried that, but it didn't work. I put "Trigger - Run Actual Upgrade (ignoring conditions)" after the variables were set, but when I tried it, nothing happened. Do you want me to send you the map so you can look at it as it really is?

And thanks for pointing that out. I'd already included that but just forgot to type it in here.
05-05-2004, 09:14 PM#4
ThyFlame
Entering unit, not triggering.

Just put the Set Upgrade Variable actions into the top of Actual Upgrade.

Also - Right click > copy as text. Paste inside [ code][/code] tags.

Also - Display the dialog after you create it.

What exactly do you want, anyway? Trigger optimization?
05-05-2004, 09:23 PM#5
CynicalYouth
If you havent figured it out yet i have the map I did it in attached, it should be easy for you to implement it into your map, and it will scale for any number of items. If you have any questions about it, ill be happy to explain
05-05-2004, 10:49 PM#6
Dougin
Thanks Cynical. I'll take a look and see. Hopefully, I'm smart enough to figure it out. Then again...

Two days later: Yup. It all worked out just fine. Thanks so much, Cyn. You'll certainly be credited in the map.