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)
47 void W_Hagar_Touch2 (void)
51 if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
55 pointparticles(particleeffectnum("hagar_bounce"), self.origin, self.velocity, 1);
56 self.angles = vectoangles (self.velocity);
58 self.projectiledeathtype |= HITTYPE_BOUNCE;
62 void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
64 self.health = self.health - damage;
66 W_PrepareExplosionByDamage(attacker, self.think);
69 void W_Hagar_Attack (void)
73 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
74 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_primary_ammo");
75 W_SetupShot (self, '25 5 -8', FALSE, 2, "weapons/hagar_fire.wav");
76 //W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
78 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
81 missile.owner = missile.realowner = self;
82 missile.classname = "missile";
83 missile.bot_dodge = TRUE;
84 missile.bot_dodgerating = cvar("g_balance_hagar_primary_damage");
85 missile.touch = W_Hagar_Touch;
86 missile.use = W_Hagar_Explode;
87 missile.think = adaptor_think2use;
88 missile.nextthink = time + cvar("g_balance_hagar_primary_lifetime");
89 missile.solid = SOLID_BBOX;
90 missile.scale = 0.4; // BUG: the model is too big
91 missile.projectiledeathtype = WEP_HAGAR;
92 setorigin (missile, w_shotorg);
93 setmodel (missile, "models/hagarmissile.mdl"); // precision set below
94 setsize (missile, '0 0 0', '0 0 0');
95 //missile.takedamage = DAMAGE_YES;
96 //missile.damageforcescale = 4;
97 //missile.health = 10;
98 //missile.event_damage = W_Hagar_Damage;
99 missile.effects = EF_LOWPRECISION;
100 missile.modelflags = MF_GRENADE;
102 missile.movetype = MOVETYPE_FLY;
103 missile.velocity = (w_shotdir + randomvec() * cvar("g_balance_hagar_primary_spread")) * cvar("g_balance_hagar_primary_speed");
104 W_SetupProjectileVelocity(missile);
106 missile.angles = vectoangles (missile.velocity);
107 missile.flags = FL_PROJECTILE;
110 void W_Hagar_Attack2 (void)
112 local entity missile;
114 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
115 self.ammo_rockets = self.ammo_rockets - cvar("g_balance_hagar_secondary_ammo");
116 W_SetupShot (self, '25 5 -8', FALSE, 2, "weapons/hagar_fire.wav");
117 //W_SetupShot (self, '25 8 -8', FALSE, 2, "weapons/hagar_fire.wav"); // TODO: move model a little to the right
119 pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
122 missile.owner = missile.realowner = self;
123 missile.classname = "missile";
124 missile.bot_dodge = TRUE;
125 missile.bot_dodgerating = cvar("g_balance_hagar_secondary_damage");
126 missile.touch = W_Hagar_Touch2;
128 missile.use = W_Hagar_Explode;
129 missile.think = adaptor_think2use;
130 missile.nextthink = time + cvar("g_balance_hagar_secondary_lifetime");
131 missile.solid = SOLID_BBOX;
132 missile.scale = 0.4; // BUG: the model is too big
133 missile.projectiledeathtype = WEP_HAGAR | HITTYPE_SECONDARY;
134 setorigin (missile, w_shotorg);
135 setmodel (missile, "models/hagarmissile.mdl"); // precision set below
136 setsize (missile, '0 0 0', '0 0 0');
137 //missile.takedamage = DAMAGE_YES;
138 //missile.damageforcescale = 4;
139 //missile.health = 10;
140 //missile.event_damage = W_Hagar_Damage;
141 missile.effects = EF_LOWPRECISION;
142 missile.modelflags = MF_GRENADE;
144 missile.movetype = MOVETYPE_BOUNCEMISSILE;
145 missile.velocity = (w_shotdir + randomvec() * cvar("g_balance_hagar_secondary_spread")) * cvar("g_balance_hagar_secondary_speed");
146 W_SetupProjectileVelocity(missile);
147 missile.avelocity = '100 10 10';
149 missile.angles = vectoangles (missile.velocity);
150 missile.flags = FL_PROJECTILE;
153 void spawnfunc_weapon_hagar (void)
155 weapon_defaultspawnfunc(WEP_HAGAR);
158 float w_hagar(float req)
162 self.BUTTON_ATCK = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
165 // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming
166 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_hagar_primary_speed"), 0, cvar("g_balance_hagar_primary_lifetime"), FALSE);
168 else if (req == WR_THINK)
170 if (self.BUTTON_ATCK)
171 if (weapon_prepareattack(0, cvar("g_balance_hagar_primary_refire")))
174 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_primary_refire"), w_ready);
176 if (self.BUTTON_ATCK2)
177 if (weapon_prepareattack(1, cvar("g_balance_hagar_secondary_refire")))
180 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_hagar_secondary_refire"), w_ready);
183 else if (req == WR_PRECACHE)
185 precache_model ("models/hagarmissile.mdl");
186 precache_model ("models/weapons/g_hagar.md3");
187 precache_model ("models/weapons/v_hagar.md3");
188 precache_model ("models/weapons/w_hagar.zym");
189 precache_sound ("weapons/hagar_fire.wav");
190 precache_sound ("weapons/hagexp1.wav");
191 precache_sound ("weapons/hagexp2.wav");
192 precache_sound ("weapons/hagexp3.wav");
194 else if (req == WR_SETUP)
195 weapon_setup(WEP_HAGAR);
196 else if (req == WR_CHECKAMMO1)
197 return self.ammo_rockets >= cvar("g_balance_hagar_primary_ammo");
198 else if (req == WR_CHECKAMMO2)
199 return self.ammo_rockets >= cvar("g_balance_hagar_secondary_ammo");
200 else if (req == WR_SUICIDEMESSAGE)
201 w_deathtypestring = "played with tiny rockets";
202 else if (req == WR_KILLMESSAGE)
204 if(w_deathtype & HITTYPE_BOUNCE) // must be secondary; unchecked: SPLASH
205 w_deathtypestring = "hoped #'s missiles wouldn't bounce";
206 else // unchecked: SPLASH, SECONDARY
207 w_deathtypestring = "was pummeled by";