• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] A unit Finish an upgrade - Help

Status
Not open for further replies.
Level 8
Joined
Aug 19, 2007
Messages
294
Hello Hive,

Kinda hard to explan my problem so i try to give and example:
Unit 1 got 2 different units to upgrade (unit 2 and unit 3), Unit 1 upgrade to unit 2 for 100 gold. Then Unit 2 upgrade back to unit 1 and get 50 gold return.
  • Gold Return
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to 1
    • Actions
      • Player - Add 50 to (Owner of (Triggering unit)) Current gold
This looks like an easy solution. But unit 3 cost 500 gold and u should therefore get 250 gold back.

Info:
Unit 1 = Standard (main building)
Unit 2 = An upgrade to unit 1 - gold cost 100
Unit 3 = An upgrade to unit 1 - gold cost 500

Mission:
When u upgrade even unit 2 or unit 3 back to unit 1 u should get 50% of the gold cost back.


I hope u understood what i tryed to say, else just ask me.
Thx for your time - hope u can help me.
 
Level 7
Joined
Mar 22, 2010
Messages
228
some correction..upgrade term is not applicable when "upgrading to a lower level"..its degrade.. ^^

by the way..
  • Gold Return
    • Events
      • Unit - A Unit Finishes an upgrade
    • Conditions
    • Actions
      • If/then/else
        • if
          • (Unit-type of (Triggering Unit)) Equal to 1
        • then
          • Player - Add 50 to (Owner of (Triggering unit)) Current gold
      • If/then/else
        • if
          • (Unit-type of (Triggering Unit)) Equal to 2
        • then
          • Player - Add 250 to (Owner of (Triggering unit)) Current gold
i dont get your point so much so im not sure if thats the answer..
 
Level 8
Joined
Aug 19, 2007
Messages
294
The WE cant see the different between upgrade: unit 2 to unit 1 or upgrade unit 3 to unit 1.
That is what i need help for

The Trigger I show is just when u upgrade from any unit to unit 1.

Edit: The trigger u show me:
The first part is if u upgrade even unit 2 or 3 back to unit 1 witch should not give the same gold.
The second park is when u upgrade from unit 1 to 2 witch should not give gold

Edit 2: it is like I need a trigger like this:
  • Gold Return
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Unit-type of (triggering)) Equal to 1
      • (Unit-type of (old unit)) Equal to 2
    • Actions
      • Player - Add 50 to (Owner of (Triggering unit)) Current gold
  • Gold Return
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • (Unit-type of (triggering)) Equal to 1
      • (Unit-type of (old unit)) Equal to 3
    • Actions
      • Player - Add 250 to (Owner of (Triggering unit)) Current gold
Is it possible to make something like that in the "real" WE?
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
Do you think you could use an ability instead?
That makes it easier to award the correct gold to the unit.
(You'll need to replace the unit manually though, unless you used some kind of transformation ability like Destroyer Form.)

Otherwise, the only other method I can think of is using hashtables to store the unit-type of the unit that is being upgraded, then refer back to it to get the previous unit-type when it finishes the upgrade.
 
Status
Not open for further replies.
Top