1 .float bot_secondary_fireballmooth; // whatever a mooth is
2 .vector fireball_impactvec;
4 void W_Fireball_Explode (void)
12 self.event_damage = SUB_Null;
15 d = (self.owner.health + self.owner.armorvalue);
16 RadiusDamage (self, self.realowner, cvar("g_balance_fireball_secondary_damage"), cvar("g_balance_fireball_secondary_edgedamage"), cvar("g_balance_fireball_secondary_radius"), world, cvar("g_balance_fireball_secondary_force"), self.projectiledeathtype, other);
17 if(self.realowner.health + self.realowner.armorvalue >= d)
20 modeleffect_spawn("models/sphere/sphere.md3", 0, 0, self.origin, '0 0 0', '0 0 0', '0 0 0', 0, cvar("g_balance_fireball_secondary_bfgradius"), 0.2, 0.05, 0.25);
23 FOR_EACH_PLAYER(e) if(e != self.owner) if(e.takedamage) if(!self.owner || IsDifferentTeam(e, self))
25 // can we see fireball?
26 traceline(e.origin + e.view_ofs, self.origin, MOVE_NORMAL, e);
27 if(trace_startsolid || trace_fraction != 1)
29 // can we see player who shot fireball?
30 traceline(e.origin + e.view_ofs, self.realowner.origin + self.realowner.view_ofs, MOVE_NORMAL, e);
31 if(trace_ent != self.realowner)
32 if(trace_startsolid || trace_fraction != 1)
34 dist = vlen(self.origin - e.origin - e.view_ofs);
35 points = (1 - sqrt(dist / cvar("g_balance_fireball_secondary_bfgradius")));
38 dir = normalize(e.origin + e.view_ofs - self.origin);
39 Damage(e, self, self.realowner, cvar("g_balance_fireball_secondary_bfgdamage") * points, self.projectiledeathtype | HITTYPE_BOUNCE | HITTYPE_SPLASH, e.origin + e.view_ofs, cvar("g_balance_fireball_secondary_bfgforce") * dir);
40 pointparticles(particleeffectnum("fireball_bfgdamage"), e.origin, -1 * dir, 1);
42 Damage_RecordDamage(self.owner, self.projectiledeathtype, cvar("g_balance_fireball_secondary_bfgdamage") * points);
49 void W_Fireball_TouchExplode (void)
52 W_Fireball_Explode ();
55 void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime)
61 RandomSelection_Init();
62 FOR_EACH_PLAYER(e) if(e != self.owner) if(e.takedamage) if(!self.owner || IsDifferentTeam(e, self))
65 p_x += e.mins_x + random() * (e.maxs_x - e.mins_x);
66 p_y += e.mins_y + random() * (e.maxs_y - e.mins_y);
67 p_z += e.mins_z + random() * (e.maxs_z - e.mins_z);
68 d = vlen(self.origin - p);
71 traceline(p, self.origin, MOVE_NORMAL, e);
72 if(trace_startsolid || trace_fraction != 1)
74 e.fireball_impactvec = p;
75 RandomSelection_Add(e, 0, string_null, 1 / (1 + d), !Fire_IsBurning(e));
78 if(RandomSelection_chosen_ent)
80 d = vlen(self.origin - RandomSelection_chosen_ent.fireball_impactvec);
81 d = damage + (edgedamage - damage) * (d / dist);
82 Fire_AddDamage(RandomSelection_chosen_ent, self.realowner, d * burntime, burntime, self.projectiledeathtype | HITTYPE_BOUNCE);
83 //trailparticles(self, particleeffectnum("fireball_laser"), self.origin, RandomSelection_chosen_ent.fireball_impactvec);
84 pointparticles(particleeffectnum("fireball_laser"), self.origin, RandomSelection_chosen_ent.fireball_impactvec - self.origin, 1);
88 void W_Fireball_Think()
90 if(time > self.pushltime)
97 W_Fireball_LaserPlay(0.1, cvar("g_balance_fireball_secondary_laserradius"), cvar("g_balance_fireball_secondary_laserdamage"), cvar("g_balance_fireball_secondary_laseredgedamage"), cvar("g_balance_fireball_secondary_laserburntime"));
99 self.nextthink = time + 0.1;
102 void W_Fireball_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
106 self.health = self.health - damage;
107 if (self.health <= 0)
110 W_PrepareExplosionByDamage(attacker, W_Fireball_Explode);
114 void W_Fireball_Attack2()
118 W_SetupShot_ProjectileSize (self, '-16 -16 -16', '16 16 16', FALSE, 2, "weapons/fireball_fire2.wav", cvar("g_balance_fireball_secondary_damage") + cvar("g_balance_fireball_secondary_bfgdamage"));
120 pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
123 proj.classname = "plasma_prim";
124 proj.owner = proj.realowner = self;
125 proj.bot_dodge = TRUE;
126 proj.bot_dodgerating = cvar("g_balance_fireball_secondary_damage");
127 proj.pushltime = time + cvar("g_balance_fireball_secondary_lifetime");
128 proj.use = W_Fireball_Explode;
129 proj.think = W_Fireball_Think;
130 proj.nextthink = time;
131 proj.health = cvar("g_balance_fireball_secondary_health");
132 proj.team = self.team;
133 proj.event_damage = W_Fireball_Damage;
134 proj.damageforcescale = cvar("g_balance_fireball_secondary_damageforcescale");
135 PROJECTILE_MAKETRIGGER(proj);
136 proj.projectiledeathtype = WEP_FIREBALL | HITTYPE_SECONDARY;
137 setorigin(proj, w_shotorg);
139 proj.movetype = MOVETYPE_FLY;
140 proj.velocity = w_shotdir * cvar("g_balance_fireball_secondary_speed");
141 W_SetupProjectileVelocity(proj);
142 proj.angles = vectoangles(proj.velocity);
143 proj.touch = W_Fireball_TouchExplode;
144 setsize(proj, '-16 -16 -16', '16 16 16');
145 proj.flags = FL_PROJECTILE;
147 CSQCProjectile(proj, TRUE, PROJECTILE_FIREBALL, TRUE);
150 void W_Fireball_AttackEffect(float i, vector f_diff)
152 W_SetupShot_ProjectileSize (self, '-16 -16 -16', '16 16 16', FALSE, 0, "", 0);
153 w_shotorg += f_diff_x * v_up + f_diff_y * v_right;
154 pointparticles(particleeffectnum("fireball_preattack_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
157 void W_Fireball_Attack2_Frame4()
159 W_Fireball_Attack2();
160 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), w_ready);
163 void W_Fireball_Attack2_Frame3()
165 W_Fireball_AttackEffect(0, '+1.25 +3.75 0');
166 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame4);
169 void W_Fireball_Attack2_Frame2()
171 W_Fireball_AttackEffect(0, '-1.25 +3.75 0');
172 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame3);
175 void W_Fireball_Attack2_Frame1()
177 W_Fireball_AttackEffect(1, '+1.25 -3.75 0');
178 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame2);
181 void W_Fireball_Attack2_Frame0()
183 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
184 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_fireball_secondary_ammo");
186 W_Fireball_AttackEffect(0, '-1.25 -3.75 0');
187 sound (self, CHAN_WEAPON, "weapons/fireball_prefire2.wav", VOL_BASE, ATTN_NORM);
188 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_fireball_secondary_animtime"), W_Fireball_Attack2_Frame1);
191 void W_Firemine_Think()
193 if(time > self.pushltime)
199 // make it "hot" once it leaves its owner
201 if(vlen(self.origin - self.owner.origin - self.owner.view_ofs) > cvar("g_balance_fireball_primary_laserradius"))
204 W_Fireball_LaserPlay(0.1, cvar("g_balance_fireball_primary_laserradius"), cvar("g_balance_fireball_primary_laserdamage"), cvar("g_balance_fireball_primary_laseredgedamage"), cvar("g_balance_fireball_primary_laserburntime"));
206 self.nextthink = time + 0.1;
209 void W_Firemine_Touch (void)
212 if (other.takedamage == DAMAGE_AIM)
214 Fire_AddDamage(other, self.realowner, cvar("g_balance_fireball_primary_damage"), cvar("g_balance_fireball_primary_damagetime"), self.projectiledeathtype | HITTYPE_HEADSHOT);
219 self.projectiledeathtype |= HITTYPE_BOUNCE;
223 void W_Fireball_Attack1()
229 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
230 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_fireball_primary_ammo");
232 c = mod(self.bulletcounter, 4);
236 f_diff = '-1.25 -3.75 0';
239 f_diff = '+1.25 -3.75 0';
242 f_diff = '-1.25 +3.75 0';
246 f_diff = '+1.25 +3.75 0';
249 W_SetupShot_ProjectileSize(self, '-4 -4 -4', '4 4 4', FALSE, 2, "weapons/fireball_fire.wav", cvar("g_balance_fireball_primary_damage"));
250 traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, self);
251 w_shotorg = trace_endpos;
253 pointparticles(particleeffectnum("fireball_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
256 proj.owner = proj.realowner = self;
257 proj.classname = "grenade";
258 proj.bot_dodge = TRUE;
259 proj.bot_dodgerating = cvar("g_balance_fireball_primary_damage");
260 proj.movetype = MOVETYPE_BOUNCE;
261 proj.projectiledeathtype = WEP_FIREBALL;
262 proj.touch = W_Firemine_Touch;
263 PROJECTILE_MAKETRIGGER(proj);
264 setsize(proj, '-4 -4 -4', '4 4 4');
265 setorigin(proj, w_shotorg);
266 proj.think = W_Firemine_Think;
267 proj.nextthink = time;
268 proj.damageforcescale = cvar("g_balance_fireball_primary_damageforcescale");
269 proj.velocity = w_shotdir * cvar("g_balance_fireball_primary_speed") + v_up * cvar("g_balance_fireball_primary_speed_up");
270 proj.pushltime = time + cvar("g_balance_fireball_primary_lifetime");
271 W_SetupProjectileVelocity(proj);
273 proj.angles = vectoangles(proj.velocity);
274 proj.flags = FL_PROJECTILE;
276 CSQCProjectile(proj, TRUE, PROJECTILE_FIREMINE, TRUE);
279 void spawnfunc_weapon_fireball (void)
281 weapon_defaultspawnfunc(WEP_FIREBALL);
284 float w_fireball(float req)
288 self.BUTTON_ATCK = FALSE;
289 self.BUTTON_ATCK2 = FALSE;
290 if (self.bot_secondary_fireballmooth == 0)
292 if(bot_aim(cvar("g_balance_fireball_primary_speed"), cvar("g_balance_fireball_primary_speed_up"), cvar("g_balance_fireball_primary_lifetime"), TRUE))
294 self.BUTTON_ATCK = TRUE;
295 if(random() < 0.01) self.bot_secondary_fireballmooth = 1;
300 if(bot_aim(cvar("g_balance_fireball_secondary_speed"), 0, cvar("g_balance_fireball_secondary_lifetime"), FALSE))
302 self.BUTTON_ATCK2 = TRUE;
303 if(random() < 0.02) self.bot_secondary_fireballmooth = 0;
307 else if (req == WR_THINK)
309 if (self.BUTTON_ATCK)
310 if (weapon_prepareattack(0, cvar("g_balance_fireball_primary_refire")))
312 W_Fireball_Attack1();
313 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_fireball_primary_animtime"), w_ready);
315 if (self.BUTTON_ATCK2)
316 if (weapon_prepareattack(1, cvar("g_balance_fireball_secondary_refire")))
318 W_Fireball_Attack2_Frame0();
321 else if (req == WR_PRECACHE)
323 precache_model ("models/weapons/g_fireball.md3");
324 precache_model ("models/weapons/v_fireball.md3");
325 precache_model ("models/weapons/h_fireball.dpm");
326 precache_model ("models/sphere/sphere.md3");
327 precache_sound ("weapons/fireball_fire.wav");
328 precache_sound ("weapons/fireball_fire2.wav");
329 precache_sound ("weapons/fireball_prefire2.wav");
331 else if (req == WR_SETUP)
332 weapon_setup(WEP_FIREBALL);
333 else if (req == WR_CHECKAMMO1)
334 return self.ammo_rockets >= cvar("g_balance_fireball_primary_ammo");
335 else if (req == WR_CHECKAMMO2)
336 return self.ammo_rockets >= cvar("g_balance_fireball_secondary_ammo");
337 else if (req == WR_SUICIDEMESSAGE)
339 if(w_deathtype & HITTYPE_SECONDARY)
340 w_deathtypestring = "should have used a smaller gun";
342 w_deathtypestring = "forgot about some firemine";
344 else if (req == WR_KILLMESSAGE)
346 if(w_deathtype & HITTYPE_SECONDARY)
348 if(w_deathtype & HITTYPE_BOUNCE)
350 if(w_deathtype & HITTYPE_SPLASH) // BFG effect
352 w_deathtypestring = "could not hide from #'s fireball";
356 w_deathtypestring = "saw the pretty lights of #'s fireball";
359 else if(w_deathtype & HITTYPE_SPLASH)
360 w_deathtypestring = "got too close to #'s fireball";
362 w_deathtypestring = "tasted #'s fireball";
366 if(w_deathtype & HITTYPE_HEADSHOT)
367 w_deathtypestring = "tried to catch #'s firemine";
369 w_deathtypestring = "fatefully ignored #'s firemine";