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

Creep Respawn after death

Status
Not open for further replies.
Level 7
Joined
May 21, 2009
Messages
289
Hey I was wondering...When creeps die in ORPG(s) and like, and they respawn at the same spot they were placed in editor...how do you do this?

Please Note- I want it to respawn at the point it was placed in editor
I will +rep!!!

Thanks!
 
Level 7
Joined
Aug 27, 2008
Messages
378
I only know how to things the hard way, so if this is comlicated, sorry.

Find the person you wish to make come back and set that person as a variable, I'll use peasant as an example here. And you will need a region around the area where the creep will re-spawn.

Event-Unit peasant life becomes less than 1
Condition-
Event- Create one (Unit) for (Player) at center of (respwawn unit) region
-Set peasant to last created unit.

I know It's a lot of work for every individual unit, and you might want to make it wait a Minuit before bringing him back.
 
Level 7
Joined
May 21, 2009
Messages
289
hmm yeah thats little to complex- that would mean a region for every single creep on my EPIC map and a variable too, and the create a new unit works good- but the regions and variables will take ages

(BTW- Love the Avatar)
 
Level 8
Joined
Feb 15, 2009
Messages
463
a not super effiecent trigger for every unit in the map
  • A Unit Dies
  • Dying Unit belongs to Player NEUTRAL_AGGRESSIVE
  • wait 40.sec
  • instantly revive TriggeringUnit
or

  • A Unit Dies
  • Dying Unit belongs to Player NEUTRAL_AGGRESSIVE
  • wait 40.sec
  • set Temp_Point = GetUnitLoc(GetTriggerUnit)
  • Create 1 GetUnitTypeID = TriggerUnit at Temp_Point for Player NEUTRAL_AGGRESSIVE facing 0
  • call RemoveLocation(udg_TempLoc)
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Here is what i use in my map,pretty small and pretty effective.Hope you find it usefull.
  • Store Position
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Respawn_Time = 180.00
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set TempInteger = (TempInteger + 1)
          • Unit - Set the custom value of (Picked unit) to TempInteger
          • Set Creep_Point[TempInteger] = (Position of (Picked unit))
  • 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)
 
Level 4
Joined
Sep 27, 2009
Messages
119
Here is what i use in my map,pretty small and pretty effective.Hope you find it usefull.
  • Store Position
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Respawn_Time = 180.00
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
        • Loop - Actions
          • Set TempInteger = (TempInteger + 1)
          • Unit - Set the custom value of (Picked unit) to TempInteger
          • Set Creep_Point[TempInteger] = (Position of (Picked unit))

Nope, see the "Set Tempinteger = (TempInteger + 1)" Well every time a unit is picked it adds 1 to its value, and thats only the start of the loop. The second part "Unit - Set custom value of (Picked Unit) to TempInteger" assigns a unit an array value - which will be used in the final step. Finally "Set Creep_Point[TempInteger] = (Position of (Picked Unit))" Tells what creep (value which was assigned to TempInteger) has what point.
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
So...I would have to place each one of these idividually??? -.-"?

No,no.It's pretty simple to use.Just do what i told you.Create those 3 variables,copy and paste my trigger into your map and it will work.Each Neutral Hostile unit will be respawned after death to the point you placed it.
You can change this line to modify the time before they respawn again.
  • Set Respawn_Time = 180.00
In my map i want them to be respawned every 180 seconds,you can change this to whatever you want.

Reaper2008 i can't see the leak,could you be more specific?
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
ok...ok may sound noobish..but how do I copy a trigger outside of World Editor? I got the 3 variables - do I keep them all at a none/zero value?

You can't copy the whole trigger this is impossible,but its pretty easy to make it.I suggest you just copy the Custom Script parts.Just left click here drag all of the text and then press CTRL+C.Open your map create a new Custom Script and press CTRL+V.
 
Level 7
Joined
May 21, 2009
Messages
289
Ok ok..I got the trigger without your last responce....BUT the last custom script gives me an error.... line 124- attempt to index a non-arry variable

NOTE I copied and pasted your custom script....
although there is one part of the trigger I didn't understand-

Set creep_point[tempinterger]
I can get the creep_point variable...but not the [tempinterger] part

dont know if this affects the script
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Ok ok..I got the trigger without your last responce....BUT the last custom script gives me an error.... line 124- attempt to index a non-arry variable

NOTE I copied and pasted your custom script....
although there is one part of the trigger I didn't understand-

Set creep_point[tempinterger]
I can get the creep_point variable...but not the [tempinterger] part

dont know if this affects the script

Well its for the custom text script...nevermind just use it as is.
And about your error...simply the Creep_Point variable is an array.Just select the Creep_Point variable in your Variable Editor and click in the array box,number 1.
 
Level 7
Joined
May 21, 2009
Messages
289
Man id hug you but that would be a little akward (and im talking over the internet...sooo) dude your the best you always respond to my questions!

+rep for all

oh and one quick question- I just change the Set Repawn Time to what I want right? doesnt affect the trigger at all?
 
Status
Not open for further replies.
Top