2 void W_Plasma_Explode (void)
4 if(other.takedamage == DAMAGE_AIM)
5 if(other.classname == "player")
6 if(IsDifferentTeam(self.owner, other))
7 if(other.deadflag == DEAD_NO)
9 announce(self.owner, "announcer/male/electrobitch.wav");
11 self.event_damage = SUB_Null;
12 self.takedamage = DAMAGE_NO;
13 if (self.movetype == MOVETYPE_BOUNCE)
15 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);
19 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 void W_Plasma_Explode_Combo (void) {
26 self.event_damage = SUB_Null;
27 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, world); // use THIS type for a combo because primary can't bounce
31 void W_Plasma_Touch (void)
34 if (other.takedamage == DAMAGE_AIM) {
37 spamsound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
38 self.projectiledeathtype |= HITTYPE_BOUNCE;
42 void W_Plasma_TouchExplode (void)
48 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
52 self.health = self.health - damage;
55 self.takedamage = DAMAGE_NO;
56 self.nextthink = time;
57 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
59 // change owner to whoever caused the combo explosion
60 self.owner = inflictor.owner;
61 self.classname = "plasma_chain";
62 self.think = W_Plasma_Explode_Combo;
63 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
66 self.think = W_Plasma_Explode;
70 void W_Electro_Attack()
74 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire.wav", cvar("g_balance_electro_primary_damage"));
76 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
79 proj.classname = "plasma_prim";
81 proj.bot_dodge = TRUE;
82 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
83 proj.use = W_Plasma_Explode;
84 proj.think = adaptor_think2use;
85 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
86 PROJECTILE_MAKETRIGGER(proj);
87 proj.projectiledeathtype = WEP_ELECTRO;
88 setorigin(proj, w_shotorg);
90 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
91 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
92 proj.movetype = MOVETYPE_FLY;
93 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
94 W_SetupProjectileVelocity(proj);
95 proj.angles = vectoangles(proj.velocity);
96 proj.touch = W_Plasma_TouchExplode;
97 setsize(proj, '0 0 -3', '0 0 -3');
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_ProjectileSize (self, '0 0 -3', '0 0 -3', FALSE, 2, "weapons/electro_fire2.wav", cvar("g_balance_electro_secondary_damage"));
111 w_shotdir = v_forward; // no TrueAim for grenades please
113 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
116 proj.classname = "plasma";
118 proj.use = W_Plasma_Explode;
119 proj.think = adaptor_think2use;
120 proj.bot_dodge = TRUE;
121 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
122 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
123 PROJECTILE_MAKETRIGGER(proj);
124 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
125 setorigin(proj, w_shotorg);
127 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
128 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
129 //proj.glow_size = 50;
130 //proj.glow_color = 45;
131 proj.movetype = MOVETYPE_BOUNCE;
132 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");
133 W_SetupProjectileVelocity(proj);
134 proj.touch = W_Plasma_Touch;
135 setsize(proj, '0 0 -3', '0 0 -3');
136 proj.takedamage = DAMAGE_YES;
137 proj.damageforcescale = cvar("g_balance_electro_secondary_damageforcescale");
138 proj.health = cvar("g_balance_electro_secondary_health");
139 proj.event_damage = W_Plasma_Damage;
140 proj.flags = FL_PROJECTILE;
145 copyentity(proj, p2);
146 setmodel(p2, "models/ebomb.mdl");
147 setsize(p2, proj.mins, proj.maxs);
150 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
153 void spawnfunc_weapon_electro (void)
155 weapon_defaultspawnfunc(WEP_ELECTRO);
158 .float bot_secondary_electromooth;
159 float w_electro(float req)
163 self.BUTTON_ATCK=FALSE;
164 self.BUTTON_ATCK2=FALSE;
165 if(vlen(self.origin-self.enemy.origin) > 1000)
166 self.bot_secondary_electromooth = 0;
167 if(self.bot_secondary_electromooth == 0)
169 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
171 self.BUTTON_ATCK = TRUE;
172 if(random() < 0.01) self.bot_secondary_electromooth = 1;
177 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
179 self.BUTTON_ATCK2 = TRUE;
180 if(random() < 0.03) self.bot_secondary_electromooth = 0;
184 else if (req == WR_THINK)
186 if (self.BUTTON_ATCK)
187 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
190 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
192 if (self.BUTTON_ATCK2)
193 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
196 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_electro_secondary_animtime"), w_ready);
199 else if (req == WR_PRECACHE)
201 precache_model ("models/weapons/g_electro.md3");
202 precache_model ("models/weapons/v_electro.md3");
203 precache_model ("models/weapons/h_electro.dpm");
204 precache_sound ("weapons/electro_bounce.wav");
205 precache_sound ("weapons/electro_fire.wav");
206 precache_sound ("weapons/electro_fire2.wav");
207 precache_sound ("weapons/electro_impact.wav");
208 precache_sound ("weapons/electro_impact_combo.wav");
210 else if (req == WR_SETUP)
211 weapon_setup(WEP_ELECTRO);
212 else if (req == WR_CHECKAMMO1)
213 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
214 else if (req == WR_CHECKAMMO2)
215 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
216 else if (req == WR_SUICIDEMESSAGE)
218 if(w_deathtype & HITTYPE_SECONDARY)
219 w_deathtypestring = "could not remember where he put plasma";
221 w_deathtypestring = "played with plasma";
223 else if (req == WR_KILLMESSAGE)
225 if(w_deathtype & HITTYPE_SECONDARY)
227 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
228 w_deathtypestring = "just noticed #'s blue ball";
229 else // unchecked: BOUNCE
230 w_deathtypestring = "got in touch with #'s blue ball";
234 if(w_deathtype & HITTYPE_BOUNCE) // combo
235 w_deathtypestring = "felt the electrifying air of #'s combo";
236 else if(w_deathtype & HITTYPE_SPLASH)
237 w_deathtypestring = "got too close to #'s blue beam";
239 w_deathtypestring = "was blasted by #'s blue beam";