Reset last saved position.

Have questions about CoD4 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
Reality
CJ Newbie
CJ Newbie
Posts: 51
Joined: May 3rd, 2011, 9:57 pm

Reset last saved position.

Post by Reality » August 12th, 2011, 10:20 pm

I have this code to reset a player last position when (s)he lands on the trigger,

Code: Select all

stachel_Reset()
{
        ent_ResetLoad = getentarray("reset","targetname");
        if(isdefined(ent_ResetLoad))
        {
                for(lp=0;lp<ent_ResetLoad.size;lp++)
                ent_ResetLoad[lp] thread _ResetLoad();
        }
}
 
_ResetLoad()                    //As soon as player is touching trigger "reset" -> thread loadPos()
{
        self endon("disconnect");
        self endon("killed_player");
        self endon("joined_spectators");
        
        while(true)
        {
                self waittill("trigger",other);
                
                wait(0.10);
                other thread maps\mp\gametypes\_codjumper::loadPos();
                wait(0.10);
        }
}
Unfortunatley im unable to get this to work because i dont have the '_codjumper.gsc' in this line
other thread maps\mp\gametypes\_codjumper::loadPos(); and was just wondering if anyone knew the code to put inside the '_codjumper.gsc' file and could post it here to help me to get this to work, if not a different code? many thanks.

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Reset last saved position.

Post by Drofder2004 » August 13th, 2011, 2:18 am

The last released mod currently on server uses LoadPos, so there is no problem with your code.

The problem may be there "ground" checking (you cannot load in the air).
You could however try:

Code: Select all

self setPlayerAngles(self.cj["save"]["ang1"]);
self setOrigin(self.cj["save"]["org1"]);
I would suggest doing a "if( isDefined() )" on both variables however, jsut incase the player has not saved.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

User avatar
Paragon
CJ Wannabe
CJ Wannabe
Posts: 28
Joined: May 9th, 2011, 8:35 am

Re: Reset last saved position.

Post by Paragon » August 13th, 2011, 7:33 am

_codjumper.gsc :

Code: Select all

loadPos()
{
	self suicide();
}

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Reset last saved position.

Post by Drofder2004 » August 13th, 2011, 11:16 am

Paragon wrote:_codjumper.gsc :

Code: Select all

loadPos()
{
	self suicide();
}
what?
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest