• 🏆 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] Respawn Creeps

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
You will need to explain how you want your creeps to respawn for anyone to be able to help you. There are dozens of ways they could respawn which I have seen inside custom maps. Here is but a few.
* Instantly/after some time on death at original spawn point.
* Replaced near original position "bully" style by an AI building them from a building.
* Periodically re-created within a "spawn zone" after death.
* Resurrect after some period of time at death point.
* Respawn near original spawn point after some time but from a pool of random unit types.
* Respawn at original spawn point upon completion/reset of the zone in "dungeon" systems.
 
Level 5
Joined
Jun 17, 2014
Messages
103
Respawn
  • Events
  • Unit -A unit owned by Player 11 Dark Green] Dies
  • Actions
  • Wait 25.00 seconds
  • Unit -create 1 [Unittyoe if [Triggering unit] for Player 11 [Dark Green] at GraveyardPoints[Custom value of [dying unit]]] facing default building facing [270.0] degrees
  • Unit -Set the custom value of [Last created unit] to [Custom value of [Dying unit]]
[Respawn INIT]
  • Events
  • Map initialization
  • Actions
  • Set Tempinteger =0
  • Unit Group -ick every units in Units in [Playable map area] owned by Player 11 [Dark Green]] and do [actions]
  • Loop -Actions
  • Set GraveyardPoints [TempInteger] = [Position of [Picked unit]]
  • Unit Set the custom value of [Picked unit] to TempInteger
  • Set TempInteger [TempInteger 1]
Its respawn system everywhere unit owned by dark green dies he respawn in the same place

its basic system but it should work :)
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Respawn
  • Events
  • Unit -A unit owned by Player 11 Dark Green] Dies
  • Actions
  • Wait 25.00 seconds
  • Unit -create 1 [Unittyoe if [Triggering unit] for Player 11 [Dark Green] at GraveyardPoints[Custom value of [dying unit]]] facing default building facing [270.0] degrees
  • Unit -Set the custom value of [Last created unit] to [Custom value of [Dying unit]]
[Respawn INIT]
  • Events
  • Map initialization
  • Actions
  • Set Tempinteger =0
  • Unit Group -ick every units in Units in [Playable map area] owned by Player 11 [Dark Green]] and do [actions]
  • Loop -Actions
  • Set GraveyardPoints [TempInteger] = [Position of [Picked unit]]
  • Unit Set the custom value of [Picked unit] to TempInteger
  • Set TempInteger [TempInteger 1]
Its respawn system everywhere unit owned by dark green dies he respawn in the same place

its basic system but it should work :)
This is a terrible system, as it requires to set the unit's custom value. Custom value should be reserved for unit indexers.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
SaintShen, the Respawn trigger is prone to bugging if the unit is removed within the >>25 seconds the TriggerSleepAction performs. That can easily happen if the unit was exploded to death.

You need to save the custom value and unit type in local variables to prevent this loss occurring.

Custom value should be reserved for unit indexers.
No, they are reserved for whatever the map author wants them to be. A lot of GUI programmers find it convenient for them to be used as a unit indexer system however such systems are not critical to making a map so the custom value could be used for something else if so desired. The only thing that maters is that there are no conflicting custom value systems in a map (eg no unit indexer running with this).

Spells for the spell section are not allowed to use custom values out side of unit indexers to avoid conflict and even then I keep running into people with indexer related conflicts (as they use 2 indexers at once).
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
SaintShen, the Respawn trigger is prone to bugging if the unit is removed within the >>25 seconds the TriggerSleepAction performs. That can easily happen if the unit was exploded to death.

You need to save the custom value and unit type in local variables to prevent this loss occurring.


No, they are reserved for whatever the map author wants them to be. A lot of GUI programmers find it convenient for them to be used as a unit indexer system however such systems are not critical to making a map so the custom value could be used for something else if so desired. The only thing that maters is that there are no conflicting custom value systems in a map (eg no unit indexer running with this).

Spells for the spell section are not allowed to use custom values out side of unit indexers to avoid conflict and even then I keep running into people with indexer related conflicts (as they use 2 indexers at once).
The problem is that many inexperienced map makers (and even experienced ones) import spells from the spells section (and seriously: that's the point of the spells section!) that usually require a unit indexer without actually knowing what a unit indexer does. If they now use custom value for something else, this creates all kinds of nasty bugs that are hard to detect as they are not easy to reproduce, most of the time.

That's why I tell everyone not to use custom value. It's just not a good practice for anyone that doesn't know 100% what he's doing.

It's the same reason why teachers tell kids at school that you can not get the squareroot of a negative number even though that isn't correct if you know about higher mathematics.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236

sentrywiz

S

sentrywiz

I made my own system that resembles @SaintShen's one. It might have problems, but I've played my map for 2+ hours and it didn't lag nor did it have any problems.


  • First Time Rev Creeps
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set CREEP_Temp_Integer = (CREEP_Temp_Integer + 1)
          • Unit - Set the custom value of (Picked unit) to CREEP_Temp_Integer
          • Set CREEP_Point[CREEP_Temp_Integer] = (Position of (Picked unit))
          • Set CREEP_Facing_Angle[CREEP_Temp_Integer] = (Facing of (Picked unit))
  • Creep Revive
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Not equal to True
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
      • (Custom value of (Triggering unit)) Greater than 0
    • Actions
      • Wait 30.00 seconds
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at CREEP_Point[(Custom value of (Triggering unit))] facing CREEP_Facing_Angle[(Custom value of (Triggering unit))] degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))


Alternatively, I've been using Ryoko's creep respawn system for a long time. It still works great, but since I made my own I disabled this one.


  • Neutral Coords
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in FORUM FFA MAP <gen> owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set Integer = (Integer + 1)
          • Unit - Set the custom value of (Picked unit) to Integer
          • Custom script: set udg_Creep_X[udg_Integer] = GetUnitX(GetEnumUnit())
          • Custom script: set udg_Creep_Y[udg_Integer] = GetUnitY(GetEnumUnit())
  • Rev Neutrals
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Neutral Hostile
    • Actions
      • Wait 30.00 seconds
      • Set Center_Map = (Center of FORUM FFA MAP <gen>)
      • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center_Map offset by (Creep_X[(Custom value of (Triggering unit))], Creep_Y[(Custom value of (Triggering unit))])) facing (Random angle) degrees
      • Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
      • Custom script: call RemoveLocation ( udg_Center_Map )


Lastly, you can read this tutorial if you don't understand the above systems.

Creep Respawn Tutorial

@Zwelbelchen - saying custom value should be reserved for unit indexers makes it sound like that's all custom value should be used for. Maybe the user doesn't need or want or use a unit indexer.
 
Status
Not open for further replies.
Top