Make a new .gsc file in the proper scripts folder for your mod or map, and paste all of this into it.
Name it whatever you want, or give it it's own namespace. Whatever you want to do. I named the script one_in_the_chamber because I'm creative.
//read comments for helpful tips
//Spawns players with a random weapon each game for one in the chamber
#using scripts\shared\array_shared;
#using scripts\shared\util_shared;
#using scripts\shared\callbacks_shared;
#using scripts\codescripts\struct;
function main()
{
thread no_weapons();
callback::on_spawned(&oic_start);
}
function no_weapons() //this function disables wall buys. You have to disable magic box and pack a punch separately.
{
level.func_override_wallbuy_prompt = ¬hing_func;
}
function nothing_func()
{
self.stub.hint_string = "";
self.stub.cursor_hint = "HINT_NOICON";
}
function onPlayerDisconnect()
{
self waittill( "disconnect" );
}
function oic_start()
{
self thread onPlayerDisconnect();
self endon("death");
self endon("disconnect");
wait 0.05;
self give_oic_weapon();
self thread kill_watcher();
}
function give_oic_weapon()
{
self endon("death");
self endon("disconnect");
wait 0.05;
weapons = []; //weapons array, follow the pattern to add more weapon options
weapons[0] = "sniper_powerbolt";
weapons[1] = "shotgun_precision";
weapons[2] = "launcher_standard";
weapons[3] = "sniper_fastsemi";
weapons[4] = "sniper_fastbolt";
oic_weap = weapons[randomIntRange(0,5)]; //set the 2nd number to 1 higher than the last number in your weapons array
self TakeAllWeapons();
weap = getweapon(oic_weap);
self giveweapon(weap);
self setWeaponAmmoClip(weap, 1);
self setWeaponAmmoStock(weap, 0);
self switchToWeapon(weap);
stabby = GetWeapon( "knife" );
self GiveWeapon( stabby );
}
function kill_watcher()
{
self endon("death");
self endon("disconnect");
while(IsAlive(self))
{
self waittill("zom_kill");
weapon = self getcurrentweapon();
ammo_clip = self getWeaponAmmoClip(weapon);
self setWeaponAmmoClip(weapon, ammo_clip + 1);
self setWeaponAmmoStock(weapon, 0); //this part stops there from ever being more ammo than what is in the magazine aka no stock ammo, only clip ammo
}
}
Now need to make it so the max ammo powerup will fill up the clip ammo, not the stock ammo. Copy _zm_powerup_full_ammo.gsc to the proper scripts folder.
Find
players[i] GiveMaxAmmo( primary_weapons[x] );
players[i] SetWeaponAmmoClip( primary_weapons[x], 125 );
if ( players[i] HasWeapon( primary_weapons[x] ) )
//players[i] GiveMaxAmmo( primary_weapons[x] );
players[i] SetWeaponAmmoClip( primary_weapons[x], 125 );
Copy _zm_magicbox.gsc to the proper scripts folder.
Open it and find
if ( zm_utility::is_Classic() )
//if ( zm_utility::is_Classic() )
//{
//level.chests = struct::get_array( "treasure_chest_use", "targetname" );
//treasure_chest_init( level.start_chest_name );
//}
Copy _zm_powerup_fire_sale.gsc to the proper scripts folder then open it and somewhere at the top add
#using scripts\zm\one_in_the_chamber;
Then still in firesale script find
function grab_fire_sale( player )
function grab_fire_sale( player )
{
players = getplayers();
foreach (player in players)
{
player one_in_the_chamber::give_oic_weapon();
wait 0.5;
player thread more_ammo();
}
//level thread start_fire_sale( self );
//player thread zm_powerups::powerup_vo("firesale");
}
function more_ammo() //gives the player full ammo for new gun
{
weapon = self getcurrentweapon();
ammo_clip = self getWeaponAmmoClip(weapon);
self setWeaponAmmoClip(weapon, ammo_clip + 125);
self setWeaponAmmoStock(weapon, 0);
}
So copy _zm_powerup_weapon_minigun.gsc to the proper scripts folder. Open it and find...
function grab_minigun( player )
function grab_minigun( player )
{
level thread give_bullets( player );
//level thread minigun_weapon_powerup( player );
player thread zm_powerups::powerup_vo( "minigun" );
if( IsDefined( level._grab_minigun ) )
{
level thread [[ level._grab_minigun ]]( player );
}
}
function give_bullets( ent_player )
{
weapon = ent_player getcurrentweapon();
ammo_clip = ent_player getWeaponAmmoClip(weapon);
ent_player setWeaponAmmoClip(weapon, ammo_clip + 5); //change to amount of bullets you want to give
ent_player setWeaponAmmoStock(weapon, 0);
}
Okay, finally. The pack a punch machine. I didn't want it active in my version cuz the guns are already strong, then pack a punching would make the game go forever. So, once again; I went the lazy quick route of commenting stuff out. Someone probably found a better way to deactivate pack a punch by now.
Copy _zm_pack_a_punch.gsc to the proper scripts folder and open it and find...
use_trigger
Don't forget to call your script somewhere for your map or mod. Since I did a mod, I called the script in my magicbox script. So the using...
//one in the chamber
#using scripts\zm\one_in_the_chamber;
one_in_the_chamber::main();
I believe that's everything. I deleted the BO3 tools awhile ago so can't really test the tutorial on my own or really support the tutorial any further. I'm sure some brilliant scripter in the community could make a better script and tutorial but here's this decent one I wrote, now for anyone to use.
Oh, I guess for anyone that wants to see how the mode plays