3 void W_Plasma_Explode_Combo (void);
5 void W_Plasma_TriggerCombo(vector org, float rad, entity own)
8 e = findradius(org, rad);
11 if (e.classname == "plasma")
13 // see if there is line of sight to the combo ball
14 traceline(org, e.origin, MOVE_NOMONSTERS, e);
15 if (trace_fraction == 1 || trace_ent == e)
17 // change owner to whoever caused the combo explosion
19 e.takedamage = DAMAGE_NO;
20 e.classname = "plasma_chain";
21 e.think = W_Plasma_Explode_Combo;
22 e.nextthink = time + vlen(e.origin - org) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
29 void W_Plasma_Explode (void)
31 if(other.takedamage == DAMAGE_AIM)
32 if(other.classname == "player")
33 if(IsDifferentTeam(self.owner, other))
34 if(other.deadflag == DEAD_NO)
36 announce(self.owner, "announcer/male/electrobitch.wav");
38 self.event_damage = SUB_Null;
39 self.takedamage = DAMAGE_NO;
40 if (self.movetype == MOVETYPE_BOUNCE)
42 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);
46 W_Plasma_TriggerCombo(self.origin, cvar("g_balance_electro_primary_comboradius"), self.owner);
47 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);
53 void W_Plasma_Explode_Combo (void)
56 W_Plasma_TriggerCombo(self.origin, cvar("g_balance_electro_combo_comboradius"), self.owner);
58 self.event_damage = SUB_Null;
59 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
63 void W_Plasma_Touch (void)
66 if (other.takedamage == DAMAGE_AIM) {
69 spamsound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
70 self.projectiledeathtype |= HITTYPE_BOUNCE;
74 void W_Plasma_TouchExplode (void)
80 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
84 // note: combos are usually triggered by W_Plasma_TriggerCombo, not damage
85 self.health = self.health - damage;
88 self.takedamage = DAMAGE_NO;
89 self.nextthink = time;
90 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
92 // change owner to whoever caused the combo explosion
93 self.owner = inflictor.owner;
94 self.classname = "plasma_chain";
95 self.think = W_Plasma_Explode_Combo;
96 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
100 self.use = W_Plasma_Explode;
101 self.think = adaptor_think2use;
106 void W_Electro_Attack()
110 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", cvar("g_balance_electro_primary_damage"));
112 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
115 proj.classname = "plasma_prim";
117 proj.bot_dodge = TRUE;
118 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
119 proj.use = W_Plasma_Explode;
120 proj.think = adaptor_think2use;
121 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
122 PROJECTILE_MAKETRIGGER(proj);
123 proj.projectiledeathtype = WEP_ELECTRO;
124 setorigin(proj, w_shotorg);
126 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
127 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
128 proj.movetype = MOVETYPE_FLY;
129 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
130 W_SetupProjectileVelocity(proj);
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 proj.velocity = (w_shotdir + randomvec() * cvar("g_balance_electro_secondary_spread")) * cvar("g_balance_electro_secondary_speed") + v_up * cvar("g_balance_electro_secondary_speed_up");
169 W_SetupProjectileVelocity(proj);
170 proj.touch = W_Plasma_Touch;
171 setsize(proj, '0 0 -3', '0 0 -3');
172 proj.takedamage = DAMAGE_YES;
173 proj.damageforcescale = cvar("g_balance_electro_secondary_damageforcescale");
174 proj.health = cvar("g_balance_electro_secondary_health");
175 proj.event_damage = W_Plasma_Damage;
176 proj.flags = FL_PROJECTILE;
181 copyentity(proj, p2);
182 setmodel(p2, "models/ebomb.mdl");
183 setsize(p2, proj.mins, proj.maxs);
186 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
189 void spawnfunc_weapon_electro (void)
191 weapon_defaultspawnfunc(WEP_ELECTRO);
194 void w_electro_checkattack()
196 if(self.electro_count > 1)
197 if(self.BUTTON_ATCK2)
198 if(weapon_prepareattack(1, -1))
201 self.electro_count -= 1;
202 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_electro_secondary_animtime"), w_electro_checkattack);
209 .float bot_secondary_electromooth;
210 float w_electro(float req)
214 self.BUTTON_ATCK=FALSE;
215 self.BUTTON_ATCK2=FALSE;
216 if(vlen(self.origin-self.enemy.origin) > 1000)
217 self.bot_secondary_electromooth = 0;
218 if(self.bot_secondary_electromooth == 0)
220 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
222 self.BUTTON_ATCK = TRUE;
223 if(random() < 0.01) self.bot_secondary_electromooth = 1;
228 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
230 self.BUTTON_ATCK2 = TRUE;
231 if(random() < 0.03) self.bot_secondary_electromooth = 0;
235 else if (req == WR_THINK)
237 if (self.BUTTON_ATCK)
238 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
241 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
243 if (self.BUTTON_ATCK2)
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);
251 else if (req == WR_PRECACHE)
253 precache_model ("models/weapons/g_electro.md3");
254 precache_model ("models/weapons/v_electro.md3");
255 precache_model ("models/weapons/h_electro.dpm");
256 precache_sound ("weapons/electro_bounce.wav");
257 precache_sound ("weapons/electro_fire.wav");
258 precache_sound ("weapons/electro_fire2.wav");
259 precache_sound ("weapons/electro_impact.wav");
260 precache_sound ("weapons/electro_impact_combo.wav");
262 else if (req == WR_SETUP)
263 weapon_setup(WEP_ELECTRO);
264 else if (req == WR_CHECKAMMO1)
265 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
266 else if (req == WR_CHECKAMMO2)
267 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
268 else if (req == WR_SUICIDEMESSAGE)
270 if(w_deathtype & HITTYPE_SECONDARY)
271 w_deathtypestring = "could not remember where he put plasma";
273 w_deathtypestring = "played with plasma";
275 else if (req == WR_KILLMESSAGE)
277 if(w_deathtype & HITTYPE_SECONDARY)
279 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
280 w_deathtypestring = "just noticed #'s blue ball";
281 else // unchecked: BOUNCE
282 w_deathtypestring = "got in touch with #'s blue ball";
286 if(w_deathtype & HITTYPE_BOUNCE) // combo
287 w_deathtypestring = "felt the electrifying air of #'s combo";
288 else if(w_deathtype & HITTYPE_SPLASH)
289 w_deathtypestring = "got too close to #'s blue beam";
291 w_deathtypestring = "was blasted by #'s blue beam";