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);
19 if(other.takedamage == DAMAGE_AIM)
20 if(other.classname == "player")
21 if(IsDifferentTeam(self.owner, other))
23 announce(self.owner, "announcer/male/electrobitch.ogg");
25 sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
30 void W_Plasma_Explode_Combo (void) {
33 org2 = findbetterlocation (self.origin, 8);
34 pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
36 sound (self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
38 self.event_damage = SUB_Null;
39 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
43 void W_Plasma_Touch (void)
45 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
47 sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM);
51 if (other.takedamage == DAMAGE_AIM) {
54 sound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
55 self.projectiledeathtype |= HITTYPE_BOUNCE;
59 void W_Plasma_TouchExplode (void)
62 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
64 sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM);
72 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
74 self.health = self.health - damage;
77 self.takedamage = DAMAGE_NO;
78 self.nextthink = time;
79 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
81 // change owner to whoever caused the combo explosion
82 self.owner = inflictor.owner;
83 self.classname = "plasma_chain";
84 self.think = W_Plasma_Explode_Combo;
87 self.think = W_Plasma_Explode;
91 void W_Electro_Attack()
95 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire.wav");
97 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
100 proj.classname = "plasma_prim";
102 proj.bot_dodge = TRUE;
103 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
104 proj.use = W_Plasma_Explode;
105 proj.think = adaptor_think2use;
106 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
107 proj.solid = SOLID_BBOX;
108 proj.projectiledeathtype = WEP_ELECTRO;
109 setorigin(proj, w_shotorg);
111 if not(self.items & IT_UNLIMITED_AMMO)
112 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
113 proj.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
114 proj.movetype = MOVETYPE_FLY;
115 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
116 W_SetupProjectileVelocity(proj);
117 proj.angles = vectoangles(proj.velocity);
118 proj.touch = W_Plasma_TouchExplode;
119 proj.flags = FL_PROJECTILE;
120 setmodel(proj, "models/elaser.mdl"); // precision set above
121 setsize(proj, '0 0 0', '0 0 0');
123 // LordHavoc: disabled because no one likes this sound and it sometimes never stops due to packet loss
124 //sound (proj, CHAN_PROJECTILE, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
127 void W_Electro_Attack2()
131 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire2.wav");
133 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
136 proj.classname = "plasma";
138 proj.use = W_Plasma_Explode;
139 proj.think = adaptor_think2use;
140 proj.bot_dodge = TRUE;
141 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
142 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
143 proj.solid = SOLID_BBOX;
144 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
145 setorigin(proj, w_shotorg);
147 if not(self.items & IT_UNLIMITED_AMMO)
148 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
149 proj.effects = EF_LOWPRECISION;
150 //proj.glow_size = 50;
151 //proj.glow_color = 45;
152 proj.movetype = MOVETYPE_BOUNCE;
153 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");
154 W_SetupProjectileVelocity(proj);
155 proj.touch = W_Plasma_Touch;
156 setmodel(proj, "models/ebomb.mdl"); // precision set above
157 setsize(proj, '0 0 -3', '0 0 -3');
158 proj.takedamage = DAMAGE_YES;
159 proj.damageforcescale = 4;
160 proj.health = cvar("g_balance_electro_secondary_health");
161 proj.event_damage = W_Plasma_Damage;
162 proj.flags = FL_PROJECTILE;
164 // LordHavoc: disabled because no one likes this sound and it sometimes never stops due to packet loss
165 //sound (proj, CHAN_PROJECTILE, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
168 void spawnfunc_weapon_electro (void)
170 weapon_defaultspawnfunc(WEP_ELECTRO);
173 .float bot_secondary_electromooth;
174 float w_electro(float req)
178 self.BUTTON_ATCK=FALSE;
179 self.BUTTON_ATCK2=FALSE;
180 if(vlen(self.origin-self.enemy.origin) > 1000)
181 self.bot_secondary_electromooth = 0;
182 if(self.bot_secondary_electromooth == 0)
184 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
186 self.BUTTON_ATCK = TRUE;
187 if(random() < 0.01) self.bot_secondary_electromooth = 1;
192 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
194 self.BUTTON_ATCK2 = TRUE;
195 if(random() < 0.03) self.bot_secondary_electromooth = 0;
199 else if (req == WR_THINK)
201 if (self.BUTTON_ATCK)
202 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
205 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
207 if (self.BUTTON_ATCK2)
208 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
211 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_secondary_animtime"), w_ready);
214 else if (req == WR_PRECACHE)
216 precache_model ("models/ebomb.mdl");
217 precache_model ("models/elaser.mdl");
218 precache_model ("models/weapons/g_electro.md3");
219 precache_model ("models/weapons/v_electro.md3");
220 precache_model ("models/weapons/w_electro.zym");
221 precache_sound ("weapons/electro_bounce.wav");
222 precache_sound ("weapons/electro_fire.wav");
223 precache_sound ("weapons/electro_fire2.wav");
224 precache_sound ("weapons/electro_fly.wav");
225 precache_sound ("weapons/electro_impact.wav");
226 precache_sound ("weapons/electro_impact_combo.wav");
228 else if (req == WR_SETUP)
229 weapon_setup(WEP_ELECTRO);
230 else if (req == WR_CHECKAMMO1)
231 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
232 else if (req == WR_CHECKAMMO2)
233 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
234 else if (req == WR_SUICIDEMESSAGE)
236 if(w_deathtype & HITTYPE_SECONDARY)
237 w_deathtypestring = "could not remember where he put plasma";
239 w_deathtypestring = "played with plasma";
241 else if (req == WR_KILLMESSAGE)
243 if(w_deathtype & HITTYPE_SECONDARY)
245 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
246 w_deathtypestring = "just noticed #'s blue ball";
247 else // unchecked: BOUNCE
248 w_deathtypestring = "got in touch with #'s blue ball";
252 if(w_deathtype & HITTYPE_BOUNCE) // combo
253 w_deathtypestring = "felt the electrifying air of #'s combo";
254 else if(w_deathtype & HITTYPE_SPLASH)
255 w_deathtypestring = "got too close to #'s blue beam";
257 w_deathtypestring = "was blasted by #'s blue beam";