2 REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "crylink", "crylink", "Crylink");
8 // NO bounce protection, as bounces are limited!
9 void W_Crylink_Touch (void)
14 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
18 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
21 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);
27 self.cnt = self.cnt - 1;
28 self.angles = vectoangles(self.velocity);
30 self.projectiledeathtype |= HITTYPE_BOUNCE;
31 // commented out as it causes a little hitch...
33 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
36 void W_Crylink_Touch2 (void)
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 // commented out as it causes a little hitch...
60 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
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, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
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 PROJECTILE_MAKETRIGGER(proj);
90 proj.projectiledeathtype = WEP_CRYLINK;
91 //proj.gravity = 0.001;
93 setorigin (proj, w_shotorg);
94 setsize(proj, '0 0 0', '0 0 0');
102 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
106 s = s * cvar("g_balance_crylink_primary_spread") * g_weaponspreadfactor;
107 W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0);
108 proj.touch = W_Crylink_Touch;
110 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_middle_lifetime"), cvar("g_balance_crylink_primary_middle_fadetime"));
111 else if(counter <= 3)
112 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_star_lifetime"), cvar("g_balance_crylink_primary_star_fadetime"));
114 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_other_lifetime"), cvar("g_balance_crylink_primary_other_fadetime"));
115 proj.cnt = cvar("g_balance_crylink_primary_bounces");
116 //proj.scale = 1 + 1 * proj.cnt;
118 proj.angles = vectoangles (proj.velocity);
120 //proj.glow_size = 20;
122 proj.flags = FL_PROJECTILE;
124 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
126 counter = counter + 1;
130 void W_Crylink_Attack2 (void)
132 local float counter, shots;
135 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
136 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
138 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
140 shots = cvar("g_balance_crylink_secondary_shots");
141 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
142 while (counter < shots)
145 proj.realowner = proj.owner = self;
146 proj.classname = "spike";
147 proj.bot_dodge = TRUE;
148 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
150 proj.movetype = MOVETYPE_BOUNCEMISSILE;
151 PROJECTILE_MAKETRIGGER(proj);
152 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
153 //proj.gravity = 0.001;
155 setorigin (proj, w_shotorg);
156 setsize(proj, '0 0 0', '0 0 0');
158 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);
159 proj.touch = W_Crylink_Touch2;
160 if(counter == (shots - 1) / 2)
161 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_middle_lifetime"), cvar("g_balance_crylink_secondary_middle_fadetime"));
163 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_line_lifetime"), cvar("g_balance_crylink_secondary_line_fadetime"));
164 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
165 //proj.scale = 1 + 1 * proj.cnt;
167 proj.angles = vectoangles (proj.velocity);
169 //proj.glow_size = 20;
171 proj.flags = FL_PROJECTILE;
173 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
175 counter = counter + 1;
179 // experimental lightning gun
180 void W_Crylink_Attack3 (void)
182 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
183 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
184 W_SetupShot (self, TRUE, 0, "weapons/crylink_fire2.wav", cvar("g_balance_crylink_secondary_damage"));
186 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_crylink_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self));
188 te_lightning1(self, w_shotorg, trace_endpos);
190 if (trace_fraction < 1)
191 Damage(trace_ent, self, self, cvar("g_balance_crylink_secondary_damage"), WEP_CRYLINK | HITTYPE_SECONDARY, trace_endpos, cvar("g_balance_crylink_secondary_force") * w_shotdir);
194 void spawnfunc_weapon_crylink (void)
196 weapon_defaultspawnfunc(WEP_CRYLINK);
199 float w_crylink(float req)
204 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
206 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
208 else if (req == WR_THINK)
210 if (self.BUTTON_ATCK)
211 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
214 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
216 if (self.BUTTON_ATCK2)
217 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
219 if(cvar("g_balance_crylink_secondary_lightning"))
223 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
226 else if (req == WR_PRECACHE)
228 precache_model ("models/weapons/g_crylink.md3");
229 precache_model ("models/weapons/v_crylink.md3");
230 precache_model ("models/weapons/h_crylink.dpm");
231 precache_sound ("weapons/crylink_fire.wav");
232 precache_sound ("weapons/crylink_fire2.wav");
234 else if (req == WR_SETUP)
235 weapon_setup(WEP_CRYLINK);
236 else if (req == WR_CHECKAMMO1)
237 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
238 else if (req == WR_CHECKAMMO2)
239 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
240 else if (req == WR_SUICIDEMESSAGE)
242 w_deathtypestring = "succeeded at self-destructing themself with the Crylink";
244 else if (req == WR_KILLMESSAGE)
246 if(w_deathtype & HITTYPE_BOUNCE)
247 w_deathtypestring = "could not hide from #'s Crylink"; // unchecked: SPLASH (SECONDARY can't be)
248 else if(w_deathtype & HITTYPE_SPLASH)
249 w_deathtypestring = "was too close to #'s Crylink"; // unchecked: SECONDARY
251 w_deathtypestring = "took a close look at #'s Crylink"; // unchecked: SECONDARY