2 REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "crylink", "crylink", "Crylink");
12 // force projectile to explode
13 void W_Crylink_LinkExplode (entity e, entity e2)
16 a = bound(0, 1 - (time - e.fade_time) * e.fade_rate, 1);
18 RadiusDamage (e, e.realowner, cvar("g_balance_crylink_primary_damage") * a, cvar("g_balance_crylink_primary_edgedamage") * a, cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force") * a, e.projectiledeathtype, other);
21 W_Crylink_LinkExplode(e.queuenext, e2);
25 // NO bounce protection, as bounces are limited!
26 void W_Crylink_Touch (void)
31 local entity savenext, saveprev;
32 savenext = self.queuenext;
33 saveprev = self.queueprev;
34 if(WarpZone_Projectile_Touch())
38 savenext.queueprev = saveprev;
39 saveprev.queuenext = savenext;
45 a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1);
47 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
51 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
54 if (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) || finalhit)
56 W_Crylink_LinkExplode(self.queuenext, self);
60 self.cnt = self.cnt - 1;
61 self.angles = vectoangles(self.velocity);
63 self.projectiledeathtype |= HITTYPE_BOUNCE;
64 // commented out as it causes a little hitch...
66 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
69 void W_Crylink_Touch2 (void)
74 local entity savenext, saveprev;
75 savenext = self.queuenext;
76 saveprev = self.queueprev;
77 if(WarpZone_Projectile_Touch())
81 savenext.queueprev = saveprev;
82 saveprev.queuenext = savenext;
88 a = 1 - (time - self.fade_time) * self.fade_rate;
90 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
94 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
97 if (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) || finalhit)
99 W_Crylink_LinkExplode(self.queuenext, self);
103 self.cnt = self.cnt - 1;
104 self.angles = vectoangles(self.velocity);
106 self.projectiledeathtype |= HITTYPE_BOUNCE;
107 // commented out as it causes a little hitch...
109 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
112 void W_Crylink_Fadethink (void)
114 self.queuenext.queueprev = self.queueprev;
115 self.queueprev.queuenext = self.queuenext;
119 void W_Crylink_Attack (void)
121 local float counter, shots;
122 local entity proj, prevproj, firstproj;
124 vector forward, right, up;
126 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
127 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
129 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
134 shots = cvar("g_balance_crylink_primary_shots");
135 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
136 while (counter < shots)
139 proj.realowner = proj.owner = self;
140 proj.classname = "spike";
141 proj.bot_dodge = TRUE;
142 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
143 if(counter == 0) { // first projectile, store in firstproj for now
146 else if(counter == shots - 1) { // last projectile, link up with first projectile
147 prevproj.queuenext = proj;
148 firstproj.queueprev = proj;
149 proj.queuenext = firstproj;
150 proj.queueprev = prevproj;
152 else { // else link up with previous projectile
153 prevproj.queuenext = proj;
154 proj.queueprev = prevproj;
159 proj.movetype = MOVETYPE_BOUNCEMISSILE;
160 PROJECTILE_MAKETRIGGER(proj);
161 proj.projectiledeathtype = WEP_CRYLINK;
162 //proj.gravity = 0.001;
164 setorigin (proj, w_shotorg);
165 setsize(proj, '0 0 0', '0 0 0');
173 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
177 s = s * cvar("g_balance_crylink_primary_spread") * g_weaponspreadfactor;
178 W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0, 0);
179 proj.touch = W_Crylink_Touch;
181 proj.think = W_Crylink_Fadethink;
184 proj.fade_time = time + cvar("g_balance_crylink_primary_middle_lifetime");
185 self.fade_rate = 1 / cvar("g_balance_crylink_primary_middle_fadetime");
186 proj.nextthink = time + cvar("g_balance_crylink_primary_middle_lifetime") + cvar("g_balance_crylink_primary_middle_fadetime");
188 else if(counter <= 3)
190 proj.fade_time = time + cvar("g_balance_crylink_primary_star_lifetime");
191 self.fade_rate = 1 / cvar("g_balance_crylink_primary_star_fadetime");
192 proj.nextthink = time + cvar("g_balance_crylink_primary_star_lifetime") + cvar("g_balance_crylink_primary_star_fadetime");
196 proj.fade_time = time + cvar("g_balance_crylink_primary_other_lifetime");
197 self.fade_rate = 1 / cvar("g_balance_crylink_primary_other_fadetime");
198 proj.nextthink = time + cvar("g_balance_crylink_primary_other_lifetime") + cvar("g_balance_crylink_primary_other_fadetime");
200 proj.cnt = cvar("g_balance_crylink_primary_bounces");
201 //proj.scale = 1 + 1 * proj.cnt;
203 proj.angles = vectoangles (proj.velocity);
205 //proj.glow_size = 20;
207 proj.flags = FL_PROJECTILE;
209 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
211 counter = counter + 1;
215 void W_Crylink_Attack2 (void)
217 local float counter, shots;
218 local entity proj, prevproj, firstproj;
220 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
221 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
223 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
225 shots = cvar("g_balance_crylink_secondary_shots");
226 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
227 while (counter < shots)
230 proj.realowner = proj.owner = self;
231 proj.classname = "spike";
232 proj.bot_dodge = TRUE;
233 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
234 if(counter == 0) { // first projectile, store in firstproj for now
237 else if(counter == shots - 1) { // last projectile, link up with first projectile
238 prevproj.queuenext = proj;
239 firstproj.queueprev = proj;
240 proj.queuenext = firstproj;
241 proj.queueprev = prevproj;
243 else { // else link up with previous projectile
244 prevproj.queuenext = proj;
245 proj.queueprev = prevproj;
250 proj.movetype = MOVETYPE_BOUNCEMISSILE;
251 PROJECTILE_MAKETRIGGER(proj);
252 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
253 //proj.gravity = 0.001;
255 setorigin (proj, w_shotorg);
256 setsize(proj, '0 0 0', '0 0 0');
258 W_SetupProjectileVelocityEx(proj, (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread") * g_weaponspreadfactor), v_up, cvar("g_balance_crylink_secondary_speed"), 0, 0, 0);
259 proj.touch = W_Crylink_Touch2;
260 proj.think = W_Crylink_Fadethink;
261 if(counter == (shots - 1) / 2)
263 proj.fade_time = time + cvar("g_balance_crylink_secondary_middle_lifetime");
264 self.fade_rate = 1 / cvar("g_balance_crylink_secondary_middle_fadetime");
265 proj.nextthink = time + cvar("g_balance_crylink_secondary_middle_lifetime") + cvar("g_balance_crylink_secondary_middle_fadetime");
269 proj.fade_time = time + cvar("g_balance_crylink_secondary_line_lifetime");
270 self.fade_rate = 1 / cvar("g_balance_crylink_secondary_line_fadetime");
271 proj.nextthink = time + cvar("g_balance_crylink_secondary_line_lifetime") + cvar("g_balance_crylink_secondary_line_fadetime");
273 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
274 //proj.scale = 1 + 1 * proj.cnt;
276 proj.angles = vectoangles (proj.velocity);
278 //proj.glow_size = 20;
280 proj.flags = FL_PROJECTILE;
282 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
284 counter = counter + 1;
288 void spawnfunc_weapon_crylink (void)
290 weapon_defaultspawnfunc(WEP_CRYLINK);
293 float w_crylink(float req)
298 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
300 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
302 else if (req == WR_THINK)
304 if (self.BUTTON_ATCK)
305 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
308 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
310 if (self.BUTTON_ATCK2 && cvar("g_balance_crylink_secondary"))
311 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
314 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
317 else if (req == WR_PRECACHE)
319 precache_model ("models/weapons/g_crylink.md3");
320 precache_model ("models/weapons/v_crylink.md3");
321 precache_model ("models/weapons/h_crylink.iqm");
322 precache_sound ("weapons/crylink_fire.wav");
323 precache_sound ("weapons/crylink_fire2.wav");
325 else if (req == WR_SETUP)
326 weapon_setup(WEP_CRYLINK);
327 else if (req == WR_CHECKAMMO1)
328 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
329 else if (req == WR_CHECKAMMO2)
330 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
335 float w_crylink(float req)
337 if(req == WR_IMPACTEFFECT)
340 org2 = w_org + w_backoff * 2;
341 if(w_deathtype & HITTYPE_SECONDARY)
343 pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
345 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
349 pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
351 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
354 else if(req == WR_PRECACHE)
356 precache_sound("weapons/crylink_impact2.wav");
357 precache_sound("weapons/crylink_impact.wav");
359 else if (req == WR_SUICIDEMESSAGE)
361 w_deathtypestring = "%s succeeded at self-destructing themself with the Crylink";
363 else if (req == WR_KILLMESSAGE)
365 if(w_deathtype & HITTYPE_BOUNCE)
366 w_deathtypestring = "%s could not hide from %s's Crylink"; // unchecked: SPLASH (SECONDARY can't be)
367 else if(w_deathtype & HITTYPE_SPLASH)
368 w_deathtypestring = "%s was too close to %s's Crylink"; // unchecked: SECONDARY
370 w_deathtypestring = "%s took a close look at %s's Crylink"; // unchecked: SECONDARY