2 void W_Shotgun_Attack (void)
14 ammo = cvar("g_balance_shotgun_primary_ammo");
15 bullets = cvar("g_balance_shotgun_primary_bullets");
16 d = cvar("g_balance_shotgun_primary_damage");
17 f = cvar("g_balance_shotgun_primary_force");
18 spread = cvar("g_balance_shotgun_primary_spread");
19 bulletspeed = cvar("g_balance_shotgun_primary_speed");
20 bulletconstant = cvar("g_balance_shotgun_primary_bulletconstant");
22 W_SetupShot (self, '28 8 -10', TRUE, 5, "weapons/shotgun_fire.wav");
23 for (sc = 0;sc < bullets;sc = sc + 1)
24 fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN, 0, 1, bulletconstant);
25 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
26 self.ammo_shells = self.ammo_shells - ammo;
28 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_primary_ammo"));
31 if (cvar("g_casings") >= 1)
32 for (sc = 0;sc < ammo;sc = sc + 1)
33 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);
35 // muzzle flash for 1st person view
37 setorigin(flash, '5 0 0');
38 setmodel(flash, "models/uziflash.md3"); // precision set below
39 if (gettagindex(self.weaponentity, "shot"))
40 setattachment(flash, self.weaponentity, "shot");
41 else if (gettagindex(self.weaponentity, "bone02"))
42 setattachment(flash, self.weaponentity, "bone02");
45 setorigin(flash, '48 0 5');
46 setattachment(flash, self.weaponentity, "");
49 flash.viewmodelforclient = self;
50 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
51 flash.think = SUB_Remove;
52 flash.nextthink = time + 0.06;
53 flash.angles_z = flash.v_angle_z + random() * 180;
55 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
59 void W_Shotgun_Attack2 (void)
71 ammo = cvar("g_balance_shotgun_secondary_ammo");
72 bullets = cvar("g_balance_shotgun_secondary_bullets");
73 d = cvar("g_balance_shotgun_secondary_damage");
74 f = cvar("g_balance_shotgun_secondary_force");
75 spread = cvar("g_balance_shotgun_secondary_spread");
76 bulletspeed = cvar("g_balance_shotgun_secondary_speed");
77 bulletconstant = cvar("g_balance_shotgun_secondary_bulletconstant");
79 W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
80 for (sc = 0;sc < bullets;sc = sc + 1)
81 fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, 0, f, WEP_SHOTGUN | HITTYPE_SECONDARY, 0, 1, bulletconstant);
82 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
83 self.ammo_shells = self.ammo_shells - ammo;
85 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_secondary_ammo"));
88 if (cvar("g_casings") >= 1)
89 for (sc = 0;sc < ammo;sc = sc + 1)
90 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);
93 setorigin(flash, '53 5 0');
94 setmodel(flash, "models/uziflash.md3"); // precision set below
95 if (gettagindex(self.weaponentity, "shot"))
96 setattachment(flash, self.weaponentity, "shot");
97 else if (gettagindex(self.weaponentity, "bone01"))
98 setattachment(flash, self.weaponentity, "bone01");
101 setorigin(flash, '48 0 5');
102 setattachment(flash, self.weaponentity, "");
105 flash.viewmodelforclient = self;
106 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
108 flash.think = SUB_Remove;
109 flash.nextthink = time + 0.06;
110 flash.angles_z = flash.v_angle_z + random() * 180;
112 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
116 void shotgun_fire2_03()
119 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), w_ready);
121 void shotgun_fire2_02()
124 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
127 void spawnfunc_weapon_shotgun(); // defined in t_items.qc
129 float w_shotgun(float req)
132 if(vlen(self.origin-self.enemy.origin)>200)
133 self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
135 self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
136 else if (req == WR_THINK)
138 if (self.BUTTON_ATCK)
139 if (weapon_prepareattack(0, cvar("g_balance_shotgun_primary_refire")))
142 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), w_ready);
144 if (self.BUTTON_ATCK2)
145 if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire")))
148 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);
151 else if (req == WR_PRECACHE)
153 precache_model ("models/uziflash.md3");
154 precache_model ("models/weapons/g_shotgun.md3");
155 precache_model ("models/weapons/v_shotgun.md3");
156 precache_model ("models/weapons/w_shotgun.zym");
157 precache_sound ("misc/itempickup.wav");
158 precache_sound ("weapons/shotgun_fire.wav");
160 else if (req == WR_SETUP)
161 weapon_setup(WEP_SHOTGUN);
162 else if (req == WR_CHECKAMMO1)
163 return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo");
164 else if (req == WR_CHECKAMMO2)
165 return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3;
166 else if (req == WR_SUICIDEMESSAGE)
167 w_deathtypestring = "did the impossible";
168 else if (req == WR_KILLMESSAGE)
170 w_deathtypestring = "was gunned by"; // unchecked: SECONDARY