2 .float electro_secondarytime;
4 void W_Plasma_Explode_Combo (void);
6 void W_Plasma_TriggerCombo(vector org, float rad, entity own)
9 e = findradius(org, rad);
12 if (e.classname == "plasma")
14 // see if there is line of sight to the combo ball
15 traceline(org, e.origin, MOVE_NOMONSTERS, e);
16 if (trace_fraction == 1 || trace_ent == e)
18 // change owner to whoever caused the combo explosion
20 e.takedamage = DAMAGE_NO;
21 e.classname = "plasma_chain";
22 e.think = W_Plasma_Explode_Combo;
23 e.nextthink = time + vlen(e.origin - org) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
30 void W_Plasma_Explode (void)
32 if(other.takedamage == DAMAGE_AIM)
33 if(other.classname == "player")
34 if(IsDifferentTeam(self.owner, other))
35 if(other.deadflag == DEAD_NO)
37 announce(self.owner, "announcer/male/electrobitch.wav");
39 self.event_damage = SUB_Null;
40 self.takedamage = DAMAGE_NO;
41 if (self.movetype == MOVETYPE_BOUNCE)
43 RadiusDamage (self, self.owner, cvar("g_balance_electro_secondary_damage"), cvar("g_balance_electro_secondary_edgedamage"), cvar("g_balance_electro_secondary_radius"), world, cvar("g_balance_electro_secondary_force"), self.projectiledeathtype, other);
47 W_Plasma_TriggerCombo(self.origin, cvar("g_balance_electro_primary_comboradius"), self.owner);
48 RadiusDamage (self, self.owner, cvar("g_balance_electro_primary_damage"), cvar("g_balance_electro_primary_edgedamage"), cvar("g_balance_electro_primary_radius"), world, cvar("g_balance_electro_primary_force"), self.projectiledeathtype, other);
54 void W_Plasma_Explode_Combo (void)
57 W_Plasma_TriggerCombo(self.origin, cvar("g_balance_electro_combo_comboradius"), self.owner);
59 self.event_damage = SUB_Null;
60 RadiusDamage (self, self.owner, cvar("g_balance_electro_combo_damage"), cvar("g_balance_electro_combo_edgedamage"), cvar("g_balance_electro_combo_radius"), world, cvar("g_balance_electro_combo_force"), WEP_ELECTRO | HITTYPE_BOUNCE, world); // use THIS type for a combo because primary can't bounce
64 void W_Plasma_Touch (void)
67 if (other.takedamage == DAMAGE_AIM) {
70 spamsound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
71 self.projectiledeathtype |= HITTYPE_BOUNCE;
75 void W_Plasma_TouchExplode (void)
81 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
85 // note: combos are usually triggered by W_Plasma_TriggerCombo, not damage
86 self.health = self.health - damage;
89 self.takedamage = DAMAGE_NO;
90 self.nextthink = time;
91 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
93 // change owner to whoever caused the combo explosion
94 self.owner = inflictor.owner;
95 self.classname = "plasma_chain";
96 self.think = W_Plasma_Explode_Combo;
97 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
101 self.use = W_Plasma_Explode;
102 self.think = adaptor_think2use;
107 void W_Electro_Attack()
111 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", cvar("g_balance_electro_primary_damage"));
113 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
116 proj.classname = "plasma_prim";
118 proj.bot_dodge = TRUE;
119 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
120 proj.use = W_Plasma_Explode;
121 proj.think = adaptor_think2use;
122 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
123 PROJECTILE_MAKETRIGGER(proj);
124 proj.projectiledeathtype = WEP_ELECTRO;
125 setorigin(proj, w_shotorg);
127 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
128 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
129 proj.movetype = MOVETYPE_FLY;
130 W_SETUPPROJECTILEVELOCITY(proj, g_balance_electro_primary);
131 proj.angles = vectoangles(proj.velocity);
132 proj.touch = W_Plasma_TouchExplode;
133 setsize(proj, '0 0 -3', '0 0 -3');
134 proj.flags = FL_PROJECTILE;
136 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
139 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
142 void W_Electro_Attack2()
146 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire2.wav", cvar("g_balance_electro_secondary_damage"));
147 w_shotdir = v_forward; // no TrueAim for grenades please
149 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
152 proj.classname = "plasma";
154 proj.use = W_Plasma_Explode;
155 proj.think = adaptor_think2use;
156 proj.bot_dodge = TRUE;
157 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
158 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
159 PROJECTILE_MAKETRIGGER(proj);
160 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
161 setorigin(proj, w_shotorg);
163 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
164 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
165 //proj.glow_size = 50;
166 //proj.glow_color = 45;
167 proj.movetype = MOVETYPE_BOUNCE;
168 W_SETUPPROJECTILEVELOCITY_UP(proj, g_balance_electro_secondary);
169 proj.touch = W_Plasma_Touch;
170 setsize(proj, '0 0 -3', '0 0 -3');
171 proj.takedamage = DAMAGE_YES;
172 proj.damageforcescale = cvar("g_balance_electro_secondary_damageforcescale");
173 proj.health = cvar("g_balance_electro_secondary_health");
174 proj.event_damage = W_Plasma_Damage;
175 proj.flags = FL_PROJECTILE;
180 copyentity(proj, p2);
181 setmodel(p2, "models/ebomb.mdl");
182 setsize(p2, proj.mins, proj.maxs);
185 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
188 void spawnfunc_weapon_electro (void)
190 weapon_defaultspawnfunc(WEP_ELECTRO);
193 void w_electro_checkattack()
195 if(self.electro_count > 1)
196 if(self.BUTTON_ATCK2)
197 if(weapon_prepareattack(1, -1))
200 self.electro_count -= 1;
201 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_electro_secondary_animtime"), w_electro_checkattack);
208 .float bot_secondary_electromooth;
209 float w_electro(float req)
213 self.BUTTON_ATCK=FALSE;
214 self.BUTTON_ATCK2=FALSE;
215 if(vlen(self.origin-self.enemy.origin) > 1000)
216 self.bot_secondary_electromooth = 0;
217 if(self.bot_secondary_electromooth == 0)
219 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
221 self.BUTTON_ATCK = TRUE;
222 if(random() < 0.01) self.bot_secondary_electromooth = 1;
227 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
229 self.BUTTON_ATCK2 = TRUE;
230 if(random() < 0.03) self.bot_secondary_electromooth = 0;
234 else if (req == WR_THINK)
236 if (self.BUTTON_ATCK)
237 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
240 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
242 if (self.BUTTON_ATCK2)
243 if (time >= self.electro_secondarytime)
244 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
247 self.electro_count = cvar("g_balance_electro_secondary_count");
248 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_electro_secondary_animtime"), w_electro_checkattack);
249 self.electro_secondarytime = time + cvar("g_balance_electro_secondary_refire2");
252 else if (req == WR_PRECACHE)
254 precache_model ("models/weapons/g_electro.md3");
255 precache_model ("models/weapons/v_electro.md3");
256 precache_model ("models/weapons/h_electro.dpm");
257 precache_sound ("weapons/electro_bounce.wav");
258 precache_sound ("weapons/electro_fire.wav");
259 precache_sound ("weapons/electro_fire2.wav");
260 precache_sound ("weapons/electro_impact.wav");
261 precache_sound ("weapons/electro_impact_combo.wav");
263 else if (req == WR_SETUP)
264 weapon_setup(WEP_ELECTRO);
265 else if (req == WR_CHECKAMMO1)
266 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
267 else if (req == WR_CHECKAMMO2)
268 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
269 else if (req == WR_SUICIDEMESSAGE)
271 if(w_deathtype & HITTYPE_SECONDARY)
272 w_deathtypestring = "could not remember where they put plasma";
274 w_deathtypestring = "played with plasma";
276 else if (req == WR_KILLMESSAGE)
278 if(w_deathtype & HITTYPE_SECONDARY)
280 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
281 w_deathtypestring = "just noticed #'s blue ball";
282 else // unchecked: BOUNCE
283 w_deathtypestring = "got in touch with #'s blue ball";
287 if(w_deathtype & HITTYPE_BOUNCE) // combo
288 w_deathtypestring = "felt the electrifying air of #'s combo";
289 else if(w_deathtype & HITTYPE_SPLASH)
290 w_deathtypestring = "got too close to #'s blue beam";
292 w_deathtypestring = "was blasted by #'s blue beam";
295 else if (req == WR_RESETPLAYER)
297 self.electro_secondarytime = time;