Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .float shotgun_bullets_fired;
- .float shotgun_bullets_hit;
- void W_Shotgun_Attack (void)
- {
- float sc;
- float bullets;
- float d;
- float f;
- float spread;
- local entity flash;
- bullets = cvar("g_balance_shotgun_primary_bullets");
- d = cvar("g_balance_shotgun_primary_damage");
- f = cvar("g_balance_shotgun_primary_force");
- spread = cvar("g_balance_shotgun_primary_spread");
- self.shotgun_bullets_fired = self.shotgun_bullets_fired + bullets;
- W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
- for (sc = 0;sc < bullets;sc = sc + 1)
- self.shotgun_bullets_hit = self.shotgun_bullets_hit + fireBullet (w_shotorg, w_shotdir, spread, d, f, WEP_SHOTGUN, sc < 3);
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_primary_ammo");
- if not(self.isbot)
- {
- string s;
- float e;
- e = self.shotgun_bullets_hit / self.shotgun_bullets_fired ;
- e = f * 100;
- e = rint(e);
- s = ftos(e);
- sprint(self, "Shotgun Hit%: ",s,"\n");
- }
- pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_primary_ammo"));
- // casing code
- if (cvar("g_casings") >= 1)
- 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);
- // muzzle flash for 1st person view
- flash = spawn();
- setorigin(flash, '53 5 0');
- setmodel(flash, "models/uziflash.md3"); // precision set below
- setattachment(flash, self.weaponentity, "bone01");
- flash.owner = self;
- flash.viewmodelforclient = self;
- flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
- flash.scale = 1.2;
- flash.think = SUB_Remove;
- flash.nextthink = time + 0.06;
- flash.angles_z = flash.v_angle_z + random() * 180;
- flash.alpha = 1;
- flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- }
- void W_Shotgun_Attack2 (void)
- {
- float sc;
- float bullets;
- float d;
- float f;
- float spread;
- local entity flash;
- bullets = cvar("g_balance_shotgun_secondary_bullets");
- d = cvar("g_balance_shotgun_secondary_damage");
- f = cvar("g_balance_shotgun_secondary_force");
- spread = cvar("g_balance_shotgun_secondary_spread");
- W_SetupShot (self, '25 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
- for (sc = 0;sc < bullets;sc = sc + 1)
- fireBullet (w_shotorg, w_shotdir, spread, d, f, WEP_SHOTGUN | HITTYPE_SECONDARY, sc < 3);
- if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
- self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
- pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, cvar("g_balance_shotgun_secondary_ammo"));
- // casing code
- if (cvar("g_casings") >= 1)
- 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);
- flash = spawn();
- setorigin(flash, '53 5 0');
- setmodel(flash, "models/uziflash.md3"); // precision set below
- setattachment(flash, self.weaponentity, "bone01");
- flash.owner = self;
- flash.viewmodelforclient = self;
- flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
- flash.scale = 1.2;
- flash.think = SUB_Remove;
- flash.nextthink = time + 0.06;
- flash.angles_z = flash.v_angle_z + random() * 180;
- flash.alpha = 1;
- flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
- }
- // weapon frames
- void shotgun_fire2_03()
- {
- W_Shotgun_Attack2();
- weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), w_ready);
- }
- void shotgun_fire2_02()
- {
- W_Shotgun_Attack2();
- weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
- }
- void spawnfunc_weapon_shotgun(); // defined in t_items.qc
- float w_shotgun(float req)
- {
- if (req == WR_AIM)
- if(vlen(self.origin-self.enemy.origin)>200)
- self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
- else
- self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
- else if (req == WR_THINK)
- {
- if (self.BUTTON_ATCK)
- if (weapon_prepareattack(0, cvar("g_balance_shotgun_primary_refire")))
- {
- W_Shotgun_Attack();
- weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), w_ready);
- }
- if (self.BUTTON_ATCK2)
- if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire")))
- {
- W_Shotgun_Attack2();
- weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);
- }
- }
- else if (req == WR_PRECACHE)
- {
- precache_model ("models/uziflash.md3");
- precache_model ("models/tracer.mdl");
- precache_model ("models/weapons/g_shotgun.md3");
- precache_model ("models/weapons/v_shotgun.md3");
- precache_model ("models/weapons/w_shotgun.zym");
- precache_sound ("misc/itempickup.wav");
- precache_sound ("weapons/ric1.wav");
- precache_sound ("weapons/ric2.wav");
- precache_sound ("weapons/ric3.wav");
- precache_sound ("weapons/shotgun_fire.wav");
- if (cvar("g_casings") >= 1)
- {
- precache_sound ("weapons/casings1.wav");
- precache_sound ("weapons/casings2.wav");
- precache_sound ("weapons/casings3.wav");
- precache_model ("models/casing_shell.mdl");
- }
- }
- else if (req == WR_SETUP)
- weapon_setup(WEP_SHOTGUN);
- else if (req == WR_CHECKAMMO1)
- return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo");
- else if (req == WR_CHECKAMMO2)
- return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3;
- else if (req == WR_SUICIDEMESSAGE)
- w_deathtypestring = "did the impossible";
- else if (req == WR_KILLMESSAGE)
- {
- w_deathtypestring = "was gunned by"; // unchecked: SECONDARY
- }
- return TRUE;
- };
Add Comment
Please, Sign In to add comment