I put ".float axecharge;" at line 221 in defs.qc
I included this inside the W_FireAxe function (The lightning bolt is used as a placeholder as I said earlier) :
Code: Select all
*/
void() Charge =
{
if (self.axecharge == 0)
sound (self, CHAN_WEAPON, "player/charge.wav", 1, ATTN_NORM);
if (self.axecharge >= 15)
{
self.axecharge = 15;
self.punchangle_x = -2;
}
else
{
self.axecharge = self.axecharge + 1;
sprint (self, "*");
}
self.attack_finished = time + 0.1;
};
void() W_FireAxe = //AKA W_FireLaser
{
local vector source;
local vector org;
if (self.axecharge > 3) //if the charge value is above 3, The laser will be shot (I copy/pasted W_FireLightning's code)
{
if (self.t_width < time)
{
sound (self, CHAN_WEAPON, "weapons/gauntl2.wav", 1, ATTN_NORM);
self.t_width = time + 0.6;
}
self.punchangle_x = -2;
org = self.origin + '0 0 16';
traceline (org, org + v_forward * self.axecharge * 10, TRUE, self); // I assume this is the lightning bolt's length, so I added in the charge value
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);
LightningDamage (self.origin, trace_endpos + v_forward*4, self, 40);
self.axecharge = 0;
sprint (self, "\n");
self.attack_finished = time + 0.7;
}
else // If the charge's value is below 3, the traditionnal axe stuff comes in
{
makevectors (self.v_angle);
source = self.origin + '0 0 16';
traceline (source, source + v_forward*64, FALSE, self);
if (trace_fraction == 1.0)
return;
org = trace_endpos - v_forward*4;
if (trace_ent.takedamage)
{
trace_ent.axhitme = 1;
SpawnBlood (org, '0 0 0', 20);
T_Damage (trace_ent, self, self, 20);
}
else
{ // hit wall
sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
}
self.axecharge = 0;
sprint (self, "\n");
self.attack_finished = time + 0.5;
}
};
Code: Select all
if (self.weapon == IT_AXE && self.axecharge > 0 && !self.button0)
{
player_axe1();
W_FireAxe();
So that means copy-pasting W_FireLightning wasn't the thing to do. What should I do then?
Oh and before I forgot once again, I'd like for the weapon viewmodel to tilt up & down whever I look up or down, similar to nQuake. How can I do this?