Home
Got egnufeB?
Quake
News News
Befunge Befunge
Doom Doom
Inform Inform
Quake Quake
   - Levels
   - Mods
   - Miscellaneous

RISC OS RISC OS
Misc Misc
Links Links
Contact Contact

DIY Chain rocket launcher

(aka 'BOOM BOOM BOOM BOOM BOOM BOOM BOOM!')

  1. Get your favourite copy of the QC source. Or make a new one.
  2. Open Weapons.qc, and scroll down to W_FireSpikes
  3. Replace the lines

     dir = aim (self, 1000);
     launch_spike (self.origin + '0 0 16' + v_right*ox, dir);
    
    with:

     missile = spawn ();
     missile.owner = self;
     missile.movetype = MOVETYPE_FLYMISSILE;
     missile.solid = SOLID_BBOX;
    
    // set missile speed
     makevectors (self.v_angle);
     missile.velocity = aim(self, 1000);
     missile.velocity = missile.velocity * 1000;
     missile.angles = vectoangles(missile.velocity);
    
     missile.touch = T_MissileTouch;
    
    // set missile duration
     missile.nextthink = time + 5;
     missile.think = SUB_Remove;
     setmodel (missile, "progs/missile.mdl");
     setsize (missile, '0 0 0', '0 0 0');
     setorigin (missile, self.origin + v_forward*8 + '0 0 16');
    
    This is virtually the same as found in W_FireRocket, just without the bit that reduces your rocket ammo, plays the rocket launcher sound, and sets the punchangle. You'll want to add this at the top of W_FireSpikes:

     local entity missile;
    
  4. You need to change

    setorigin (missile, self.origin + v_forward*8 + '0 0 16');
    
    to:

     setorigin (missile, self.origin + v_forward*8 + '0 0 16' + v_right*ox);
    
    to make sure it fires the rockets from alternating barrels of the nailgun.

  5. You'll also want to change

     sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
    
    to:

     sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
    
    to make sure it plays the rocket sound.

  6. Now open items.qc, and scroll down to the weapons area. Find weapon_nailgun, and change the netname from 'nailgun' to 'Chain Rocket Launcher'.
  7. Open client.qc, and scroll down to ClientObituary. Change:

        if (rnum == IT_NAILGUN)
        {
         deathstring = " was nailed by ";
         deathstring2 = "\n";
        }
    
    to:

        if (rnum == IT_NAILGUN)
        {
         deathstring = " was liquidized by ";
         deathstring2 = "'s chain rocket launcher\n";
        }
    
    Or some other comment. Deathstring is printed after the deceased's name, while deathstring2 is printed after the attacker's name:

    <deceased> <deathstring> <attacker> <deathstring2>
  8. Save all the files and compile!
  9. Further extenstion - adding some random inaccuracy. Go down to W_FireSpikes again, and change

     self.punchangle_x = -2;
    
    to:

     self.punchangle_x = 4 * crandom();
    
    This changes the punchangle (An offset to your view when you fire weapons, get hurt, etc) to a random number between -4 and 4 degrees pitch (crandom returns a number from -1 to 1, have a look at its definition at the top of weapons.qc)
    Unfortunately punchangle doesn't effect the direction your gun fires, so we'll have to do that ourselves. The vector missile.velocity is a direction for the rocket to head. We need to convert this into a set of angles, by using vectoangles. Below

     missile.velocity = aim(self, 1000);
    
    insert the lines:

     missile.velocity = vectoangles(missile.velocity);
    // Convert it to a set of angles (Stored as in a vector), format 'pitch yaw 0' as opposed to 'x y z'
     missile.velocity = missile.velocity + self.punchangle; // Add the punchangle to the direction the rocket's going.
     makevectors(missile.velocity); // Convert back to a set of vectors. The function sets global variables v_forward,
    v_right and v_up to point forward, right and up (Each has length 1).
     missile.velocity = v_forward;
    
    Hopefully the comments explain what's happening. Save and recompile to make this weapon a bit harder to use!

  10. Another extension - punchangle_y. Just like punchangle_x, you can set the yaw. Simply insert the line:

     self.punchangle_y = 4 * crandom();
    
    underneath the punchangle_x line. You could also set punchangle_z (Roll, although few QC functions work with it).

  11. Yet another extension. Like the last, this is simple. Change the

    4 * crandom()
    
    bits to

    2 * skill * crandom()
    
    for skill dependent inaccuracy! Skill 0 gives no inaccuracy, and skill 3 gives up to 6 degrees!
    Fiddle around with this bit as much as you want

  12. No extensions this time. Now you've got to think up a few problems you're having, and ask me to write another of these handy file thingies for it!


Page last modified 03/03/2005