SOLVED Spawn instead of respawn. Why?

Toranks

Active member
This player-manageable entity uses spawn instead of respawn animation every time the player loses a life:

Code:
name		remcar
type		none
health		200
mp		100
speedf		1.4
jumpheight	0
cantgrab	1
notgrab		1
noquake		1
falldie		1
nodieblink	1
makeinv		3
gfxshadow	1
modelflag 	1
weaploss	3
nodrop		1
facing		1
grabforce       0
candamage	enemy obstacle
diesound      data/sounds/bguyd08.wav
icon            data/chars/misc/icons/rem.gif
parrow          data/chars/misc/flash/flash/player1.gif  -36 -145
parrow2         data/chars/misc/flash/flash/player2.gif  -36 -145
parrow3         data/chars/misc/flash/flash/player3.gif  -36 -145
diesound        data/sounds/bang2.wav

animationscript data/scripts/escript.c
animationscript data/scripts/grabscript.c

com     s	freespecial1
com     a4	freespecial1
com     j	freespecial2
com     a3	freespecial2
com     a2      freespecial15

load	remboat2
load	Steam
load	explosion1
load	burn2
load	cardam2
load	explosion3


script	@script
void main()
{
   void self = getlocalvar("self");
   void anim = getentityproperty(self,"animationID");
   void hp = getentityproperty(self,"health");
   int x = getentityproperty(self, "x");
   int y = getentityproperty(self, "a");
   int z = getentityproperty(self, "z");

   float H = checkplatformbelow(x+1,z, 5000);
   float Hz = checkplatformbelow(x+1,z-5, 5000);
   float yH = checkplatformbelow(x-60,z, 5000);
   float yHz = checkplatformbelow(x-60,z-5, 5000);

   if(Hz >= 1)
   {
     changeentityproperty(self, "position", x, z+1);
   }

   if(H >= 1)
   {
     changeentityproperty(self, "position", x-1);
   }
   if(yHz >= 1)
   {
     changeentityproperty(self, "position", x, z+1);
   }

   if(yH >= 1)
   {
     changeentityproperty(self, "position", x+1);
   }

   if(anim == openborconstant("ANI_RESPAWN"))
	{
 	changeentityproperty(self, "health", 200);
	}
}
	@end_script	
		
		
		
		
		
		
		
		
		
		
		
		
		
anim	attack
	loop	0
	delay	3
	offset	165 135
	bbox	33 50 274 85
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	death
@script
	void self = getlocalvar("self");
	void Gun = getentityvar(self, 1);

	if(frame == 0 )
	{
        damageentity(Gun, self, 1000, 0, openborconstant("ATK_NORMAL"));
	}
	if(frame == 24 )
	{
	bindentity(Gun, NULL());
	setentityvar(self, 1, NULL());
	}
	@end_script	
	loop	0
	delay	5
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar03.gif
	@cmd	spawn01 "explosion1" 20 60 10
	frame	data/chars/3remuinho/ride/remcar04.gif
	@cmd	spawnGun "burn2" 45 50 5 2
	frame	data/chars/3remuinho/ride/remcar03.gif
	@cmd	spawnGun "Steam" 20 60 5 3
	frame	data/chars/3remuinho/ride/remcar04.gif
	@cmd	spawn01 "explosion1" -20 70 10
	frame	data/chars/3remuinho/ride/remcar03.gif
	@cmd	spawn01 "cardam2" 0 40 10
	frame	data/chars/3remuinho/ride/remcar04.gif
	frame	data/chars/3remuinho/ride/remcar03.gif #6
	frame	data/chars/3remuinho/ride/remcar04.gif
	frame	data/chars/3remuinho/ride/remcar03.gif
	frame	data/chars/3remuinho/ride/remcar04.gif
	@cmd	looper 6 10
	frame	data/chars/3remuinho/ride/remcar03.gif
	move	-6
	frame	data/chars/3remuinho/ride/remcar04.gif #11
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar03.gif
	@cmd	spawn01 "explosion3" 30 50 3
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar04.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar03.gif
	frame	data/chars/3remuinho/ride/empty.gif
	@cmd	spawn01 "explosion3" 30 50 3
	frame	data/chars/3remuinho/ride/remcar04.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar03.gif
	frame	data/chars/3remuinho/ride/empty.gif
	@cmd	looper 11 7
	frame	data/chars/3remuinho/ride/remcar04.gif
	@cmd	killgun 2 0
	frame	data/chars/3remuinho/ride/empty.gif #24
	@cmd	killgun 3 0
	frame	data/chars/3remuinho/ride/remcar03.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar04.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar03.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/empty.gif
		
anim	fall
	loop	0
	delay	5
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	freespecial1
@script
	void self = getlocalvar("self");
	void plyr = getentityproperty(self, "playerindex");
	float Vx = getlocalvar("x"+self);
	float Vz = getlocalvar("z"+self);

	if(frame >= 1 )
	{
	  if( playerkeys(plyr, 0, "moveup"))
	  {
	  changeentityproperty(self, "velocity", Vx, -0.5);
	  }
	  if( playerkeys(plyr, 0, "movedown"))
	  {
	  changeentityproperty(self, "velocity", Vx, 0.5);
	  }
	  if( playerkeys(plyr, 0, "moveleft"))
	  {
	  changeentityproperty(self, "velocity", -2, Vz);
	  }
	  if( playerkeys(plyr, 0, "moveright"))
	  {
	  changeentityproperty(self, "velocity", 2, Vz);
	  }
	}
	@end_script	
	loop	0
	delay	1
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/empty.gif
	@cmd	spawnbind "dust4" -75 10 10
	frame	data/chars/3remuinho/ride/remcar01.gif
	sound	data/sounds/car1.wav
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	sound	data/sounds/bike5.wav
	frame	data/chars/3remuinho/ride/empty.gif
	move	8
	attack	130 60 180 70 15 1 1 0 10 10
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	move	14
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	move	6
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	attack	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	@cmd	stop
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	freespecial15
	loop	0
	delay	5
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar02.gif
	@cmd	spawnAni3 "freewaytot" 250 1 140 "ANI_FOLLOW5"
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	freespecial2
@script
	void self = getlocalvar("self");
	void plyr = getentityproperty(self, "playerindex");
	float Vx = getlocalvar("x"+self);
	float Vz = getlocalvar("z"+self);

	if(frame >= 1 )
	{
	  if( playerkeys(plyr, 0, "moveup"))
	  {
	  changeentityproperty(self, "velocity", Vx, -0.5);
	  }
	  if( playerkeys(plyr, 0, "movedown"))
	  {
	  changeentityproperty(self, "velocity", Vx, 0.5);
	  }
	  if( playerkeys(plyr, 0, "moveleft"))
	  {
	  changeentityproperty(self, "velocity", -2, Vz);
	  }
	  if( playerkeys(plyr, 0, "moveright"))
	  {
	  changeentityproperty(self, "velocity", 2, Vz);
	  }
	}
	@end_script	
	loop	0
	delay	1
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar02.gif
	@cmd	spawnbind2 "dust4" -75 10 10 -1
	frame	data/chars/3remuinho/ride/remcar01.gif
	sound	data/sounds/car1.wav
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	sound	data/sounds/bike5.wav
	frame	data/chars/3remuinho/ride/empty.gif
	move	-8
	attack	30 65 180 70 15 1 0 0 10 10
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	move	-14
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/empty.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	move	-6
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	attack	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	@cmd	stop
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	idle
	loop	1
	delay	5
	offset	165 135
	bbox	33 50 274 85
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	sound	data/sounds/bike5.wav
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	pain
	loop	0
	delay	5
	offset	165 135
	bbox	33 50 274 85
	move	6
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	pain2
	loop	0
	delay	5
	offset	165 135
	bbox	33 50 274 85
	move	-6
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	respawn
	loop	0
	delay	5
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar02.gif
	@cmd	spawnGun5 "remboat2" -85 60 1 1 "ANI_FOLLOW9"
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	rise
	loop	0
	delay	5
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
		
anim	spawn
	loop	0
	delay	5
	offset	165 135
	bbox	0 0 0 0
	frame	data/chars/3remuinho/ride/remcar02.gif
	@cmd	spawnGun5 "remboat2" -85 60 1 1 "ANI_FOLLOW9"
	frame	data/chars/3remuinho/ride/remcar01.gif
	frame	data/chars/3remuinho/ride/remcar02.gif
	frame	data/chars/3remuinho/ride/remcar01.gif
		
#|edited by openBor Stats v 0.53

This similar entity correctly uses the respawn animation when dies:

https://pastebin.com/mjys5BmD

Anyone know what the difference is and why this happens?
 
Because that's exactly what it's supposed to do. If available, Respawn replaces Spawn when an entity is brought back into play after a death or an NPC is warping to its parent.

DC
 
Damon Caskey said:
Because that's exactly what it's supposed to do. If available, Respawn replaces Spawn when an entity is brought back into play after a death or an NPC is warping to its parent.

DC

Sorry, there is a typo in my message. The first entity always uses spawn instead of respawn. The second one uses respawn correctly. I have edited.
In the title of the post is correctly written  xD
 
magggas said:
Toranks said:
.. The first entity always uses spawn instead of respawn.

But how can you tell? From what i see in your first post, your spawn and respawn animations are looking the exact same.

Because this part of the code doesn't work with ANI_RESPAWN, only if I change it for ANI_SPAWN, that's how i found this problem:

Code:
   if(anim == openborconstant("ANI_RESPAWN"))
	{
 	changeentityproperty(self, "health", 200);
	}
}

This code works perfect on the second entity, which has the same properties in almost everything, I think
 
This problem is also present in this entity. (never uses respawn)
https://pastebin.com/5vepuKz4

But not in this one, wich is very similar
https://pastebin.com/9YaPFTh8

All these entities I mentioned in the thread are weapons of the main entity (player), and are invoked with a "setweap" when some specific stages begins.
 
Toranks said:
Because this part of the code doesn't work with ANI_RESPAWN, only if I change it for ANI_SPAWN, that's how i found this problem:

Code:
   if(anim == openborconstant("ANI_RESPAWN"))
	{
 	changeentityproperty(self, "health", 200);
	}
}

This code works perfect on the second entity, which has the same properties in almost everything, I think

This doe not say anything because it is just a part of a script. Maybe there is another part of the script that is just not setted up right. And in meantime, all other entities you are showing are still using the exact anim clones as spawn/respawn. So please do your self a favor and try to set different spawn and different respawn anims. So only this way you will be able to say for certain that your entities are not using the respawn.

By the way, i just made a boomerang entity which needs both spawn/respawn in order to work properly. So i can say that respawn is 100% working on the latest OpenBOR like before.
 
magggas said:
Toranks said:
Because this part of the code doesn't work with ANI_RESPAWN, only if I change it for ANI_SPAWN, that's how i found this problem:

Code:
   if(anim == openborconstant("ANI_RESPAWN"))
	{
 	changeentityproperty(self, "health", 200);
	}
}

This code works perfect on the second entity, which has the same properties in almost everything, I think

This doe not say anything because it is just a part of a script. Maybe there is another part of the script that is just not setted up right. And in meantime, all other entities you are showing are still using the exact anim clones as spawn/respawn. So please do your self a favor and try to set different spawn and different respawn anims. So only this way you will be able to say for certain that your entities are not using the respawn.

That code is part of the code that appears in the header of almost all the characters whose codes I have copied here and in pastebin.
I know 100% for sure that they are using spawn instead of respawn because this code always works, and I just have to swap ANI_RESPAWN and ANI_SPAWN to know which one is using each time life is set to 200.
You can look on the code of these characters to know what can I be doing wrong
Robcar and Jonyrod2 = Spawn at start and respawn at death
Robcar:
https://pastebin.com/mjys5BmD
Jonyrod2:
https://pastebin.com/9YaPFTh8
Remcar and mblimo2 = Always uses spawn, never respawn
Remcar:
https://pastebin.com/XqY5wrdR
mblimo2:
https://pastebin.com/5vepuKz4
And I don't know why...
 
Ah okay i see, so this script could not affect that. The problem here is that we still can't say anything for sure about what's going on and if it's normal or not if we don't know how are the etities spawned or on what situations you expecting the respawn? I feel like you should explain the whole thing better and also what entities are these? I see type None, so they are not npc but just weapon models? Please you need to explain in more detail.
 
magggas said:
Ah okay i see, so this script could not affect that. The problem here is that we still can't say anything for sure about what's going on and if it's normal or not if we don't know how are the etities spawned or on what situations you expecting the respawn? I feel like you should explain the whole thing better and also what entities are these? I see type None, so they are not npc but just weapon models? Please you need to explain in more detail.

I started to look at the original entities (player) to explain it to you and I realized that the ones that failed had no respawn animation! I made a copy of spawn animation, renamed it to respawn, and now the weapons work properly. Do you know why this happens? Do the weapons (none entity) depend in any way on the original player entity?
All player entities have "weaploss 3". That is, they keep the weapon when they die, so they respawn with the last weapon acquired
 
Okay, this is exactly why asked about weapon models.

"Do the weapons (none entity) depend in any way on the original player entity?"

Normaly yes but this also depends from your weapons settings. See modelflag command, and i think the "weaploss  3" setup does affecting that too. So i think in this case this is a normal behavior.
 
Back
Top Bottom