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;
40 void W_Plasma_TouchExplode (void)
46 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
50 self.health = self.health - damage;
53 self.takedamage = DAMAGE_NO;
54 self.nextthink = time;
55 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
57 // change owner to whoever caused the combo explosion
58 self.owner = inflictor.owner;
59 self.classname = "plasma_chain";
60 self.think = W_Plasma_Explode_Combo;
61 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
64 self.think = W_Plasma_Explode;
68 void W_Electro_Attack()
72 W_SetupShot (self, FALSE, 2, "weapons/electro_fire.wav");
74 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
77 proj.classname = "plasma_prim";
79 proj.bot_dodge = TRUE;
80 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
81 proj.use = W_Plasma_Explode;
82 proj.think = adaptor_think2use;
83 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
84 proj.solid = SOLID_BBOX;
85 proj.projectiledeathtype = WEP_ELECTRO;
86 setorigin(proj, w_shotorg);
88 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
89 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
90 proj.movetype = MOVETYPE_FLY;
91 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
92 W_SetupProjectileVelocity(proj);
93 proj.angles = vectoangles(proj.velocity);
94 proj.touch = W_Plasma_TouchExplode;
95 proj.flags = FL_PROJECTILE;
97 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
100 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM, TRUE);
103 void W_Electro_Attack2()
107 W_SetupShot (self, FALSE, 2, "weapons/electro_fire2.wav");
109 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
112 proj.classname = "plasma";
114 proj.use = W_Plasma_Explode;
115 proj.think = adaptor_think2use;
116 proj.bot_dodge = TRUE;
117 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
118 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
119 proj.solid = SOLID_BBOX;
120 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
121 setorigin(proj, w_shotorg);
123 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
124 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
125 //proj.glow_size = 50;
126 //proj.glow_color = 45;
127 proj.movetype = MOVETYPE_BOUNCE;
128 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");
129 W_SetupProjectileVelocity(proj);
130 proj.touch = W_Plasma_Touch;
131 setsize(proj, '0 0 -3', '0 0 -3');
132 proj.takedamage = DAMAGE_YES;
133 proj.damageforcescale = 4;
134 proj.health = cvar("g_balance_electro_secondary_health");
135 proj.event_damage = W_Plasma_Damage;
136 proj.flags = FL_PROJECTILE;
141 copyentity(proj, p2);
142 setmodel(p2, "models/ebomb.mdl");
143 setsize(p2, proj.mins, proj.maxs);
146 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO, FALSE); // no culling, it has sound
149 void spawnfunc_weapon_electro (void)
151 weapon_defaultspawnfunc(WEP_ELECTRO);
154 .float bot_secondary_electromooth;
155 float w_electro(float req)
159 self.BUTTON_ATCK=FALSE;
160 self.BUTTON_ATCK2=FALSE;
161 if(vlen(self.origin-self.enemy.origin) > 1000)
162 self.bot_secondary_electromooth = 0;
163 if(self.bot_secondary_electromooth == 0)
165 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
167 self.BUTTON_ATCK = TRUE;
168 if(random() < 0.01) self.bot_secondary_electromooth = 1;
173 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
175 self.BUTTON_ATCK2 = TRUE;
176 if(random() < 0.03) self.bot_secondary_electromooth = 0;
180 else if (req == WR_THINK)
182 if (self.BUTTON_ATCK)
183 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
186 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
188 if (self.BUTTON_ATCK2)
189 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
192 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_electro_secondary_animtime"), w_ready);
195 else if (req == WR_PRECACHE)
197 precache_model ("models/weapons/g_electro.md3");
198 precache_model ("models/weapons/v_electro.md3");
199 precache_model ("models/weapons/h_electro.dpm");
200 precache_sound ("weapons/electro_bounce.wav");
201 precache_sound ("weapons/electro_fire.wav");
202 precache_sound ("weapons/electro_fire2.wav");
203 precache_sound ("weapons/electro_impact_combo.wav");
205 else if (req == WR_SETUP)
206 weapon_setup(WEP_ELECTRO);
207 else if (req == WR_CHECKAMMO1)
208 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
209 else if (req == WR_CHECKAMMO2)
210 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
211 else if (req == WR_SUICIDEMESSAGE)
213 if(w_deathtype & HITTYPE_SECONDARY)
214 w_deathtypestring = "could not remember where he put plasma";
216 w_deathtypestring = "played with plasma";
218 else if (req == WR_KILLMESSAGE)
220 if(w_deathtype & HITTYPE_SECONDARY)
222 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
223 w_deathtypestring = "just noticed #'s blue ball";
224 else // unchecked: BOUNCE
225 w_deathtypestring = "got in touch with #'s blue ball";
229 if(w_deathtype & HITTYPE_BOUNCE) // combo
230 w_deathtypestring = "felt the electrifying air of #'s combo";
231 else if(w_deathtype & HITTYPE_SPLASH)
232 w_deathtypestring = "got too close to #'s blue beam";
234 w_deathtypestring = "was blasted by #'s blue beam";