FAQ  •  Register  •  Login

Ceriux's Nub Tutorials [QC basics custom weps]

Moderator: Inside3D Admins

<<

ceriux

User avatar

Posts: 1852

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Sun Feb 28, 2010 6:31 am

Ceriux's Nub Tutorials [QC basics custom weps]

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:
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:
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:
   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:
self.attack_finished = time + 0.5;


to this

  Code:
self.attack_finished = time + 0.3;



next when your finished find.

void() W_FireShotgun

and change it from this:


  Code:
/*
================
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:
/*
================
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:
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:
if (rnum == IT_SHOTGUN)


and change that chunk of code to match this:





  Code:

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:
precache_model ("progs/v_shot.mdl");


and change it to

  Code:
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
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!
<<

Biodude

User avatar

Posts: 186

Joined: Wed Aug 27, 2008 7:17 pm

Post Sun Feb 28, 2010 7:06 pm

I get whatcha sayin, I will try it out :)
<<

ceriux

User avatar

Posts: 1852

Joined: Sat Sep 06, 2008 3:30 pm

Location: Florida, USA

Post Sun Feb 28, 2010 7:07 pm

im going to try and get a basic reload tutorial up tonight after my girl leaves.
QuakeDB - if you have any cool quake video's please feel free to upload them on my moddb group!

Return to Tutorial Help

Who is online

Users browsing this forum: No registered users and 0 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Icons provided by Aha Soft