Respawn exactly where you died?

Skull Kingz

Active member
Hey, so I was trying to come up with some type of way to have the Respawn Animation be in the same position as the Death Animation. I wanted Respawn to be a "Rise" type of animation so that it looks like the player just got up after dying.
Is there any way to respawn exactly where you died? Perhaps it's already coded in the engine and I'm overlooking it. I've done a lot of searching with no luck.
 
Should be simple just use a script in your death animation to record your exact location then a script in your respawn animation to jump to the last recorded location.
 
I'm pretty terrible with scripts tbh, and I'm kinda rusty with Openbor. I wouldn't be able to code it with my current knowledge. Do you know of any mods that uses this? I would love to break it down and learn the process.
 
I have a beginner tutorial for scripting in my sig that can help you get started.

This will just require a animation script I will write the code for you later.  But if you really want to be a good modder try to understand the code so you can write scripts of your own and if you get stuck you know we got your back.
 
Gotcha, I'm definitely gonna study your guide. Scripting is always something that I wanted to learn and understand fully. I just never knew where to start. I'll start with the guide. Thanks a lot!
 
Skull Kingz I have not tested this script so try it and see if it works for you.

in your scripts folder save this as aniscript.c
Code:
void save_me()
{//save current location.
void self = getlocalvar("self"); //get caller
float x = getentityproperty(self, "x"); //current x location
float z = getentityproperty(self, "z"); //current z location
setentityvar(self, "x", x); //save x location
setentityvar(self, "z", z); //save z location
}

void return_me()
{//return to a saved location
void self = getlocalvar("self"); //get caller
float x = getentityvar(self, "x"); //get saved x location
float z = getentityvar(self, "z"); //get saved z location
changeentityproperty(self, "position", x,z,a); //move to location
}

Now add the line in your characters header data "animationscript data/scripts/aniscript.c".

Add the script command in your death animation "@cmd save_me"

Next add the command "@cmd return_me" to your REspawn animation not you spawn animation. Another thing is to make sure you have a delay on the first frame of at least 3 here is a example:
Code:
anim respawn
loop   0
delay 3
frame none
@cmd return_me
frame none
 
@Skull Kingz

Got you covered. I put this behavior into my Golden Axe project back in 2010. It's not too difficult. This video shows it in action. If even works if you are someone else and continue as a fighter dead on screen, or if another player joins and selects them. Here is a link to the code that makes it work.

  1. Set your module up to leave player bodies - that part is native to OpenBOR, no script needed
  2. Copy my function into a file, import it to a model's onspawn script you want to have spawn in place effect.
  3. Run the function from main(). Example provided below.
Your onspawn script should look something like this:

C:
#import "data/scripts/com/dc_respawn_body.c"        // Path to file that has the dc_respawn_body function.

void main()
{
    void entity = getlocalvar("self");

    /*
    * Pass function the entity and ID of the
    * animation you want to play.
    */
    dc_respawn_body(entity, openborconstant("ANI_FOLLOW10"));
}

My function will find the body, move new spawn there, remove the old body, and play an animation of your choice. In the video below, it's just the fighter standing back up.


DC
 
Back
Top Bottom