• Register

BIOQUAKE is a quake mod that brings bioshock to the linux pc and the gcw zero.

Report RSS L fire secondary weapon

L fire secondary weapon r fire primary weapon, k_down cycle through lweapons

Posted by on - Basic Client Side Coding

Lets make the L button fire Lweapons.
below W_attack void add this-
void() Lfire=
{
local float r;

if (!W_CheckNoAmmo ())
return;

makevectors (self.v_angle); // calculate forward angle for velocity
self.show_hostile = time + 1; // wake monsters up

if (self.weapon != IT_LWEAPON1 && self.weapon != IT_LWEAPON2 && self.weapon != IT_LWEAPON3) { self.weapon = IT_LWEAPON1; }
else if (self.weapon == IT_LWEAPON1)
{
//Lweapon1 code
}
else if (self.weapon == IT_LWEAPON2)
{
//Lweapon2 code
}
else if (self.weapon == IT_LWEAPON3)
{
//Lweapon3 code
}
};

Then before cycleweaponcommand add-
void() Lcycle = {
local float it, am;

it = self.items;
self.impulse = 0;
while (1)
{
am = 0;

if (self.weapon != IT_LWEAPON1 && self.weapon != IT_LWEAPON2 && self.weapon != IT_LWEAPON3) { self.weapon = IT_LWEAPON1; }
else if (self.weapon == IT_LWEAPON1) { self.weapon = IT_LWEAPON2; }
else if (self.weapon == IT_LWEAPON2) { self.weapon = IT_LWEAPON3; }
else if (self.weapon == IT_LWEAPON3) { self.weapon = IT_LWEAPON1; }
}
};

To get r to switch back before fireing goto W_attack there after-
void() W_Attack =
{
local float r;

if (!W_CheckNoAmmo ())
return;

makevectors (self.v_angle); // calculate forward angle for velocity
self.show_hostile = time + 1; // wake monsters up

add the check code-
if (self.weapon == IT_LWEAPON1 || self.weapon == IT_LWEAPON2 || self.weapon == IT_LWEAPON3) { self.weapon = IT_AXE; }

go down to the impulse command and add-
if (self.impulse == 29)
Lfire ();
if (self.impulse == 30)
Lcycle();

then in the config file in id1 add-
bind LEFT_SHIFT "impulse 29"
bind K_DOWN "impulse 30"

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: