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, '25 8 -8', 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, '53 5 0');
35 setmodel(flash, "models/uziflash.md3"); // precision set below
36 setattachment(flash, self.weaponentity, "bone01");
38 flash.viewmodelforclient = self;
39 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
41 flash.think = SUB_Remove;
42 flash.nextthink = time + 0.06;
43 flash.angles_z = flash.v_angle_z + random() * 180;
45 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
49 void W_Shotgun_Attack2 (void)
60 bullets = cvar("g_balance_shotgun_secondary_bullets");
61 d = cvar("g_balance_shotgun_secondary_damage");
62 f = cvar("g_balance_shotgun_secondary_force");
63 spread = cvar("g_balance_shotgun_secondary_spread");
64 bulletspeed = cvar("g_balance_shotgun_secondary_speed");
65 bulletconstant = cvar("g_balance_shotgun_secondary_bulletconstant");
67 W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
68 for (sc = 0;sc < bullets;sc = sc + 1)
69 fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN | HITTYPE_SECONDARY, 0, 1, bulletconstant);
70 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
71 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
73 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_secondary_ammo"));
76 if (cvar("g_casings") >= 1)
77 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);
80 setorigin(flash, '53 5 0');
81 setmodel(flash, "models/uziflash.md3"); // precision set below
82 setattachment(flash, self.weaponentity, "bone01");
84 flash.viewmodelforclient = self;
85 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
87 flash.think = SUB_Remove;
88 flash.nextthink = time + 0.06;
89 flash.angles_z = flash.v_angle_z + random() * 180;
91 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
95 void shotgun_fire2_03()
98 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), w_ready);
100 void shotgun_fire2_02()
103 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
106 void spawnfunc_weapon_shotgun(); // defined in t_items.qc
108 float w_shotgun(float req)
111 if(vlen(self.origin-self.enemy.origin)>200)
112 self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
114 self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
115 else if (req == WR_THINK)
117 if (self.BUTTON_ATCK)
118 if (weapon_prepareattack(0, cvar("g_balance_shotgun_primary_refire")))
121 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), w_ready);
123 if (self.BUTTON_ATCK2)
124 if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire")))
127 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);
130 else if (req == WR_PRECACHE)
132 precache_model ("models/uziflash.md3");
133 precache_model ("models/weapons/g_shotgun.md3");
134 precache_model ("models/weapons/v_shotgun.md3");
135 precache_model ("models/weapons/w_shotgun.zym");
136 precache_sound ("misc/itempickup.wav");
137 precache_sound ("weapons/shotgun_fire.wav");
139 else if (req == WR_SETUP)
140 weapon_setup(WEP_SHOTGUN);
141 else if (req == WR_CHECKAMMO1)
142 return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo");
143 else if (req == WR_CHECKAMMO2)
144 return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3;
145 else if (req == WR_SUICIDEMESSAGE)
146 w_deathtypestring = "did the impossible";
147 else if (req == WR_KILLMESSAGE)
149 w_deathtypestring = "was gunned by"; // unchecked: SECONDARY