this is my script for a weapon locker like in black ops 2 TranZit, die rise and buried. if you don't know what that is, then basically its a place to store a weapon and keep it between games!. it will keep track of your stored weapons ammo in reserve and in clip and can be modified to not accept certain weapons.
v1.2 update players can now take the weapon if they have a free weapon slot, without it placing your current weapon in
make a trigger use by right clicking in radiant on the 2d view, then go to trigger then trigger use. place it where you want and while its selected press N to bring up the KVPs in the top text box at the bottom insert
Code Snippet
Plaintext
targetname
and in the bottom place
Code Snippet
Plaintext
weapon_locker
press enter and it should appear with the other KVPs
this is where you need to go to use the locker
part 2
now you will need to go to waw root/raw/maps and find your MAPNAME.gsc and open it up
weapon_locker() { wait 2; weapon_locker = getEnt("weapon_locker", "targetname"); weapon_locker setHintString( "press & hold &&1 to store current weapon" ); weapon_locker setCursorHint("HINT_NOICON"); while(1) { weapon_locker waittill( "trigger", user ); if( is_player_valid(user)) { user.old_gun = user getcurrentweapon(); user.gun_ammo = user GetAmmoCount( user.old_gun ); user.gun_ammo_clip = user GetWeaponAmmoClip(user.old_gun);
// this line is for non valid weapons, such as perk bottles, knuckle crack and the syringe when reviving, this should only need to be changed if adding extra perks etc. if (!( user.old_gun == "none" || user.old_gun == "syrette" || user.old_gun == "zombie_melee" || user.old_gun == "zombie_perk_bottle_revive" || user.old_gun == "zombie_perk_bottle_doubletap" || user.old_gun == "zombie_perk_bottle_jugg" || user.old_gun == "zombie_perk_bottle_sleight" || user.old_gun == "zombie_perk_bottle_staminup" || user.old_gun == "zombie_perk_bottle_phd" || user.old_gun == "zombie_perk_bottle_mulekick" || user.old_gun == "zombie_perk_bottle_deadshot" || user.old_gun == "zombie_perk_bottle_cherry" || user.old_gun == "zombie_perk_bottle_vulture" || user.old_gun == "zombie_knuckle_crack" || user.old_gun == "stielhandgranate" || user.old_gun == "zombie_cymbal_monkey" || user.old_gun == "zombie_bowie_flourish" )) { primaryWeapons = user GetWeaponsListPrimaries(); if( (IsDefined( primaryWeapons ) && primaryWeapons.size == 1 || IsDefined( primaryWeapons ) && primaryWeapons.size == 2 && user hasPerk ("specialty_extraammo")) && user.has_stored_weapon == 1) { user giveweapon( user.stored_weapon ); user SetWeaponAmmoStock(user.stored_weapon,user.stored_gun_ammo); user SetWeaponAmmoClip(user.stored_weapon,user.stored_ammo_clip); user switchtoweapon( user.stored_weapon ); user.has_stored_weapon = 0; user SetStat(3009,0); } else // the following line is for weapons that you do not want storeable, i added some from my own map and advise customizing for weapons in your own map. zombie colt should be changed to your starting weapon if ( user.old_gun == "colt" || user.old_gun == "zombie_colt" || user.old_gun == "zombie_colt_upgraded" || user.old_gun == "tesla_gun" || user.old_gun == "tesla_gun_upgraded" || user.old_gun == "thundergun" || user.old_gun == "thundergun_upgraded" || user.old_gun == "ray_gun" || user.old_gun == "ray_gun_upgraded" || user.old_gun == "scavenger" || user.old_gun == "scavenger_upgraded" || user.old_gun == "vorkuta_knife" || user.old_gun == "vorkuta_knife_upgraded" ) { user iPrintLnBold("^7cannot store this weapon"); wait 2; } else { primaryWeapons = user GetWeaponsListPrimaries(); if(!( IsDefined( primaryWeapons ) && primaryWeapons.size == 1 || IsDefined( primaryWeapons ) && primaryWeapons.size == 2 && user hasPerk ("specialty_extraammo") )) user takeweapon( user.old_gun );
if(user.has_stored_weapon == 1) { user giveweapon( user.stored_weapon ); user SetWeaponAmmoStock(user.stored_weapon,user.stored_gun_ammo); user SetWeaponAmmoClip(user.stored_weapon,user.stored_ammo_clip); user switchtoweapon( user.stored_weapon ); } user.switch_weapon = user.stored_weapon; wait 0.1; user.stored_weapon = user.old_gun; user.stored_ammo_clip = user.gun_ammo_clip; user.stored_gun_ammo = user.gun_ammo - user.stored_ammo_clip; wait 0.1;
keys = GetArrayKeys( level.zombie_weapons ); for( i = 0; i < keys.size; i ++ ) { if( keys[i] == user.stored_weapon ) { user SetStat( 3006, i ); break; } } user SetStat(3007,user.stored_gun_ammo); user SetStat(3008,user.stored_ammo_clip); user.has_stored_weapon = 1; user SetStat(3009,1);
user playlocalsound("cha_ching"); user.cur_gun = user getcurrentweapon(); primaryWeapons = user GetWeaponsListPrimaries(); if( IsDefined( primaryWeapons ) && primaryWeapons.size > 0 && (!(user.cur_gun == user.switch_weapon))) { user SwitchToWeapon( primaryWeapons[0] ); } wait 2; } } } } }
thanks to alaurenc9 and Ray1235 for their help!
that should be it, have fun with your new script (please credit if used)
Last Edit: December 15, 2015, 08:39:45 am by death_reaper0
weapon_locker setHintString( "press & hold &&1 to store current weapon" );
weapon_locker setCursorHint("HINT_NOICON");
weapon_locker waittill( "trigger", user ); if( is_player_valid(user)) {
old_gun = user getcurrentweapon();
gun_ammo = user GetAmmoCount( old_gun );
gun_ammo_clip = user GetWeaponAmmoClip(old_gun);
// the following line is for weapons that you do not want storeable, i added some from my own map and advise customizing for weapons in your own map. zombie colt should be changed to your starting weapon if ( old_gun == stored_weapon || old_gun == "colt" || old_gun == "zombie_colt" || old_gun == "zombie_colt_upgraded" || old_gun == "tesla_gun" || old_gun == "tesla_gun_upgraded" || old_gun == "thundergun" || old_gun == "thundergun_upgraded" || old_gun == "ray_gun" || old_gun == "ray_gun_upgraded" || old_gun == "scavenger" || old_gun == "scavenger_upgraded" || old_gun == "vorkuta_knife" || old_gun == "vorkuta_knife_upgraded" ) { user iPrintLnBold("^7cannot store this weapon"); wait 2; } // this line is for non valid weapons, such as perk bottles, knuckle crack and the syringe when reviving, this should only need to be changed if adding extra perks etc. else if ( old_gun == "none" || old_gun == "syrette" || old_gun == "zombie_melee" || old_gun == "zombie_perk_bottle_revive" || old_gun == "zombie_perk_bottle_doubletap" || old_gun == "zombie_perk_bottle_jugg" || old_gun == "zombie_perk_bottle_sleight" || old_gun == "zombie_perk_bottle_staminup" || old_gun == "zombie_perk_bottle_phd" || old_gun == "zombie_perk_bottle_mulekick" || old_gun == "zombie_perk_bottle_deadshot" || old_gun == "zombie_perk_bottle_cherry" || old_gun == "zombie_perk_bottle_vulture" || old_gun == "zombie_knuckle_crack" || old_gun == "stielhandgranate" || old_gun == "zombie_cymbal_monkey" || old_gun == "zombie_bowie_flourish" ) { user iPrintLnBold("^7you are not holding a weapon"); wait 2; } else {
user takeweapon( old_gun );
user giveweapon( stored_weapon ); user SetWeaponAmmoStock(stored_weapon,stored_gun_ammo); user SetWeaponAmmoClip(stored_weapon,stored_ammo_clip); user switchtoweapon( stored_weapon );
wait 0.1;
stored_weapon = old_gun;
stored_ammo_clip = gun_ammo_clip;
stored_gun_ammo = gun_ammo - stored_ammo_clip;
user playlocalsound("cha_ching");
//iprintln( stored_weapon ); //used to see console name of weapon that gets deposited, uncomment if needed
if (level.firstlockeruse == true) // used to switch weapons after the first use when receiving nothing from the locker { primaryWeapons = user GetWeaponsListPrimaries(); if( IsDefined( primaryWeapons ) && primaryWeapons.size > 0 ) { user SwitchToWeapon( primaryWeapons[0] ); } level.firstlockeruse = false; } wait 2; } } } }
to the very bottom of the script
Last Edit: December 10, 2015, 04:01:58 am by death_reaper0
If you want scripts / features made for you, then contact me by PM or email / skype etc it will cost you tho so if you have no intention of reciprocating don't even waste my time
is there a way to make that happen? if so that would be amazing
First off, you'd need to get an array of weapons and a free or unsused stat slot. In this example, I'll use 3005. (for those who don't know, stats store an int which can persist on a player profile permamently in a mod unless the player removes mod's respective mpdata000 file) level.zombie_weapons is the array which keeps all the weapons. So, here, I'm going to find the weapon that player wants to put in (player being the player entity):
Code Snippet
Plaintext
weapon = player getcurrentweapon(); for (i = 0; i < level.zombie_weapons.size; i++) { if(level.zombie_weapons[i].weapon_name == weapon) player SetStat(3005,i); }
This will set the weapon's index to 3005 slot. Now, you probably are wondering, how do you know what is the weapon that the player has put in? Well, there's GetStat
Code Snippet
Plaintext
id = player GetStat(3005); weapon = level.zombie_weapons[id].weapon_name;
And that's how you can use stats for the weapon cabinet Forgive me if I wasn't clear enough, I'm really tired today but I hope it helped you. You can use 3006 and 3007 for storing weapon ammo info. Also, I would recommend using 3008 for storing info if there is a weapon in the cabinet
First off, you'd need to get an array of weapons and a free or unsused stat slot. In this example, I'll use 3005. (for those who don't know, stats store an int which can persist on a player profile permamently in a mod unless the player removes mod's respective mpdata000 file) level.zombie_weapons is the array which keeps all the weapons. So, here, I'm going to find the weapon that player wants to put in (player being the player entity):
Code Snippet
Plaintext
weapon = player getcurrentweapon(); for (i = 0; i < level.zombie_weapons.size; i++) { if(level.zombie_weapons[i].weapon_name == weapon) player SetStat(3005,i); }
This will set the weapon's index to 3005 slot. Now, you probably are wondering, how do you know what is the weapon that the player has put in? Well, there's GetStat
Code Snippet
Plaintext
id = player GetStat(3005); weapon = level.zombie_weapons[id].weapon_name;
And that's how you can use stats for the weapon cabinet Forgive me if I wasn't clear enough, I'm really tired today but I hope it helped you. You can use 3006 and 3007 for storing weapon ammo info. Also, I would recommend using 3008 for storing info if there is a weapon in the cabinet
plenty clear, sounds very useful. Surprised it isnt used more
First off, you'd need to get an array of weapons and a free or unsused stat slot. In this example, I'll use 3005. (for those who don't know, stats store an int which can persist on a player profile permamently in a mod unless the player removes mod's respective mpdata000 file) level.zombie_weapons is the array which keeps all the weapons. So, here, I'm going to find the weapon that player wants to put in (player being the player entity):
Code Snippet
Plaintext
weapon = player getcurrentweapon(); for (i = 0; i < level.zombie_weapons.size; i++) { if(level.zombie_weapons[i].weapon_name == weapon) player SetStat(3005,i); }
This will set the weapon's index to 3005 slot. Now, you probably are wondering, how do you know what is the weapon that the player has put in? Well, there's GetStat
Code Snippet
Plaintext
id = player GetStat(3005); weapon = level.zombie_weapons[id].weapon_name;
And that's how you can use stats for the weapon cabinet Forgive me if I wasn't clear enough, I'm really tired today but I hope it helped you. You can use 3006 and 3007 for storing weapon ammo info. Also, I would recommend using 3008 for storing info if there is a weapon in the cabinet
well i dont understand 100% but i'll test out this later on and see if i can get this working. but i wanna know, would this carry it on between maps? cause if so i'd probably wouldn't use this since most maps would have different guns. it could work for a bo2 style bank though
well i dont understand 100% but i'll test out this later on and see if i can get this working. but i wanna know, would this carry it on between maps? cause if so i'd probably wouldn't use this since most maps would have different guns. it could work for a bo2 style bank though