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 stopsound (self, CHAN_PAIN);
26 sound (self, CHAN_PROJECTILE, "weapons/electro_impact.wav", VOL_BASE, ATTN_NORM);
31 void W_Plasma_Explode_Combo (void) {
34 org2 = findbetterlocation (self.origin, 8);
35 pointparticles(particleeffectnum("electro_combo"), org2, '0 0 0', 1);
37 sound (self, CHAN_PROJECTILE, "weapons/electro_impact_combo.wav", VOL_BASE, ATTN_NORM);
39 self.event_damage = SUB_Null;
40 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
44 void W_Plasma_Touch (void)
46 PROJECTILE_TOUCH_NOSOUND;
47 if (other.takedamage == DAMAGE_AIM) {
50 sound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
51 self.projectiledeathtype |= HITTYPE_BOUNCE;
55 void W_Plasma_TouchExplode (void)
57 PROJECTILE_TOUCH_NOSOUND;
61 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
65 self.health = self.health - damage;
68 self.takedamage = DAMAGE_NO;
69 self.nextthink = time;
70 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
72 // change owner to whoever caused the combo explosion
73 self.owner = inflictor.owner;
74 self.classname = "plasma_chain";
75 self.think = W_Plasma_Explode_Combo;
76 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
79 self.think = W_Plasma_Explode;
83 void W_Electro_Attack()
87 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire.wav");
89 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
92 proj.classname = "plasma_prim";
94 proj.bot_dodge = TRUE;
95 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
96 proj.use = W_Plasma_Explode;
97 proj.think = adaptor_think2use;
98 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
99 proj.solid = SOLID_BBOX;
100 proj.projectiledeathtype = WEP_ELECTRO;
101 setorigin(proj, w_shotorg);
103 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
104 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
105 proj.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
106 proj.movetype = MOVETYPE_FLY;
107 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
108 W_SetupProjectileVelocity(proj);
109 proj.angles = vectoangles(proj.velocity);
110 proj.touch = W_Plasma_TouchExplode;
111 proj.flags = FL_PROJECTILE;
112 setmodel(proj, "models/elaser.mdl"); // precision set above
113 setsize(proj, '0 0 0', '0 0 0');
115 sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
118 void W_Electro_Attack2()
122 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire2.wav");
124 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
127 proj.classname = "plasma";
129 proj.use = W_Plasma_Explode;
130 proj.think = adaptor_think2use;
131 proj.bot_dodge = TRUE;
132 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
133 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
134 proj.solid = SOLID_BBOX;
135 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
136 setorigin(proj, w_shotorg);
138 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
139 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
140 proj.effects = EF_LOWPRECISION;
141 //proj.glow_size = 50;
142 //proj.glow_color = 45;
143 proj.movetype = MOVETYPE_BOUNCE;
144 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");
145 W_SetupProjectileVelocity(proj);
146 proj.touch = W_Plasma_Touch;
147 setmodel(proj, "models/ebomb.mdl"); // precision set above
148 setsize(proj, '0 0 -3', '0 0 -3');
149 proj.takedamage = DAMAGE_YES;
150 proj.damageforcescale = 4;
151 proj.health = cvar("g_balance_electro_secondary_health");
152 proj.event_damage = W_Plasma_Damage;
153 proj.flags = FL_PROJECTILE;
156 void spawnfunc_weapon_electro (void)
158 weapon_defaultspawnfunc(WEP_ELECTRO);
161 .float bot_secondary_electromooth;
162 float w_electro(float req)
166 self.BUTTON_ATCK=FALSE;
167 self.BUTTON_ATCK2=FALSE;
168 if(vlen(self.origin-self.enemy.origin) > 1000)
169 self.bot_secondary_electromooth = 0;
170 if(self.bot_secondary_electromooth == 0)
172 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
174 self.BUTTON_ATCK = TRUE;
175 if(random() < 0.01) self.bot_secondary_electromooth = 1;
180 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
182 self.BUTTON_ATCK2 = TRUE;
183 if(random() < 0.03) self.bot_secondary_electromooth = 0;
187 else if (req == WR_THINK)
189 if (self.BUTTON_ATCK)
190 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
193 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
195 if (self.BUTTON_ATCK2)
196 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
199 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_secondary_animtime"), w_ready);
202 else if (req == WR_PRECACHE)
204 precache_model ("models/ebomb.mdl");
205 precache_model ("models/elaser.mdl");
206 precache_model ("models/weapons/g_electro.md3");
207 precache_model ("models/weapons/v_electro.md3");
208 precache_model ("models/weapons/w_electro.zym");
209 precache_sound ("weapons/electro_bounce.wav");
210 precache_sound ("weapons/electro_fire.wav");
211 precache_sound ("weapons/electro_fire2.wav");
212 precache_sound ("weapons/electro_fly.wav");
213 precache_sound ("weapons/electro_impact.wav");
214 precache_sound ("weapons/electro_impact_combo.wav");
216 else if (req == WR_SETUP)
217 weapon_setup(WEP_ELECTRO);
218 else if (req == WR_CHECKAMMO1)
219 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
220 else if (req == WR_CHECKAMMO2)
221 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
222 else if (req == WR_SUICIDEMESSAGE)
224 if(w_deathtype & HITTYPE_SECONDARY)
225 w_deathtypestring = "could not remember where he put plasma";
227 w_deathtypestring = "played with plasma";
229 else if (req == WR_KILLMESSAGE)
231 if(w_deathtype & HITTYPE_SECONDARY)
233 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
234 w_deathtypestring = "just noticed #'s blue ball";
235 else // unchecked: BOUNCE
236 w_deathtypestring = "got in touch with #'s blue ball";
240 if(w_deathtype & HITTYPE_BOUNCE) // combo
241 w_deathtypestring = "felt the electrifying air of #'s combo";
242 else if(w_deathtype & HITTYPE_SPLASH)
243 w_deathtypestring = "got too close to #'s blue beam";
245 w_deathtypestring = "was blasted by #'s blue beam";