Quake3World.com Forums
     Programming Discussion
        Spawn player without machinegun...


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Spawn player without machinegun...

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 10-02-2009 12:44 AM           Profile Send private message  E-mail  Edit post Reply with quote


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!



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 10-02-2009 04:13 AM           Profile Send private message  E-mail  Edit post Reply with quote


's Easy as pie. You need to edit ClientSpawn() in game/g_client.c for that.




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 10-05-2009 12:41 AM           Profile Send private message  E-mail  Edit post Reply with quote


Thanks a lot!

I set the amount of ammo given to the player to 0...
Code:
   
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:
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?



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 10-05-2009 08:50 AM           Profile Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

Warrior
Warrior
Joined: 16 May 2006
Posts: 90
PostPosted: 10-05-2009 11:43 PM           Profile Send private message  E-mail  Edit post Reply with quote


Cool! :cool: Would have searched for that forever... Thanks a lot again!



_________________
Visit MONKEYS of DOOM at http://www.monkeysofdoom.org


Top
                 

Grunt
Grunt
Joined: 07 Mar 2009
Posts: 65
PostPosted: 03-20-2022 01:35 PM           Profile Send private message  E-mail  Edit post Reply with quote


Okay. This post is "only" 12 Years old. Is there a way to "disable" the gauntlet?



_________________
http://www.per-thormann.de/


Top
                 

Commander
Commander
Joined: 08 Jun 2022
Posts: 100
PostPosted: 06-09-2022 12:12 PM           Profile Send private message  E-mail  Edit post Reply with quote


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:
vmCvar_t   g_disableGauntlet;


After, inside static cvarTable_t gameCvarTable[] = { add this line under g_gametype one:
Code:
{ &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:
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:
extern vmCvar_t g_disableGauntlet;


- And finally in game/g_client.c, inside ClientSpawn() you will see these lines:
Code:
   client->ps.stats[STAT_WEAPONS] |= ( 1 << WP_GAUNTLET );
   client->ps.ammo[WP_GAUNTLET] = -1;


Then replace to this:
Code:
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 07-07-2022 11:01 AM, edited 1 time in total.

Top
                 

The hell good boy
The hell good boy
Joined: 22 Jun 2011
Posts: 1922
PostPosted: 06-09-2022 09:38 PM           Profile   Send private message  E-mail  Edit post Reply with quote


Wouldn't mind a little tour through the Q3A source code. Would be super beneficial to creating the Infected mod.



_________________
[ Websites | Facebook | Twitter | YouTube | Instagram ]
When you feel the worst, turn to the sun and all the shadows will fall behind you.” - John Lennon


Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.