1 void W_Hagar_Explode (void)
5 org2 = findbetterlocation (self.origin, 12);
6 pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
9 sound (self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
11 sound (self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
13 sound (self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
15 self.event_damage = SUB_Null;
16 RadiusDamage (self, self.realowner, cvar("g_balance_hagar_primary_damage"), cvar("g_balance_hagar_primary_edgedamage"), cvar("g_balance_hagar_primary_radius"), world, cvar("g_balance_hagar_primary_force"), self.projectiledeathtype, other);
21 void W_Hagar_Explode2 (void)
25 org2 = findbetterlocation (self.origin, 12);
26 pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
29 sound (self, CHAN_PROJECTILE, "weapons/hagexp1.wav", VOL_BASE, ATTN_NORM);
31 sound (self, CHAN_PROJECTILE, "weapons/hagexp2.wav", VOL_BASE, ATTN_NORM);
33 sound (self, CHAN_PROJECTILE, "weapons/hagexp3.wav", VOL_BASE, ATTN_NORM);
35 self.event_damage = SUB_Null;
36 RadiusDamage (self, self.realowner, cvar("g_balance_hagar_secondary_damage"), cvar("g_balance_hagar_secondary_edgedamage"), cvar("g_balance_hagar_secondary_radius"), world, cvar("g_balance_hagar_secondary_force"), self.projectiledeathtype, other);
41 void W_Hagar_Touch (void)
43 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
48 if (other == self.owner)
54 void W_Hagar_Touch2 (void)
56 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
62 if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
66 pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
67 self.angles = vectoangles (self.velocity);
69 self.projectiledeathtype |= HITTYPE_BOUNCE;
73 void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
75 self.health = self.health - damage;
80 void W_Hagar_Attack (void)
84 if not(self.items & IT_UNLIMITED_AMMO)
85 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_primary_ammo");
86 W_SetupShot (self, '25 5 -8', FALSE, 2, "weapons/hagar_fire.wav");
87 //W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
89 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
92 missile.owner = missile.realowner = self;
93 missile.classname = "missile";
94 missile.bot_dodge = TRUE;
95 missile.bot_dodgerating = cvar("g_balance_hagar_primary_damage");
96 missile.touch = W_Hagar_Touch;
97 missile.use = W_Hagar_Explode;
98 missile.think = adaptor_think2use;
99 missile.nextthink = time + cvar("g_balance_hagar_primary_lifetime");
100 missile.solid = SOLID_BBOX;
101 missile.scale = 0.4; // BUG: the model is too big
102 missile.projectiledeathtype = WEP_HAGAR;
103 setorigin (missile, w_shotorg);
104 setmodel (missile, "models/hagarmissile.mdl"); // precision set below
105 setsize (missile, '0 0 0', '0 0 0');
106 //missile.takedamage = DAMAGE_YES;
107 //missile.damageforcescale = 4;
108 //missile.health = 10;
109 //missile.event_damage = W_Hagar_Damage;
110 missile.effects = EF_LOWPRECISION;
111 missile.modelflags = MF_GRENADE;
113 missile.movetype = MOVETYPE_FLY;
114 missile.velocity = (w_shotdir + randomvec() * cvar("g_balance_hagar_primary_spread")) * cvar("g_balance_hagar_primary_speed");
115 W_SetupProjectileVelocity(missile);
117 missile.angles = vectoangles (missile.velocity);
118 missile.flags = FL_PROJECTILE;
121 void W_Hagar_Attack2 (void)
123 local entity missile;
125 if not(self.items & IT_UNLIMITED_AMMO)
126 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_secondary_ammo");
127 W_SetupShot (self, '25 5 -8', FALSE, 2, "weapons/hagar_fire.wav");
128 //W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
130 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
133 missile.owner = missile.realowner = self;
134 missile.classname = "missile";
135 missile.bot_dodge = TRUE;
136 missile.bot_dodgerating = cvar("g_balance_hagar_secondary_damage");
137 missile.touch = W_Hagar_Touch2;
139 missile.use = W_Hagar_Explode;
140 missile.think = adaptor_think2use;
141 missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime");
142 missile.solid = SOLID_BBOX;
143 missile.scale = 0.4; // BUG: the model is too big
144 missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
145 setorigin (missile, w_shotorg);
146 setmodel (missile, "models/hagarmissile.mdl"); // precision set below
147 setsize (missile, '0 0 0', '0 0 0');
148 //missile.takedamage = DAMAGE_YES;
149 //missile.damageforcescale = 4;
150 //missile.health = 10;
151 //missile.event_damage = W_Hagar_Damage;
152 missile.effects = EF_LOWPRECISION;
153 missile.modelflags = MF_GRENADE;
155 missile.movetype = MOVETYPE_BOUNCEMISSILE;
156 missile.velocity = (w_shotdir + randomvec() * cvar("g_balance_hagar_secondary_spread")) * cvar("g_balance_hagar_secondary_speed");
157 W_SetupProjectileVelocity(missile);
158 missile.avelocity = '100 10 10';
160 missile.angles = vectoangles (missile.velocity);
161 missile.flags = FL_PROJECTILE;
164 void spawnfunc_weapon_hagar (void)
166 weapon_defaultspawnfunc(WEP_HAGAR);
169 float w_hagar(float req)
173 self.BUTTON_ATCK = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
176 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
177 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
179 else if (req == WR_THINK)
181 if (self.BUTTON_ATCK)
182 if (weapon_prepareattack(0, cvar("g_balance_hagar_primary_refire")))
185 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_primary_refire"), w_ready);
187 if (self.BUTTON_ATCK2)
188 if (weapon_prepareattack(1, cvar("g_balance_hagar_secondary_refire")))
191 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_secondary_refire"), w_ready);
194 else if (req == WR_PRECACHE)
196 precache_model ("models/hagarmissile.mdl");
197 precache_model ("models/weapons/g_hagar.md3");
198 precache_model ("models/weapons/v_hagar.md3");
199 precache_model ("models/weapons/w_hagar.zym");
200 precache_sound ("weapons/hagar_fire.wav");
201 precache_sound ("weapons/hagexp1.wav");
202 precache_sound ("weapons/hagexp2.wav");
203 precache_sound ("weapons/hagexp3.wav");
205 else if (req == WR_SETUP)
206 weapon_setup(WEP_HAGAR);
207 else if (req == WR_CHECKAMMO1)
208 return self.ammo_rockets >= cvar("g_balance_hagar_primary_ammo");
209 else if (req == WR_CHECKAMMO2)
210 return self.ammo_rockets >= cvar("g_balance_hagar_secondary_ammo");
211 else if (req == WR_SUICIDEMESSAGE)
212 w_deathtypestring = "played with tiny rockets";
213 else if (req == WR_KILLMESSAGE)
215 if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
216 w_deathtypestring = "hoped #'s missiles wouldn't bounce";
217 else // unchecked: SPLASH, SECONDARY
218 w_deathtypestring = "was pummeled by";