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

Respawning Neutral Hostile creeps periodically, but at their original position?

Status
Not open for further replies.
Level 2
Joined
Jan 26, 2009
Messages
13
How do you resurrect Neutral Hostile creeps that have been killed, but have them revive at the location they started at initialization?
Like, if somebody pulls a creep out of it's camp, then kills it, it's body would be resurrected where it died rather than it's initial spawn point.

Do I have to create a trigger for every individual creep or something? D:
 
Level 5
Joined
Jul 4, 2007
Messages
166
How do you resurrect Neutral Hostile creeps that have been killed, but have them revive at the location they started at initialization?
Like, if somebody pulls a creep out of it's camp, then kills it, it's body would be resurrected where it died rather than it's initial spawn point.

Do I have to create a trigger for every individual creep or something? D:

The best way to do this is to make a region for where you want the new one to spawn, but if you have a lot of spread-out creeps this could be a problem. One alternative, if no additional creeps are created in game, is to, at initialization, do a trigger like this:

  • Set Up Vars
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Comment - spawnLocs is an array of points large enough for each neutral hostile unit on your map. spawnUnit is an array of units large enough for each neutral hostile unit on your map. 900 or so should be far more than enough. Counter is an integer that defaults to 0.
    • Unit Group - Pick every unit in (Units owned by (Neutral Hostile)) and do (actions):
      • set spawnUnit[counter] = (Picked Unit)
      • set spawnLocs[counter] = position of (Picked Unit)
      • set counter = (counter + 1)
Now you have an array set up that associates every creep in the map with its spawn location. Your respawn trigger just has to search the spawnUnit array and find the 'counter' variable associated with it, then resurrect the unit at the spawnLocs point with the counter value equal.
 
Level 7
Joined
Dec 18, 2008
Messages
400
There is a very easy tyrtorial about this, i think its called something like "Making a GUI respawn system" or something close to that.
 
Level 12
Joined
Mar 16, 2006
Messages
992
There are much easier and much better systems already uploaded. I'd go digging through them if I were you.

Here's all you really need: a point array to remember their locations and an integer to give the units a custom value. When the map starts, integer = 0, using a Pick All Units trigger, you set the (picked unit)'s custom value to INTEGER, then do integer=integer+1. When a unit dies, owner being Hostile, wait X seconds, and spawn unit (dying unit) at point [custom value of (dying unit)]. Give (last created unit) custom value of (dying unit).

Wow, I got carried away. I typed the entire trigger out for you.
 
Status
Not open for further replies.
Top