Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
riouken

Local Ammo Boxes

Recommended Posts

I have been using local ammo boxes for several months now. As of about two weeks ago all my scripts stopped being local and are treated as global.

My unit just ran a mission with this script in it 3 weeks ago and the ammo box worked correctly. Now when I load this mission the ammo box is no longer client side.

in the init of the ammo box.

hNil = [this] execVM "ammous_oa_ace.sqf";

///////// Made by Riouken for the 15th MEU(SOC)
///////// Definitions used from xeno
///////// If you have problems with the script post a topic in the forums for help or PM me. 
/////////
///////// Run with :                 hNil = [this] execVM "ammous_oa_ace.sqf";
///////// Name your ammo box :       ammo1
private "ammo1";

#define __awc(wtype,wcount) ammo1 addWeaponCargo [#wtype,wcount];
#define __amc(mtype,mcount) ammo1 addMagazineCargo [#mtype,mcount];

ammo1 = _this select 0;



while {true} do
{

clearMagazineCargo ammo1;
clearWeaponCargo ammo1;


__awc(ACE_ParachutePack,50)
__awc(M9,1)
__awc(M9SD,1)
__awc(Colt1911,1)
__awc(revolver_EP1,1)
__awc(revolver_gold_EP1,1)
__awc(glock17_EP1,1)
__awc(Sa61_EP1,1)
__awc(UZI_EP1,1)
__awc(UZI_SD_EP1,1)
__awc(ACE_Glock18,1)
__awc(ACE_P226,1)
__awc(ACE_Flaregun,1)
__awc(M16A2,1)
__awc(M16A2GL,1)
       __awc(M16A4_ACG,1)
       __awc(M16A4_ACG_GL,1)

__awc(Sa58P_EP1,1)
__awc(Sa58V_EP1,1)
__awc(Sa58V_RCO_EP1,1)
__awc(Sa58V_CCO_EP1,1)

__awc(FN_FAL,1)
__awc(FN_FAL_ANPVS4,1)

__awc(LeeEnfield,1)

__awc(M4A1,1)
__awc(ACE_M4A1_GL,1)
__awc(ACE_M4A1_GL_SD,1)
__awc(M4A3_CCO_EP1,1)
__awc(M4A3_RCO_GL_EP1,1)

__awc(ACE_SOC_M4A1_Aim,1)
__awc(ACE_SOC_M4A1_AIM_SD,1)
__awc(ACE_SOC_M4A1_GL,1)
__awc(ACE_SOC_M4A1,1)
__awc(ACE_SOC_M4A1_GL_SD,1)
__awc(ACE_SOC_M4A1_Eotech,1)
__awc(ACE_SOC_M4A1_GL_13,1)
__awc(ACE_SOC_M4A1_GL_EOTECH,1)
__awc(ACE_SOC_M4A1_SD_9,1)
__awc(ACE_SOC_M4A1_SHORTDOT,1)
__awc(ACE_SOC_M4A1_SHORTDOT_SD,1)
__awc(ACE_SOC_M4A1_RCO_GL,1)
__awc(ACE_SOC_M4A1_GL_AIMPOINT,1)

__awc(ACE_M4A1_ACOG,1)
__awc(ACE_M4A1_ACOG_SD,1)
__awc(ACE_M4A1_Aim_SD,1)
__awc(ACE_M4A1_Eotech,1)

__awc(ACE_HK416_D10,1)
__awc(ACE_HK416_D10_SD,1)
__awc(ACE_HK416_D10_COMPM3,1)
__awc(ACE_HK416_D10_COMPM3_SD,1)
__awc(ACE_HK416_D14,1)
__awc(ACE_HK416_D14_SD,1)
__awc(ACE_HK416_D14_COMPM3,1)
__awc(ACE_HK416_D14_COMPM3_M320,1)

__awc(ACE_HK416_D10_M320,1)

__awc(M14_EP1,1)

__awc(G36C_camo,1)
__awc(G36_C_SD_camo,1)
__awc(G36A_camo,1)
__awc(G36K_camo,1)

__awc(ACE_G3A3,1)
__awc(ACE_G3SG1,1)

__awc(ACE_MP5A4,1)
__awc(ACE_UMP45,1)
__awc(ACE_UMP45_SD,1)

__awc(SCAR_L_CQC,1)
__awc(SCAR_L_CQC_Holo,1)
__awc(SCAR_L_STD_Mk4CQT,1)
__awc(SCAR_L_STD_EGLM_RCO,1)
__awc(SCAR_L_CQC_EGLM_Holo,1)
__awc(SCAR_L_STD_EGLM_TWS,1)
__awc(SCAR_L_STD_HOLO,1)
__awc(SCAR_L_CQC_CCO_SD,1)
__awc(SCAR_H_CQC_CCO,1)
__awc(SCAR_H_CQC_CCO_SD,1)
__awc(SCAR_H_STD_EGLM_Spect,1)
__awc(SCAR_H_LNG_Sniper,1)
__awc(SCAR_H_LNG_Sniper_SD,1)
__awc(SCAR_H_STD_TWS_SD,1)

__awc(MG36_camo,1)
__awc(Mk_48_DES_EP1,1)
__awc(m240_scoped_EP1,1)
__awc(M249_EP1,1)
__awc(M249_TWS_EP1,1)
__awc(M249_m145_EP1,1)
__awc(M60A4_EP1,1)
//__awc(ACE_M249Para,1)
//__awc(ACE_M249Para_M145,1)

__awc(M24_des_EP1,1)
__awc(M107,1)
__awc(m107_TWS_EP1,1)
__awc(M110_TWS_EP1,1)
__awc(M110_NVG_EP1,1)
__awc(ACE_M4SPR_SD,1)
__awc(ACE_M109,1)
__awc(ACE_M110,1)
__awc(ACE_M110_SD,1)
__awc(ACE_TAC50,1)
__awc(ACE_TAC50_SD,1)

__awc(M32_EP1,1)
__awc(M79_EP1,1)
__awc(Mk13_EP1,1)

__awc(M136,1)
__awc(M47Launcher_EP1,1)
__awc(MAAWS,1)

//__awc(ACE_GlassesSpectacles,1)
//__awc(ACE_GlassesRoundGlasses,1)
__awc(ACE_GlassesSunglasses,1)
__awc(ACE_GlassesLHD_glasses,1)
__awc(ACE_GlassesTactical,1)
__awc(ACE_GlassesGasMask_US,1)
__awc(ACE_GlassesBalaklava,1)
__awc(ACE_Earplugs,1)
__awc(ACE_Kestrel4500,1)
__awc(ACE_Map_Tools,1)
__awc(ACE_KeyCuffs,1)

__awc(Laserdesignator,1)
__awc(Binocular,1)
__awc(Binocular_Vector,1)
__awc(ACE_Rangefinder_OD,1)
__awc(NVGoggles,1)
__awc(ACE_SpottingScope,1)
__awc(ACE_WireCutter,1)
__awc(ACE_DAGR,1)
__awc(JAVELIN,1)
__awc(STINGER,1)

__amc(ace_flashbang,30)
__amc(ace_m84,30)
__amc(ace_m7a3,30)
__amc(ace_m34,30)
__amc(ACE_IRStrobe,30)
__amc(ACE_M86PDM,30)
__amc(ACE_M2SLAM_M,30)
__amc(ACE_Battery_Rangefinder,30)
__amc(HandGrenade_West,30)
//__amc(HandGrenade_Stone,50)
__amc(Smokeshell,20)
__amc(Smokeshellred,20)
__amc(Smokeshellgreen,20)
__amc(SmokeShellYellow,20)
__amc(SmokeShellOrange,20)
__amc(SmokeShellPurple,50)
__amc(SmokeShellBlue,50)
__amc(30Rnd_9x19_MP5,30)
__amc(30Rnd_9x19_MP5SD,30)
__amc(ACE_25Rnd_1143x23_B_UMP45,50)
__amc(7Rnd_45ACP_1911,30)
__amc(ACE_33Rnd_9x19_G18,30)
__amc(ACE_15Rnd_9x19_P226,30)
__amc(6Rnd_45ACP,50)
__amc(20Rnd_B_765x17_Ball,30)
__amc(10Rnd_B_765x17_Ball,50)
__amc(15Rnd_9x19_M9,30)
__amc(15Rnd_9x19_M9SD,30)
__amc(17Rnd_9x19_glock17,50)
__amc(20Rnd_556x45_Stanag,30)
__amc(30Rnd_556x45_Stanag,30)
__amc(ACE_30Rnd_556x45_T_Stanag,30)
__amc(ACE_30Rnd_556x45_SB_Stanag,30)
__amc(30Rnd_556x45_StanagSD,30)
__amc(30Rnd_762x39_SA58,50)
__amc(20Rnd_762x51_FNFAL,30)
__amc(10x_303,50)
__amc(30Rnd_556x45_G36,30)
__amc(30Rnd_556x45_G36SD,30)
__amc(ACE_20Rnd_762x51_B_G3,30)
__amc(200Rnd_556x45_M249,30)
__amc(ACE_200Rnd_556x45_T_M249,30)
__amc(100Rnd_556x45_M249,30)
__amc(100Rnd_556x45_BetaCMag,30)
__amc(8Rnd_B_Beneli_74Slug,50)
__amc(5Rnd_762x51_M24,6)
__amc(ACE_5Rnd_762x51_T_M24,6)
__amc(20Rnd_762x51_DMR,50)
__amc(10Rnd_127x99_M107,3)
__amc(ACE_10Rnd_127x99_Raufoss_m107,3)
__amc(ACE_5Rnd_25x59_HEDP_Barrett,3)
__amc(ACE_20Rnd_762x51_SB_M110,10)
__amc(ACE_20Rnd_762x51_S_M110,10)
__amc(ACE_20Rnd_762x51_T_M110,10)
__amc(ACE_5Rnd_127x99_B_TAC50,3)
__amc(ACE_5Rnd_127x99_S_TAC50,3)
__amc(ACE_5Rnd_127x99_T_TAC50,3)
__amc(20Rnd_762x51_B_SCAR,30)
__amc(20rnd_762x51_SB_SCAR,30)
__amc(100Rnd_762x51_M240,30)
__amc(ACE_6Rnd_CS_M32,30)
__amc(FlareWhite_M203,20)
__amc(FlareGreen_M203,20)
__amc(FlareRed_M203,20)
__amc(FlareYellow_M203,20)
__amc(1Rnd_HE_M203,30)
__amc(6Rnd_FlareWhite_M203,20)
__amc(6Rnd_FlareGreen_M203,20)
__amc(6Rnd_FlareRed_M203,20)
__amc(6Rnd_FlareYellow_M203,20)
__amc(6Rnd_HE_M203,30)
__amc(6Rnd_Smoke_M203,20)
__amc(6Rnd_SmokeRed_M203,20)
__amc(6Rnd_SmokeGreen_M203,20)
__amc(6Rnd_SmokeYellow_M203,20)
__amc(1Rnd_Smoke_M203,20)
__amc(1Rnd_SmokeRed_M203,20)
__amc(1Rnd_SmokeGreen_M203,20)
__amc(1Rnd_SmokeYellow_M203,20)
__amc(ACE_SSWhite_FG,20)
__amc(ACE_SSRed_FG,20)
__amc(ACE_SSGreen_FG,20)
__amc(ACE_SSYellow_FG,20)
__amc(ACE_SSWhite_M203,20)
__amc(ACE_SSGreen_M203,20)
__amc(ACE_SSRed_M203,20)
__amc(ACE_SSYellow_M203,20)
__amc(M136,10)
__amc(Dragon_EP1,10)
__amc(MAAWS_HEAT,2)
__amc(MAAWS_HEDP,2)
__amc(Pipebomb,5)
__amc(Mine,10)
__amc(Laserbatteries,20)
__amc(JAVELIN,1)
__amc(STINGER,2)

__amc(ACE_Claymore_M,5)
__amc(ACE_C4_M,5)
__amc(ACE_BBetty_M,5)
__amc(ACE_TripFlare_M,5)
__amc(IR_Strobe_Target,3)
__amc(IR_Strobe_Marker,3)
__amc(IRStrobe,3)

__amc(30Rnd_9x19_UZI,30)
__amc(30Rnd_9x19_UZI_SD,30)


       __awc(ACE_Rucksack_MOLLE_WMARPAT,2)
       __awc(ACE_Rucksack_MOLLE_DMARPAT_Medic,2)
       __awc(ACE_Rucksack_MOLLE_ACU,2)
       __awc(ACE_Rucksack_MOLLE_Brown_Medic,2)
       __awc(ACE_Rucksack_MOLLE_WMARPAT_Medic,2)
       __awc(ACE_Rucksack_MOLLE_Wood,2)
       __awc(ACE_Rucksack_MOLLE_Green_Medic,2)
       __awc(ACE_Rucksack_MOLLE_ACU_Medic,2)
       __awc(ACE_PRC119,2)
       __awc(ACE_PRC119_ACU,2)
       __awc(ACE_PRC119_ACU,2)
       __awc(ACE_PRC119_MAR,2)
       __awc(ACE_VTAC_RUSH72_ACU,2)
       __awc(ACE_CharliePack,2)
       __awc(ACE_FAST_PackEDC,2)
       __awc(ACE_Combat_Pack,2)



__amc(ACE_Knicklicht_R,50)
__amc(ACE_Knicklicht_W,50)
__amc(ACE_Knicklicht_Y,50)
__amc(ACE_Knicklicht_B,50)
__amc(ACE_Knicklicht_IR,50)
__amc(ACE_VS17Panel_M,50)
__amc(ACE_Rope_M_50,2)
__amc(ACE_Rope_M_60,2)
__amc(ACE_Rope_M_90,2)
__amc(ACE_Rope_M_120,2)

__amc(ACE_Bandage,50)
__amc(ACE_Morphine,50)
__amc(ACE_Epinephrine,50)

// Set time for ammo box refresh (in seconds)
sleep 180;
}

I know I am using a global variable but it was working before as is. But I tried changing it to a local variable (_ammo1), but it would still not work.

Were using ACE btw.

anyone have any ideas why this quit working all of the sudden?

Share this post


Link to post
Share on other sites

Do you have to use "ammo1"? Can't you just use _this select 0 (or _this if you leave off the [ ] in the call)?

Share this post


Link to post
Share on other sites

You cant use _this in the init of the ammo boxes you have to use a global variable. I tried it with out the [] but it did not work.

Share this post


Link to post
Share on other sites

I mean call it from the box's init as:

hNil = this execVM "ammous_oa_ace.sqf";

Then in the script:

#define __awc(wtype,wcount) _this addWeaponCargo [#wtype,wcount];
#define __amc(mtype,mcount) _this addMagazineCargo [#mtype,mcount];

Haven't tested this, but that way you're not hardcoding the "ammo1" name into anything.

Share this post


Link to post
Share on other sites

Frankly I'm surprised it used to work at all, with a preplaced ammo crate. A preplaced object is always global. It's not about local or global variables, but locality of the object (where it was created).

So although you may be able to fill the crate differently for each client, once you put something back, that item will be available for all. And (earlier at least, may be fixed now), that item may be problematic for JIP clients.

Why use local crates?

1) To limit what the player can get, which may be important in public games to disallow everyone being snipers.

2) For the player to have his own private storage place.

3) Fixes problematic JIP issues, but those may be fixed now.

Why use global crates?

1) It's far more realistic and fun, but isn't a good thing for pubbers, who will take what they feel like. Have one sniper and one sniper rifle, and the sniper will not be able to find his weapon.

2) The crate also exist for enemy AI, meaning the box will work as cover and resupply for them.

To use local crates:

1) Start some sort of setupplayer.sqf for each client (where you assign actions, ids and whatever).

2) Then createVehicleLocal the crate in this script

3) Set orientation and move it to its correct location.

4) Start the filler script.

Edited by CarlGustaffa

Share this post


Link to post
Share on other sites
Sign in to follow this  

×