5 void W_Crylink_Touch (void)
10 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
14 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
17 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);
23 self.cnt = self.cnt - 1;
24 self.angles = vectoangles(self.velocity);
26 self.projectiledeathtype |= HITTYPE_BOUNCE;
27 //self.scale = 1 + self.cnt;
28 UpdateCSQCProjectile(self);
31 void W_Crylink_Touch2 (void)
36 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
40 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
43 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);
49 self.cnt = self.cnt - 1;
50 self.angles = vectoangles(self.velocity);
52 self.projectiledeathtype |= HITTYPE_BOUNCE;
53 // self.scale = 1 + 1 * self.cnt;
56 void W_Crylink_Attack (void)
58 local float counter, shots;
61 vector forward, right, up;
63 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
64 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
66 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav");
71 shots = cvar("g_balance_crylink_primary_shots");
72 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
73 while (counter < shots)
76 proj.realowner = proj.owner = self;
77 proj.classname = "spike";
78 proj.bot_dodge = TRUE;
79 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
81 proj.movetype = MOVETYPE_BOUNCEMISSILE;
82 proj.solid = SOLID_BBOX;
83 proj.projectiledeathtype = WEP_CRYLINK;
84 //proj.gravity = 0.001;
86 setorigin (proj, w_shotorg);
94 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
98 s = s * cvar("g_balance_crylink_primary_spread");
99 proj.velocity = (w_shotdir + right * s_y + up * s_z) * cvar("g_balance_crylink_primary_speed");
100 // proj.velocity = (w_shotdir + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
101 W_SetupProjectileVelocity(proj);
102 proj.touch = W_Crylink_Touch;
104 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_middle_lifetime"), cvar("g_balance_crylink_primary_middle_fadetime"));
105 else if(counter <= 3)
106 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_star_lifetime"), cvar("g_balance_crylink_primary_star_fadetime"));
108 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_other_lifetime"), cvar("g_balance_crylink_primary_other_fadetime"));
109 proj.cnt = cvar("g_balance_crylink_primary_bounces");
110 //proj.scale = 1 + 1 * proj.cnt;
112 proj.angles = vectoangles (proj.velocity);
114 //proj.glow_size = 20;
116 proj.flags = FL_PROJECTILE;
118 CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
120 counter = counter + 1;
124 void W_Crylink_Attack2 (void)
126 local float counter, shots;
129 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
130 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
132 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav");
134 shots = cvar("g_balance_crylink_secondary_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_secondary_damage");
144 proj.movetype = MOVETYPE_BOUNCEMISSILE;
145 proj.solid = SOLID_BBOX;
146 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
147 //proj.gravity = 0.001;
149 setorigin (proj, w_shotorg);
151 proj.velocity = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
152 W_SetupProjectileVelocity(proj);
153 proj.touch = W_Crylink_Touch2;
154 if(counter == (shots - 1) / 2)
155 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_middle_lifetime"), cvar("g_balance_crylink_secondary_middle_fadetime"));
157 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_line_lifetime"), cvar("g_balance_crylink_secondary_line_fadetime"));
158 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
159 //proj.scale = 1 + 1 * proj.cnt;
161 proj.angles = vectoangles (proj.velocity);
163 //proj.glow_size = 20;
165 proj.flags = FL_PROJECTILE;
167 CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
169 counter = counter + 1;
175 // experimental lightning gun
176 void W_Crylink_Attack3 (void)
178 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
179 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
180 W_SetupShot (self, TRUE, 0, "weapons/crylink_fire.wav");
182 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * 1000, FALSE, self, self.ping * 0.001);
184 pointparticles(particleeffectnum("lightning_muzzleflash", w_shotorg, w_shotdir * 1000, 1);
185 pointparticles(particleeffectnum("lightning_impact", trace_endpos, trace_plane_normal * 1000, 1);
186 trailparticles(world, particleeffectnum("lightning_beam", w_shotorg, trace_endpos);
188 if (trace_fraction < 1)
189 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), WEP_CRYLINK | HITTYPE_SECONDARY, trace_endpos, '0 0 0');
193 void spawnfunc_weapon_crylink (void)
195 weapon_defaultspawnfunc(WEP_CRYLINK);
198 float w_crylink(float req)
203 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
205 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
207 else if (req == WR_THINK)
209 if (self.BUTTON_ATCK)
210 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
213 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
215 if (self.BUTTON_ATCK2)
216 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
219 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
222 else if (req == WR_PRECACHE)
224 precache_model ("models/weapons/g_crylink.md3");
225 precache_model ("models/weapons/v_crylink.md3");
226 precache_model ("models/weapons/h_crylink.dpm");
227 precache_sound ("weapons/crylink_fire.wav");
228 precache_sound ("weapons/crylink_fire2.wav");
230 else if (req == WR_SETUP)
231 weapon_setup(WEP_CRYLINK);
232 else if (req == WR_CHECKAMMO1)
233 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
234 else if (req == WR_CHECKAMMO2)
235 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
236 else if (req == WR_SUICIDEMESSAGE)
238 w_deathtypestring = "succeeded at self-destructing himself with the Crylink";
240 else if (req == WR_KILLMESSAGE)
242 if(w_deathtype & HITTYPE_BOUNCE)
243 w_deathtypestring = "could not hide from #'s Crylink"; // unchecked: SPLASH (SECONDARY can't be)
244 else if(w_deathtype & HITTYPE_SPLASH)
245 w_deathtypestring = "was too close to #'s Crylink"; // unchecked: SECONDARY
247 w_deathtypestring = "took a close look at #'s Crylink"; // unchecked: SECONDARY