Forum

Primary/secondary weapon slots system

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Primary/secondary weapon slots system

Postby DusterdooSmock » Thu May 26, 2011 5:17 am

How would I go about creating a weapon slot system like in most modern fps games, where the player can only hold two weapons, and when he goes to pick up a new weapon, if he only has one, it just adds the new one to his inventory, and if he already has two weapons, then it swaps his current weapon and the ground weapon?
DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm

Postby Jukki » Thu May 26, 2011 11:14 am

(on iphone)

i did this by adding new .float weapon2

in weaponswitch functioni have made similiar to this:
local float priweapon;
priweapon = self.weapon;
self.weapon = self.weapon2;
self.weapon = priweapon;

when you pick up weapon you have if statement:
if (self.weapon2)
{
self.weapon = pickupweapon;
}
else
{
self.weapon2 = self.weapon;
self.weapon = pickupweapon;
}


Thqts how in theory it works. Easy and small. But 100 % working and there is no 3 weapon glitches possible.
Jukki
 
Posts: 214
Joined: Wed Apr 07, 2010 4:59 am

Postby DusterdooSmock » Thu May 26, 2011 1:13 pm

Nice. Thank you. :D
DusterdooSmock
 
Posts: 170
Joined: Thu Aug 19, 2010 9:58 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest