|
| Tutorials are copyrighted by their author and the Inside3D staff. And may be used in any Quake modification provided that the author and the InsideQC staff are credited. Please direct any comments to the author. |
Created By: | Mr. Pink |
eMail: | mrpink@telefragged.com |
Difficulty Scale: | Easy |
Step 1 Open Weapons.qc and remplace the GrenadeTouch funtion with this: void () GlueStick = { if ( (random () < 0.020) ) { // check for a random number self.think = GrenadeExplode; //maybe to explode self.touch = GrenadeExplode; } else { self.think = GlueStick; // maybe to Stick self.touch = GlueStick; } if ( ((self.enemy != world) && (self.enemy.health > 1)) ) { self.origin = self.enemy.origin; if ( (self.velocity == VEC_ORIGIN) ) { self.avelocity = VEC_ORIGIN; } } self.nextthink = (time + 0.100); }; |
Step 2 Then under the above function insert this: void () GlueTouch = { if ( (other == self.owner) ) { return ; } sound (self,CHAN_WEAPON,"misc/outwater.wav",TRUE,ATTN_NORM); // sound to make when it stick self.think = GlueStick; self.touch = GlueStick; // go to GlueStick when touching something self.nextthink = (time + 0.100); self.velocity = (self.velocity * 0); self.avelocity = VEC_ORIGIN; self.enemy = other; }; |
Step 3 Now remplace the W_FireGrenade function with this: void () W_FireGlue = { local entity missile; local entity mpuff; self.ammo_rockets = (self.ammo_rockets - 1); self.currentammo = (self.ammo_rockets - 1); sound (self,CHAN_WEAPON,"weapons/grenade.wav",TRUE,ATTN_NORM); self.punchangle_x = CONTENT_SOLID; missile = spawn (); missile.owner = self; missile.movetype = MOVETYPE_FLYMISSILE; // make the grenade fly missile.solid = SOLID_BBOX; makevectors (self.v_angle); missile.velocity = aim (self,1000); missile.velocity = (missile.velocity * 1000); missile.angles = vectoangles (missile.velocity); missile.nextthink = (time + MOVETYPE_FLY); missile.think = GrenadeExplode; missile.touch = GlueTouch; setmodel (missile,"progs/grenade.mdl"); setsize (missile,VEC_ORIGIN,VEC_ORIGIN); setorigin (missile,self.origin); }; |