Nicely accelerating rockets :) looking kewl :)


 

Posted by Defcon-X on January 16, 1999 at 22:47:09:

I made this tut because a guy (maybe a girl i dunno) asked me over icq how to do that,
here's the answer, maybe you can use it too :)
Ok open up g_weapons.c and create a new think function :


void rocket_think (edict_t *self)
{
      if (self->count >= 1000) {
             self->count = 1000;            
      }
      else
             self->count *= 2;

      gi.centerprintf(self->owner, "Rocket Speed %i\n", self->count);

      VectorScale (self->movedir, self->count, self->velocity);

      self->nextthink = level.time + .1;
      self->think = rocket_think;
}

then add the line (marked with '+') to the function :
void fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage)

 

      VectorClear (rocket->mins);
      VectorClear (rocket->maxs);
      rocket->s.modelindex = gi.modelindex ("models/objects/rocket/tris.md2");
      rocket->owner = self;
      rocket->touch = rocket_touch;
+     speed = 30;
+     rocket->count = speed;
      rocket->nextthink = level.time + .1;
      rocket->think = rocket_think;

OK, now this time there are NO tricky solutons in this TUT... it should work just fine..
Any probs: mailto:defcon-x@planetquake.com
to MAJ.BITCH: 'Ok now ?'

And don't forget:
Now go out and kill those bastards with your accelerating rockets ;-)

cya,

maybe in heaven :))