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;
29 UpdateCSQCProjectile(self);
32 void W_Crylink_Touch2 (void)
37 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
41 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
44 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);
50 self.cnt = self.cnt - 1;
51 self.angles = vectoangles(self.velocity);
53 self.projectiledeathtype |= HITTYPE_BOUNCE;
54 // self.scale = 1 + 1 * self.cnt;
56 UpdateCSQCProjectile(self);
59 void W_Crylink_Attack (void)
61 local float counter, shots;
64 vector forward, right, up;
66 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
67 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
69 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/crylink_fire.wav");
74 shots = cvar("g_balance_crylink_primary_shots");
75 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
76 while (counter < shots)
79 proj.realowner = proj.owner = self;
80 proj.classname = "spike";
81 proj.bot_dodge = TRUE;
82 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
84 proj.movetype = MOVETYPE_BOUNCEMISSILE;
85 proj.solid = SOLID_BBOX;
86 proj.projectiledeathtype = WEP_CRYLINK;
87 //proj.gravity = 0.001;
89 setmodel (proj, "models/plasmatrail.mdl"); // precision set below
90 setsize (proj, '0 0 0', '0 0 0');
91 setorigin (proj, w_shotorg);
99 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
103 s = s * cvar("g_balance_crylink_primary_spread");
104 proj.velocity = (w_shotdir + right * s_y + up * s_z) * cvar("g_balance_crylink_primary_speed");
105 // proj.velocity = (w_shotdir + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
106 W_SetupProjectileVelocity(proj);
107 proj.touch = W_Crylink_Touch;
109 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_middle_lifetime"), cvar("g_balance_crylink_primary_middle_fadetime"));
110 else if(counter <= 3)
111 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_star_lifetime"), cvar("g_balance_crylink_primary_star_fadetime"));
113 SUB_SetFade(proj, time + cvar("g_balance_crylink_primary_other_lifetime"), cvar("g_balance_crylink_primary_other_fadetime"));
114 proj.cnt = cvar("g_balance_crylink_primary_bounces");
115 //proj.scale = 1 + 1 * proj.cnt;
117 proj.angles = vectoangles (proj.velocity);
119 //proj.glow_size = 20;
121 proj.effects = EF_LOWPRECISION;
122 proj.flags = FL_PROJECTILE;
124 CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK);
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, '25 8 -8', FALSE, 2, "weapons/crylink_fire2.wav");
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 proj.solid = SOLID_BBOX;
152 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
153 //proj.gravity = 0.001;
155 setmodel (proj, "models/plasmatrail.mdl"); // precision set below
156 setsize (proj, '0 0 0', '0 0 0');
157 setorigin (proj, w_shotorg);
159 proj.velocity = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
160 W_SetupProjectileVelocity(proj);
161 proj.touch = W_Crylink_Touch2;
162 if(counter == (shots - 1) / 2)
163 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_middle_lifetime"), cvar("g_balance_crylink_secondary_middle_fadetime"));
165 SUB_SetFade(proj, time + cvar("g_balance_crylink_secondary_line_lifetime"), cvar("g_balance_crylink_secondary_line_fadetime"));
166 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
167 //proj.scale = 1 + 1 * proj.cnt;
169 proj.angles = vectoangles (proj.velocity);
171 //proj.glow_size = 20;
173 proj.effects = EF_LOWPRECISION;
174 proj.flags = FL_PROJECTILE;
176 CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK);
178 counter = counter + 1;
184 // experimental lightning gun
185 void W_Crylink_Attack3 (void)
187 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
188 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
189 W_SetupShot (self, '25 8 -8', TRUE, 0, "weapons/crylink_fire.wav");
191 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * 1000, FALSE, self, self.ping * 0.001);
193 pointparticles(particleeffectnum("lightning_muzzleflash", w_shotorg, w_shotdir * 1000, 1);
194 pointparticles(particleeffectnum("lightning_impact", trace_endpos, trace_plane_normal * 1000, 1);
195 trailparticles(world, particleeffectnum("lightning_beam", w_shotorg, trace_endpos);
197 if (trace_fraction < 1)
198 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), WEP_CRYLINK | HITTYPE_SECONDARY, trace_endpos, '0 0 0');
202 void spawnfunc_weapon_crylink (void)
204 weapon_defaultspawnfunc(WEP_CRYLINK);
207 float w_crylink(float req)
212 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
214 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
216 else if (req == WR_THINK)
218 if (self.BUTTON_ATCK)
219 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
222 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
224 if (self.BUTTON_ATCK2)
225 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
228 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
231 else if (req == WR_PRECACHE)
233 precache_model ("models/plasma.mdl");
234 precache_model ("models/plasmatrail.mdl");
235 precache_model ("models/weapons/g_crylink.md3");
236 precache_model ("models/weapons/v_crylink.md3");
237 precache_model ("models/weapons/w_crylink.zym");
238 precache_sound ("weapons/crylink_fire.wav");
239 precache_sound ("weapons/crylink_fire2.wav");
240 precache_sound ("weapons/crylink_impact.wav");
241 precache_sound ("weapons/crylink_impact2.wav");
243 else if (req == WR_SETUP)
244 weapon_setup(WEP_CRYLINK);
245 else if (req == WR_CHECKAMMO1)
246 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
247 else if (req == WR_CHECKAMMO2)
248 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
249 else if (req == WR_SUICIDEMESSAGE)
251 w_deathtypestring = "succeeded at self-destructing himself with the Crylink";
253 else if (req == WR_KILLMESSAGE)
255 if(w_deathtype & HITTYPE_BOUNCE)
256 w_deathtypestring = "could not hide from #'s Crylink"; // unchecked: SPLASH (SECONDARY can't be)
257 else if(w_deathtype & HITTYPE_SPLASH)
258 w_deathtypestring = "was too close to #'s Crylink"; // unchecked: SECONDARY
260 w_deathtypestring = "took a close look at #'s Crylink"; // unchecked: SECONDARY