Player spawn location problem

Die_In_Fire

Well-known member
In some stages. when player loses a life, it respawns inside walls or over the walls...
how can I prevent this?
 
Die_In_Fire said:
it doesn't work for me...

Mmm.. I tested the script and works.
delete this code
Code:
	@script
		void self = getlocalvar("self");
		int p = getentityproperty(self, "playerindex");
		int animpos = getentityproperty(self, "animpos");

		if ( animpos == 1 ) {
        		float x = getentityproperty(self, "x");
        		float z = getentityproperty(self, "z");
        		float a = getentityproperty(self, "a");

            		setglobalvar("p"+(p+1)+"respawn_x", x);
            		setglobalvar("p"+(p+1)+"respawn_z", z);
            		setglobalvar("p"+(p+1)+"respawn_a", a);
			setglobalvar("last_player_spawned", self);
		}
	@end_script

no longer need to write that code anymore.
if u take an error, can u post Whole log file?
 
White Dragon said:
no longer need to write that code anymore.
if u take an error, can u post Whole log file?
I deleted it, but the crash continue, always after I select a game mode aka loading a stage. this is the log:
Code:
Script function 'openborvariant' returned an exception, check the manual for details.
 parameters: 18,  
 
********** An Error Occurred **********
*            Shutting Down            *

There's an exception while executing script 'updateentityscript' data/chars/billy/bimmy.txtTotal Ram: 1063370752 Bytes
 Free Ram: 286322688 Bytes
 Used Ram: 13385728 Bytes

Release level data...........	Done!
Release graphics data........	Done!
Release game data............

Unload 'Flash' ............done.
Unload 'blockflash' ............done.
Unload 'Bimmy' ............done.
Unload 'Jimmy' ............done.
Unload 'Chin' ............done.
Unload 'Ranzou' ............done.
Unload 'Chin2' ............done.
Unload 'Flare' ............done.
Unload 'Star1' ............done.
Unload 'Knife2' ............done.
Unload 'Shot' ............done.

Release game data............	Done!
Release timer................	Done!
Release input hardware.......	Done!
Release sound system.........	Done!
Release FileCaching System...	Done!

**************** Done *****************

There's an exception while executing script 'updateentityscript' data/chars/billy/bimmy.txt

scriptlog:
Code:
####animationscript function main#####
# data/chars/billy/bimmy.txt
########################################
void main()
{
    int frame = getlocalvar("frame");
    int animhandle = getlocalvar("animhandle");
    if(animhandle==6)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==7)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==8)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==9)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==16)
    {
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW3"), openborconstant("ANI_PAIN2"));
        }
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW4"), openborconstant("ANI_FOLLOW2"));
        }
        return;
    }
    if(animhandle==23)
    {
        if(frame==0)
        {
            stop();
        }
        if(frame==0)
        {
            floater(10);
        }
        if(frame==1)
        {
            dasher(5, -3, 0);
        }
        return;
    }
    if(animhandle==38)
    {
        if(frame==0)
        {
            lock();
        }
        if(frame==0)
        {
            position(2, -10, 5, -1, 1);
        }
        if(frame==2)
        {
            position(2, 20, 20, -1, 1);
        }
        if(frame==4)
        {
            throw(26, 2, 2, 0, 0);
        }
        if(frame==4)
        {
            clearSlam();
        }
        return;
    }
    if(animhandle==39)
    {
        if(frame==0)
        {
            lock();
        }
        if(frame==0)
        {
            position(2, 7, 0, -1, -1);
        }
        if(frame==1)
        {
            position(2, 6, 8, -1, -1);
        }
        if(frame==2)
        {
            position(2, 7, 8, -1, -1);
        }
        if(frame==3)
        {
            position(2, 7, 8, -1, -1);
        }
        if(frame==4)
        {
            position(2, 8, 8, -1, -1);
        }
        if(frame==5)
        {
            throw(35, -2.5, 2.5, 0, 0);
        }
        return;
    }
    if(animhandle==45)
    {
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW5"), openborconstant("ANI_PAIN2"));
        }
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW4"), openborconstant("ANI_FOLLOW2"));
        }
        return;
    }
    if(animhandle==47)
    {
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW5"), openborconstant("ANI_PAIN2"));
        }
        return;
    }

}

####animationscript function main#####
# data/chars/billy/jimmy.txt
########################################
void main()
{
    int frame = getlocalvar("frame");
    int animhandle = getlocalvar("animhandle");
    if(animhandle==58)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==59)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==60)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==61)
    {
        if(frame==0)
        {
            clearL();
        }
        return;
    }
    if(animhandle==68)
    {
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW3"), openborconstant("ANI_PAIN2"));
        }
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW4"), openborconstant("ANI_FOLLOW2"));
        }
        return;
    }
    if(animhandle==75)
    {
        if(frame==0)
        {
            stop();
        }
        if(frame==0)
        {
            floater(10);
        }
        if(frame==1)
        {
            dasher(5, -3, 0);
        }
        return;
    }
    if(animhandle==90)
    {
        if(frame==0)
        {
            lock();
        }
        if(frame==0)
        {
            position(0, -10, 5, -1, 1);
        }
        if(frame==2)
        {
            position(2, 20, 20, -1, 1);
        }
        if(frame==4)
        {
            throw(26, 2, 2, 0, 0);
        }
        if(frame==4)
        {
            clearSlam();
        }
        return;
    }
    if(animhandle==91)
    {
        if(frame==0)
        {
            lock();
        }
        if(frame==0)
        {
            position(2, 7, 0, -1, -1);
        }
        if(frame==1)
        {
            position(4, 6, 8, -1, -1);
        }
        if(frame==2)
        {
            position(2, 7, 8, -1, -1);
        }
        if(frame==3)
        {
            position(2, 7, 8, -1, -1);
        }
        if(frame==4)
        {
            position(2, 8, 8, -1, -1);
        }
        if(frame==5)
        {
            throw(35, -2.5, 2.5, 0, 0);
        }
        return;
    }
    if(animhandle==97)
    {
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW5"), openborconstant("ANI_PAIN2"));
        }
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW4"), openborconstant("ANI_FOLLOW2"));
        }
        return;
    }
    if(animhandle==99)
    {
        if(frame==0)
        {
            ani0020(openborconstant("ANI_FOLLOW5"), openborconstant("ANI_PAIN2"));
        }
        return;
    }

}
 
Mmm...
I tested spawn.c again and it works!!
My openBOR ver is OpenBOR v3.0 Build 3949.
Yours?
Oh then try to disable temporary your animation script.
In this way my script works?
 
It crashes while loading the stage.

I'm at work, so when I go home I will see which openbor build I have. It could maybe a problem that I'm using an older build. That said, I will download 3949 if I'm not already using it  :)
However, your previous script was working fine 

EDIT: Just tried build 3949, but same error, same log. it crashes after I select a game mode, before the select screen
 
in that case u need to add script.
for example, during a Death get the floating Platform entity (if u stay on a Platform)
Then when u respawn get Platform coords and change position on it ^__^
 
BWWd, you could create a custom respawn animation on which the character floats in the air for a limited time or until player press some button. Many old platformers do it that way.
 
You can check if player exists first,

Code:
void p1 = getplayerproperty(0, "entity");
void p2 = getplayerproperty(1, "entity");

if(getentityproperty(p1, "exists")) {

 
}
 
You could check the other player's position and spawn on that position +10 pixels for example.  Not sure about WD's script thou.

Did you try bWWd's script method in respawn anim?

Code:
	@script
    	void self = getlocalvar("self");
    	int x = getindexedvar(0); //Get respawn x coordinate
    	int z = getentityproperty(self,"z"); //Get character's z coordinate
    	int a = getindexedvar(1); //Get respawn a coordinate

    	if(x==NULL()){
      	x = getentityproperty(self, "x");

    	}

    	if(a!=NULL()){
      	if(frame == 0){
        changeentityproperty(self, "position", x, z, a+100);
      	 }
    	}
	@end_script
 
Back
Top Bottom