Powerful Axe
Author: NightWolfSource: https://www.insideqc.com/qctut/qctut-27.shtml
Step 1
We are going to transform your shotgun into a damn powerful axe. First open up weapons.qc. Find void() W_FireAxe = copy the code right below it. It should look like this:
{
local vector source;
local vector org;
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);
}
};
Step 2
Paste this right after void() W_FireShotgun = so it sould look like this:
Ok, now open up defs.qc and add to the end:
void() W_FireShotgun =
{
local vector source;
local vector org;
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);
//Change the 20 into any number you want.
//The 20 indicates the damage it will do
}
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);
}
};
Step 3
Now search for self.weaponmodel = "progs/v_shot.mdl"; and make the changes in this color:
}
else if (self.weapon == IT_SHOTGUN)
{
self.currentammo = self.ammo_shells;
self.weaponmodel = "progs/v_axe.mdl";
self.weaponframe = 0;
self.items = self.items | IT_SHELLS;
}
Step 4
Compile and have fun. Tutorial done by NightWolf. Email: [email protected] This may be a bit confusing.. It is my first tut and im still trying to explain it better.
Tags: tutorial, quakec, qc, insideqc, weapon
Comments