Page 1 of 1

Spawn player without machinegun...

Posted: Fri Oct 02, 2009 8:44 am
by Herr W
Hi everyone,

I would like to know if there is a (not to complicated :dork: ) way to spawn the player without machinegun, i.e. only with the gauntlet...

Thanks in advance!

Re: Spawn player without machinegun...

Posted: Fri Oct 02, 2009 12:13 pm
by ^misantropia^
's Easy as pie. You need to edit ClientSpawn() in game/g_client.c for that.

Re: Spawn player without machinegun...

Posted: Mon Oct 05, 2009 8:41 am
by Herr W
Thanks a lot!

I set the amount of ammo given to the player to 0...

Code: Select all

	
client->ps.stats[STAT_WEAPONS] = ( 1 << WP_MACHINEGUN );
	if ( g_gametype.integer == GT_TEAM ) {
		client->ps.ammo[WP_MACHINEGUN] = 0;//WW was 50
	} else {
		client->ps.ammo[WP_MACHINEGUN] = 0;//WW was 100
	}
... and made the gauntlet base weapon...

Code: Select all

client->ps.weapon = WP_GAUNTLET;//WW was WP_MACHINEGUN
... Works! :D

One thing I'm still not quite happy with is that the gauntlet doesn't appear in the "normal" weapon cycle. Can you tell me where to alter that?

Re: Spawn player without machinegun...

Posted: Mon Oct 05, 2009 4:50 pm
by ^misantropia^
I can and I will. It's client-side code in cgame/cg_weapons.c. More specifically, the CG_PrevWeapon_f() and CG_NextWeapon_f() functions.

Re: Spawn player without machinegun...

Posted: Tue Oct 06, 2009 7:43 am
by Herr W
Cool! :cool: Would have searched for that forever... Thanks a lot again!

Re: Spawn player without machinegun...

Posted: Sun Mar 20, 2022 9:35 pm
by Perle
Okay. This post is "only" 12 Years old. Is there a way to "disable" the gauntlet?

Re: Spawn player without machinegun...

Posted: Thu Jun 09, 2022 8:12 pm
by LegendGuard
Perle wrote:Okay. This post is "only" 12 Years old. Is there a way to "disable" the gauntlet?
The one way would be to create a cvar in the code.

- In game/g_main.c, add this where you can see the vmCvar_t list:

Code: Select all

vmCvar_t	g_disableGauntlet;
After, inside static cvarTable_t gameCvarTable[] = { add this line under g_gametype one:

Code: Select all

{ &g_disableGauntlet, "g_disableGauntlet", "0", CVAR_SERVERINFO | CVAR_USERINFO | CVAR_LATCH, 0, qfalse  },
And in G_RegisterCvars function, add this after g_gametype conditional if:

Code: Select all

if ( g_disableGauntlet.integer >= 1 )
{
	G_Printf( "Gauntlet weapon disabled, to enable: 'g_disableGauntlet 0' and restart \n" );
	va("print \"Gauntlet weapon disabled, to enable: 'g_disableGauntlet 0' and restart.\n\"");
	trap_Cvar_Set( "g_disableGauntlet", "1" );
	trap_Cvar_Update( &g_disableGauntlet );
}

- In game/g_local.h, add this in extern vmCvar_t list:

Code: Select all

extern vmCvar_t g_disableGauntlet;
- And finally in game/g_client.c, inside ClientSpawn() you will see these lines:

Code: Select all

	client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GAUNTLET );
	client->ps.ammo[WP_GAUNTLET] = -1;
Then replace to this:

Code: Select all

if( g_disableGauntlet.integer <= 0 )
{
	client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GAUNTLET );
	client->ps.ammo[WP_GAUNTLET] = -1;
}

Finally, compile the code, copy the compiled qvm, run the game, in console write and execute the cvar: \g_disableGauntlet 1
restart and enjoy without the gauntlet! :cool:



Image

Re: Spawn player without machinegun...

Posted: Fri Jun 10, 2022 5:38 am
by CZghost
Wouldn't mind a little tour through the Q3A source code. Would be super beneficial to creating the Infected mod.