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)
49 if (other.takedamage == DAMAGE_AIM) {
52 sound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
53 self.projectiledeathtype |= HITTYPE_BOUNCE;
57 void W_Plasma_TouchExplode (void)
59 PROJECTILE_TOUCH_NOSOUND;
63 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
67 self.health = self.health - damage;
70 self.takedamage = DAMAGE_NO;
71 self.nextthink = time;
72 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
74 // change owner to whoever caused the combo explosion
75 self.owner = inflictor.owner;
76 self.classname = "plasma_chain";
77 self.think = W_Plasma_Explode_Combo;
78 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
81 self.think = W_Plasma_Explode;
85 void W_Electro_Attack()
89 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire.wav");
91 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
94 proj.classname = "plasma_prim";
96 proj.bot_dodge = TRUE;
97 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
98 proj.use = W_Plasma_Explode;
99 proj.think = adaptor_think2use;
100 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
101 proj.solid = SOLID_BBOX;
102 proj.projectiledeathtype = WEP_ELECTRO;
103 setorigin(proj, w_shotorg);
105 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
106 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
107 proj.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
108 proj.movetype = MOVETYPE_FLY;
109 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
110 W_SetupProjectileVelocity(proj);
111 proj.angles = vectoangles(proj.velocity);
112 proj.touch = W_Plasma_TouchExplode;
113 proj.flags = FL_PROJECTILE;
114 setmodel(proj, "models/elaser.mdl"); // precision set above
115 setsize(proj, '0 0 0', '0 0 0');
117 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
121 void W_Electro_Attack2()
125 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire2.wav");
127 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
130 proj.classname = "plasma";
132 proj.use = W_Plasma_Explode;
133 proj.think = adaptor_think2use;
134 proj.bot_dodge = TRUE;
135 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
136 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
137 proj.solid = SOLID_BBOX;
138 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
139 setorigin(proj, w_shotorg);
141 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
142 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
143 proj.effects = EF_LOWPRECISION;
144 //proj.glow_size = 50;
145 //proj.glow_color = 45;
146 proj.movetype = MOVETYPE_BOUNCE;
147 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");
148 W_SetupProjectileVelocity(proj);
149 proj.touch = W_Plasma_Touch;
150 setmodel(proj, "models/ebomb.mdl"); // precision set above
151 setsize(proj, '0 0 -3', '0 0 -3');
152 proj.takedamage = DAMAGE_YES;
153 proj.damageforcescale = 4;
154 proj.health = cvar("g_balance_electro_secondary_health");
155 proj.event_damage = W_Plasma_Damage;
156 proj.flags = FL_PROJECTILE;
158 sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
161 void spawnfunc_weapon_electro (void)
163 weapon_defaultspawnfunc(WEP_ELECTRO);
166 .float bot_secondary_electromooth;
167 float w_electro(float req)
171 self.BUTTON_ATCK=FALSE;
172 self.BUTTON_ATCK2=FALSE;
173 if(vlen(self.origin-self.enemy.origin) > 1000)
174 self.bot_secondary_electromooth = 0;
175 if(self.bot_secondary_electromooth == 0)
177 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
179 self.BUTTON_ATCK = TRUE;
180 if(random() < 0.01) self.bot_secondary_electromooth = 1;
185 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
187 self.BUTTON_ATCK2 = TRUE;
188 if(random() < 0.03) self.bot_secondary_electromooth = 0;
192 else if (req == WR_THINK)
194 if (self.BUTTON_ATCK)
195 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
198 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
200 if (self.BUTTON_ATCK2)
201 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
204 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_secondary_animtime"), w_ready);
207 else if (req == WR_PRECACHE)
209 precache_model ("models/ebomb.mdl");
210 precache_model ("models/elaser.mdl");
211 precache_model ("models/weapons/g_electro.md3");
212 precache_model ("models/weapons/v_electro.md3");
213 precache_model ("models/weapons/w_electro.zym");
214 precache_sound ("weapons/electro_bounce.wav");
215 precache_sound ("weapons/electro_fire.wav");
216 precache_sound ("weapons/electro_fire2.wav");
217 precache_sound ("weapons/electro_fly.wav");
218 precache_sound ("weapons/electro_impact.wav");
219 precache_sound ("weapons/electro_impact_combo.wav");
221 else if (req == WR_SETUP)
222 weapon_setup(WEP_ELECTRO);
223 else if (req == WR_CHECKAMMO1)
224 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
225 else if (req == WR_CHECKAMMO2)
226 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
227 else if (req == WR_SUICIDEMESSAGE)
229 if(w_deathtype & HITTYPE_SECONDARY)
230 w_deathtypestring = "could not remember where he put plasma";
232 w_deathtypestring = "played with plasma";
234 else if (req == WR_KILLMESSAGE)
236 if(w_deathtype & HITTYPE_SECONDARY)
238 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
239 w_deathtypestring = "just noticed #'s blue ball";
240 else // unchecked: BOUNCE
241 w_deathtypestring = "got in touch with #'s blue ball";
245 if(w_deathtype & HITTYPE_BOUNCE) // combo
246 w_deathtypestring = "felt the electrifying air of #'s combo";
247 else if(w_deathtype & HITTYPE_SPLASH)
248 w_deathtypestring = "got too close to #'s blue beam";
250 w_deathtypestring = "was blasted by #'s blue beam";