Tutorial Creating A Basic Creep Revive System

Hero

─║╣ero─
Reaction score
250
Creep Revive System


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
 
M

Mythic Fr0st

Guest
I think it was a good idea for someone to post this.

However, writing in custom script, and making it include vexorians caster system(I cant even install it(havent tried recently))probably wasn't the best idea, as most noobs dont know what "jass" is
and certainly dont know how to install it...

In which most people requiring the system will need it in GUI

But anyway good job,

(PS, Im pretty sure you will get problems of multiple units of "different" types die)
 

Chocobo

White-Flower
Reaction score
409
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:   local string gg [B]//gg=""[/B]
                Custom script:   local location creepoints=GetUnitLoc(GetEnumUnit())
                Custom script:   call SetTableObject("gg","creepoints",creepoints)
                Trigger - Turn on Creep Respawn <gen>

can be simply :

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=GetDyingUnit()
        Custom script:   local location p=GetTableLocation ("gg","creepoints")
        Custom script:   call TriggerSleepAction( ( I2R(GetUnitLevel(a)) * 10.00 ) )
        Custom script:   call CreateNUnitsAtLoc( 1, GetUnitTypeId(a), Player(PLAYER_NEUTRAL_AGGRESSIVE), p, bj_UNIT_FACING )
        Custom script:   set a=null
        Custom script:   call RemoveLocation(p)

is simply :

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

And can be simply done using a global game cache instead of the CS Cache.

Interesting.. by the way.
 

lh2705

Just another Helper
Reaction score
111
I agree basic, but not newbie friendly.
If you're already doing it in GUI, why use custom scripts? I understand the need for you to use locals since there is a wait, but other than that, I see no need for you to use custom scripts.

Anyways, good effort :D
 

turok255

New Member
Reaction score
30
Hmmm..... i just did this...

Code:
Hard Spawn
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Hard Spawn
    Actions
        Unit - Create 1 Hard Spawn for Neutral Hostile at (Center of Hard Creep Spawn <gen>) facing Default building facing degrees

Code:
Medium Spawn
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Medium Spawn
    Actions
        Unit - Create 1 Medium Spawn for Neutral Hostile at (Center of Medium Creep Spawn <gen>) facing Default building facing degrees

And i did one for easy level to :)
 

lh2705

Just another Helper
Reaction score
111
Hmmm..... i just did this...

Code:
Hard Spawn
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Hard Spawn
    Actions
        Unit - Create 1 Hard Spawn for Neutral Hostile at (Center of Hard Creep Spawn <gen>) facing Default building facing degrees

Code:
Medium Spawn
    Events
        Unit - A unit Dies
    Conditions
        (Unit-type of (Dying unit)) Equal to Medium Spawn
    Actions
        Unit - Create 1 Medium Spawn for Neutral Hostile at (Center of Medium Creep Spawn <gen>) facing Default building facing degrees

And i did one for easy level to :)

They both have point leaks and Hero's trigger applies to all dead units owned by neutral hostile.
 

turok255

New Member
Reaction score
30
Hmmm..... good point, I just did it for a training area type thing, If thats the case then it does need to be more newb freindly
 

Chocobo

White-Flower
Reaction score
409
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:   local string gg
                Custom script:   local location creepoints=GetUnitLoc(GetEnumUnit())
                Custom script:   call SetTableObject("gg","creepoints",creepoints)
                Trigger - Turn on Creep Respawn <gen>

In this trigger you are creating 2 leaks repeated <how many units in the map> times.
 

emjlr3

Change can be a good thing
Reaction score
395
the first part u don't null the location, but is fine for a basic one, however you should also comment on not reviving images, or summons

second one works, but again u don't null your location, and u should comment on what string you are using there, and hell, if your going to make it all in CS

y not just do it in JASS, so it can be C&P'd to another map easily, other then that though mainly just like any other creep re spawn system

I may may my own tutorial for this, aka, you have given my an idea
 

Hero

─║╣ero─
Reaction score
250
the first part u don't null the location, but is fine for a basic one, however you should also comment on not reviving images, or summons

second one works, but again u don't null your location, and u should comment on what string you are using there, and hell, if your going to make it all in CS

y not just do it in JASS, so it can be C&P'd to another map easily, other then that though mainly just like any other creep re spawn system

I may may my own tutorial for this, aka, you have given my an idea

I tried to keep it basic...but yeah i will fix all the stuff

_______________
Fixed Them or at least they should be...I am going to start writing the next one soon...oh does anyone know why the WE pictures look blurry when you post them on Photobucket or ImageShack...or is it just me
 

Thanatos_820

Death is Not the End
Reaction score
91
I didn't check for leaks but I made a quick one (Might have a leak to 2).

Code:
Creep Revival
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
    Actions
        Wait 30.00 seconds
        Unit - Replace (Dying unit) with a (Unit-type of (Dying unit)) using The new unit's max life and mana

Yeah, it works but I didn't check for leaks.
 

Hero

─║╣ero─
Reaction score
250
I didn't check for leaks but I made a quick one (Might have a leak to 2).

Code:
Creep Revival
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
    Actions
        Wait 30.00 seconds
        Unit - Replace (Dying unit) with a (Unit-type of (Dying unit)) using The new unit's max life and mana

Yeah, it works but I didn't check for leaks.

That won't work at all..

after the wait dying unit is lost
 
M

Mythic Fr0st

Guest
Dying unit does survive a wait, but i've had problems with it when writing my own

I had to have a condition to check each unit type, otherwise when an icetroll died, it would somehow spawn a wolf instantly lol...
 

Hero

─║╣ero─
Reaction score
250
Dying unit does survive a wait, but i've had problems with it when writing my own

I had to have a condition to check each unit type, otherwise when an icetroll died, it would somehow spawn a wolf instantly lol...

lol anyways I'm making some other tutorials by time..lol
 

Thanatos_820

Death is Not the End
Reaction score
91
That won't work at all..

after the wait dying unit is lost

You mean it won't work if the trigger says:

Code:
Creep Revival
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
    Actions
        Wait 30.00 seconds
        Unit - Replace (Dying unit) with a (Unit-type of (Dying unit)) using The old unit's max life and mana

I don't have WE on, I just closed it a moment ago.
 

Hero

─║╣ero─
Reaction score
250
Dying unit does survive a wait, but i've had problems with it when writing my own

I had to have a condition to check each unit type, otherwise when an icetroll died, it would somehow spawn a wolf instantly lol...

I still think it won't work because if another unit dies within the wait it will be overwritten so I say no it won't work use locals...makes things easier..or use a local and a global to make it even more simpler.
 

Chocobo

White-Flower
Reaction score
409
Dying unit does survive a wait, but i've had problems with it when writing my own

I had to have a condition to check each unit type, otherwise when an icetroll died, it would somehow spawn a wolf instantly lol...

For some it dies, for some it isn't. It depends weirdly afaik.

My computer accepts only Triggering unit to stand after a wait, and it's quite weird. I downloaded a map that uses Casting unit after a wait, it worked fine. But when I opened the map (without saving), the spell never worked correctly (casting unit == null)

Use (Triggering unit) instead of (Dying unit).
 

Anything.

New Member
Reaction score
69
So to make the units respawn for a NPC Player (Not Neutral Hostile) I have to edit "Neutral Hostile" to whatever player and "PLAYER_NEUTRAL_AGGRESSIVE" to player... #-1 (So player Red is 0)?

Heh, I forgot :D

I wish it was in JASS so I could CnP :(
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top