2 const vector proj_color = '1 1 1';
6 void W_Crylink_Touch (void)
10 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
15 pointparticles(particleeffectnum("crylink_impactbig"), self.origin, '0 0 0', 1);
16 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
20 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
23 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, IT_CRYLINK);
29 self.cnt = self.cnt - 1;
30 self.angles = vectoangles(self.velocity);
32 //self.scale = 1 + self.cnt;
35 void W_Crylink_Touch2 (void)
39 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
44 pointparticles(particleeffectnum("crylink_impact"), self.origin, '0 0 0', 1);
45 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
49 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
52 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, IT_CRYLINK);
58 self.cnt = self.cnt - 1;
59 self.angles = vectoangles(self.velocity);
61 // self.scale = 1 + 1 * self.cnt;
64 void W_Crylink_Attack (void)
66 local float counter, shots;
70 if (cvar("g_use_ammunition"))
71 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
73 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/crylink_fire.wav");
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 proj.solid = SOLID_BBOX;
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);
96 else if (counter == 1)
98 else if (counter == 2)
100 else if (counter == 3)
104 s = s * cvar("g_balance_crylink_primary_spread");
105 proj.velocity = (w_shotdir + v_right * s_y + v_up * s_z) * cvar("g_balance_crylink_primary_speed");
106 // proj.velocity = (w_shotdir + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
107 W_SetupProjectileVelocity(proj);
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.effects = EF_LOWPRECISION;
123 proj.flags = FL_PROJECTILE;
124 proj.colormod = proj_color;
125 counter = counter + 1;
129 void W_Crylink_Attack2 (void)
131 local float counter, shots;
134 if (cvar("g_use_ammunition"))
135 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
137 W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/crylink_fire.wav");
139 shots = cvar("g_balance_crylink_secondary_shots");
140 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
141 while (counter < shots)
144 proj.realowner = proj.owner = self;
145 proj.classname = "spike";
146 proj.bot_dodge = TRUE;
147 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
149 proj.movetype = MOVETYPE_BOUNCEMISSILE;
150 proj.solid = SOLID_BBOX;
151 //proj.gravity = 0.001;
153 setmodel (proj, "models/plasmatrail.mdl"); // precision set below
154 setsize (proj, '0 0 0', '0 0 0');
155 setorigin (proj, w_shotorg);
157 proj.velocity = (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
158 W_SetupProjectileVelocity(proj);
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.effects = EF_LOWPRECISION;
172 proj.flags = FL_PROJECTILE;
173 proj.colormod = proj_color;
174 counter = counter + 1;
180 // experimental lightning gun
181 void W_Crylink_Attack3 (void)
183 if (cvar("g_use_ammunition"))
184 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
185 W_SetupShot (self, '25 8 -8', TRUE, 0, "weapons/crylink_fire.wav");
187 traceline_antilag(self, w_shotorg, w_shotorg + w_shotdir * 1000, FALSE, self, self.ping * 0.001);
189 pointparticles(particleeffectnum("lightning_muzzleflash", w_shotorg, w_shotdir * 1000, 1);
190 pointparticles(particleeffectnum("lightning_impact", trace_endpos, trace_plane_normal * 1000, 1);
191 trailparticles(world, particleeffectnum("lightning_beam", w_shotorg, trace_endpos);
193 if (trace_fraction < 1)
194 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), IT_CRYLINK, trace_endpos, '0 0 0');
198 float(float req) w_crylink =
203 self.button0 = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
205 self.button3 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
207 else if (req == WR_THINK)
210 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
213 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
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/plasma.mdl");
225 precache_model ("models/plasmatrail.mdl");
226 precache_model ("models/weapons/g_crylink.md3");
227 precache_model ("models/weapons/v_crylink.md3");
228 precache_model ("models/weapons/w_crylink.zym");
229 precache_sound ("weapons/crylink_fire.wav");
231 else if (req == WR_SETUP)
232 weapon_setup(WEP_CRYLINK, "crylink", IT_CELLS);
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_REGISTER)
238 weapon_register(WEP_CRYLINK, min(cvar("g_balance_crylink_primary_ammo"), cvar("g_balance_crylink_secondary_ammo")));