[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - Weapon slots

Weapon slots

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Weapon slots

Postby sniperz227 » Mon Sep 12, 2011 2:46 am

sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Re: Weapon slots

Postby gnounc » Mon Sep 12, 2011 3:52 am

Your floats need to be .floats
and their scope needs to be global, so not inside a function.
my
gnounc's
User avatar
gnounc
 
Posts: 424
Joined: Mon Apr 06, 2009 6:26 am

Re: Weapon slots

Postby Nahuel » Mon Sep 12, 2011 8:09 pm

.float Wep_Primary;
.float Wep_Secondary;
/*
===============
Player weapons
===============
*/
Void () Weapon_Type =
{


if (self.classname = "player")
{
self.Wep_Primary == IT_M40A3 | IT_ACR ;
bprint (" Primary Weapon"); // print when you have one of the primary weapons.
bprint ("/n");
self.Wep_Secondary == IT_HKM23;
bprint ("Secondary Weapon"); // print when you have a secondary weapon.
bprint ("/n");
}
}

/*
============
Weapon Slots
============
*/
void () Wep_Slots =
{
self.weapon = self.Wep_Primary + 2 && self.Wep_Secondary + 1; // can only carry 2 primary and 1 secondary weapons
};
hi, I am nahuel, I love quake and qc.
User avatar
Nahuel
 
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Re: Weapon slots

Postby Electro » Mon Sep 12, 2011 11:00 pm

Benjamin Darling


Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Re: Weapon slots

Postby sniperz227 » Tue Sep 13, 2011 1:17 am

sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Re: Weapon slots

Postby Electro » Tue Sep 13, 2011 1:37 am

Benjamin Darling


Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Re: Weapon slots

Postby sniperz227 » Wed Sep 14, 2011 9:40 pm

umm yee sorta like that except i want it so that the player can only hold 2 primary weapons(i know i've only put 2 in but im putting more after) and only 1 secondary
sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Re: Weapon slots

Postby Electro » Wed Sep 14, 2011 10:19 pm

I recommend for the sake of the HUD (and heaps of other stuff in qc) that you use the existing items field.

Then how you select them as primary/secondary is entirely up to you. It's not like having them also stored in items is going to stop you having them as primary/secondary weapons, those are merely how you think of them.
Benjamin Darling


Reflex - In development competitive arena fps combining modern tech with the speed, precision and freedom of 90's shooters.
Electro
 
Posts: 312
Joined: Wed Dec 29, 2004 11:25 pm
Location: Brisbane, Australia

Re: Weapon slots

Postby sniperz227 » Thu Sep 15, 2011 7:44 pm

um yee but i want it so that say i had 4 primary weapons i can only use two of those
sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Re: Weapon slots

Postby ceriux » Thu Sep 15, 2011 7:58 pm

he wants a halo styled weapon system with an extra slot.
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapon slots

Postby sniperz227 » Thu Sep 15, 2011 8:05 pm

no like call of duty where you have 2 primary and 1 secondary and the only way to get another one is drop a primary n then you can pick another primary up
sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Re: Weapon slots

Postby ceriux » Fri Sep 16, 2011 3:25 am

User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapon slots

Postby Spike » Fri Sep 16, 2011 4:05 am

the easy way to do 1 secondary weapon is to say 'mneh, they're just all mutually exclusive' and clear out all secondary weapon bits upon secondary weapon pickup, just before setting the flag.

the lame way to do 2 primary weapons is to say 'mneh, they're nearly all mutually exclusive' and clear out all primary weapon bits except for the next numerically higher (rotated) weapon bit which you already have, but otherwise same idea as for secondary weapons. This will mean that if you have the sg+rl, and you grab the ng, it drops the sg. if you grabbed the lg, it drops the rl. well, it works without lots of extra fields at least. you could retain the next numerically lower instead if you wanted slightly more obvious grabbing. it'll be 0 or 1 bits cleared depending on how many you currently have, of course, hence why its easier to retain the first found and clear any others.

then you've still got the .weapon/.items fields for a working hud and stuff.
.
Spike
 
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: Weapon slots

Postby ceriux » Fri Sep 16, 2011 4:38 am

id just make 4 .floats (primary & secondary - primary_wep & secondary_wep) then in the pick up code if primary < 2 allow a pickup if not drop current weapon then pick up. pretty much the same for secondary except if its < 1. id assign primary_wep & secondary_wep to the weapons world entities, so the counter i made knew weather the weapon was a primary or secondary so it could add to the counter when the pickup was made. sorry if this makes no sense...
User avatar
ceriux
 
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapon slots

Postby sniperz227 » Sat Sep 17, 2011 5:04 pm

ye i get it i just don`t know how i would write don`t drop weapon in qc :P
sniperz227
 
Posts: 112
Joined: Sat Apr 09, 2011 3:19 am

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 3 guests