Navigation

 Missiles and Rockets Feature Type: Coding Tutorials     Added: 05/01  
  Author: Corven 

You can make the Grenade Launcher fire the grenades over long distances and in straight lines so the grenades aren't effected by gravity.

What they do and how they do it

g_missile.c

In the missile functions you'll see nearly the same code for each one, which determines how the missiles react, so lets see what all those lines really mean:-

bolt = G_Spawn(); create the missile
bolt->classname = "rocket"; the missile name
bolt->nextthink = level.time + 10000; how long the missle stays before exploding
bolt->think = G_ExplodeMissile; tells it to explode
bolt->s.eType = ET_MISSILE; what to explode
bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
bolt->s.weapon = WP_ROCKET_LAUNCHER; where is the missile being fired from
bolt->r.ownerNum = self->s.number; who is firing the missile
bolt->parent = self;
bolt->damage = 100; how much damage on direct hit
bolt->splashDamage = 100; how much damage if hit by splash radius
bolt->splashRadius = 60; how big the splash radius is
bolt->methodOfDeath = MOD_ROCKET; message shown on death by weapon type
bolt->splashMethodOfDeath = MOD_ROCKET_SPLASH; death message for splash damage
bolt->clipmask = MASK_SHOT;
bolt->s.pos.trType = TR_LINEAR; trajectory of the missile (see grenade tutorial)
bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME;
// move a bit on the very first frame
VectorCopy( start, bolt->s.pos.trBase );
VectorScale( dir, 2000, bolt->s.pos.trDelta ); how fast the missle will travel once fired
SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
VectorCopy (start, bolt->r.currentOrigin);
return bolt;
}

So you can have a play around with your rocket effects now :)

Comments »



  Page 1

  Comments ( 0 )


  Features Index

  Home

Copyright © 2001 MGON International AB - Privacy statement