Hero
─║╣ero─
- Reaction score
- 250
Creep Revive System
UPDATED
What is a Creep Revive System?
A Creep Revive System is a system that runs everytime a unit dies that is owned by a Neutral Hostile Player. The system waits an allotted time and then revives the unit in it's original spot.
Is this an easy system to create?
This question is asked frequently and depends on how you want it. You can make it revive depending on a units level * some number or make it just wait a number like 10 seconds. You can make the unit revive at it's original spot or make it revive at it's place of death.
Why are you writing this?
It is a very frequent question and I did not see a tutorial on this anywhere on the site so I am creating one.
Why are you splitting this into two different tutorials?
For many reasons: I felt like it. It will be more readable and bearable if it was split into two sections. Third, the advanced creep revive system tutorial will be pretty long.
GUI/Custom Script Creep Revive System
That is a simple version of the GUI/Custom Script Creep Revive System.
Something more complicated may look like this.
This is a little more complicated and it uses Vexorian's CS_Cache. Notice it is in 2 triggers. The first sets the location of the units and stores it. It then turns on the second trigger which runs when a unit dies it checks the condition of the dying unit being owned by Neutral Hostile. Then it runs all the actions
and waits the Dying Unit's Level * 10.00 (can easily be changed) retrieves the point of the unit and creates the same unit type at the original point of the unit when the map was loaded.
Creep Revival System can get even more complicated and set a revival time for a certain type of unit or a certain family of units. But I will not get into this inside of the "Basic" Tutorial
_____________________________________________
All Comments, Questions, Inquires, Typos, Mistakes and other stuff relating to this tutorial can go here and are welcomed.
Thank You For Reading this Tutorial and I hope It Was Very Helpful for you. Next up is the Advanced Creep Revive System.
Updates may include pictures.
-Hero
UPDATED
Code:
[B][SIZE="3"]Legend[/SIZE]: [/B]
[B]Bold[/B]=Question
[I]Italic[/I]=Answer
What is a Creep Revive System?
A Creep Revive System is a system that runs everytime a unit dies that is owned by a Neutral Hostile Player. The system waits an allotted time and then revives the unit in it's original spot.
Is this an easy system to create?
This question is asked frequently and depends on how you want it. You can make it revive depending on a units level * some number or make it just wait a number like 10 seconds. You can make the unit revive at it's original spot or make it revive at it's place of death.
Why are you writing this?
It is a very frequent question and I did not see a tutorial on this anywhere on the site so I am creating one.
Why are you splitting this into two different tutorials?
For many reasons: I felt like it. It will be more readable and bearable if it was split into two sections. Third, the advanced creep revive system tutorial will be pretty long.
GUI/Custom Script Creep Revive System
Code:
Simple Creep Revive
Events
Unit - A unit Dies [COLOR="DarkRed"]//the event for when a unit dies[/COLOR]
Conditions
(Owner of (Dying unit)) Equal to Neutral Hostile [COLOR="DarkRed"]//the condition to make sure the unit was owned by Neutral Hostile[/COLOR]
Actions
Custom script: local unit dyingunit=GetTriggerUnit() [COLOR="DarkRed"]//sets the unit to a local var so it is not lost after the wait[/COLOR]
Custom script: local location p=GetUnitLoc(dyingunit) [COLOR="DarkRed"]//gets the position of the dying unit[/COLOR]
Custom script: call TriggerSleepAction (13.00)[COLOR="DarkRed"] //waits 13.00 seconds you can easily change this [/COLOR]
Custom script: call CreateNUnitsAtLoc( 1, GetUnitTypeId(dyingunit), Player(PLAYER_NEUTRAL_AGGRESSIVE), p, bj_UNIT_FACING ) [COLOR="DarkRed"]//creates the same type as the dead unit at local location p[/COLOR]
Custom script: set dyingunit=null [COLOR="DarkRed"]//nulls dyingunit[/COLOR]
Custom script: call RemoveLocation (p) [COLOR="DarkRed"]//removes the location so no leaks occur[/COLOR]
That is a simple version of the GUI/Custom Script Creep Revive System.
Something more complicated may look like this.
Code:
Int Creep Respawn
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
Custom script: set bj_wantDestroyGroup=true
Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
Loop - Actions
Custom script: call SetTableObject("","creepoints",GetUnitLoc(GetEnumUnit()))
Trigger - Turn on Creep Respawn <gen>
Code:
Creep Respawn Not Turned On
Events
Unit - A unit Dies
Conditions
(Owner of (Dying unit)) Equal to Neutral Hostile
Actions
Custom script: local unit a=GetTriggerUnit()
Custom script: local location p=GetTableLocation("gg","creepoints")
Custom script: call PolledWait((I2R(GetUnitLevel(a))*10.))
Custom script: call CreateNUnitsAtLoc(1,GetUnitTypeId(a),Player(12),p,270)
Custom script: set a=null
Custom script: call RemoveLocation(p)
Custom script: set p=null
This is a little more complicated and it uses Vexorian's CS_Cache. Notice it is in 2 triggers. The first sets the location of the units and stores it. It then turns on the second trigger which runs when a unit dies it checks the condition of the dying unit being owned by Neutral Hostile. Then it runs all the actions
and waits the Dying Unit's Level * 10.00 (can easily be changed) retrieves the point of the unit and creates the same unit type at the original point of the unit when the map was loaded.
Creep Revival System can get even more complicated and set a revival time for a certain type of unit or a certain family of units. But I will not get into this inside of the "Basic" Tutorial
_____________________________________________
All Comments, Questions, Inquires, Typos, Mistakes and other stuff relating to this tutorial can go here and are welcomed.
Thank You For Reading this Tutorial and I hope It Was Very Helpful for you. Next up is the Advanced Creep Revive System.
Updates may include pictures.
-Hero