Inside3D tutorials.

Inside3D
 • Front Page
 • Articles
 • Downloads
 • Forums
 • Hosting
 • Help Wanted
 • Interviews
 • Reviews
 • Staff

 
Allied Sites
 - AI Cafe
 - Bot Epidemic
 - Dark Places
 - Flat Earth
 - FrikBot
 - Ghoulish Art
 - Kilbert3D
 - Quake Info Pool
 - QSG: Quake Standards
 - Rusted Fork
 - Stroggs Gone Mad
 - More...
 
Quake
 - Getting Started
 - QuakeC Specs v1.0
 - QuakeC Tutorials
 - Quake Mod Index
 
Quake II
 - Getting Started
 - dll Sourcecode
 - Coding Tutorials
 
.dll Central
 - Getting Started
 - Learning
 - dll Primer
 - dll in C
 - dll in Delphi
 - Compilers
 
Jedi Knight
 - Getting Started
 - COG Specs
 - Sound Specs
 - Tutorials
 
Level Editing
 - Tutorials/Tips
 
 
Telefragged!!!
Created By: Pob the Impaler (Paul Johnstone)
eMail: itac025@lauder.ac.uk
Difficulty Scale: Medium



Note:
YOU NEED TO DOWNLOAD THIS FILE FOR THE RIP TO WORK! DO NOT MAIL THE INSIDE3D STAFF OR THE AUTOR OF THE RIP IF YOU ARE HAVING TROUBLE WITH THIS TUTORIAL AND YOU DONT HAVE THE FILE!
Yipee the RIPs are back...

Legion (Roscoe Sincero) has buggered off to work on his ElimaReaper patch, so I'll be filling his shoes for a while.
He is still active in a consultancy capacity, so I can still draw on his wealth of knowledge for support.

So, my name is Pob the Impaler (Paul Johnstone), you can send me mail at:
A.W.Johnstone@btinternet.com (for home)
OR
itac025@lauder.ac.uk (for College)
I don't mind which address you use, so when I inevitably make a boo-boo you'll know how to send me
hate-mail :)
My site is at: http://www.btinternet.com/~impaler please help my hit-counter and visit!

Roscoe Sincero's address is legion@keg.zymurgy.org

//------------//
//-Credits--//
//-----------//

Steve Polge - For the Reaper bots
Alan Kivlin - For the clever scoreboard stuff
Lee Smith - For ProQCC
Roscoe Sincero - For starting it all off and for giving me a shot of his ElimaReaper!
Iikka Keranen - For the Plasma Gun model


|=========================================================|

ALWAYS MAKE A BACKUP OF YOUR CODE BEFORE TRYING ONE OF MY LESSONS. IF THERE IS A MISTAKE IN IT WHICH RUINS YOUR CODE OR BLOWS UP YOUR HOUSE, TOUGH SHIT, RESTORE THE BACKUP AND TELL ME WHERE I FUCKED UP.

Right 'ya buggers, today we are going to add a new weapon, to the bots. DooM's Plasma Rifle!

This requires two new models, two sounds, 1 sprite, 1 map and a LOT of hard work.

This is pretty complicated so you'll need to pay attention. :)
*******
A lot of the functions need changed so much, I've put the whole function in for you to cut & paste.
Each step will just deal with ONE function.
*******
First of all go into your reaper directory where your progs.dat goes.
Now make a directory called progs and copy plasma.mdl, v_plasma.mdl and s_plasma.spr into it.
Now make a directory in your reaper directory called sounds, now in sounds make another directory
called weapons. Into that directory copy Plasexpl.wav and plasma.wav.
No in your reaper directory make a directory called maps and copy the bsp file into there.

Ok, now go back to wherever your .qc files are...


Step 1

botfight.qc

(I hope you didn't skip the above stuff, or this ain't gonna work!)

Open up botfight.qc
Find the function W_BestBotWeapon  float () W_BestBotWeapon = {

Cut & Paste this code over the WHOLE function:

//===========Begin Code==========//
float () W_BestBotWeapon = {

   local float it;
   local float rng;
   local float wlevel;

   it = self.items;
   rng = botrange (self.enemy);
   if ( (rng != RANGE_MELEE) ) {

      if ( ((self.ammo_rockets >= TRUE) && (it & IT_ROCKET_LAUNCHER)) ) {

         return ( IT_ROCKET_LAUNCHER );

      }

   }
   if ( ((self.ammo_cells >= TRUE) && (it & IT_LIGHTNING)) ) {

      if ( ((rng == RANGE_MELEE) || (rng == RANGE_NEAR)) ) {

         wlevel = CheckWaterLevel ();
         if ( (wlevel < FL_SWIM) ) {

            return ( IT_LIGHTNING );

         }
         if ( (self.items & IT_INVULNERABILITY) ) {

            return ( IT_LIGHTNING );

         }

      }

   }
if ( ((self.ammo_cells >= 1) && (it & IT_PLASMA_GUN))){   // Notice this line!
return ( IT_PLASMA_GUN );
} 
   if ( ((self.ammo_nails >= FL_SWIM) && (it & IT_SUPER_NAILGUN)) ) {

      return ( IT_SUPER_NAILGUN );

   }
   if ( (rng == RANGE_NEAR) ) {

      if ( ((self.ammo_rockets >= TRUE) && (it & IT_GRENADE_LAUNCHER)) ) {

         if ( (self.enemy.origin_z < (self.origin_z + 175.000)) ) {

            return ( IT_GRENADE_LAUNCHER );

         }

      }

   }
   if ( ((rng == RANGE_NEAR) || (rng == RANGE_MELEE)) ) {

      if ( ((self.ammo_shells >= FL_SWIM) && (it & IT_SUPER_SHOTGUN)) ) {

         return ( IT_SUPER_SHOTGUN );

      }

   }
   if ( ((self.ammo_nails >= TRUE) && (it & IT_NAILGUN)) ) {

      return ( IT_NAILGUN );

   }
   if ( ((self.ammo_shells >= TRUE) && (it & IT_SHOTGUN)) ) {

      return ( IT_SHOTGUN );

   }
   return ( IT_AXE );

};
//=================End Code==========//


Step 2
Find the function W_BestHeldWeapon  float () W_BestHeldWeapon = {

Cut & Paste the following code over the WHOLE function.

//===========Begin Code==========//
float () W_BestHeldWeapon = {

   local float it;
   local float wlevel;

   it = self.items;
   if ( ((self.ammo_rockets >= TRUE) && (it & IT_ROCKET_LAUNCHER)) ) {

      return ( IT_ROCKET_LAUNCHER );

   }
   if ( ((self.ammo_cells >= TRUE) && (it & IT_LIGHTNING)) ) {

      wlevel = CheckWaterLevel ();
      if ( (wlevel < FL_SWIM) ) {

         return ( IT_LIGHTNING );

      }
      if ( (self.items & IT_INVULNERABILITY) ) {

         return ( IT_LIGHTNING );

      }

   }
 if ( ((self.ammo_cells >= 1) && (it & IT_PLASMA_GUN)) ) {

      return ( IT_PLASMA_GUN );

   }


  if ( ((self.ammo_nails >= FL_SWIM) && (it & IT_SUPER_NAILGUN)) ) {

      return ( IT_SUPER_NAILGUN );

   }
   if ( ((self.ammo_rockets >= TRUE) && (it & IT_GRENADE_LAUNCHER)) ) {

      if ( (self.enemy.origin_z < (self.origin_z + 175.000)) ) {

         return ( IT_GRENADE_LAUNCHER );

      }

   }
   if ( ((self.ammo_shells >= FL_SWIM) && (it & IT_SUPER_SHOTGUN)) ) {

      return ( IT_SUPER_SHOTGUN );

   }
   if ( ((self.ammo_nails >= TRUE) && (it & IT_NAILGUN)) ) {

      return ( IT_NAILGUN );

   }
   if ( ((self.ammo_shells >= TRUE) && (it & IT_SHOTGUN)) ) {

      return ( IT_SHOTGUN );

   }
   return ( IT_AXE );

};

//=================End Code==========//


Step 3

Find the lines of code which read:
void () bot_axe1;

void () bot_axeb1;

void () bot_axec1;

void () bot_axed1;

void () bot_shot1;

void () bot_nail1;

Under this add:
//===========Begin Code==========//
void () bot_plasma1; // plasma frames
//=================End Code==========//


Step 4

Find the function W_BotAttack()  void () W_BotAttack = {

Replace the whole function with this:

//===========Begin Code==========//
void () W_BotAttack = {

   local float r;
   local float addt;

   if ( !W_CheckNoAmmo () ) {

      return ;

   }
   if ( (time < self.attack_finished) ) {

      return ;

   }
   addt = FALSE;
   if ( (self.skil < MOVETYPE_WALK) ) {

      addt = (((MOVETYPE_WALK - self.skil) * random ()) * 0.350);

   }
   if ( (self.skil < TRUE) ) {

      addt = (addt + (random () * 0.300));

   }
   makevectors (self.v_angle);
   self.show_hostile = (time + TRUE);
   if ( (self.weapon == IT_AXE) ) {

      sound (self,CHAN_WEAPON,"weapons/ax1.html",TRUE,ATTN_NORM);
      r = random ();
      if ( (r < 0.250) ) {

         bot_axe1 ();

      } else {

         if ( (r < 0.500) ) {

            bot_axeb1 ();

         } else {

            if ( (r < 0.750) ) {

               bot_axec1 ();

            } else {

               bot_axed1 ();

            }

         }

      }
      self.attack_finished = ((time + 0.500) + addt);

   } else {

      if ( (self.weapon == IT_SHOTGUN) ) {

         bot_shot1 ();
         W_FireShotgun ();
         self.attack_finished = ((time + 0.500) + addt);

      } else {

         if ( (self.weapon == IT_SUPER_SHOTGUN) ) {

            bot_shot1 ();
            W_FireSuperShotgun ();
            self.attack_finished = ((time + 0.700) + addt);

         } else {

            if ( (self.weapon == IT_NAILGUN) ) {

               self.think = bot_nail1;

            } else {
if ( (self.weapon == IT_PLASMA_GUN)) {
self.think = bot_plasma1;      // FIRE plasma gun
plasma_firebolt();

self.attack_finished = ((time + 0.001) + addt); 
} else {

               if ( (self.weapon == IT_SUPER_NAILGUN) ) {

                  self.think = bot_nail1;

               } else {

                  if ( (self.weapon == IT_GRENADE_LAUNCHER) ) {

                     bot_rocket1 ();
                     W_FireGrenade ();
                     self.attack_finished = ((time + 0.600) + addt);

                  } else {

                     if ( (self.weapon == IT_ROCKET_LAUNCHER) ) {

                        bot_rocket1 ();
                        W_FireRocket ();
                        self.attack_finished = ((time + 0.800) + addt);

                     } else {

                        if ( (self.weapon == IT_LIGHTNING) ) {

                           self.think = bot_light1;
                           self.attack_finished = (time + 0.100);
                           sound (self,CHAN_AUTO,"weapons/lstart.html",TRUE,ATTN_NORM);

                        }

                     }

                  }

               }
} // added for plasma
            }

         }

      }

   }

};
//=================End Code=%3d%3d%3d%3d%3d%3d%3d%3d%3d/index.html


Step 5

Botit_th.qc

Open Botit_th.qc

Find the function supernailweight float (entity e) supernailweight = {

BENEATH this function add:

//===========Begin Code==========//
float (entity e) plasmaweight = {

   local float weight;

   weight = (WANT + TRUE);
   if ( !(self.items & IT_PLASMA_GUN) ) {

      weight = (MUST_HAVE - TRUE);

   }
   return ( weight );

};
//=================End Code==========//

Save and close botit_th.qc


Step 6

client.qc

Open client.qc
Find the function ClientObituary()  void (entity targ, entity attacker) ClientObituary = {

Find the lines:
 if ( (rnum == IT_SUPER_NAILGUN) ) {

               deathstring = " was punctured by ";
               deathstring2 = "\n";

            }

UNDER this add:

//===========Begin Code==========//

if ( (rnum == IT_PLASMA_GUN) ) {
deathstring = " sucks a load of ";
deathstring2 = "'s Plasma\n";

}

//=================End Code==========//

Save and close client.qc


Step 7

defs.qc

Open up Defs.qc

At the bottom of defs.qc add:

//===========Begin Code==========//
float IT_PLASMA_GUN    = 128.000;
//=================End Code==========//

save and close defs.qc


Step 8

dmbot.qc

Open dmbot.qc

Find the function bot_rebound6()  void () bot_rebound6 = [ 112.000, bot_chase ] {

Under this add:

//===========Begin Code==========//
void () bot_plasma1 = [ 103.000, bot_plasma2 ] {
   self.effects = (self.effects | EF_MUZZLEFLASH);
  
   ai_botnailcharge (BOTSPEED);
   BotPostThink ();

};


void () bot_plasma2 = [ 104.000, bot_run ] {
   self.effects = (self.effects | EF_MUZZLEFLASH);
   
   SuperDamageSound ();
plasma_firebolt();

   
   ai_botnailcharge (BOTSPEED);
   BotPostThink ();

};
//=================End Code==========//

save and close dmbot.qc


Step 9

items.qc

Open items.qc
Find the function RankForWeapon  float (float w) RankForWeapon = {

Copy & Paste the following code over the WHOLE function:

//===========Begin Code==========//
float (float w) RankForWeapon = {

   if ( (w == IT_LIGHTNING) ) {

      return ( TRUE );

   }
   if ( (w == IT_ROCKET_LAUNCHER) ) {

      return ( FL_SWIM );

   }
if ( (w == IT_PLASMA_GUN) ) {
return (3);

}
   if ( (w == IT_SUPER_NAILGUN) ) {

      return ( 4 );

   }
   if ( (w == IT_GRENADE_LAUNCHER) ) {

      return ( 5 );

   }
   if ( (w == IT_SUPER_SHOTGUN) ) {

      return ( 6 );

   }
   if ( (w == IT_NAILGUN) ) {

      return ( 7 );

   }
   return ( MOVETYPE_PUSH );

};
//=================End Code==========//


Step 10

Find the function weapon_touch()  void () weapon_touch = {

Replace the ENTIRE function with the following code:

//===========Begin Code==========//
void () weapon_touch = {

   local float hadammo;
   local float best;
   local float new;
   local float old;
   local entity stemp;
   local float leave;

   if ( (other.classname == "peeper") ) {

      return ;     //   remmed out for develpment

   }
   if ( !(other.flags & FL_CLIENT) ) {

      if ( (other.classname != "dmbot") ) {

         return ;

      }

   }
   stemp = self;
   self = other;
   if ( (self.classname == "player") ) {

      best = W_BestWeapon ();

   }
   self = stemp;
   if ( ((deathmatch == FL_SWIM) || coop) ) {

      leave = TRUE;

   } else {

      leave = FALSE;

   }
   if ( (self.classname == "weapon_nailgun") ) {

      if ( (leave && (other.items & IT_NAILGUN)) ) {

         return ;

}
                
      hadammo = other.ammo_nails;
      new = IT_NAILGUN;
      other.ammo_nails = (other.ammo_nails + SVC_INTERMISSION);
if ( other.movetarget.movetarget ) {

            cacheRoute (other.movetarget,other.movetarget.movetarget,FALSE,self);

         }

   } else {
  
    if ( (self.classname == "weapon_supernailgun") ) {

         if ( (leave && (other.items & IT_SUPER_NAILGUN)) ) {

            return ;

         }
         hadammo = other.ammo_rockets;
         new = IT_SUPER_NAILGUN;
         other.ammo_nails = (other.ammo_nails + SVC_INTERMISSION);
         if ( other.movetarget.movetarget ) {

            cacheRoute (other.movetarget,other.movetarget.movetarget,FALSE,self);

         }

      } else {

         if ( (self.classname == "weapon_supershotgun") ) {

            if ( (leave && (other.items & IT_SUPER_SHOTGUN)) ) {

               return ;

            }
            hadammo = other.ammo_rockets;
            new = IT_SUPER_SHOTGUN;
            other.ammo_shells = (other.ammo_shells + MOVETYPE_FLY);

         } else {

            if ( (self.classname == "weapon_rocketlauncher") ) {

               if ( (leave && (other.items & IT_ROCKET_LAUNCHER)) ) {

                  return ;

               }
               hadammo = other.ammo_rockets;
               new = IT_ROCKET_LAUNCHER;
               other.ammo_rockets = (other.ammo_rockets + MOVETYPE_FLY);
               if ( other.movetarget.movetarget ) {

                  cacheRoute (other.movetarget,other.movetarget.movetarget,FALSE,self);

               }

            } else {

               if ( (self.classname == "weapon_grenadelauncher") ) {

                  if ( (leave && (other.items & IT_GRENADE_LAUNCHER)) ) {

                     return ;

                  }
                  hadammo = other.ammo_rockets;
                  new = IT_GRENADE_LAUNCHER;
                  other.ammo_rockets = (other.ammo_rockets + MOVETYPE_FLY);
                  if ( other.movetarget.movetarget ) {

                     cacheRoute (other.movetarget,other.movetarget.movetarget,FALSE,self);

                  }

               } else {

                  if ( (self.classname == "weapon_lightning") ) {

                     if ( (leave && (other.items & IT_LIGHTNING)) ) {

                        return ;

                     }
                     hadammo = other.ammo_rockets;
                     new = IT_LIGHTNING;
                     other.ammo_cells = (other.ammo_cells + 15.000);
                     if ( other.movetarget.movetarget ) {

                        cacheRoute (other.movetarget,other.movetarget.movetarget,FALSE,self);

                     }

                  } else {
//////
if ( (self.classname == "weapon_plasma") ) {
if ( (leave && (other.items & IT_PLASMA_GUN)) ) {

            return ;

         }
         hadammo = other.ammo_rockets;
         new = IT_PLASMA_GUN;
         other.ammo_cells = (other.ammo_cells + 25);

         if ( other.movetarget.movetarget ) {

            cacheRoute (other.movetarget,other.movetarget.movetarget,FALSE,self);
            }
         } else {


//////

                     objerror ("weapon_touch: unknown classname");

                  }

               }

            }

         }
}// added for plasma gun
      }

   }
   if ( (other.classname == "player") ) {

      sprint (other,"ΩΟ՞ΗΟԞΤΘŞ");   //  "You got the "
      sprint (other,self.netname);
      sprint (other,"\n");

   }
   sound (other,CHAN_ITEM,"weapons/pkup.wav",TRUE,ATTN_NORM);
   if ( (other.classname == "player") ) {

      stuffcmd (other,"bf\n");

   }
   bound_other_ammo ();
   old = other.items;   
other.items = (other.items | new);
        
// self.weapon = new;
   stemp = self;
   self = other;
   if ( !deathmatch ) {

      self.weapon = new;

   } else {

      Deathmatch_Weapon (old,new);

   }
   W_SetCurrentAmmo ();
   self = stemp;
   if ( leave ) {

      return ;

   }
   self.model = string_null;
   self.solid = SOLID_NOT;
   if ( (deathmatch >= TRUE) ) {

      self.nextthink = (time + SVC_INTERMISSION);

   }
   self.think = SUB_regen;
   activator = other;
   SUB_UseTargets ();

};
//=================End Code==========//


Step 11

Find the function weapon_nailgun()  void () weapon_nailgun = {

BENEATH this function add:

//===========Begin Code==========//
void () weapon_plasma = {
precache_model ("progs/plasma.mdl");
setmodel (self,"progs/plasma.mdl");
self.classname == ("weapon_plasma");
   self.weapon = MOVETYPE_WALK;
   self.netname = "Plasma Gun";
   self.touch = weapon_touch;
   setsize (self,'-16.000 -16.000 0.000','16.000 16.000 56.000');
   self.th_weight = plasmaweight;
   self.th_cache = cachelightning;
   self.th_update = updatelightning;
   StartItem ();
};
//=================End Code==========//

save and close items.qc


Step 12

weapons.qc

Don't worry not too far to go now!  :)

Open weapons.qc

Find the line:
void (vector org, vector vel, float damage) SpawnBlood;

under this add:
//===========Begin Code==========//
void()  plasma_attack1;  
//=================End Code==========//
|=========================================================|


Step 13

Step 13
Find the function W_Precache  void () W_Precache = {
at the top of this function add:
//===========Begin Code==========//
precache_model ("progs/v_plasma.mdl");  // plasma gun
precache_model ("progs/s_plasma.spr");  // plasma
precache_sound ("weapons/plasma.wav");          // plasma gun sound
precache_sound ("weapons/plasexpl.wav");        // plasma sound
//=================End Code==========//


Step 14

Find the function W_FireRocket  void () W_FireRocket = {



After this function add:

//===========Begin Code==========//


void()  plasma_impact1  =       [1,             plasma_impact2] {};
void()  plasma_impact2  =       [2,             plasma_impact3] {};
void()  plasma_impact3  =       [3,             plasma_impact4] {};
void()  plasma_impact4  =       [4,             plasma_impact5] {};
void()  plasma_impact5  =       [1,             plasma_impact6] {};
void()  plasma_impact6  =       [5,             SUB_Remove ] {};


/*
==================
plasma_touch
==================
*/
float () CheckWaterLevel;
void () plasma_touch =

{
local float rand;
local float wlevel;
// hit something that bleeds
  if (other.takedamage)
  {
    // direct hit on an entity
    spawn_touchblood (2);
    
    T_Damage (other, self, self.owner, 20);  // Do 20 points of damage
  }

local float  pc;

  pc = pointcontents (self.origin);
  if ((pc == CONTENT_WATER) || (pc == CONTENT_SLIME) || (pc == CONTENT_LAVA))
  {
    //sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_NORM);

    T_RadiusDamage (self, self.owner, 60, world);   // If hit someone underwater do BIG damage  :>
   
  }
  sound (self, CHAN_WEAPON, "weapons/plasexpl.wav", 1, ATTN_NORM);

  self.nextthink = time + 0.1;
  self.think = plasma_impact1;
  self.touch = SUB_Null;
  self.velocity = '0 0 0';
};


/*
============
New plasma_firebolt
============
*/
void () plasma_firebolt = {

   local entity missile;
   local entity mpuff;
   local vector bfwd;
   local vector dir;
   dir = aim (self, 1000);
   self.ammo_cells = (self.ammo_cells - TRUE);
   self.currentammo = (self.ammo_cells - TRUE);
   sound (self,CHAN_WEAPON,"weapons/plasma.wav",TRUE,ATTN_NORM);
  self.punchangle_x = -2;
   missile = spawn ();
   missile.owner = self;
   missile.movetype = MOVETYPE_FLYMISSILE;
   missile.solid = SOLID_BBOX;
   makevectors (self.v_angle);
   if ( (self.classname == "dmbot") ) {

      missile.velocity = botaim ();
      bfwd = botaim ();
      bfwd_z = FALSE;

   } else {

      missile.velocity = aim (self,1000.000);

   }
   
   missile.velocity = (missile.velocity * 1000.000);
   missile.angles = vectoangles (missile.velocity);
   missile.touch = plasma_touch;
   missile.nextthink = (time + 3);
   missile.think = SUB_Remove;
   setmodel (missile,"progs/s_plasma.spr");
   setsize (missile,VEC_ORIGIN,VEC_ORIGIN);
   if ( (self.classname == "dmbot") ) {

      setorigin (missile,((self.origin + (bfwd * FL_CLIENT)) + '0.000 0.000 16.000'));

   } else {

      setorigin (missile,((self.origin + (v_forward * FL_CLIENT)) + '0.000 0.000 16.000'));

   }

};


/*
==================
plasma_attack
==================
*/


void () plasma_attack1   =[103.00, plasma_attack2  ]

{
 
if ( (self.ammo_cells < TRUE) ) {

      self.weapon = W_BestWeapon ();
      W_SetCurrentAmmo ();
      if ( (self.classname == "dmbot") ) {

         self.think = self.th_run;

      }
      return ;

   }


  self.effects = self.effects | EF_MUZZLEFLASH;

  if (!self.button0)
  {
    player_run ();
    return;
  }

  self.weaponframe = self.weaponframe + 1;

  if (self.weaponframe == 9) self.weaponframe = 1;
  SuperDamageSound();

  plasma_firebolt ();
  self.attack_finished = time + 0.1;
};


void() plasma_attack2   =[104.00, plasma_attack1  ]

{
  self.effects = self.effects | EF_MUZZLEFLASH;

  if (!self.button0)
  {
    player_run ();
    return;
  }

  self.weaponframe = self.weaponframe + 1;

  if (self.weaponframe == 9) self.weaponframe = 1;
  SuperDamageSound();

  plasma_firebolt ();
  self.attack_finished = time + 0.1;
};

//=================End Code=%3d%3d%3d%3d%3d%3d%3d%3d%3d/index.html


Step 15

Find W_SetCurrentAmmo  void() W_SetCurrentAmmo =

replace the whole function with:

//===========Begin Code==========//
void() W_SetCurrentAmmo =

{

   if ( (self.classname == "player") || (self.classname == "peeper")  )
   {// get out of any weapon firing states
      player_run ();
   }

                        

        self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
        
        if (self.weapon == IT_AXE)
        {
                self.currentammo = 0;
                self.weaponmodel = "progs/v_axe.mdl";
                self.weaponframe = 0;
        }
        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;
        }
        else if (self.weapon == IT_SUPER_SHOTGUN)
        {
                self.currentammo = self.ammo_shells;
                self.weaponmodel = "progs/v_shot2.mdl";
                self.weaponframe = 0;
                self.items = self.items | IT_SHELLS;
        }
        else if (self.weapon == IT_NAILGUN)
        {
                self.currentammo = self.ammo_nails;
                self.weaponmodel = "progs/v_nail.mdl";
                self.weaponframe = 0;
                self.items = self.items | IT_NAILS;
        }
        else if (self.weapon == IT_SUPER_NAILGUN)
        {
                self.currentammo = self.ammo_nails;
                self.weaponmodel = "progs/v_nail2.mdl";
                self.weaponframe = 0;
                self.items = self.items | IT_NAILS;
        }
        else if (self.weapon == IT_GRENADE_LAUNCHER)
        {
                self.currentammo = self.ammo_rockets;
                self.weaponmodel = "progs/v_rock.mdl";
                self.weaponframe = 0;
                self.items = self.items | IT_ROCKETS;
        }
        else if (self.weapon == IT_ROCKET_LAUNCHER)
        {
                self.currentammo = self.ammo_rockets;
                self.weaponmodel = "progs/v_rock2.mdl";
                self.weaponframe = 0;
                self.items = self.items | IT_ROCKETS;
        }

        else if (self.weapon == IT_LIGHTNING)
        {
                self.currentammo = self.ammo_cells;
                self.weaponmodel = "progs/v_light.mdl";
                self.weaponframe = 0;
                self.items = self.items | IT_CELLS;
        }
else if ( (self.weapon == IT_PLASMA_GUN) ) {

                              self.currentammo = self.ammo_cells;
                              self.weaponmodel = "progs/v_plasma.mdl";
                              self.weaponframe = FALSE;
                              self.items = (self.items | IT_CELLS);

}
        else
        {
                self.currentammo = 0;
                self.weaponmodel = " ";
                self.weaponframe = 0;
        }
        
        // ### chase cam mod ###
        if ( (self.speed & CHSCAM_ON) )
        {
                self.weaponmodel = "";
                self.weaponframe = 0;
        }
        
};
//=================End Code==========//


Step 16

Find the function W_Attack  void () W_Attack = {

Replace the whole function with:

//===========Begin Code==========//
void () W_Attack = {

   local float r;

   if ( !W_CheckNoAmmo () ) {

      return ;

   }
   makevectors (self.v_angle);
   self.show_hostile = (time + TRUE);
   signalnoise (self,self);
   if ( (self.weapon == IT_AXE) ) {

      sound (self,CHAN_WEAPON,"weapons/ax1.wav",TRUE,ATTN_NORM);
      r = random ();
      if ( (r < 0.250) ) {

         player_axe1 ();

      } else {

         if ( (r < 0.500) ) {

            player_axeb1 ();

         } else {

            if ( (r < 0.750) ) {

               player_axec1 ();

            } else {

               player_axed1 ();

            }

         }

      }
      self.attack_finished = (time + 0.500);

   } else {

      if ( (self.weapon == IT_SHOTGUN) ) {

         player_shot1 ();
         W_FireShotgun ();
         self.attack_finished = (time + 0.500);

      } else {

         if ( (self.weapon == IT_SUPER_SHOTGUN) ) {

            player_shot1 ();
            W_FireSuperShotgun ();
            self.attack_finished = (time + 0.700);

         } else {

            if ( (self.weapon == IT_NAILGUN) ) {

               player_nail1 ();

            } else {

               if ( (self.weapon == IT_SUPER_NAILGUN) ) {

                  player_nail1 ();

               } else {

                  if ( (self.weapon == IT_GRENADE_LAUNCHER) ) {

                     player_rocket1 ();
                     W_FireGrenade ();

self.attack_finished = (time + 0.600);

                  } else {

                     if ( (self.weapon == IT_ROCKET_LAUNCHER) ) {

                        player_rocket1 ();
                        W_FireRocket ();
                        self.attack_finished = (time + 0.800);

                     } 
else if (self.weapon == IT_PLASMA_GUN)
        {
                plasma_attack1 ();
                self.attack_finished = time + 0.1;
        }

                       else if ( (self.weapon == IT_LIGHTNING) ) {

                           player_light1 ();
                           self.attack_finished = (time + 0.100);
                           sound (self,CHAN_AUTO,"weapons/lstart.html",TRUE,ATTN_NORM);

                        }

                  }

               }

            }

         }

      }

   }

};
//=================End Code=%3d%3d%3d%3d%3d%3d%3d%3d%3d/index.html


Step 17

Find the function W_ChangeWeapon  void () W_ChangeWeapon = {

Replace the whole function with:

//===========Begin Code==========//
void () W_ChangeWeapon = {

   local float it;
   local float am;
   local float fl;

   it = self.items;
   am = FALSE;
   if ( (self.impulse == TRUE) ) {

      fl = IT_AXE;

   } else {

      if ( (self.impulse == FL_SWIM) ) {

         fl = IT_SHOTGUN;
         if ( (self.ammo_shells < TRUE) ) {

            am = TRUE;

         }

      } else {

         if ( (self.impulse == MOVETYPE_WALK) ) {

            fl = IT_SUPER_SHOTGUN;
            if ( (self.ammo_shells < FL_SWIM) ) {

               am = TRUE;

            }

         } else {

            if ( (self.impulse == MOVETYPE_STEP) ) {

               fl = IT_NAILGUN;
               if ( (self.ammo_nails < TRUE) ) {

                  am = TRUE;

               }

            } else {

               if ( (self.impulse == MOVETYPE_FLY) ) {

                  fl = IT_SUPER_NAILGUN;
                  if ( (self.ammo_nails < FL_SWIM) ) {

                     am = TRUE;

                  }

               } else {

                  if ( (self.impulse == MOVETYPE_TOSS) ) {

                     fl = IT_GRENADE_LAUNCHER;
                     if ( (self.ammo_rockets < TRUE) ) {

                        am = TRUE;

                     }

                  } else {

                     if ( (self.impulse == MOVETYPE_PUSH) ) {

                        fl = IT_ROCKET_LAUNCHER;
                        if ( (self.ammo_rockets < TRUE) ) {

                           am = TRUE;

                        }

                     } else {

                        if ( (self.impulse == FL_CLIENT) ) {

                           fl = IT_LIGHTNING;
                           if ( (self.ammo_cells < TRUE) ) {

                              am = TRUE;

                           } 
                                }else {
if ( (self.impulse == 20) )

{

fl = IT_PLASMA_GUN;
if ( (self.ammo_cells < TRUE) ) {

 am = TRUE;

                              }
                             }


                        }

                     }

                  }

               }

            }

         }

      }

   }
   self.impulse = FALSE;
   if ( !(self.items & fl) ) {

      sprint (self,"ΞϞΧΕΑΠΟΟ\n");   // "No Weapon" in nice gold letters
      return ;

   }
   if ( am ) {

      sprint (self,"ΞΟԞΕΞΟΥΗȞΑΝΝϟ\n");  // "Not enough ammo" in nice gold letters
      return ;

   }
   self.weapon = fl;
   W_SetCurrentAmmo ();

};
//=================End Code=%3d%3d%3d%3d%3d%3d%3d%3d%3d/index.html


Step 18

Now find the function  void () CycleWeaponCommand = { 

Replace the whole function with:

//===========Begin Code==========//
void () CycleWeaponCommand = {

   local float it;
   local float am;

   it = self.items;
   self.impulse = FALSE;
   while ( TRUE ) {

      am = FALSE;
      if ( (self.weapon == IT_PLASMA_GUN) ) {

         self.weapon = IT_AXE;

      } else {

         if ( (self.weapon == IT_AXE) ) {

            self.weapon = IT_SHOTGUN;
            if ( (self.ammo_shells < TRUE) ) {

               am = TRUE;

            }

         } else {

            if ( (self.weapon == IT_SHOTGUN) ) {

               self.weapon = IT_SUPER_SHOTGUN;
               if ( (self.ammo_shells < FL_SWIM) ) {

                  am = TRUE;

               }

            } else {

               if ( (self.weapon == IT_SUPER_SHOTGUN) ) {

                  self.weapon = IT_NAILGUN;
                  if ( (self.ammo_nails < TRUE) ) {

                     am = TRUE;

                  }

               } else {

                  if ( (self.weapon == IT_NAILGUN) ) {

                     self.weapon = IT_SUPER_NAILGUN;
                     if ( (self.ammo_nails < FL_SWIM) ) {

                        am = TRUE;

                     }

                  } else {

                     if ( (self.weapon == IT_SUPER_NAILGUN) ) {

                        self.weapon = IT_GRENADE_LAUNCHER;
                        if ( (self.ammo_rockets < TRUE) ) {

                           am = TRUE;
}} else {

                        if ( (self.weapon == IT_GRENADE_LAUNCHER) ) {

                           self.weapon = IT_ROCKET_LAUNCHER;
                           if ( (self.ammo_rockets < TRUE) ) {

                              am = TRUE;

                           }

                        } else {

                           if ( (self.weapon == IT_ROCKET_LAUNCHER) ) {

                              self.weapon = IT_LIGHTNING;
                              if ( (self.ammo_cells < TRUE) ) {

                                 am = TRUE;
                                                }
                              }else {

                              if ( (self.weapon == IT_LIGHTNING) ) {

                                 self.weapon = IT_PLASMA_GUN;
                                 if ( (self.ammo_cells < TRUE) ) {

                                    am = TRUE;

                                 }

}// added for plasma
                           }

                        }

                     }
                   
                  }

               }

            }

         }

      }
      if ( ((self.items & self.weapon) && (am == FALSE)) ) {

         W_SetCurrentAmmo ();
         return ;

      }
     
   }

};

//=================End Code=%3d%3d%3d%3d%3d%3d%3d%3d%3d/index.html


Step 19

Find the function ImpulseCommands()  void () ImpulseCommands = {

This bit is kind of hard to explain...

Find the bit that says:
 if ( ((self.impulse >= TRUE) && (self.impulse <= 8)) ) {

      W_ChangeWeapon ();

   } 

add this:
//===========Begin Code=%3d%3d%3d%3d%3d%3d%3d%3d%3d/index.html
else if (self.impulse == 20)

{
W_ChangeWeapon ();

}

//=================End Code=%3d%3d%3d%3d%3d%3d%3d%3d%3d/index.html
It should now read:

void () ImpulseCommands = {

   local string tmp;

   if ( ((self.impulse >= TRUE) && (self.impulse <= 8)) ) {

      W_ChangeWeapon ();

   } else if (self.impulse == 20)

{
W_ChangeWeapon ();

}
else if ( (self.impulse == MOVETYPE_BOUNCE) ) {

         CycleWeaponCommand ();

}

etc etc.......


Step 20

Save and close everything.
Compile!

No go into Quake.

Bind 9 to "impulse 9"

type map dm3.
Wander about a bit until you find the plasma gun, then shoot! To put a plasma gun into your levels insert a weapon_plasma. I hope this works! see 'ya next time.








The Inside3D content and design is copyrighted by the Inside3D team, and may not be re-produced or copied without proper consent. All rights reserved. Any work credited to any author not part of InsideQC is copyrighted by that author. If you have any feedback, suggestions or flames please send it in to the author. Inside3D is hosted by telefragged and the design was originated by project-9.