Map restart

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

Moderator: Core Staff

Post Reply
darkpheonixz4x
CJ Newbie
CJ Newbie
Posts: 51
Joined: July 2nd, 2012, 11:15 am

Map restart

Post by darkpheonixz4x » March 2nd, 2013, 8:08 pm

Hey guys,

i was making a plugin for promod (as it had a .gsc file to add custom functions, like codjumper). I added a toggle fullbright script and it works great!

My problem is that this only works when the server does /fast_restart. It does not load up the function when i try /map_restart or when it actually rotates the map automatically.

Any suggestions/fixes?

Thanks,
darkpheonixz4x

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Map restart

Post by F |Madness| U » March 2nd, 2013, 8:22 pm

Sounds like you're calling the function too late in the script, which would explain why it works on fast_restart when the map stays the same. Can't really offer any more help without knowing where your script is and such.
-

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

Re: Map restart

Post by Drofder2004 » March 2nd, 2013, 11:32 pm

Start by posting the script, maybe?
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

darkpheonixz4x
CJ Newbie
CJ Newbie
Posts: 51
Joined: July 2nd, 2012, 11:15 am

Re: Map restart

Post by darkpheonixz4x » March 3rd, 2013, 5:11 am

This part is in the _rank.gsc. onJoinedTeam, onJoinedSpectators and onPlayerSpawned is threaded by onPlayerConnect().

Code: Select all

onJoinedTeam()
{
        self endon("disconnect");
 
        for(;;)
        while(1)
        {
            
                self waittill("joined_team");
                self thread removeRankHUD();
                self iPrintlnBold("^2Press your ^1FRAG ^2and ^1USE ^2key TOGETHER to toggle ^7fullbright");
        }
}
 
 
onJoinedSpectators()
{
        self endon("disconnect");
 
        for(;;)
        {
                self waittill("joined_spectators");
                self thread removeRankHUD();
        }
}
          
 
onPlayerSpawned()
{
        self endon("disconnect");
 
        for(;;)
        while(1)
        {
                self waittill("spawned_player");
                self thread fullbrighttoggle();
 
                if(!isdefined(self.hud_rankscroreupdate))
                {
                        self.hud_rankscroreupdate = newClientHudElem(self);
                        self.hud_rankscroreupdate.horzAlign = "center";
                        self.hud_rankscroreupdate.vertAlign = "middle";
                        self.hud_rankscroreupdate.alignX = "center";
                        self.hud_rankscroreupdate.alignY = "middle";
                        self.hud_rankscroreupdate.x = 0;
                        self.hud_rankscroreupdate.y = -60;
                        self.hud_rankscroreupdate.font = "default";
                        self.hud_rankscroreupdate.fontscale = 2.0;
                        self.hud_rankscroreupdate.archived = false;
                        self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
                        self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
                }
        }
}
and the fullbright toggle script:

Code: Select all

FullbrightToggle() 
{
        self endon( "disconnect" );
        
        fullbright = false;
        
        while( 1 ) {
                
                wait( 0.05 );
        
                 if( self usebuttonpressed() && self fragbuttonpressed() )
 {
                        
                        
                        if( fullbright )
                                fullbright = false;
                        else
                                fullbright = true;
                        
                        
                        setFullbright( fullbright );
                        
                        
                        while( self usebuttonpressed() && self fragbuttonpressed() )
                                wait( 0.05 );
                
                }       
        }
}
 
 
setFullbright( toggle ) {
 
        
        if( toggle )
                self setClientDvar( "r_fullbright", 1 );
 
        else
                self setClientDvar( "r_fullbright", 0 );
 
}

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

Re: Map restart

Post by Drofder2004 » March 3rd, 2013, 9:52 am

You said there was a gsc file to add your own commands, is that file 'rank' or is there another file?

There are no problems with the code from what I can see, and if there are no other files in the tree, then there is opssibly a load order in the core of promod that does this.

edit:

Noticed this in script, blank loop. (line 5 and line 32)

Code: Select all

 for(;;)
Not sure what it is doing there, but it certainly isn't helping.
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

darkpheonixz4x
CJ Newbie
CJ Newbie
Posts: 51
Joined: July 2nd, 2012, 11:15 am

Re: Map restart

Post by darkpheonixz4x » March 3rd, 2013, 11:16 am

Yes its the _rank.gsc

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

Re: Map restart

Post by Drofder2004 » March 3rd, 2013, 9:51 pm

did you try deleting the pointless "for loops".
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

darkpheonixz4x
CJ Newbie
CJ Newbie
Posts: 51
Joined: July 2nd, 2012, 11:15 am

Re: Map restart

Post by darkpheonixz4x » March 4th, 2013, 1:16 pm

Yep, here's the updated script.

Code: Select all

onJoinedTeam()
{
        self endon("disconnect");
 
       
        while(1)
        {
           
                self waittill("joined_team");
                self thread removeRankHUD();
                self iPrintlnBold("^2Press your ^1FRAG ^2and ^1USE ^2key TOGETHER to toggle ^7fullbright");
        }
}
 
 
onJoinedSpectators()
{
        self endon("disconnect");
 
        for(;;)
        {
                self waittill("joined_spectators");
                self thread removeRankHUD();
        }
}
         
 
onPlayerSpawned()
{
        self endon("disconnect");
 
       
        while(1)
        {
                self waittill("spawned_player");
                self thread fullbrighttoggle();
 
                if(!isdefined(self.hud_rankscroreupdate))
                {
                        self.hud_rankscroreupdate = newClientHudElem(self);
                        self.hud_rankscroreupdate.horzAlign = "center";
                        self.hud_rankscroreupdate.vertAlign = "middle";
                        self.hud_rankscroreupdate.alignX = "center";
                        self.hud_rankscroreupdate.alignY = "middle";
                        self.hud_rankscroreupdate.x = 0;
                        self.hud_rankscroreupdate.y = -60;
                        self.hud_rankscroreupdate.font = "default";
                        self.hud_rankscroreupdate.fontscale = 2.0;
                        self.hud_rankscroreupdate.archived = false;
                        self.hud_rankscroreupdate.color = (0.5,0.5,0.5);
                        self.hud_rankscroreupdate maps\mp\gametypes\_hud::fontPulseInit();
                }
        }
}
I'm thinking that the problem is because its the _rank.gsc. Do you think threading my function in another gsc like _globallogic would work?

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

Re: Map restart

Post by Drofder2004 » March 4th, 2013, 6:22 pm

If you have access to globallogic, then I see no reason not to use it. Globallogic already has the functions you are using, you can simply insert your extra functions in them.
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 13 guests