Forum

Ceriux's Nub Tutorials [QC basics custom weps]

Need help with a tutorial found on InsideQC.com? Post here.

Moderator: InsideQC Admins

Ceriux's Nub Tutorials [QC basics custom weps]

Postby ceriux » Sun Feb 28, 2010 6:31 am

Okay so you have your weapon modeled,skinned, and animated. ready to be put in game.

so for the first steps put your v_pistol.mdl in yourmod/progs folder.

then open up "weapons.qc" then scroll down for find this: void() W_SetCurrentAmmo once there look for this:

Code: Select all
else if (self.weapon == IT_SHOTGUN)
   {
      self.currentammo = self.ammo_shells;
      self.weaponmodel = "progs/v_shot.mdl";
      self.weaponframe = 0;
      self.items = self.items | IT_SHELLS;
   }


and change it so it looks like this:

Code: Select all
else if (self.weapon == IT_SHOTGUN) // if your weapon is the shotgun (pistol)
   {
      self.currentammo = self.ammo_shells; // the weapons uses shells
      self.weaponmodel = "progs/v_pistol.mdl";  // the model is this (v_pistol.mdl)
      self.weaponframe = 0; // starts at the beggining of the weapons animations (all .mdls in quake start at  0) so if you have 6 frames it actually counts as 0,1,2,3,4,5.
      self.items = self.items | IT_SHELLS;  // has shells
   }



then scroll down to here:

void() W_Attack

and find this:

Code: Select all
   else if (self.weapon == IT_SHOTGUN)
   {
      player_shot1 ();
      W_FireShotgun ();
      self.attack_finished = time + 0.5;
   }


we're going to make it fire a little fast so change

Code: Select all
self.attack_finished = time + 0.5;


to this

Code: Select all
self.attack_finished = time + 0.3;



next when your finished find.

void() W_FireShotgun

and change it from this:


Code: Select all
/*
================
W_FireShotgun
================
*/
void() W_FireShotgun =
{
   local vector dir;

   sound (self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM);   

   self.punchangle_x = -2;
   
   self.currentammo = self.ammo_shells = self.ammo_shells - 1;
   dir = aim (self, 100000);
   FireBullets (6, dir, '0.04 0.04 0');
};


to this:

Code: Select all
/*
================
W_FireShotgun
================
*/
void() W_FireShotgun =
{
   local vector dir;

   sound (self, CHAN_WEAPON, "weapons/guncock.wav", 1, ATTN_NORM);   

   self.punchangle_x = -2;
   
   self.currentammo = self.ammo_shells = self.ammo_shells - 1;
   dir = aim (self, 18000);
   FireBullets (1, dir, '0.059 0.059 0');
};


lets look at this:

Code: Select all
FireBullets (1, dir, '0.059 0.059 0');


FireBullets is the function

(1, dir, '0.059 0.059 0')
the one in this function is how many bullets are being fired from the gun. and this '0.059 0.059 0' is the x y z cordinantes which tell the code how accurate the weapon is, the larger the number the more inaccurate the smaller the number the more accurate it is.


next we'll go into client.qc and scroll down to the ClientObituary function and scroll down till you see.

Code: Select all
if (rnum == IT_SHOTGUN)


and change that chunk of code to match this:





Code: Select all

if (rnum == IT_SHOTGUN)
            {
               deathstring = " was shot down by";
               deathstring2 = "'s pistol\n";
            }



lastly we need to go to world.qc and scroll down till you see :

Code: Select all
precache_model ("progs/v_shot.mdl");


and change it to

Code: Select all
precache_model ("progs/v_pistol.mdl");


or leave it the same and scroll down to the end of that list and add it there.

there all finished. compile, hop in game and test out what you got. after that if you dont like it, using what you've learned (which hopefully you did learn something) go back and change some stuff around and see what you get.

src: tutmodp1.zip
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Biodude » Sun Feb 28, 2010 7:06 pm

I get whatcha sayin, I will try it out :)
User avatar
Biodude
 
Posts: 186
Joined: Wed Aug 27, 2008 7:17 pm

Postby ceriux » Sun Feb 28, 2010 7:07 pm

im going to try and get a basic reload tutorial up tonight after my girl leaves.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA


Return to Tutorial Help

Who is online

Users browsing this forum: No registered users and 1 guest