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, '11 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 W_Smoke(w_shotorg + v_forward * 8, v_forward, 12);
23 //te_smallflash(w_shotorg);
26 if (cvar("g_casings") >= 1)
27 SpawnCasing (w_shotorg, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
29 // muzzle flash for 1st person view
31 setorigin(flash, '53 5 0');
32 setmodel(flash, "models/uziflash.md3"); // precision set below
33 setattachment(flash, self.weaponentity, "bone01");
35 flash.viewmodelforclient = self;
36 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
38 flash.think = SUB_Remove;
39 flash.nextthink = time + 0.06;
40 flash.angles_z = flash.v_angle_z + random() * 180;
42 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
46 void W_Shotgun_Attack2 (void)
55 bullets = cvar("g_balance_shotgun_secondary_bullets");
56 d = cvar("g_balance_shotgun_secondary_damage");
57 f = cvar("g_balance_shotgun_secondary_force");
58 spread = cvar("g_balance_shotgun_secondary_spread");
60 W_SetupShot (self, '11 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
61 for (sc = 0;sc < bullets;sc = sc + 1)
62 fireBullet (w_shotorg, w_shotdir, spread, d, f, IT_SHOTGUN, sc < 3);
63 if (cvar("g_use_ammunition"))
64 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
66 W_Smoke(w_shotorg + v_forward * 8, v_forward, 12);
67 //te_smallflash(w_shotorg);
70 if (cvar("g_casings") >= 1)
71 SpawnCasing (w_shotorg, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
74 setorigin(flash, '53 5 0');
75 setmodel(flash, "models/uziflash.md3"); // precision set below
76 setattachment(flash, self.weaponentity, "bone01");
78 flash.viewmodelforclient = self;
79 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
81 flash.think = SUB_Remove;
82 flash.nextthink = time + 0.06;
83 flash.angles_z = flash.v_angle_z + random() * 180;
85 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
89 void() shotgun_fire2_03 =
92 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), w_ready);
94 void() shotgun_fire2_02 =
97 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
100 float(float req) w_shotgun =
103 if(vlen(self.origin-self.enemy.origin)>200)
104 self.button0 = bot_aim(1000000, 0, 0.001, FALSE);
106 self.button3 = bot_aim(1000000, 0, 0.001, FALSE);
107 else if (req == WR_THINK)
110 if (weapon_prepareattack(0, cvar("g_balance_shotgun_primary_refire")))
113 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), w_ready);
116 if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire")))
119 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);
122 else if (req == WR_PRECACHE)
124 precache_model ("models/uziflash.md3");
125 precache_model ("models/tracer.mdl");
126 precache_model ("models/weapons/g_shotgun.md3");
127 precache_model ("models/weapons/v_shotgun.md3");
128 precache_model ("models/weapons/w_shotgun.zym");
129 precache_sound ("misc/itempickup.wav");
130 precache_sound ("weapons/ric1.wav");
131 precache_sound ("weapons/ric2.wav");
132 precache_sound ("weapons/ric3.wav");
133 precache_sound ("weapons/shotgun_fire.wav");
134 precache_sound ("weapons/tink1.wav");
135 if (cvar("g_casings") >= 1)
136 precache_model ("models/casing_shell.mdl");
138 else if (req == WR_SETUP)
139 weapon_setup(WEP_SHOTGUN, "shotgun", IT_SHELLS);
140 else if (req == WR_CHECKAMMO1)
141 return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo");
142 else if (req == WR_CHECKAMMO2)
143 return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3;
144 else if (req == WR_REGISTER)
145 weapon_register(WEP_SHOTGUN, min(cvar("g_balance_shotgun_primary_ammo"), cvar("g_balance_shotgun_secondary_ammo")));