[ioquake3] g_client.c weapon init question

Robert Hamilton rob at ccrma.Stanford.EDU
Thu May 29 09:42:17 PDT 2008


Thanks for all the help.

client->ps.stats[STAT_WEAPONS] = (1 << WP_PLASMAGUN) | (1 << WP_BFG);

did the trick. 

that plus a quick client->ps.weapon = 8; to hard code the Plasma Gun at Spawn
(and not select the "highest" weapon num at spawn) works perfectly.

rob



> -----------------------------
> It's an enum, in bg_public.h (about halfway down
>
http://svn.icculus.org/quake3/trunk/code/game/bg_public.h?revision=726&view=markup)
>
> so client->ps.stats[STAT_WEAPONS] = (1 << WP_PLASMAGUN) | (1 << WP_BFG); is
> right
>WP_PLASMAGUN is 8 and WP_BFG is 9, by the way.
>
> ------------------------------
> 
> Date: Thu, 29 May 2008 00:45:19 -0700
> From: "Robert Hamilton" <rob at ccrma.Stanford.EDU>
> Subject: [ioquake3] g_client.c weapon init question
> To: ioquake3 at lists.ioquake.org
> Message-ID: <20080529073529.M88931 at ccrma.Stanford.EDU>
> Content-Type: text/plain;	charset=iso-8859-1
> 
> Hi all,
> 
> I'm sure this topic has been covered before but I'm new to this list 
> and haven't had much luck looking online.
> 
> I'm trying to restrict the weapons my q3osc users can select, while 
> at the same time giving them the Plasma Gun and the BFG at spawning.
> 
> So far, I've tweaked the ClientSpawn method in g_client.c to get rid 
> of the Gauntlet and the Chaingun:
> 
> g_client.c
> ...
>   void ClientSpawn(gentity_t *ent) {
>   ...
>   ...
> 	client->ps.stats[STAT_WEAPONS] = ( 1 << WP_PLASMAGUN );
> 	client->ps.ammo[WP_PLASMAGUN] = -1;
> 	client->ps.ammo[WP_BFG] = -1;
> 
> This gives the users the PlasmaGun at spawn, with unlimited ammo 
> (ps.ammo = -1  ?)
> 
> How can I also give them the BFG at spawn? I'm not exactly sure what 
> this syntax is saying yet.
> 
> Also is there a better way of doing this? I've got a bunch of users 
> who like to tweak the game more than I want them to, so I'm also 
> locking out the "give" command in g_cmds.c, which works but also is 
> a bit extreme. I'm just trying to make sure they can only select 
> certain weapons.
> 
> Thanks in advance for any suggestions,
> 
> best,
> 
> Rob
> 
> ___________________________________________________________ 
> Robert Hamilton 
> Center for Computer Research in Music and Acoustics (CCRMA) 
> Department of Music 
> Stanford University 
> rob at ccrma.stanford.edu 
> http://ccrma.stanford.edu/~rob 
> http://cm-wiki.stanford.edu/wiki/Q3osc
> 
> ------------------------------
> 
> _______________________________________________
> ioquake3 mailing list
> ioquake3 at lists.ioquake.org
> http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
> 
> End of ioquake3 Digest, Vol 1, Issue 31
> ***************************************


___________________________________________________________ 

Robert Hamilton 
Center for Computer Research in Music and Acoustics (CCRMA) 
Department of Music 
Stanford University 

rob at ccrma.stanford.edu 

http://ccrma.stanford.edu/~rob 

c: (650) 704-6650



More information about the ioquake3 mailing list