Spawn player without machinegun...

Locked
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Spawn player without machinegun...

Post 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!
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Spawn player without machinegun...

Post by ^misantropia^ »

's Easy as pie. You need to edit ClientSpawn() in game/g_client.c for that.
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: Spawn player without machinegun...

Post 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?
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Re: Spawn player without machinegun...

Post 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.
Herr W
Posts: 90
Joined: Tue May 16, 2006 8:53 am

Re: Spawn player without machinegun...

Post by Herr W »

Cool! :cool: Would have searched for that forever... Thanks a lot again!
[color=#FF0000]Visit MONKEYS of DOOM at [url]http://www.monkeysofdoom.org[/url][/color]
Perle
Posts: 65
Joined: Sat Mar 07, 2009 4:08 pm

Re: Spawn player without machinegun...

Post by Perle »

Okay. This post is "only" 12 Years old. Is there a way to "disable" the gauntlet?
[b][url]http://www.per-thormann.de/[/url][/b]
User avatar
LegendGuard
Posts: 121
Joined: Thu Jun 09, 2022 7:35 am

Re: Spawn player without machinegun...

Post 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
Last edited by LegendGuard on Thu Jul 07, 2022 7:01 pm, edited 1 time in total.
User avatar
CZghost
Posts: 1943
Joined: Wed Jun 22, 2011 1:45 pm
Location: Czechia
Contact:

Re: Spawn player without machinegun...

Post by CZghost »

Wouldn't mind a little tour through the Q3A source code. Would be super beneficial to creating the Infected mod.
[ Linktree | Twitch | YouTube | Instagram | Websites ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon
Locked