Q4 Modding - Looking for the console commands.

Locked
jester!
Posts: 969
Joined: Mon Oct 31, 2005 1:55 am

Q4 Modding - Looking for the console commands.

Post by jester! »

Hey, I am completely new to modding Quake games and am looking for the console commands. Specifically the r_singlelight command and what makes it cheat protected...

Anyone know where it is?
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

In the engine, where you can't directly access it. You might have luck with this snippet:

Code: Select all

cvarSystem->SetCVarBool( "r_singleLight", true );
However, you can't change the cvar's flags so it will always be marked as a cheat.
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

Well, it seems you can update cvars with a bit of trickery. Here you go:

Code: Select all

// Update cvar. Returns true on success, false otherwise.
bool UpdateCVar( const char* name, idCVar& value ) {
    if ( !name ) {
        return false;
    }

    idCVar* cvar = cvarSystem->Find( name );
    if ( !cvar ) {
        return false;
    }

    *cvar = value;
    return true;
}
Call it like this to unmark r_singleLight as a cheat:

Code: Select all

idCVar r_singleLight( "r_singleLight", "0", CVAR_BOOL, "Toggle single lights" );
if ( ReplaceCVar( "r_singleLight", r_singleLight ) ) {
  // all ok
} else {
  // cvar not found
}
jester!
Posts: 969
Joined: Mon Oct 31, 2005 1:55 am

Post by jester! »

Cool, thanks. :icon32:
Locked