Quake3World.com Forums
     Level Editing & Modeling
        Making missiles hit the owner


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Making missiles hit the owner

Gomu Gomu no.....
Gomu Gomu no.....
Joined: 07 Aug 2003
Posts: 1902
PostPosted: 03-10-2005 09:16 AM           Profile Send private message  E-mail  Edit post Reply with quote


I'm having a bit of trouble getting missiles to hit the owner, in g_runmissile() in g_missile.c

Code:
   BG_EvaluateTrajectory( &ent->s.pos, level.time, origin );

   
   if ( ent->target_ent ) {
      passent = ent->target_ent->s.number;
   }

   else if (ent->count)
   {
      passent = ENTITYNUM_NONE;
   }

   else {
      passent = ent->r.ownerNum;
   }
   
   trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, origin, passent, ent->clipmask | CONTENTS_TRIGGER);

   if ( tr.entityNum != ENTITYNUM_NONE )
   {
      
      traceEnt = &g_entities[ tr.entityNum ];

      if((strcmp(ent->classname, "hook")) && (strcmp(ent->classname, "althook")))
      if(g_telemissiles.integer)
      if ( traceEnt && traceEnt->s.eType == ET_TELEPORT_TRIGGER ) {
         trigger_teleporter_touch ( traceEnt, ent, &tr );
         return;
      }

      if((strcmp(ent->classname, "hook")) && (strcmp(ent->classname, "althook")))
      if(g_bouncepadmissiles.integer)
      if ( traceEnt && traceEnt->s.eType == ET_PUSH_TRIGGER ) {
         trigger_push_touch ( traceEnt, ent, &tr );
         return;
      }
   }

   
   if ( tr.startsolid || tr.allsolid ) {
   
      trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, ent->r.currentOrigin, passent, ent->clipmask );
      tr.fraction = 0;
   }
   else {
      VectorCopy( tr.endpos, ent->r.currentOrigin );
   }

   trap_LinkEntity( ent );

   if ( tr.fraction != 1 ) {
      
      if ( tr.surfaceFlags & SURF_NOIMPACT ) {
         if (ent->parent && ent->parent->client && ent->parent->client->hook == ent) {
            ent->parent->client->hook = NULL;
         }
         G_FreeEntity( ent );
         return;
      }

      G_MissileImpact( ent, &tr );
      
      if ( ent->s.eType != ET_MISSILE ) {
         return;      
      }
   }

   if (!ent->count) {
      trap_Trace( &tr, ent->r.currentOrigin, ent->r.mins, ent->r.maxs, ent->r.currentOrigin, ENTITYNUM_NONE, ent->clipmask );
      if (!tr.startsolid || tr.entityNum != ent->r.ownerNum) {
         ent->count = 1;
      }
   }

   if(trap_PointContents (origin , -1) & MASK_WATER)
   {
      if(ent->s.weapon == WP_PLASMAGUN)
      {
         G_ExplodeMissile(ent);
         return;
      }
   }

   G_RunThink( ent );


The code above works provided I don't make the missiles shootable in the actual fire function, I think it might have something to do with the r.maxs and r.mins. If I do make the missiles shootable, the missile explodes immediately after being fired.


Code:
bolt->health = rocket.health;
      bolt->takedamage = qtrue;
      bolt->die = G_MissileDie;    
      bolt->r.contents = CONTENTS_SHOOTABLE;
      VectorSet(bolt->r.mins, -10, -3, 0);
      VectorCopy(bolt->r.mins, bolt->r.absmin);
      VectorSet(bolt->r.maxs, 10, 3, 6);
      VectorCopy(bolt->r.maxs, bolt->r.absmax);



_________________
-It is not the fall that kills you. It's the sudden stop at the end. (Douglas Adams)-

-An eyeful a day is bloody fantastic!-


Top
                 

4days Joined: 15 Apr 2002
Posts: 8193
PostPosted: 03-10-2005 09:22 AM           Profile Send private message  E-mail  Edit post Reply with quote


not a coder so i'm probably talking bollocks, but wouldn't you need to let the missle fly for a second or two before it thinks about a target?




Top
                 

Gomu Gomu no.....
Gomu Gomu no.....
Joined: 07 Aug 2003
Posts: 1902
PostPosted: 03-10-2005 09:23 AM           Profile Send private message  E-mail  Edit post Reply with quote


Probably. I tried incorporating a wait into the missile without much success, they just explode after the wait has expired.



_________________
-It is not the fall that kills you. It's the sudden stop at the end. (Douglas Adams)-

-An eyeful a day is bloody fantastic!-


Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.