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

TRIGGER - If unit is upgraded, set "varible" = Uni

Status
Not open for further replies.
Level 5
Joined
Aug 26, 2004
Messages
114
Can someone help me with a trigger... in my map there are spawning Units every 1 second in game... if unit is upgraded the spawn unit shall change to another unit... How do i do?
 
Level 8
Joined
Apr 3, 2004
Messages
507
Store the unit to be spawned in a unit-type variable, and create one of the unit-type variable every interval.

To update the unit-type variable, make a trigger that fires when someone researches the right upgrade, and changes the unit-type variable to a new unit-type.
 
Level 8
Joined
Apr 3, 2004
Messages
507
Alright, I'll try to simplify it even further.

You'll need two triggers and one variable.

The var is a unit-type variable, we'll call it unittypeSpawn.

One trigger spawns the unit-type, and the other upgrades the unit-type.

The spawner should run every x.xx seconds, and merely create 1 unittypeSpawn for Player X at a location.

The upgrader should run whenever someone researches the unit-type upgrade, and should set unittypeSpawn to the new unit-type.

This way, whenever the unit is spawned, you don't have to run through and check all the upgrades; you just create whatever unit has been stored as the kind of unit the upgrade is set to.
 
Level 3
Joined
Aug 5, 2004
Messages
47
Panto I got your back

Like panto said before, I will create this out for you so even clord could understand it :)

You need 2 triggers and 1 variable (the button that looks like the x)

1. Establish your variable. You do this in creating the variable screen. Lets start it out with a footman.

2. Create one trigger that spawns a unit based in your variable every 10 seconds at rect spawn for player 1.

3. Now have one more trigger that will change the unit inside your variable. To do this you will need an event that will set the trigger off. Lets say that as soon as a pleyer researches "Advanced Footmen". To do this you would need an event that recognizes that the reshearch for "Advanced Footmen" has been completed. Now you have your action that will change the unit inside your variable. That's all this trigger will do.

Now with all of this together, You have 1 footmen constantly coming out every 10 seconds until you research the "Advanced Footmen" upgrade. Upon doing so your trigger recognizes this and changes your variable wich in turn will change the unit spawned with the first trigger. I hope that cleared out the simple explanation of Panto.
 
Status
Not open for further replies.
Top