2 void W_Shotgun_Attack (void)
13 bullets = cvar("g_balance_shotgun_primary_bullets");
14 d = cvar("g_balance_shotgun_primary_damage");
15 f = cvar("g_balance_shotgun_primary_force");
16 spread = cvar("g_balance_shotgun_primary_spread");
17 bulletspeed = cvar("g_balance_shotgun_primary_speed");
18 bulletconstant = cvar("g_balance_shotgun_primary_bulletconstant");
20 W_SetupShot (self, '28 8 -10', TRUE, 5, "weapons/shotgun_fire.wav");
21 for (sc = 0;sc < bullets;sc = sc + 1)
22 fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN, 0, 1, bulletconstant);
23 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
24 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_primary_ammo");
26 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_primary_ammo"));
29 if (cvar("g_casings") >= 1)
30 SpawnCasing (w_shotorg - v_forward * 10, ((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
32 // muzzle flash for 1st person view
34 setorigin(flash, '5 0 0');
35 setmodel(flash, "models/uziflash.md3"); // precision set below
36 if (gettagindex(self.weaponentity, "shot"))
37 setattachment(flash, self.weaponentity, "shot");
38 else if (gettagindex(self.weaponentity, "bone02"))
39 setattachment(flash, self.weaponentity, "bone02");
42 setorigin(flash, '48 0 5');
43 setattachment(flash, self.weaponentity, "");
46 flash.viewmodelforclient = self;
47 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
48 flash.think = SUB_Remove;
49 flash.nextthink = time + 0.06;
50 flash.angles_z = flash.v_angle_z + random() * 180;
52 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
56 void W_Shotgun_Attack2 (void)
67 bullets = cvar("g_balance_shotgun_secondary_bullets");
68 d = cvar("g_balance_shotgun_secondary_damage");
69 f = cvar("g_balance_shotgun_secondary_force");
70 spread = cvar("g_balance_shotgun_secondary_spread");
71 bulletspeed = cvar("g_balance_shotgun_secondary_speed");
72 bulletconstant = cvar("g_balance_shotgun_secondary_bulletconstant");
74 W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
75 for (sc = 0;sc < bullets;sc = sc + 1)
76 fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN | HITTYPE_SECONDARY, 0, 1, bulletconstant);
77 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
78 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
80 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_secondary_ammo"));
83 if (cvar("g_casings") >= 1)
84 SpawnCasing (w_shotorg - v_forward * 10, ((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
87 setorigin(flash, '53 5 0');
88 setmodel(flash, "models/uziflash.md3"); // precision set below
89 if (gettagindex(self.weaponentity, "shot"))
90 setattachment(flash, self.weaponentity, "shot");
91 else if (gettagindex(self.weaponentity, "bone01"))
92 setattachment(flash, self.weaponentity, "bone01");
95 setorigin(flash, '48 0 5');
96 setattachment(flash, self.weaponentity, "");
99 flash.viewmodelforclient = self;
100 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
102 flash.think = SUB_Remove;
103 flash.nextthink = time + 0.06;
104 flash.angles_z = flash.v_angle_z + random() * 180;
106 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
110 void shotgun_fire2_03()
113 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), w_ready);
115 void shotgun_fire2_02()
118 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
121 void spawnfunc_weapon_shotgun(); // defined in t_items.qc
123 float w_shotgun(float req)
126 if(vlen(self.origin-self.enemy.origin)>200)
127 self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
129 self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
130 else if (req == WR_THINK)
132 if (self.BUTTON_ATCK)
133 if (weapon_prepareattack(0, cvar("g_balance_shotgun_primary_refire")))
136 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), w_ready);
138 if (self.BUTTON_ATCK2)
139 if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire")))
142 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);
145 else if (req == WR_PRECACHE)
147 precache_model ("models/uziflash.md3");
148 precache_model ("models/weapons/g_shotgun.md3");
149 precache_model ("models/weapons/v_shotgun.md3");
150 precache_model ("models/weapons/w_shotgun.zym");
151 precache_sound ("misc/itempickup.wav");
152 precache_sound ("weapons/shotgun_fire.wav");
154 else if (req == WR_SETUP)
155 weapon_setup(WEP_SHOTGUN);
156 else if (req == WR_CHECKAMMO1)
157 return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo");
158 else if (req == WR_CHECKAMMO2)
159 return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3;
160 else if (req == WR_SUICIDEMESSAGE)
161 w_deathtypestring = "did the impossible";
162 else if (req == WR_KILLMESSAGE)
164 w_deathtypestring = "was gunned by"; // unchecked: SECONDARY