Posts
941
Respect
136Add +1
Forum Rank
The Decider
Primary Group
Member
Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!
#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_zombiemode_weapons;
main()
{
self.storagecost = 500; // Set the cost of the storage/regenerate ammo
trig = getEnt("storage_trig","targetname");
startorig = getEnt("storage_start","targetname");
endorig = getEnt("storage_end","targetname");
level.upgrade = 0;
level.take = 1;
thread storage_trig(trig, startorig, endorig);
}
storage_trig(trig, startorig, endorig)
{
trig setHintString("Requires Power");
trig SetCursorHint( "HINT_NOICON" );
flag_wait("electricity_on");
while(1)
{
trig setHintString("Press f to store your weapon["+self.storagecost+"]");
trig waittill("trigger",player);
if( player.score >= self.storagecost )
{
player playsound( "cha_ching" );
player maps\_zombiemode_score::minus_to_player_score( self.storagecost );
current_weapon = player GetCurrentWeapon();
trig setHintString("Storing...");
weapon_stock_ammo = player getWeaponAmmoStock(current_weapon);
weapList = player GetWeaponsListPrimaries();
player takeweapon(current_weapon);
player switchtoweapon(weapList[1]);
spawnweapon(current_weapon, startorig, endorig, player);
thread give_ammo();
trig setHintString("Press f to take your weapon out of storage");
trig enable_trigger();
trig waittill("trigger",player);
spawngive(player);
giveback(current_weapon,player,0);
level.stop = 1;
player setWeaponAmmoStock(current_weapon, (weapon_stock_ammo+level.addammo));
wait 0.5;
level.stop = 0;
level.addammo = 0;
}
}
}
spawnweapon(weapon, startorig, endorig, player)
{
level.modeln = spawn( "script_model", startorig.origin );
modelname = GetWeaponModel(weapon);
level.modeln setmodel(modelname);
level.modeln.angles = self.angles +( 0, 90, 0 );
level.modeln moveto( endorig.origin,5,1,1);
wait 5;
}
spawngive(player)
{
timer = 2;
on = 0;
while(1)
{
level.modeln moveto( player.origin+(0,0,50),timer,0,0);
on = on+1;
wait 1;
if(on == 5){ break; }
}
level.modeln Delete();
}
rotate(entity, time)
{
on = 0;
while(1)
{
entity rotateYaw(360,1);
on = on+1;
if( on == time )
{
break;
}
wait 1;
}
}
//devmap nazi_zombie_family
give_ammo()
{
level.addammo = 0;
while(1)
{
level.addammo = level.addammo+1;
wait 0.5;
if(level.stop == 1)
{
break;
}
}
}
giveback(weapon, player, up)
{
weapList = player GetWeaponsListPrimaries();
current_weapon = player GetCurrentWeapon();
if(weapList.size >= 2)
{
player takeweapon(current_weapon);
}
if(up == 0)
{
player giveweapon(weapon);
player switchtoweapon(weapon);
}
}


![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() Oil Rig Beta Access |

thread maps\_storage::main(); maps\_zombiemode::main();#include maps\_utility;
#include common_scripts\utility;
#include maps\_zombiemode_utility;
#include maps\_zombiemode_weapons;
main()
{
level.storagecost = 500; // Set the cost of the storage/regenerate ammo
trig = getEnt("storage_trig","targetname");
trig thread storage_func();
}
storage_func()
{
player = undefined;
self setHintString("Press f to store your weapon["+level.storagecost+"]");
self waittill("trigger",player);
weapList = player GetWeaponsListPrimaries();
if( weaplist.size <= 1 )
{
player iprintlnbold( "Only got one weapon, can't put it in storage" );
self thread storage_func();
}
else if( weaplist.size >= 2 )
{
if( player.score >= level.storagecost )
{
player playsound( "cha_ching" );
player maps\_zombiemode_score::minus_to_player_score( level.storagecost );
player thread store_weapon( self, player );
}
if( player.score < level.storagecost )
{
player iprintlnbold( "Not enough points" );
self thread storage_func();
}
}
}
store_weapon( trig, player )
{
trig setHintString("Storing weapon...");
weapList = player GetWeaponsListPrimaries();
stored_weapon = player GetCurrentWeapon();
weapon_stock_ammo = player getWeaponAmmoStock( stored_weapon );
clip_stock_ammo = player GetWeaponAmmoClip( stored_weapon );
player takeweapon( stored_weapon );
weapList = player GetWeaponsListPrimaries();
switch_gun = weapList[0];
if( switch_gun == "none" )
{
switch_gun = weapList[1];
iprintln( "changing gun to switch to");
}
// if( switch_gun == "none" ) // MULE KICK ???
// {
// switch_gun = weapList[2];
// iprintln( "changing gun to switch to");
// }
player switchtoweapon( switch_gun );
trig thread storage_anims( stored_weapon );
trig thread fill_ammo( player, stored_weapon, weapon_stock_ammo, clip_stock_ammo );
wait 5;
trig setHintString("Press f to take your weapon out of storage");
trig waittill("trigger", player );
weapList = player GetWeaponsListPrimaries();
if( weaplist.size >= 2 )
{
player iprintlnbold( "This will replace your current weapon!" );
trig setHintString("Press f to take pick up weapon");
trig waittill("trigger", player );
trig notify( "gun_grabbed" );
player thread gun_storage_hud_destroy();
wait 2;
current_weapon = player GetCurrentWeapon();
player takeweapon( current_weapon );
player giveweapon(stored_weapon);
player setWeaponAmmoStock(stored_weapon, player.gun_stock );
player SetWeaponAmmoClip(stored_weapon, player.clip_stock );
player switchtoweapon(stored_weapon);
trig thread storage_func();
}
else if( weaplist.size <= 1 )
{
trig notify( "gun_grabbed" );
player thread gun_storage_hud_destroy();
wait 2;
player giveweapon(stored_weapon);
player setWeaponAmmoStock(stored_weapon, player.gun_stock );
player SetWeaponAmmoClip(stored_weapon, player.clip_stock );
player switchtoweapon(stored_weapon);
trig thread storage_func();
}
}
fill_ammo( player, weapon, weapon_stock, clip_stock )
{
player endon( "disconnect" );
player endon( "death" );
self endon( "gun_grabbed" );
player.gun_max = 0;
player.clip_max = 0;
player.total_max = 0;
player.gun_stock = 0;
player.clip_stock = 0;
player.total_gun = 0;
player.gun_max = WeaponMaxAmmo( weapon );
player.clip_max = WeaponClipSize( weapon );
player.total_max = player.gun_max + player.clip_max ;
player.gun_stock = weapon_stock;
player.clip_stock = clip_stock;
player.total_gun = player.gun_stock + player.clip_stock ;
player thread hud_create_gun_storage();
for(i=player.clip_stock;player.clip_stock< player.clip_max;player.clip_stock++ )
{
wait 0.5;
iprintln( "adding bullet to clip" );
player.total_gun = player.gun_stock + player.clip_stock ;
player.store_hud[ "stock2" ] SetValue( player.total_gun );
}
iprintln( "clip full, changing to gun stock" );
for(i=player.gun_stock;player.gun_stock< player.gun_max;player.gun_stock++ )
{
wait 0.5;
iprintln( "adding bullet to gun" );
player.total_gun = player.gun_stock + player.clip_stock ;
player.store_hud[ "stock2" ] SetValue( player.total_gun );
}
player thread gun_storage_hud_destroy();
iprintln( "gun filled to max!" );
}
storage_anims( weapon )
{
start = getent( "store_start" , "targetname" );
end = getent( "store_end" , "targetname" );
gun_model = GetWeaponModel( weapon );
gun = Spawn( "script_model" , start.origin );
gun.angles = self.angles;
gun SetModel( gun_model );
gun moveto( end.origin, 2 );
gun rotateyaw( 540, 2);
wait 2;
playfx (level._effect["powerup_grabbed_wave"], end.origin );
self waittill( "gun_grabbed" );
gun moveto( start.origin, 2 );
gun rotateyaw( 540, 2);
wait 2;
playfx (level._effect["powerup_grabbed_wave"], start.origin );
gun delete();
}
hud_create_gun_storage()
{
iprintln( "creating HUD element" );
texthud = create_simple_hud( self );
texthud.foreground = true;
texthud.sort = 1;
texthud.hidewheninmenu = false;
texthud.alignX = "left";
texthud.alignY = "bottom";
texthud.horzAlign = "left";
texthud.vertAlign = "bottom";
texthud.x = 10;
texthud.y = -220;
texthud.fontScale = 1;
texthud.color = ( 1.0, 1.0, 90 );
texthud.alpha = 1;
texthud setText( "Stored weapon max ammo:" );
self.store_hud[ "text" ] = texthud;
hud = create_simple_hud( self );
hud.foreground = true;
hud.sort = 1;
hud.hidewheninmenu = false;
hud.alignX = "left";
hud.alignY = "bottom";
hud.horzAlign = "left";
hud.vertAlign = "bottom";
hud.x = 10;
hud.y = -200;
hud.fontScale = 1;
hud.color = ( 1.0, 1.0, 90 );
hud.alpha = 1;
hud SetValue( self.total_max ) ;
self.store_hud[ "stock" ] = hud;
text2hud = create_simple_hud( self );
text2hud.foreground = true;
text2hud.sort = 1;
text2hud.hidewheninmenu = false;
text2hud.alignX = "left";
text2hud.alignY = "bottom";
text2hud.horzAlign = "left";
text2hud.vertAlign = "bottom";
text2hud.x = 10;
text2hud.y = -180;
text2hud.fontScale = 1;
text2hud.color = ( 1.0, 1.0, 90 );
text2hud.alpha = 1;
text2hud setText( "Current ammo:" );
self.store_hud[ "text2" ] = text2hud;
text3hud = create_simple_hud( self );
text3hud.foreground = true;
text3hud.sort = 1;
text3hud.hidewheninmenu = false;
text3hud.alignX = "left";
text3hud.alignY = "bottom";
text3hud.horzAlign = "left";
text3hud.vertAlign = "bottom";
text3hud.x = 10;
text3hud.y = -160;
text3hud.fontScale = 1;
text3hud.color = ( 1.0, 1.0, 90 );
text3hud.alpha = 1;
text3hud SetValue( self.total_gun ) ;
self.store_hud[ "stock2" ] = text3hud;
}
gun_storage_hud_destroy()
{
iprintln( "removing HUD element" );
self.store_hud[ "stock" ] destroy_hud();
self.store_hud[ "stock" ] = undefined;
self.store_hud[ "stock2" ] destroy_hud();
self.store_hud[ "stock2" ] = undefined;
self.store_hud[ "text" ] destroy_hud();
self.store_hud[ "text" ] = undefined;
self.store_hud[ "text2" ] destroy_hud();
self.store_hud[ "text2" ] = undefined;
}
storage_trig - targetnamestore_start - targetnamestore_end - targetname
I took the liberty to start over, tell me if there's anything missing.. Btw it adds bullets for every type of gun at the same rate. You might want to change that, but i figured i should leave some work for you

![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Has shown excellence and experience in the area of custom scripting in the UGX-Mods community. |
![]() Oil Rig Beta Access |
Seeing as you already did all the work it would be really nice if you posted this in the user tutorials section so other members could easily access it.
!!!! it seems that making this script wasnt as easy as i thought
i'll try to test it with mule kick(i also noticed the part you commented out for it o.O lol) ill let you know about any bugs and i think it would be cool to share it 