I Am making a RPG and i have added a unit respawn system But when a unit dies it respawns where the corpse was left off at how can i make it so it spawns at its Original Starting Point and by orginal point i mean where i put the monster in the editor
the thing you do is to revive the dead so they revive to the point they where killed.You have to "save" the position of every unit you have, (except heroes ofc)
There is a system around here that will help you very much.
If are good enought to understand me the prob is solved.
You have to take all units (for the rpg) excluding buildings and heroes.
You have to set their custom value from 1 and increasing 1 for every unit, (if you have 5 units it you will set custom value of first 1 of second 2 and so on until 5)
Now create a real valiable with arrays and use the custom values you set to the points array ( so for unit with custom value 1 there is a UnitPointX[1] and UnitPointY[1] that defines the units position)
All you have to do for not making 10-8200 actions, use loops.....
And when it dies check his cutom value after some seconds make it spawn at its UnitPointX[z] and UnitPointY[z] (z=custom value of unit)
Player Group - Add Player 9 (Gray) to Creep_Respawn_player_group
Player Group - Add Player 10 (Light Blue) to Creep_Respawn_player_group
Player Group - Pick every player in Creep_Respawn_player_group and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Loop - Actions
Set Creep_respawn_Number_int = (Creep_respawn_Number_int + 1)
Unit - Set the custom value of (Picked unit) to Creep_respawn_Number_int
Set CreepRespawnPoint[(Custom value of (Picked unit))] = (Position of (Picked unit))
Trigger:
C H Respawn Creep advan
Events
Unit - A unit Dies
Conditions
Or - Any (Conditions) are true
Conditions
(Owner of (Dying unit)) Equal to Player 12 (Brown)
(Owner of (Dying unit)) Equal to Player 10 (Light Blue)
(Owner of (Dying unit)) Equal to Player 9 (Gray)
Actions
Wait 80.00 seconds
Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at CreepRespawnPoint[(Custom value of (Dying unit))] facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to (Custom value of (Dying unit))
THis adds the players to a group... (which i should delete :/) then takes all there units sets the custom value to preivuos unit +1 and sets its "point" as the location [custom value of picked unit]
the respawn re-makes the dead unit(agian need 2 fix) at there point [custom value of dying unit]
then sets its value to the old units value
what i want to know is why use point offset by x y when you can use JUST point?
why spend extra time saving the x/y postion when you can just save its point?
Ghan has said he has fixed this. Monovertex please confirm this fix. This was only a problem with people that had signatures in the upper levels like not the special members but the respected members.