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

How to create creep respawning

Status
Not open for further replies.
Level 1
Joined
Nov 7, 2013
Messages
1
I am currently trying to create a map in which whenever you kill a creep, it respawns 30 seconds later in it's original camp. I have made a trigger to do this but it seems to only work once and then it stops. On top of that, it seems to only work for very low level creeps. If I could get some help on this that would be awesome. Thanks in advance!
Event:
Unit - A unit Dies
Condition:
(Owner of (Triggering unit)) Equal to Neutral Hostile
Action:
Wait 30 seconds
Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Position of (Triggering unit)) facing Default building facing degrees.
 
That trigger should work just fine, although it leaks a location which means every time the trigger is ran (possibly a lot, considering it's a revive trigger) the game allocates more memory and over time will cause your map to lag. So we need to free that memory. See this thread for a list of things that leak.

Here is a version without leaks.

  • Untitled Trigger 003
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Custom script: local location l = GetUnitLoc(GetTriggerUnit())
      • -------- --------------------------- --------
      • Set PointVariable = PointVariable // this line isn't needed, just create this variable
      • -------- --------------------------- --------
      • Wait 30.00 seconds
      • Custom script: set udg_PointVariable = l
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at PointVariable facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_PointVariable)
      • Custom script: call RemoveLocation(l)
      • Custom script: set udg_PointVariable = null
      • Custom script: set l = null
It requires a point variable named PointVariable to work (you can pick a different name if you change it in the Custom script parts too). If you're unsure how to use variables, read this.

You also say it only works for low level creeps? That's odd. Are you sure all units are owned by Neutral Hostile?

Alternatively you can check the Spells section for a respawn system, or read the tutorial NaserKingArthas provided.
 
Level 5
Joined
Dec 3, 2012
Messages
117
Not sure, but I think this won't work the way you want it to.
You mentioned you want them to respawn in it's original camp, yet this way the unit respawns where it died, doesn't it ?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
The wait can cause problems if the dying unit does not decay, or if the decay time is less than 30 seconds. If the dying unit is removed from the game during that 30 seconds, the respawn will not happen. By default the decay time is 8 seconds for flesh and around 80 seconds for bones. But not all units decay. Check their death type in object editor.
 
Status
Not open for further replies.
Top