2 void W_Plasma_Explode (void)
5 org2 = findbetterlocation (self.origin, 8);
7 if(other.takedamage == DAMAGE_AIM)
8 if(other.classname == "player")
9 if(IsDifferentTeam(self.owner, other))
11 announce(self.owner, "announcer/male/electrobitch.wav");
13 self.event_damage = SUB_Null;
14 if (self.movetype == MOVETYPE_BOUNCE)
16 pointparticles(particleeffectnum("electro_ballexplode"), org2, '0 0 0', 1);
17 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);
21 pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
22 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);
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 UpdateCSQCProjectile(self);
48 if (other.takedamage == DAMAGE_AIM) {
51 sound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
52 self.projectiledeathtype |= HITTYPE_BOUNCE;
56 void W_Plasma_TouchExplode (void)
62 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
66 self.health = self.health - damage;
69 self.takedamage = DAMAGE_NO;
70 self.nextthink = time;
71 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
73 // change owner to whoever caused the combo explosion
74 self.owner = inflictor.owner;
75 self.classname = "plasma_chain";
76 self.think = W_Plasma_Explode_Combo;
77 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
80 self.think = W_Plasma_Explode;
84 void W_Electro_Attack()
88 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire.wav");
90 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
93 proj.classname = "plasma_prim";
95 proj.bot_dodge = TRUE;
96 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
97 proj.use = W_Plasma_Explode;
98 proj.think = adaptor_think2use;
99 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
100 proj.solid = SOLID_BBOX;
101 proj.projectiledeathtype = WEP_ELECTRO;
102 setorigin(proj, w_shotorg);
104 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
105 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
106 proj.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
107 proj.movetype = MOVETYPE_FLY;
108 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
109 W_SetupProjectileVelocity(proj);
110 proj.angles = vectoangles(proj.velocity);
111 proj.touch = W_Plasma_TouchExplode;
112 proj.flags = FL_PROJECTILE;
113 setmodel(proj, "models/elaser.mdl"); // precision set above
114 setsize(proj, '0 0 0', '0 0 0');
116 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
120 void W_Electro_Attack2()
124 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire2.wav");
126 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
129 proj.classname = "plasma";
131 proj.use = W_Plasma_Explode;
132 proj.think = adaptor_think2use;
133 proj.bot_dodge = TRUE;
134 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
135 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
136 proj.solid = SOLID_BBOX;
137 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
138 setorigin(proj, w_shotorg);
140 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
141 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
142 proj.effects = EF_LOWPRECISION;
143 //proj.glow_size = 50;
144 //proj.glow_color = 45;
145 proj.movetype = MOVETYPE_BOUNCE;
146 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");
147 W_SetupProjectileVelocity(proj);
148 proj.touch = W_Plasma_Touch;
149 setmodel(proj, "models/ebomb.mdl"); // precision set above
150 setsize(proj, '0 0 -3', '0 0 -3');
151 proj.takedamage = DAMAGE_YES;
152 proj.damageforcescale = 4;
153 proj.health = cvar("g_balance_electro_secondary_health");
154 proj.event_damage = W_Plasma_Damage;
155 proj.flags = FL_PROJECTILE;
157 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO);
160 void spawnfunc_weapon_electro (void)
162 weapon_defaultspawnfunc(WEP_ELECTRO);
165 .float bot_secondary_electromooth;
166 float w_electro(float req)
170 self.BUTTON_ATCK=FALSE;
171 self.BUTTON_ATCK2=FALSE;
172 if(vlen(self.origin-self.enemy.origin) > 1000)
173 self.bot_secondary_electromooth = 0;
174 if(self.bot_secondary_electromooth == 0)
176 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
178 self.BUTTON_ATCK = TRUE;
179 if(random() < 0.01) self.bot_secondary_electromooth = 1;
184 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
186 self.BUTTON_ATCK2 = TRUE;
187 if(random() < 0.03) self.bot_secondary_electromooth = 0;
191 else if (req == WR_THINK)
193 if (self.BUTTON_ATCK)
194 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
197 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
199 if (self.BUTTON_ATCK2)
200 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
203 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_secondary_animtime"), w_ready);
206 else if (req == WR_PRECACHE)
208 precache_model ("models/ebomb.mdl");
209 precache_model ("models/elaser.mdl");
210 precache_model ("models/weapons/g_electro.md3");
211 precache_model ("models/weapons/v_electro.md3");
212 precache_model ("models/weapons/w_electro.zym");
213 precache_sound ("weapons/electro_bounce.wav");
214 precache_sound ("weapons/electro_fire.wav");
215 precache_sound ("weapons/electro_fire2.wav");
216 precache_sound ("weapons/electro_fly.wav");
217 precache_sound ("weapons/electro_impact.wav");
218 precache_sound ("weapons/electro_impact_combo.wav");
220 else if (req == WR_SETUP)
221 weapon_setup(WEP_ELECTRO);
222 else if (req == WR_CHECKAMMO1)
223 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
224 else if (req == WR_CHECKAMMO2)
225 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
226 else if (req == WR_SUICIDEMESSAGE)
228 if(w_deathtype & HITTYPE_SECONDARY)
229 w_deathtypestring = "could not remember where he put plasma";
231 w_deathtypestring = "played with plasma";
233 else if (req == WR_KILLMESSAGE)
235 if(w_deathtype & HITTYPE_SECONDARY)
237 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
238 w_deathtypestring = "just noticed #'s blue ball";
239 else // unchecked: BOUNCE
240 w_deathtypestring = "got in touch with #'s blue ball";
244 if(w_deathtype & HITTYPE_BOUNCE) // combo
245 w_deathtypestring = "felt the electrifying air of #'s combo";
246 else if(w_deathtype & HITTYPE_SPLASH)
247 w_deathtypestring = "got too close to #'s blue beam";
249 w_deathtypestring = "was blasted by #'s blue beam";