5 void W_Crylink_Touch (void)
10 sound (self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
11 pointparticles(particleeffectnum("crylink_impactbig"), self.origin, '0 0 0', 1);
12 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
16 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
19 RadiusDamage (self, self.realowner, cvar("g_balance_crylink_primary_damage") * f, cvar("g_balance_crylink_primary_edgedamage") * f, cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force") * f, self.projectiledeathtype, other);
25 self.cnt = self.cnt - 1;
26 self.angles = vectoangles(self.velocity);
28 self.projectiledeathtype |= HITTYPE_BOUNCE;
29 //self.scale = 1 + self.cnt;
31 UpdateCSQCProjectile(self);
34 void W_Crylink_Touch2 (void)
39 sound (self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
40 pointparticles(particleeffectnum("crylink_impact"), self.origin, '0 0 0', 1);
41 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
45 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
48 RadiusDamage (self, self.realowner, cvar("g_balance_crylink_secondary_damage") * f, cvar("g_balance_crylink_secondary_edgedamage") * f, cvar("g_balance_crylink_secondary_radius"), world, cvar("g_balance_crylink_secondary_force") * f, self.projectiledeathtype, other);
54 self.cnt = self.cnt - 1;
55 self.angles = vectoangles(self.velocity);
57 self.projectiledeathtype |= HITTYPE_BOUNCE;
58 // self.scale = 1 + 1 * self.cnt;
60 UpdateCSQCProjectile(self);
63 void W_Crylink_Attack (void)
65 local float counter, shots;
68 vector forward, right, up;
70 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
71 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
73 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/crylink_fire.wav");
78 shots = cvar("g_balance_crylink_primary_shots");
79 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
80 while (counter < shots)
83 proj.realowner = proj.owner = self;
84 proj.classname = "spike";
85 proj.bot_dodge = TRUE;
86 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
88 proj.movetype = MOVETYPE_BOUNCEMISSILE;
89 proj.solid = SOLID_BBOX;
90 proj.projectiledeathtype = WEP_CRYLINK;
91 //proj.gravity = 0.001;
93 setmodel (proj, "models/plasmatrail.mdl"); // precision set below
94 setsize (proj, '0 0 0', '0 0 0');
95 setorigin (proj, w_shotorg);
103 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
107 s = s * cvar("g_balance_crylink_primary_spread");
108 proj.velocity = (w_shotdir + right * s_y + up * s_z) * cvar("g_balance_crylink_primary_speed");
109 // proj.velocity = (w_shotdir + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
110 W_SetupProjectileVelocity(proj);
111 proj.touch = W_Crylink_Touch;
113 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_middle_lifetime"), cvar("g_balance_crylink_primary_middle_fadetime"));
114 else if(counter <= 3)
115 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_star_lifetime"), cvar("g_balance_crylink_primary_star_fadetime"));
117 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_other_lifetime"), cvar("g_balance_crylink_primary_other_fadetime"));
118 proj.cnt = cvar("g_balance_crylink_primary_bounces");
119 proj.scale = 1 + 1 * proj.cnt;
121 proj.angles = vectoangles (proj.velocity);
123 //proj.glow_size = 20;
125 proj.effects = EF_LOWPRECISION;
126 proj.flags = FL_PROJECTILE;
128 CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK);
130 counter = counter + 1;
134 void W_Crylink_Attack2 (void)
136 local float counter, shots;
139 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
140 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
142 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/crylink_fire2.wav");
144 shots = cvar("g_balance_crylink_secondary_shots");
145 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
146 while (counter < shots)
149 proj.realowner = proj.owner = self;
150 proj.classname = "spike";
151 proj.bot_dodge = TRUE;
152 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
154 proj.movetype = MOVETYPE_BOUNCEMISSILE;
155 proj.solid = SOLID_BBOX;
156 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
157 //proj.gravity = 0.001;
159 setmodel (proj, "models/plasmatrail.mdl"); // precision set below
160 setsize (proj, '0 0 0', '0 0 0');
161 setorigin (proj, w_shotorg);
163 proj.velocity = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
164 W_SetupProjectileVelocity(proj);
165 proj.touch = W_Crylink_Touch2;
166 if(counter == (shots - 1) / 2)
167 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_middle_lifetime"), cvar("g_balance_crylink_secondary_middle_fadetime"));
169 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_line_lifetime"), cvar("g_balance_crylink_secondary_line_fadetime"));
170 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
171 proj.scale = 1 + 1 * proj.cnt;
173 proj.angles = vectoangles (proj.velocity);
175 //proj.glow_size = 20;
177 proj.effects = EF_LOWPRECISION;
178 proj.flags = FL_PROJECTILE;
180 CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK);
182 counter = counter + 1;
188 // experimental lightning gun
189 void W_Crylink_Attack3 (void)
191 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
192 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
193 W_SetupShot (self, '25 8 -8', TRUE, 0, "weapons/crylink_fire.wav");
195 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * 1000, FALSE, self, self.ping * 0.001);
197 pointparticles(particleeffectnum("lightning_muzzleflash", w_shotorg, w_shotdir * 1000, 1);
198 pointparticles(particleeffectnum("lightning_impact", trace_endpos, trace_plane_normal * 1000, 1);
199 trailparticles(world, particleeffectnum("lightning_beam", w_shotorg, trace_endpos);
201 if (trace_fraction < 1)
202 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), WEP_CRYLINK | HITTYPE_SECONDARY, trace_endpos, '0 0 0');
206 void spawnfunc_weapon_crylink (void)
208 weapon_defaultspawnfunc(WEP_CRYLINK);
211 float w_crylink(float req)
216 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
218 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
220 else if (req == WR_THINK)
222 if (self.BUTTON_ATCK)
223 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
226 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
228 if (self.BUTTON_ATCK2)
229 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
232 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
235 else if (req == WR_PRECACHE)
237 precache_model ("models/plasma.mdl");
238 precache_model ("models/plasmatrail.mdl");
239 precache_model ("models/weapons/g_crylink.md3");
240 precache_model ("models/weapons/v_crylink.md3");
241 precache_model ("models/weapons/w_crylink.zym");
242 precache_sound ("weapons/crylink_fire.wav");
243 precache_sound ("weapons/crylink_fire2.wav");
244 precache_sound ("weapons/crylink_impact.wav");
245 precache_sound ("weapons/crylink_impact2.wav");
247 else if (req == WR_SETUP)
248 weapon_setup(WEP_CRYLINK);
249 else if (req == WR_CHECKAMMO1)
250 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
251 else if (req == WR_CHECKAMMO2)
252 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
253 else if (req == WR_SUICIDEMESSAGE)
255 w_deathtypestring = "succeeded at self-destructing himself with the Crylink";
257 else if (req == WR_KILLMESSAGE)
259 if(w_deathtype & HITTYPE_BOUNCE)
260 w_deathtypestring = "could not hide from #'s Crylink"; // unchecked: SPLASH (SECONDARY can't be)
261 else if(w_deathtype & HITTYPE_SPLASH)
262 w_deathtypestring = "was too close to #'s Crylink"; // unchecked: SECONDARY
264 w_deathtypestring = "took a close look at #'s Crylink"; // unchecked: SECONDARY