2 void W_Shotgun_Attack (void)
11 bullets = cvar("g_balance_shotgun_primary_bullets");
12 d = cvar("g_balance_shotgun_primary_damage");
13 f = cvar("g_balance_shotgun_primary_force");
14 spread = cvar("g_balance_shotgun_primary_spread");
16 W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
17 for (sc = 0;sc < bullets;sc = sc + 1)
18 fireBullet (w_shotorg, w_shotdir, spread, d, f, IT_SHOTGUN, sc < 3);
19 if (cvar("g_use_ammunition"))
20 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_primary_ammo");
22 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_primary_ammo"));
25 if (cvar("g_casings") >= 1)
26 SpawnCasing (w_shotorg, ((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
28 // muzzle flash for 1st person view
30 setorigin(flash, '53 5 0');
31 setmodel(flash, "models/uziflash.md3"); // precision set below
32 setattachment(flash, self.weaponentity, "bone01");
34 flash.viewmodelforclient = self;
35 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
37 flash.think = SUB_Remove;
38 flash.nextthink = time + 0.06;
39 flash.angles_z = flash.v_angle_z + random() * 180;
41 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
45 void W_Shotgun_Attack2 (void)
54 bullets = cvar("g_balance_shotgun_secondary_bullets");
55 d = cvar("g_balance_shotgun_secondary_damage");
56 f = cvar("g_balance_shotgun_secondary_force");
57 spread = cvar("g_balance_shotgun_secondary_spread");
59 W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
60 for (sc = 0;sc < bullets;sc = sc + 1)
61 fireBullet (w_shotorg, w_shotdir, spread, d, f, IT_SHOTGUN, sc < 3);
62 if (cvar("g_use_ammunition"))
63 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
65 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_secondary_ammo"));
68 if (cvar("g_casings") >= 1)
69 SpawnCasing (w_shotorg, ((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
72 setorigin(flash, '53 5 0');
73 setmodel(flash, "models/uziflash.md3"); // precision set below
74 setattachment(flash, self.weaponentity, "bone01");
76 flash.viewmodelforclient = self;
77 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
79 flash.think = SUB_Remove;
80 flash.nextthink = time + 0.06;
81 flash.angles_z = flash.v_angle_z + random() * 180;
83 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
87 void shotgun_fire2_03()
90 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), w_ready);
92 void shotgun_fire2_02()
95 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
98 float w_shotgun(float req)
101 if(vlen(self.origin-self.enemy.origin)>200)
102 self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
104 self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
105 else if (req == WR_THINK)
107 if (self.BUTTON_ATCK)
108 if (weapon_prepareattack(0, cvar("g_balance_shotgun_primary_refire")))
111 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), w_ready);
113 if (self.BUTTON_ATCK2)
114 if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire")))
117 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);
120 else if (req == WR_PRECACHE)
122 precache_model ("models/uziflash.md3");
123 precache_model ("models/tracer.mdl");
124 precache_model ("models/weapons/g_shotgun.md3");
125 precache_model ("models/weapons/v_shotgun.md3");
126 precache_model ("models/weapons/w_shotgun.zym");
127 precache_sound ("misc/itempickup.wav");
128 precache_sound ("weapons/ric1.wav");
129 precache_sound ("weapons/ric2.wav");
130 precache_sound ("weapons/ric3.wav");
131 precache_sound ("weapons/shotgun_fire.wav");
132 precache_sound ("weapons/tink1.wav");
133 if (cvar("g_casings") >= 1)
134 precache_model ("models/casing_shell.mdl");
136 else if (req == WR_SETUP)
137 weapon_setup(WEP_SHOTGUN, "shotgun", IT_SHELLS);
138 else if (req == WR_CHECKAMMO1)
139 return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo");
140 else if (req == WR_CHECKAMMO2)
141 return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3;
142 else if (req == WR_REGISTER)
143 weapon_register(WEP_SHOTGUN, min(cvar("g_balance_shotgun_primary_ammo"), cvar("g_balance_shotgun_secondary_ammo")));