2 REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "crylink", "crylink", "Crylink");
9 // NO bounce protection, as bounces are limited!
10 void W_Crylink_Touch (void)
15 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
19 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
22 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);
28 self.cnt = self.cnt - 1;
29 self.angles = vectoangles(self.velocity);
31 self.projectiledeathtype |= HITTYPE_BOUNCE;
32 // commented out as it causes a little hitch...
34 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
37 void W_Crylink_Touch2 (void)
42 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
46 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
49 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);
55 self.cnt = self.cnt - 1;
56 self.angles = vectoangles(self.velocity);
58 self.projectiledeathtype |= HITTYPE_BOUNCE;
59 // commented out as it causes a little hitch...
61 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
64 void W_Crylink_Attack (void)
66 local float counter, shots;
69 vector forward, right, up;
71 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
72 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
74 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
79 shots = cvar("g_balance_crylink_primary_shots");
80 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
81 while (counter < shots)
84 proj.realowner = proj.owner = self;
85 proj.classname = "spike";
86 proj.bot_dodge = TRUE;
87 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
89 proj.movetype = MOVETYPE_BOUNCEMISSILE;
90 PROJECTILE_MAKETRIGGER(proj);
91 proj.projectiledeathtype = WEP_CRYLINK;
92 //proj.gravity = 0.001;
94 setorigin (proj, w_shotorg);
95 setsize(proj, '0 0 0', '0 0 0');
103 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
107 s = s * cvar("g_balance_crylink_primary_spread") * g_weaponspreadfactor;
108 W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0, 0);
109 proj.touch = W_Crylink_Touch;
111 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_middle_lifetime"), cvar("g_balance_crylink_primary_middle_fadetime"));
112 else if(counter <= 3)
113 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_star_lifetime"), cvar("g_balance_crylink_primary_star_fadetime"));
115 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_other_lifetime"), cvar("g_balance_crylink_primary_other_fadetime"));
116 proj.cnt = cvar("g_balance_crylink_primary_bounces");
117 //proj.scale = 1 + 1 * proj.cnt;
119 proj.angles = vectoangles (proj.velocity);
121 //proj.glow_size = 20;
123 proj.flags = FL_PROJECTILE;
125 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
127 counter = counter + 1;
131 void W_Crylink_Attack2 (void)
133 local float counter, shots;
136 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
137 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
139 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
141 shots = cvar("g_balance_crylink_secondary_shots");
142 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
143 while (counter < shots)
146 proj.realowner = proj.owner = self;
147 proj.classname = "spike";
148 proj.bot_dodge = TRUE;
149 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
151 proj.movetype = MOVETYPE_BOUNCEMISSILE;
152 PROJECTILE_MAKETRIGGER(proj);
153 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
154 //proj.gravity = 0.001;
156 setorigin (proj, w_shotorg);
157 setsize(proj, '0 0 0', '0 0 0');
159 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);
160 proj.touch = W_Crylink_Touch2;
161 if(counter == (shots - 1) / 2)
162 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_middle_lifetime"), cvar("g_balance_crylink_secondary_middle_fadetime"));
164 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_line_lifetime"), cvar("g_balance_crylink_secondary_line_fadetime"));
165 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
166 //proj.scale = 1 + 1 * proj.cnt;
168 proj.angles = vectoangles (proj.velocity);
170 //proj.glow_size = 20;
172 proj.flags = FL_PROJECTILE;
174 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
176 counter = counter + 1;
180 void spawnfunc_weapon_crylink (void)
182 weapon_defaultspawnfunc(WEP_CRYLINK);
185 float w_crylink(float req)
190 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
192 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
194 else if (req == WR_THINK)
196 if (self.BUTTON_ATCK)
197 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
200 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
202 if (self.BUTTON_ATCK2 && cvar("g_balance_crylink_secondary"))
203 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
206 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
209 else if (req == WR_PRECACHE)
211 precache_model ("models/weapons/g_crylink.md3");
212 precache_model ("models/weapons/v_crylink.md3");
213 precache_model ("models/weapons/h_crylink.iqm");
214 precache_sound ("weapons/crylink_fire.wav");
215 precache_sound ("weapons/crylink_fire2.wav");
217 else if (req == WR_SETUP)
218 weapon_setup(WEP_CRYLINK);
219 else if (req == WR_CHECKAMMO1)
220 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
221 else if (req == WR_CHECKAMMO2)
222 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
223 else if (req == WR_SUICIDEMESSAGE)
225 w_deathtypestring = "succeeded at self-destructing themself with the Crylink";
227 else if (req == WR_KILLMESSAGE)
229 if(w_deathtype & HITTYPE_BOUNCE)
230 w_deathtypestring = "could not hide from #'s Crylink"; // unchecked: SPLASH (SECONDARY can't be)
231 else if(w_deathtype & HITTYPE_SPLASH)
232 w_deathtypestring = "was too close to #'s Crylink"; // unchecked: SECONDARY
234 w_deathtypestring = "took a close look at #'s Crylink"; // unchecked: SECONDARY
240 float w_crylink(float req)
242 if(req == WR_IMPACTEFFECT)
245 org2 = w_org + w_backoff * 2;
246 if(w_deathtype & HITTYPE_SECONDARY)
248 pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
250 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
254 pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
256 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
259 else if(req == WR_PRECACHE)
261 precache_sound("weapons/crylink_impact2.wav");
262 precache_sound("weapons/crylink_impact.wav");