ROTT Firebomb
Created By: | Plumb |
eMail: | plumbjit@tinyonline.co.uk |
Difficulty Scale: | Medium |
void() W_FireRocket =Most of our code is going to be based around these functions. The line we're after is:
missile.touch = T_MissileTouch;Find it and change it to
missile.touch = T_FireBombTouch;
void() T_FireBombTouch = { local float damg;
// don't do radius damage to the other, because all the damage // was done in the impact // T_RadiusDamage (self, self.owner, 120, other); // No need for it to hurt people // sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM); self.origin = self.origin - 8*normalize(self.velocity); WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); // Leave the pretty explosion in WriteByte (MSG_BROADCAST, TE_EXPLOSION); WriteCoord (MSG_BROADCAST, self.origin_x); WriteCoord (MSG_BROADCAST, self.origin_y); WriteCoord (MSG_BROADCAST, self.origin_z); // BecomeExplosion (); // We don't want this happening either LaunchFirebomb ('1 0 0', self.origin, self.owner); // THE NASTY BIT LaunchFirebomb ('0 1 0', self.origin, self.owner); LaunchFirebomb ('-1 0 0', self.origin, self.owner); LaunchFirebomb ('0 -1 0', self.origin, self.owner); remove(self); };You can always remove the lines I've commented out but I've left them in here for clarity. T_RadiusDamage is removed because it's not really needed. If you shot someone with the missile, what happens after is sure to kill them anyway. BecomeExplosion you won't really notice either as it just creates the little sprite in the middle of an explosion. If you can notice this you're about to be gibbed. :P
// // Plumb's firebomb tutorial // void(vector dir, vector org, entity e) LaunchFirebomb = { local entity fb; fb = spawn(); org_z = org_z + 10; // Incase u shoot it at the floor fb.classname = "firebomb"; fb.owner = e; fb.movetype = MOVETYPE_FLYMISSILE; fb.solid = SOLID_BBOX; fb.velocity = dir * 600; fb.angles = vectoangles(fb.velocity); fb.touch = T_MissileTouch; // Told you we'd need this fb.nextthink = time + 0.1; // Explosions :> fb.think = FirebombKaboom; setsize (fb, '0 0 0', '0 0 0'); setorigin (fb, org); };It's a modified version of W_FireRocket. There's no setmodel line so it's invisible and there's a few small changes to the way that it works.
void() FirebombKaboom = { self.nextthink = time + 0.1; self.think = FirebombKaboom; T_RadiusDamage (self, self.owner, 120, world); WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); WriteByte (MSG_BROADCAST, TE_EXPLOSION); WriteCoord (MSG_BROADCAST, self.origin_x); WriteCoord (MSG_BROADCAST, self.origin_y); WriteCoord (MSG_BROADCAST, self.origin_z); };I stole most of that code from GrenadeExplode. If it's already written, borrow it! Feel free to adjust the value in T_RadiusDamage if you think it's all a bit too meaty.