- Joined
- Mar 26, 2004
- Messages
- 569
Creep Respawn (GUI) - Difficulty: 3/10
-------------------------
Introduction
This tutorial explains how to make units owned by a certain player to respawn at their original position after a given amount of time.
The Tutorial
-------------------------
Setup
There are a few things you'll need to set up. Let's begin with the variables.
Variables
- Open your Trigger Editor and press CTRL+B to open the variable manager.
- While there press CTRL+N to create a new variable.
- Set "Variable Type" to Integer and set "Variable Name" to Temp_Integer. Then press OK.
- Press CTRL+N again to create another variable. Set this one's variable type to Point and name it Creep_Point. In this one, you'll also check the [ ] Array field for the variable. Then press OK.
- One last time, press CTRL+N to create a new variable. Set it's type to Real and name it Respawn_Time. Then press OK.
By now, you should have these 3 variables:
The Map
Now, to respawn units you'll need some units. So go ahead and place some units on your map. Set these unit's owner to Neutral Hostile.
-------------------------
Triggers
Initialization
We'll start off with the Map Initialization trigger, which are the triggers that are run when the map has finished loading.
Note: The amount you set for Respawn_Time is how long the next trigger will wait before respawning the unit.
The Respawn
Adding a creep to Respawn
To add creeps, that are spawned during the game's progress, to the "Respawn" trigger you'll have to make this trigger:
In conclusion: This will make a unit owned by Neutral Hostile that dies respawn at it's original position after a set amount of time.
Footnote
This system has only been tested in a small scale and I am totally unaware of leaks, so if anyone could point them out it would be appreciated.
Please comment and criticize the content and be picky about grammar and spelling errors, i don't want it to be faulty.
-------------------------
Hope it was useful! And hope it hasn't been done before! Over and out. ~SkriK
-------------------------
Introduction
This tutorial explains how to make units owned by a certain player to respawn at their original position after a given amount of time.
The Tutorial
-------------------------
Setup
There are a few things you'll need to set up. Let's begin with the variables.
Variables
- Open your Trigger Editor and press CTRL+B to open the variable manager.
- While there press CTRL+N to create a new variable.
- Set "Variable Type" to Integer and set "Variable Name" to Temp_Integer. Then press OK.
- Press CTRL+N again to create another variable. Set this one's variable type to Point and name it Creep_Point. In this one, you'll also check the [ ] Array field for the variable. Then press OK.
- One last time, press CTRL+N to create a new variable. Set it's type to Real and name it Respawn_Time. Then press OK.
By now, you should have these 3 variables:
The Map
Now, to respawn units you'll need some units. So go ahead and place some units on your map. Set these unit's owner to Neutral Hostile.
-------------------------
Triggers
Initialization
We'll start off with the Map Initialization trigger, which are the triggers that are run when the map has finished loading.
-
Map Initialization
-

Events
-


Map initialization
-
-

Conditions
-

Actions
-


Set Respawn_Time = 5.00
-


Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
-



Loop - Actions
-




Set Temp_Integer = (Temp_Integer + 1)
-




Unit - Set the custom value of (Picked unit) to Temp_Integer
-




Set Creep_Point[Temp_Integer] = (Position of (Picked unit))
-
-
-
-
Note: The amount you set for Respawn_Time is how long the next trigger will wait before respawning the unit.
The Respawn
-
Respawn
-

Events
-


Unit - A unit Dies
-
-

Conditions
-


(Owner of (Triggering unit)) Equal to Neutral Hostile
-


(Custom Value of (Triggering unit)) Greater than 0
-
-

Actions
-


Custom script: local integer i = GetUnitTypeId(GetTriggerUnit())
-


Custom script: local integer ii = GetUnitUserData(GetTriggerUnit())
-


Wait Respawn_Time game-time seconds
-


Custom script: call SetUnitUserData(CreateUnit(Player(12),i,GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),270),ii)
-
-
-
Respawn
-

Events
-


Unit - A unit Dies
-
-

Conditions
-


(Owner of (Triggering unit)) Equal to Neutral Hostile
-


(Custom Value of (Triggering unit)) Greater than 0
-
-

Actions
-


Wait Respawn_Time game-time seconds
-


Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at Creep_Point[(Custom value of (Triggering unit))] facing Default building facing (270.0) degrees
-


Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
-
-
To add creeps, that are spawned during the game's progress, to the "Respawn" trigger you'll have to make this trigger:
-
Add Creep to Respawn
-

Events
-


Unit - A unit enters (Playable map area)
-
-

Conditions
-


(Owner of (Triggering unit)) Equal to Neutral Hostile
-
-

Actions
-


Set Temp_Integer = (Temp_Integer + 1)
-


Unit - Set the custom value of (Triggering unit) to Temp_Integer
-


Set Creep_Point[Temp_Integer] = (Position of (Triggering unit))
-
-
In conclusion: This will make a unit owned by Neutral Hostile that dies respawn at it's original position after a set amount of time.
Footnote
This system has only been tested in a small scale and I am totally unaware of leaks, so if anyone could point them out it would be appreciated.
Please comment and criticize the content and be picky about grammar and spelling errors, i don't want it to be faulty.
-------------------------
Hope it was useful! And hope it hasn't been done before! Over and out. ~SkriK
Attachments
Last edited:









i found a problem why maximum wait time in all trigger of this type can be around 60-100 seconds when i add wait 320 seconds trigger even don't run why this happen??



