2 void W_Plasma_Explode (void)
4 if(other.takedamage == DAMAGE_AIM)
5 if(other.classname == "player")
6 if(IsDifferentTeam(self.owner, other))
8 announce(self.owner, "announcer/male/electrobitch.wav");
10 self.event_damage = SUB_Null;
11 if (self.movetype == MOVETYPE_BOUNCE)
13 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);
17 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);
23 void W_Plasma_Explode_Combo (void) {
24 self.event_damage = SUB_Null;
25 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
29 void W_Plasma_Touch (void)
32 if (other.takedamage == DAMAGE_AIM) {
35 sound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
36 self.projectiledeathtype |= HITTYPE_BOUNCE;
39 if(trace_ent && trace_ent.solid > SOLID_TRIGGER) // CSQC doesn't know about these entities well enough
40 UpdateCSQCProjectile(self);
43 void W_Plasma_TouchExplode (void)
49 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
53 self.health = self.health - damage;
56 self.takedamage = DAMAGE_NO;
57 self.nextthink = time;
58 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
60 // change owner to whoever caused the combo explosion
61 self.owner = inflictor.owner;
62 self.classname = "plasma_chain";
63 self.think = W_Plasma_Explode_Combo;
64 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
67 self.think = W_Plasma_Explode;
71 void W_Electro_Attack()
75 W_SetupShot (self, FALSE, 2, "weapons/electro_fire.wav");
77 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
80 proj.classname = "plasma_prim";
82 proj.bot_dodge = TRUE;
83 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
84 proj.use = W_Plasma_Explode;
85 proj.think = adaptor_think2use;
86 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
87 proj.solid = SOLID_BBOX;
88 proj.projectiledeathtype = WEP_ELECTRO;
89 setorigin(proj, w_shotorg);
91 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
92 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
93 proj.movetype = MOVETYPE_FLY;
94 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
95 W_SetupProjectileVelocity(proj);
96 proj.angles = vectoangles(proj.velocity);
97 proj.touch = W_Plasma_TouchExplode;
98 proj.flags = FL_PROJECTILE;
100 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
103 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
106 void W_Electro_Attack2()
110 W_SetupShot (self, FALSE, 2, "weapons/electro_fire2.wav");
112 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
115 proj.classname = "plasma";
117 proj.use = W_Plasma_Explode;
118 proj.think = adaptor_think2use;
119 proj.bot_dodge = TRUE;
120 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
121 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
122 proj.solid = SOLID_BBOX;
123 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
124 setorigin(proj, w_shotorg);
126 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
127 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
128 //proj.glow_size = 50;
129 //proj.glow_color = 45;
130 proj.movetype = MOVETYPE_BOUNCE;
131 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");
132 W_SetupProjectileVelocity(proj);
133 proj.touch = W_Plasma_Touch;
134 setsize(proj, '0 0 -3', '0 0 -3');
135 proj.takedamage = DAMAGE_YES;
136 proj.damageforcescale = 4;
137 proj.health = cvar("g_balance_electro_secondary_health");
138 proj.event_damage = W_Plasma_Damage;
139 proj.flags = FL_PROJECTILE;
144 copyentity(proj, p2);
145 setmodel(p2, "models/ebomb.mdl");
146 setsize(p2, proj.mins, proj.maxs);
149 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
152 void spawnfunc_weapon_electro (void)
154 weapon_defaultspawnfunc(WEP_ELECTRO);
157 .float bot_secondary_electromooth;
158 float w_electro(float req)
162 self.BUTTON_ATCK=FALSE;
163 self.BUTTON_ATCK2=FALSE;
164 if(vlen(self.origin-self.enemy.origin) > 1000)
165 self.bot_secondary_electromooth = 0;
166 if(self.bot_secondary_electromooth == 0)
168 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
170 self.BUTTON_ATCK = TRUE;
171 if(random() < 0.01) self.bot_secondary_electromooth = 1;
176 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
178 self.BUTTON_ATCK2 = TRUE;
179 if(random() < 0.03) self.bot_secondary_electromooth = 0;
183 else if (req == WR_THINK)
185 if (self.BUTTON_ATCK)
186 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
189 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
191 if (self.BUTTON_ATCK2)
192 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
195 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_electro_secondary_animtime"), w_ready);
198 else if (req == WR_PRECACHE)
200 precache_model ("models/weapons/g_electro.md3");
201 precache_model ("models/weapons/v_electro.md3");
202 precache_model ("models/weapons/w_electro.zym");
203 precache_sound ("weapons/electro_bounce.wav");
204 precache_sound ("weapons/electro_fire.wav");
205 precache_sound ("weapons/electro_fire2.wav");
206 precache_sound ("weapons/electro_impact_combo.wav");
208 else if (req == WR_SETUP)
209 weapon_setup(WEP_ELECTRO);
210 else if (req == WR_CHECKAMMO1)
211 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
212 else if (req == WR_CHECKAMMO2)
213 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
214 else if (req == WR_SUICIDEMESSAGE)
216 if(w_deathtype & HITTYPE_SECONDARY)
217 w_deathtypestring = "could not remember where he put plasma";
219 w_deathtypestring = "played with plasma";
221 else if (req == WR_KILLMESSAGE)
223 if(w_deathtype & HITTYPE_SECONDARY)
225 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
226 w_deathtypestring = "just noticed #'s blue ball";
227 else // unchecked: BOUNCE
228 w_deathtypestring = "got in touch with #'s blue ball";
232 if(w_deathtype & HITTYPE_BOUNCE) // combo
233 w_deathtypestring = "felt the electrifying air of #'s combo";
234 else if(w_deathtype & HITTYPE_SPLASH)
235 w_deathtypestring = "got too close to #'s blue beam";
237 w_deathtypestring = "was blasted by #'s blue beam";