Spawning A Unit

Ryanfg

New Member
Reaction score
0
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
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
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)
 

laxperson808

New Member
Reaction score
9
Trigger:
  • C H Repawn Int
    • Events
      • Map initialization
    • Conditions
    • Actions
      • 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
 

laxperson808

New Member
Reaction score
9
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?
 

laxperson808

New Member
Reaction score
9
well only if u dont delete them... mine saves as point but doesnt delete.. becus it needs to replace unit.. and ive never had any probs using points..
 
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