2 void W_Plasma_Explode (void)
6 if(other.takedamage == DAMAGE_AIM)
7 if(other.classname == "player")
8 if(IsDifferentTeam(self.owner, other))
10 announce(self.owner, "announcer/male/electrobitch.wav");
12 self.event_damage = SUB_Null;
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, other); // use THIS type for a combo because primary can't bounce
31 void W_Plasma_Touch (void)
34 if (other.takedamage == DAMAGE_AIM) {
37 sound (self, CHAN_PROJECTILE, "weapons/electro_bounce.wav", VOL_BASE, ATTN_NORM);
38 self.projectiledeathtype |= HITTYPE_BOUNCE;
41 if(trace_ent && trace_ent.solid > SOLID_TRIGGER) // CSQC doesn't know about these entities well enough
42 UpdateCSQCProjectile(self);
45 void W_Plasma_TouchExplode (void)
51 void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
55 self.health = self.health - damage;
58 self.takedamage = DAMAGE_NO;
59 self.nextthink = time;
60 if (inflictor.classname == "plasma_chain" || inflictor.classname == "plasma_prim")
62 // change owner to whoever caused the combo explosion
63 self.owner = inflictor.owner;
64 self.classname = "plasma_chain";
65 self.think = W_Plasma_Explode_Combo;
66 self.nextthink = time + vlen(self.origin - inflictor.origin) / cvar("g_balance_electro_combo_speed"); // delay combo chains, looks cooler
69 self.think = W_Plasma_Explode;
73 void W_Electro_Attack()
77 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire.wav");
79 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
82 proj.classname = "plasma_prim";
84 proj.bot_dodge = TRUE;
85 proj.bot_dodgerating = cvar("g_balance_electro_primary_damage");
86 proj.use = W_Plasma_Explode;
87 proj.think = adaptor_think2use;
88 proj.nextthink = time + cvar("g_balance_electro_primary_lifetime");
89 proj.solid = SOLID_BBOX;
90 proj.projectiledeathtype = WEP_ELECTRO;
91 setorigin(proj, w_shotorg);
93 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
94 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_primary_ammo");
95 proj.movetype = MOVETYPE_FLY;
96 proj.velocity = w_shotdir * cvar("g_balance_electro_primary_speed");
97 W_SetupProjectileVelocity(proj);
98 proj.angles = vectoangles(proj.velocity);
99 proj.touch = W_Plasma_TouchExplode;
100 proj.flags = FL_PROJECTILE;
101 setmodel(proj, "null"); // precision set above
102 setsize(proj, '0 0 0', '0 0 0');
104 //sound (proj, CHAN_PAIN, "weapons/electro_fly.wav", VOL_BASE, ATTN_NORM);
107 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO_BEAM);
110 void W_Electro_Attack2()
114 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/electro_fire2.wav");
116 pointparticles(particleeffectnum("electro_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
119 proj.classname = "plasma";
121 proj.use = W_Plasma_Explode;
122 proj.think = adaptor_think2use;
123 proj.bot_dodge = TRUE;
124 proj.bot_dodgerating = cvar("g_balance_electro_secondary_damage");
125 proj.nextthink = time + cvar("g_balance_electro_secondary_lifetime");
126 proj.solid = SOLID_BBOX;
127 proj.projectiledeathtype = WEP_ELECTRO | HITTYPE_SECONDARY;
128 setorigin(proj, w_shotorg);
130 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
131 self.ammo_cells = self.ammo_cells - cvar("g_balance_electro_secondary_ammo");
132 //proj.glow_size = 50;
133 //proj.glow_color = 45;
134 proj.movetype = MOVETYPE_BOUNCE;
135 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");
136 W_SetupProjectileVelocity(proj);
137 proj.touch = W_Plasma_Touch;
138 setmodel(proj, "null"); // precision set above
139 setsize(proj, '0 0 -3', '0 0 -3');
140 proj.takedamage = DAMAGE_YES;
141 proj.damageforcescale = 4;
142 proj.health = cvar("g_balance_electro_secondary_health");
143 proj.event_damage = W_Plasma_Damage;
144 proj.flags = FL_PROJECTILE;
146 CSQCProjectile(proj, TRUE, PROJECTILE_ELECTRO);
147 proj.effects = EF_NODEPTHTEST;
150 void spawnfunc_weapon_electro (void)
152 weapon_defaultspawnfunc(WEP_ELECTRO);
155 .float bot_secondary_electromooth;
156 float w_electro(float req)
160 self.BUTTON_ATCK=FALSE;
161 self.BUTTON_ATCK2=FALSE;
162 if(vlen(self.origin-self.enemy.origin) > 1000)
163 self.bot_secondary_electromooth = 0;
164 if(self.bot_secondary_electromooth == 0)
166 if(bot_aim(cvar("g_balance_electro_primary_speed"), 0, cvar("g_balance_electro_primary_lifetime"), FALSE))
168 self.BUTTON_ATCK = TRUE;
169 if(random() < 0.01) self.bot_secondary_electromooth = 1;
174 if(bot_aim(cvar("g_balance_electro_secondary_speed"), cvar("g_balance_grenadelauncher_secondary_speed_up"), cvar("g_balance_electro_secondary_lifetime"), TRUE))
176 self.BUTTON_ATCK2 = TRUE;
177 if(random() < 0.03) self.bot_secondary_electromooth = 0;
181 else if (req == WR_THINK)
183 if (self.BUTTON_ATCK)
184 if (weapon_prepareattack(0, cvar("g_balance_electro_primary_refire")))
187 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_primary_animtime"), w_ready);
189 if (self.BUTTON_ATCK2)
190 if (weapon_prepareattack(1, cvar("g_balance_electro_secondary_refire")))
193 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_secondary_animtime"), w_ready);
196 else if (req == WR_PRECACHE)
198 precache_model ("models/weapons/g_electro.md3");
199 precache_model ("models/weapons/v_electro.md3");
200 precache_model ("models/weapons/w_electro.zym");
201 precache_sound ("weapons/electro_bounce.wav");
202 precache_sound ("weapons/electro_fire.wav");
203 precache_sound ("weapons/electro_fire2.wav");
204 precache_sound ("weapons/electro_impact_combo.wav");
206 else if (req == WR_SETUP)
207 weapon_setup(WEP_ELECTRO);
208 else if (req == WR_CHECKAMMO1)
209 return self.ammo_cells >= cvar("g_balance_electro_primary_ammo");
210 else if (req == WR_CHECKAMMO2)
211 return self.ammo_cells >= cvar("g_balance_electro_secondary_ammo");
212 else if (req == WR_SUICIDEMESSAGE)
214 if(w_deathtype & HITTYPE_SECONDARY)
215 w_deathtypestring = "could not remember where he put plasma";
217 w_deathtypestring = "played with plasma";
219 else if (req == WR_KILLMESSAGE)
221 if(w_deathtype & HITTYPE_SECONDARY)
223 if(w_deathtype & HITTYPE_SPLASH) // unchecked: BOUNCE
224 w_deathtypestring = "just noticed #'s blue ball";
225 else // unchecked: BOUNCE
226 w_deathtypestring = "got in touch with #'s blue ball";
230 if(w_deathtype & HITTYPE_BOUNCE) // combo
231 w_deathtypestring = "felt the electrifying air of #'s combo";
232 else if(w_deathtype & HITTYPE_SPLASH)
233 w_deathtypestring = "got too close to #'s blue beam";
235 w_deathtypestring = "was blasted by #'s blue beam";