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);
18 stopsound (self, CHAN_PAIN);
22 pointparticles(particleeffectnum("electro_impact"), org2, '0 0 0', 1);
23 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);
24 //stopsound (self, CHAN_PAIN);
27 sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
32 void W_Plasma_Explode_Combo (void) {
35 org2 = findbetterlocation (self.origin, 8);
36 pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
38 stopsound (self, CHAN_PAIN);
39 sound (self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
41 self.event_damage = SUB_Null;
42 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
46 void W_Plasma_Touch (void)
48 UpdateCSQCProjectile(self);
50 PROJECTILE_TOUCH_NOSOUND;
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)
65 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
69 self.health = self.health - damage;
72 self.takedamage = DAMAGE_NO;
73 self.nextthink = time;
74 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
76 // change owner to whoever caused the combo explosion
77 self.owner = inflictor.owner;
78 self.classname = "plasma_chain";
79 self.think = W_Plasma_Explode_Combo;
80 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
83 self.think = W_Plasma_Explode;
87 void W_Electro_Attack()
91 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire.wav");
93 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
96 proj.classname = "plasma_prim";
98 proj.bot_dodge = TRUE;
99 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
100 proj.use = W_Plasma_Explode;
101 proj.think = adaptor_think2use;
102 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
103 proj.solid = SOLID_BBOX;
104 proj.projectiledeathtype = WEP_ELECTRO;
105 setorigin(proj, w_shotorg);
107 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
108 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
109 proj.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
110 proj.movetype = MOVETYPE_FLY;
111 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
112 W_SetupProjectileVelocity(proj);
113 proj.angles = vectoangles(proj.velocity);
114 proj.touch = W_Plasma_TouchExplode;
115 proj.flags = FL_PROJECTILE;
116 setmodel(proj, "models/elaser.mdl"); // precision set above
117 setsize(proj, '0 0 0', '0 0 0');
119 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
123 void W_Electro_Attack2()
127 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire2.wav");
129 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
132 proj.classname = "plasma";
134 proj.use = W_Plasma_Explode;
135 proj.think = adaptor_think2use;
136 proj.bot_dodge = TRUE;
137 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
138 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
139 proj.solid = SOLID_BBOX;
140 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
141 setorigin(proj, w_shotorg);
143 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
144 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
145 proj.effects = EF_LOWPRECISION;
146 //proj.glow_size = 50;
147 //proj.glow_color = 45;
148 proj.movetype = MOVETYPE_BOUNCE;
149 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");
150 W_SetupProjectileVelocity(proj);
151 proj.touch = W_Plasma_Touch;
152 setmodel(proj, "models/ebomb.mdl"); // precision set above
153 setsize(proj, '0 0 -3', '0 0 -3');
154 proj.takedamage = DAMAGE_YES;
155 proj.damageforcescale = 4;
156 proj.health = cvar("g_balance_electro_secondary_health");
157 proj.event_damage = W_Plasma_Damage;
158 proj.flags = FL_PROJECTILE;
160 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
162 CSQCProjectile(proj);
163 proj.csqcprojectile_clientanimate = 1;
165 proj.csqcprojectile_flysound = 1;
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";