5 // NO bounce protection, as bounces are limited!
6 void W_Crylink_Touch (void)
11 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
15 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
18 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);
24 self.cnt = self.cnt - 1;
25 self.angles = vectoangles(self.velocity);
27 self.projectiledeathtype |= HITTYPE_BOUNCE;
28 // commented out as it causes a little hitch...
30 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
33 void W_Crylink_Touch2 (void)
38 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
42 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
45 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);
51 self.cnt = self.cnt - 1;
52 self.angles = vectoangles(self.velocity);
54 self.projectiledeathtype |= HITTYPE_BOUNCE;
55 // commented out as it causes a little hitch...
57 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
60 void W_Crylink_Attack (void)
62 local float counter, shots;
65 vector forward, right, up;
67 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
68 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
70 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
75 shots = cvar("g_balance_crylink_primary_shots");
76 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
77 while (counter < shots)
80 proj.realowner = proj.owner = self;
81 proj.classname = "spike";
82 proj.bot_dodge = TRUE;
83 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
85 proj.movetype = MOVETYPE_BOUNCEMISSILE;
86 PROJECTILE_MAKETRIGGER(proj);
87 proj.projectiledeathtype = WEP_CRYLINK;
88 //proj.gravity = 0.001;
90 setorigin (proj, w_shotorg);
91 setsize(proj, '0 0 0', '0 0 0');
99 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
103 s = s * cvar("g_balance_crylink_primary_spread");
104 W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0);
105 proj.touch = W_Crylink_Touch;
107 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_middle_lifetime"), cvar("g_balance_crylink_primary_middle_fadetime"));
108 else if(counter <= 3)
109 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_star_lifetime"), cvar("g_balance_crylink_primary_star_fadetime"));
111 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_other_lifetime"), cvar("g_balance_crylink_primary_other_fadetime"));
112 proj.cnt = cvar("g_balance_crylink_primary_bounces");
113 //proj.scale = 1 + 1 * proj.cnt;
115 proj.angles = vectoangles (proj.velocity);
117 //proj.glow_size = 20;
119 proj.flags = FL_PROJECTILE;
121 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
123 counter = counter + 1;
127 void W_Crylink_Attack2 (void)
129 local float counter, shots;
132 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
133 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
135 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
137 shots = cvar("g_balance_crylink_secondary_shots");
138 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
139 while (counter < shots)
142 proj.realowner = proj.owner = self;
143 proj.classname = "spike";
144 proj.bot_dodge = TRUE;
145 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
147 proj.movetype = MOVETYPE_BOUNCEMISSILE;
148 PROJECTILE_MAKETRIGGER(proj);
149 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
150 //proj.gravity = 0.001;
152 setorigin (proj, w_shotorg);
153 setsize(proj, '0 0 0', '0 0 0');
155 W_SetupProjectileVelocityEx(proj, (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")), v_up, cvar("g_balance_crylink_secondary_speed"), 0, 0);
156 proj.touch = W_Crylink_Touch2;
157 if(counter == (shots - 1) / 2)
158 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_middle_lifetime"), cvar("g_balance_crylink_secondary_middle_fadetime"));
160 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_line_lifetime"), cvar("g_balance_crylink_secondary_line_fadetime"));
161 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
162 //proj.scale = 1 + 1 * proj.cnt;
164 proj.angles = vectoangles (proj.velocity);
166 //proj.glow_size = 20;
168 proj.flags = FL_PROJECTILE;
170 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
172 counter = counter + 1;
176 // experimental lightning gun
177 void W_Crylink_Attack3 (void)
179 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
180 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
181 W_SetupShot (self, TRUE, 0, "weapons/crylink_fire2.wav", cvar("g_balance_crylink_secondary_damage"));
183 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * cvar("g_balance_crylink_secondary_radius"), FALSE, self, ANTILAG_LATENCY(self));
185 te_lightning1(self, w_shotorg, trace_endpos);
187 if (trace_fraction < 1)
188 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);
191 void spawnfunc_weapon_crylink (void)
193 weapon_defaultspawnfunc(WEP_CRYLINK);
196 float w_crylink(float req)
201 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
203 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
205 else if (req == WR_THINK)
207 if (self.BUTTON_ATCK)
208 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
211 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
213 if (self.BUTTON_ATCK2)
214 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
216 if(cvar("g_balance_crylink_secondary_lightning"))
220 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
223 else if (req == WR_PRECACHE)
225 precache_model ("models/weapons/g_crylink.md3");
226 precache_model ("models/weapons/v_crylink.md3");
227 precache_model ("models/weapons/h_crylink.dpm");
228 precache_sound ("weapons/crylink_fire.wav");
229 precache_sound ("weapons/crylink_fire2.wav");
231 else if (req == WR_SETUP)
232 weapon_setup(WEP_CRYLINK);
233 else if (req == WR_CHECKAMMO1)
234 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
235 else if (req == WR_CHECKAMMO2)
236 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
237 else if (req == WR_SUICIDEMESSAGE)
239 w_deathtypestring = "succeeded at self-destructing themself with the Crylink";
241 else if (req == WR_KILLMESSAGE)
243 if(w_deathtype & HITTYPE_BOUNCE)
244 w_deathtypestring = "could not hide from #'s Crylink"; // unchecked: SPLASH (SECONDARY can't be)
245 else if(w_deathtype & HITTYPE_SPLASH)
246 w_deathtypestring = "was too close to #'s Crylink"; // unchecked: SECONDARY
248 w_deathtypestring = "took a close look at #'s Crylink"; // unchecked: SECONDARY