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_BODY, "weapons/hagexp1.wav", 1, ATTN_NORM);
11 sound (self, CHAN_BODY, "weapons/hagexp2.wav", 1, ATTN_NORM);
13 sound (self, CHAN_BODY, "weapons/hagexp3.wav", 1, 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"), IT_HAGAR);
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_BODY, "weapons/hagexp1.wav", 1, ATTN_NORM);
31 sound (self, CHAN_BODY, "weapons/hagexp2.wav", 1, ATTN_NORM);
33 sound (self, CHAN_BODY, "weapons/hagexp3.wav", 1, 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"), IT_HAGAR);
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);
72 void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
74 self.health = self.health - damage;
79 void W_Hagar_Attack (void)
83 if (cvar("g_use_ammunition"))
84 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_primary_ammo");
85 W_SetupShot (self, '25 5 -8', FALSE, 2, "weapons/hagar_fire.wav");
86 //W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
88 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
91 missile.owner = missile.realowner = self;
92 missile.classname = "missile";
93 missile.bot_dodge = TRUE;
94 missile.bot_dodgerating = cvar("g_balance_hagar_primary_damage");
95 missile.touch = W_Hagar_Touch;
96 missile.think = W_Hagar_Explode;
97 missile.nextthink = time + cvar("g_balance_hagar_primary_lifetime");
98 missile.solid = SOLID_BBOX;
99 missile.scale = 0.4; // BUG: the model is too big
100 setorigin (missile, w_shotorg);
101 setmodel (missile, "models/hagarmissile.mdl"); // precision set below
102 setsize (missile, '0 0 0', '0 0 0');
103 //missile.takedamage = DAMAGE_YES;
104 //missile.damageforcescale = 4;
105 //missile.health = 10;
106 //missile.event_damage = W_Hagar_Damage;
107 missile.effects = EF_LOWPRECISION;
108 missile.modelflags = MF_GRENADE;
110 missile.movetype = MOVETYPE_FLY;
111 missile.velocity = (w_shotdir + randomvec() * cvar("g_balance_hagar_primary_spread")) * cvar("g_balance_hagar_primary_speed");
112 W_SetupProjectileVelocity(missile);
114 missile.angles = vectoangles (missile.velocity);
115 missile.flags = FL_PROJECTILE;
118 void W_Hagar_Attack2 (void)
120 local entity missile;
122 if (cvar("g_use_ammunition"))
123 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_secondary_ammo");
124 W_SetupShot (self, '25 5 -8', FALSE, 2, "weapons/hagar_fire.wav");
125 //W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
127 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
130 missile.owner = missile.realowner = self;
131 missile.classname = "missile";
132 missile.bot_dodge = TRUE;
133 missile.bot_dodgerating = cvar("g_balance_hagar_secondary_damage");
134 missile.touch = W_Hagar_Touch2;
136 missile.think = W_Hagar_Explode;
137 missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime");
138 missile.solid = SOLID_BBOX;
139 missile.scale = 0.4; // BUG: the model is too big
140 setorigin (missile, w_shotorg);
141 setmodel (missile, "models/hagarmissile.mdl"); // precision set below
142 setsize (missile, '0 0 0', '0 0 0');
143 //missile.takedamage = DAMAGE_YES;
144 //missile.damageforcescale = 4;
145 //missile.health = 10;
146 //missile.event_damage = W_Hagar_Damage;
147 missile.effects = EF_LOWPRECISION;
148 missile.modelflags = MF_GRENADE;
150 missile.movetype = MOVETYPE_BOUNCEMISSILE;
151 missile.velocity = (w_shotdir + randomvec() * cvar("g_balance_hagar_secondary_spread")) * cvar("g_balance_hagar_secondary_speed");
152 W_SetupProjectileVelocity(missile);
153 missile.avelocity = '100 10 10';
155 missile.angles = vectoangles (missile.velocity);
156 missile.flags = FL_PROJECTILE;
159 float w_hagar(float req)
163 self.BUTTON_ATCK = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
166 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
167 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
169 else if (req == WR_THINK)
171 if (self.BUTTON_ATCK)
172 if (weapon_prepareattack(0, cvar("g_balance_hagar_primary_refire")))
175 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_primary_refire"), w_ready);
177 if (self.BUTTON_ATCK2)
178 if (weapon_prepareattack(1, cvar("g_balance_hagar_secondary_refire")))
181 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_secondary_refire"), w_ready);
184 else if (req == WR_PRECACHE)
186 precache_model ("models/hagarmissile.mdl");
187 precache_model ("models/weapons/g_hagar.md3");
188 precache_model ("models/weapons/v_hagar.md3");
189 precache_model ("models/weapons/w_hagar.zym");
190 precache_sound ("weapons/hagar_fire.wav");
191 precache_sound ("weapons/hagexp1.wav");
192 precache_sound ("weapons/hagexp2.wav");
193 precache_sound ("weapons/hagexp3.wav");
195 else if (req == WR_SETUP)
196 weapon_setup(WEP_HAGAR, "hagar", IT_ROCKETS);
197 else if (req == WR_CHECKAMMO1)
198 return self.ammo_rockets >= cvar("g_balance_hagar_primary_ammo");
199 else if (req == WR_CHECKAMMO2)
200 return self.ammo_rockets >= cvar("g_balance_hagar_secondary_ammo");
201 else if (req == WR_REGISTER)
202 weapon_register(WEP_HAGAR, min(cvar("g_balance_hagar_primary_ammo"), cvar("g_balance_hagar_secondary_ammo")));