2 void W_Plasma_Explode (void)
5 org2 = findbetterlocation (self.origin, 8);
7 self.event_damage = SUB_Null;
8 if (self.movetype == MOVETYPE_BOUNCE)
10 pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
11 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);
15 pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
16 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);
18 sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
23 void W_Plasma_Explode_Combo (void) {
26 org2 = findbetterlocation (self.origin, 8);
27 pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
29 sound (self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
31 self.event_damage = SUB_Null;
32 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, other); // use THIS type for a combo because primary can't bounce
36 void W_Plasma_Touch (void)
39 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
41 sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM);
45 if (other.takedamage == DAMAGE_AIM) {
48 if(other.classname == "player")
49 if(IsDifferentTeam(o, other))
51 announce(o, "announcer/male/electrobitch.ogg");
53 sound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
54 self.projectiledeathtype |= HITTYPE_BOUNCE;
58 void W_Plasma_TouchExplode (void)
61 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
63 sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM);
69 if(other.takedamage == DAMAGE_AIM)
70 if(other.classname == "player")
71 if(IsDifferentTeam(o, other))
73 announce(o, "announcer/male/electrobitch.ogg");
76 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
78 self.health = self.health - damage;
81 self.takedamage = DAMAGE_NO;
82 self.nextthink = time;
83 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
85 // change owner to whoever caused the combo explosion
86 self.owner = inflictor.owner;
87 self.classname = "plasma_chain";
88 self.think = W_Plasma_Explode_Combo;
91 self.think = W_Plasma_Explode;
95 void W_Electro_Attack()
99 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire.wav");
101 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
104 proj.classname = "plasma_prim";
106 proj.bot_dodge = TRUE;
107 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
108 proj.use = W_Plasma_Explode;
109 proj.think = adaptor_think2use;
110 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
111 proj.solid = SOLID_BBOX;
112 proj.projectiledeathtype = WEP_ELECTRO;
113 setorigin(proj, w_shotorg);
115 if not(self.items & IT_UNLIMITED_AMMO)
116 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
117 proj.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
118 proj.movetype = MOVETYPE_FLY;
119 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
120 W_SetupProjectileVelocity(proj);
121 proj.angles = vectoangles(proj.velocity);
122 proj.touch = W_Plasma_TouchExplode;
123 proj.flags = FL_PROJECTILE;
124 setmodel(proj, "models/elaser.mdl"); // precision set above
125 setsize(proj, '0 0 0', '0 0 0');
127 // LordHavoc: disabled because no one likes this sound and it sometimes never stops due to packet loss
128 //sound (proj, CHAN_PROJECTILE, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
131 void W_Electro_Attack2()
135 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire2.wav");
137 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
140 proj.classname = "plasma";
142 proj.use = W_Plasma_Explode;
143 proj.think = adaptor_think2use;
144 proj.bot_dodge = TRUE;
145 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
146 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
147 proj.solid = SOLID_BBOX;
148 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
149 setorigin(proj, w_shotorg);
151 if not(self.items & IT_UNLIMITED_AMMO)
152 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
153 proj.effects = EF_LOWPRECISION;
154 //proj.glow_size = 50;
155 //proj.glow_color = 45;
156 proj.movetype = MOVETYPE_BOUNCE;
157 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");
158 W_SetupProjectileVelocity(proj);
159 proj.touch = W_Plasma_Touch;
160 setmodel(proj, "models/ebomb.mdl"); // precision set above
161 setsize(proj, '0 0 -3', '0 0 -3');
162 proj.takedamage = DAMAGE_YES;
163 proj.damageforcescale = 4;
164 proj.health = cvar("g_balance_electro_secondary_health");
165 proj.event_damage = W_Plasma_Damage;
166 proj.flags = FL_PROJECTILE;
168 // LordHavoc: disabled because no one likes this sound and it sometimes never stops due to packet loss
169 //sound (proj, CHAN_PROJECTILE, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
172 void spawnfunc_weapon_electro (void)
174 weapon_defaultspawnfunc(WEP_ELECTRO);
177 .float bot_secondary_electromooth;
178 float w_electro(float req)
182 self.BUTTON_ATCK=FALSE;
183 self.BUTTON_ATCK2=FALSE;
184 if(vlen(self.origin-self.enemy.origin) > 1000)
185 self.bot_secondary_electromooth = 0;
186 if(self.bot_secondary_electromooth == 0)
188 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
190 self.BUTTON_ATCK = TRUE;
191 if(random() < 0.01) self.bot_secondary_electromooth = 1;
196 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
198 self.BUTTON_ATCK2 = TRUE;
199 if(random() < 0.03) self.bot_secondary_electromooth = 0;
203 else if (req == WR_THINK)
205 if (self.BUTTON_ATCK)
206 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
209 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
211 if (self.BUTTON_ATCK2)
212 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
215 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_secondary_animtime"), w_ready);
218 else if (req == WR_PRECACHE)
220 precache_model ("models/ebomb.mdl");
221 precache_model ("models/elaser.mdl");
222 precache_model ("models/weapons/g_electro.md3");
223 precache_model ("models/weapons/v_electro.md3");
224 precache_model ("models/weapons/w_electro.zym");
225 precache_sound ("weapons/electro_bounce.wav");
226 precache_sound ("weapons/electro_fire.wav");
227 precache_sound ("weapons/electro_fire2.wav");
228 precache_sound ("weapons/electro_fly.wav");
229 precache_sound ("weapons/electro_impact.wav");
230 precache_sound ("weapons/electro_impact_combo.wav");
232 else if (req == WR_SETUP)
233 weapon_setup(WEP_ELECTRO);
234 else if (req == WR_CHECKAMMO1)
235 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
236 else if (req == WR_CHECKAMMO2)
237 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
238 else if (req == WR_SUICIDEMESSAGE)
240 if(w_deathtype & HITTYPE_SECONDARY)
241 w_deathtypestring = "could not remember where he put plasma";
243 w_deathtypestring = "played with plasma";
245 else if (req == WR_KILLMESSAGE)
247 if(w_deathtype & HITTYPE_SECONDARY)
249 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
250 w_deathtypestring = "just noticed #'s blue ball";
251 else // unchecked: BOUNCE
252 w_deathtypestring = "got in touch with #'s blue ball";
256 if(w_deathtype & HITTYPE_BOUNCE) // combo
257 w_deathtypestring = "felt the electrifying air of #'s combo";
258 else if(w_deathtype & HITTYPE_SPLASH)
259 w_deathtypestring = "got too close to #'s blue beam";
261 w_deathtypestring = "was blasted by #'s blue beam";