Inside3D tutorials.
Created By: | A. George Corrigan |
eMail: | corrigan@voyager.net |
Difficulty Scale: | Medium |
void(vector org) Flame_Burn = { local entity flame; flame = spawn (); flame.owner = self; flame.classname = "fire"; flame.movetype = MOVETYPE_FLYMISSILE; flame.solid = SOLID_NOT; flame.origin = org; flame.velocity = '0 0 75'; setmodel (flame, "progs/s_explod.spr"); setsize (flame, '0 0 0', '0 0 0'); flame.nextthink = time + 0.01; flame.think = s_explode1; }; void() Flame_Touch = { local float r; local vector org; if (other.takedamage) { org = other.origin; org_z = self.origin_z; Flame_Burn (org); T_Damage (other, self, self.owner, 8); // the amount of damage remove (self); } }; void() W_FireGrenade = { local entity flame; self.currentammo = self.ammo_rockets = self.ammo_rockets - 1; sound (self, CHAN_WEAPON, "hknight/hit.wav", 1, ATTN_NORM); flame = spawn (); flame.owner = self; flame.movetype = MOVETYPE_FLYMISSILE; flame.solid = SOLID_BBOX; flame.classname = "fire"; makevectors (self.v_angle); flame.velocity = aim (self, 100000); flame.velocity = flame.velocity * 500; flame.touch = Flame_Touch; setmodel (flame, "progs/s_explod.spr"); setsize (flame, '0 0 0', '0 0 0'); setorigin (flame, self.origin + (v_forward * 16) + '0 0 16'); flame.think = s_explode1; flame.nextthink = time + 0.25; // how far away from barrel before it flames up // W_Attack, self.attack_finished - Would control how how close together they come out };
void() Flame_Think = // New... { local float r; if (self.enemy.waterlevel == 3 || self.enemy.health <= 0) { // Make hiss sound... BecomeExplosion (); return; } self.origin = self.enemy.origin + '0 0 25'; if (r < 0.3)// how often they get hurt/scream... T_Damage (self.enemy, self, self.owner, 1);// how much it burns... self.nextthink = time + 0.01; // NOTE: you must keep the .nextthink fast, otherwise the flame won't keepup with player. }; void(vector org, entity e) Flame_Onfire = // New... { local entity flame; flame = spawn (); flame.owner = self.owner; flame.enemy = e; flame.classname = "fire"; flame.movetype = MOVETYPE_NONE; flame.solid = SOLID_NOT; flame.origin = org; flame.velocity = '0 0 0'; setmodel (flame, "progs/flame2.mdl"); // Don't forget to precache this setsize (flame, '0 0 -15', '0 0 0'); flame.nextthink = time + 0.01; flame.think = Flame_Think; flame.effects = flame.effects | EF_DIMLIGHT; }; void() Flame_Touch = // remake of old Flame_Touch... Re-place the old one. { local float r; local vector org; if (other.takedamage) { org = other.origin; org_z = self.origin_z; Flame_Burn (org); T_Damage (other, self, self.owner, 8); remove (self); r = random (); if (r < 0.2)// how often they get on-fire... { if ((other.classname == "player")) { centerprint (other,"You are on fire!\n- Find WATER fast -"); stuffcmd (other,"bf\n"); } Flame_Onfire (org, other); } } };