Inside3D!
     

Sticky Grenades

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Ghost_Fang



Joined: 12 Nov 2009
Posts: 162

PostPosted: Sat Mar 13, 2010 4:59 pm    Post subject: Sticky Grenades Reply with quote

Im using the sticky grenades from the tutorials page but i did a little editing to get rid of the random and stuff. But now when the grenades stick the dont explode they just disappear. But when i kill the enemy the grenade appears on the dead body THEN explodes....


Code:
void () GlueStick =
{
if ( ((self.enemy != world) && (self.enemy.health > 1)) )
{
          self.origin = self.enemy.origin;
     
     if ( (self.velocity == VEC_ORIGIN) ) {

         self.avelocity = VEC_ORIGIN;
      

      }

   }
   self.think = GrenadeExplode;
   self.nextthink = time + 2;
   
};


Code:
void () GlueTouch =
{
   if ( (other == self.owner) ) {

      return ;

   }
   sound (self,CHAN_WEAPON,"misc/outwater.wav",TRUE,ATTN_NORM); // sound to make when it stick
   self.touch = GlueStick; // go to GlueStick when touching something
   self.velocity = (self.velocity * 0);
   self.avelocity = VEC_ORIGIN;
   self.enemy = other;

};


and my missile.touch = GlueTouch; in my grenade throwing function.

Also instead of sharing the enemies origin when it sticks, how would i make the origin on the spot of the enemy where it hits?
Back to top
View user's profile Send private message
Downsider



Joined: 16 Sep 2008
Posts: 478

PostPosted: Sat Mar 13, 2010 6:30 pm    Post subject: Reply with quote

Subtract from the grenade's origin to the object that was hits origin, then move it to the entity's origin on it's nextthink, then add the subtracted amount.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group