Jump to content
  • 0

WAI "Custom Weapon Cache Help


Link

Question

So using the Wicked AI system script(s) that I have installed inside of my server files i'm trying to create a custom weapon Cache that spawns in my own predifined items. I'm succuesfull in getting the weapon caches to spawn, and by default gear spawns in them because they are using the "ExtraLargeGunBox.sqf" to fill loot inside of them everytime one of them is created. I have modied the script where the gun boxes are created so instead of the code calling "ExtraLargeGunBox.sqf" each time one is created, I call a custom created sqf file by me that fills each box with unique gear to that box. Here is "StaticAmmoBoxes.sqf" where I am creating the boxes at their locations and calloing seperate scripts for each to fill them with gear;

/* Add ammmo boxes to static locations on map and fills it with loot from missionCfg.sqf

creates a ammo box at [0,0,0] then fills it

_box = createVehicle ["BAF_VehicleBox",[0,0,0], [], 0, "CAN_COLLIDE"];
[_box] call spawn_ammo_box;

creates a 2nd ammo box at [1,1,1] then fills it

_box2 = createVehicle ["BAF_VehicleBox",[1,1,1], [], 0, "CAN_COLLIDE"];
[_box2] call spawn_ammo_box;

add custom ammo boxes below this line
*/

/* SECTOR B CUSTOM BOXES */
_box = createVehicle ["BAF_VehicleBox",[6643.02,14211.9,0.00164795], [], 0, "CAN_COLLIDE"]; /*SECTOR B WEAPON SUPPLY BOX*/
[_box] call Sector_B_Weapons;

As you can see I call Sector_B_Weapons, inside of that script i have;

//Extra Large Gun Box

_box = _this select 0;
_box setVariable ["ObjectID","1",true];
_box setVariable ["permaLoot",true];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_box];

clearWeaponCargoGlobal _box;
clearMagazineCargoGlobal _box;

// GUNS
_box addWeaponCargoGlobal ["M4A1_AIM_camo", 1];
_box addWeaponCargoGlobal ["Pecheneg", 2];
_box addWeaponCargoGlobal ["MG36", 2];
_box addWeaponCargoGlobal ["RPG7V", 1];
_box addWeaponCargoGlobal ["Mk_48_DES_EP1", 1];
_box addWeaponCargoGlobal ["DMR", 3];
_box addWeaponCargoGlobal ["M249_DZ", 2];
_box addWeaponCargoGlobal ["RH_m14", 1];
_box addWeaponCargoGlobal ["RH_m1stsp", 2];
_box addWeaponCargoGlobal ["BAF_AS50_scoped", 1];
_box addWeaponCargoGlobal ["M60A4_EP1", 1];
_box addWeaponCargoGlobal ["BAF_AS50_TWS", 1];
_box addWeaponCargoGlobal ["Mk48_DES_EP1", 1];
_box addWeaponCargoGlobal ["M249_TWS_EP1", 1];
_box addWeaponCargoGlobal ["M110_TWS_EP1", 1];
_box addWeaponCargoGlobal ["M110_NVG_EP1", 1];
_box addWeaponCargoGlobal ["USSR_cheytacM200_sd", 1];

// AMMO
_box addWeaponCargoGlobal ["30Rnd_556x45_Stanag", 40];
_box addWeaponCargoGlobal ["100Rnd_762x54_PK", 6];
_box addWeaponCargoGlobal ["100Rnd_556x45_BetaCMag", 6];
_box addWeaponCargoGlobal ["PG7V", 2];
_box addWeaponCargoGlobal ["20Rnd_762x51_DMR", 16];
_box addWeaponCargoGlobal ["200Rnd_556x45_M249", 16];
_box addWeaponCargoGlobal ["5Rnd_127x99_AS50", 14];
_box addWeaponCargoGlobal ["100Rnd_762x51_M240", 10];
_box addWeaponCargoGlobal ["20Rnd_762x51_B_SCAR", 8];
_box addWeaponCargoGlobal ["USSR_5Rnd_408", 8];

//BACKPACKS
_box addBackpackCargoGlobal ["DZ_LargeGunBag_EP1", 3];

But for some reason when I go in-game the box instead spawns 50x M240 Rnds and 50x M249 Rnds. In matter of fact these same two items spawn in every custom box that I create and fill with custom loot on the map, is there a reason for this and could anyone have any idea as of what I am doing wrong here?

 

Thanks.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

You are using the AddWeaponCargoGlobal call for items.  Change it to AddMagazineCargoGlobal and try again. 

 

Like this: 

// AMMO
_box addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 40];
_box addMagazineCargoGlobal ["100Rnd_762x54_PK", 6];
_box addMagazineCargoGlobal ["100Rnd_556x45_BetaCMag", 6];
_box addMagazineCargoGlobal ["PG7V", 2];
_box addMagazineCargoGlobal ["20Rnd_762x51_DMR", 16];
_box addMagazineCargoGlobal ["200Rnd_556x45_M249", 16];
_box addMagazineCargoGlobal ["5Rnd_127x99_AS50", 14];
_box addMagazineCargoGlobal ["100Rnd_762x51_M240", 10];
_box addMagazineCargoGlobal ["20Rnd_762x51_B_SCAR", 8];
_box addMagazineCargoGlobal ["USSR_5Rnd_408", 8];

Also make extra sure you also have defined the box name "Sector_B_Weapons" properly.

Link to comment
Share on other sites

  • 0

You are using the AddWeaponCargoGlobal call for items.  Change it to AddMagazineCargoGlobal and try again. 

 

Like this: 

// AMMO
_box addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 40];
_box addMagazineCargoGlobal ["100Rnd_762x54_PK", 6];
_box addMagazineCargoGlobal ["100Rnd_556x45_BetaCMag", 6];
_box addMagazineCargoGlobal ["PG7V", 2];
_box addMagazineCargoGlobal ["20Rnd_762x51_DMR", 16];
_box addMagazineCargoGlobal ["200Rnd_556x45_M249", 16];
_box addMagazineCargoGlobal ["5Rnd_127x99_AS50", 14];
_box addMagazineCargoGlobal ["100Rnd_762x51_M240", 10];
_box addMagazineCargoGlobal ["20Rnd_762x51_B_SCAR", 8];
_box addMagazineCargoGlobal ["USSR_5Rnd_408", 8];

Also make extra sure you also have defined the box name "Sector_B_Weapons" properly.

 

Thanks, I overlooked this. One more question to clarify. For items such as "CinderBlocks", "ItemEtool","ItemPainkiller" and "FoodCanBakedBeans" would these be;

addItemCargoGlobal

or are they specified as something else?

 

Thanks.

Link to comment
Share on other sites

  • 0

Rule of thumb would be: 

- If it is something on your back: addBackpackCargoGlobal

- If it is something classified as weapon (including hatchet as the item in your hands): addWeaponCargoGlobal

- If it is anything else that generally goes into your inventory (but never into weapon slots):  addMagazineCargoGlobal 

 

You can also use the DB classification of 1,2,3 to determine if an item is Item (1, or addMagazineCargoGlobal ), Backpack/vehicle (2, or addBackpackCargoGlobal) or Weapon (3, or addWeaponCargoGlobal)
 

Link to comment
Share on other sites

  • 0

Despite making these changes, im still having the same issues with 50 x M249 and 50x M240 ammo spawning inside of the box.

 

This is what I have inside of StaticAmmoBoxes.sqf

/* SECTOR B CUSTOM BOXES */
_box1 = createVehicle ["BAF_VehicleBox",[6643.02,14211.9,0.00164795], [], 0, "CAN_COLLIDE"]; /*SECTOR B WEAPON SUPPLY BOX*/
[_box1] call Sector_B_Weapons;

And this is what's inside of my Sector_B_Weapons.sqf

//Extra Large Gun Box

_box1 = _this select 0;
_box1 setVariable ["ObjectID","1",true];
_box1 setVariable ["permaLoot",true];
PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_box1];

clearWeaponCargoGlobal _box1;
clearMagazineCargoGlobal _box1;
clearBackpackCargoGlobal _box1;

// GUNS
_box1 addWeaponCargoGlobal ["M4A1_AIM_camo", 1];
_box1 addWeaponCargoGlobal ["Pecheneg", 2];
_box1 addWeaponCargoGlobal ["MG36", 2];
_box1 addWeaponCargoGlobal ["RPG7V", 1];
_box1 addWeaponCargoGlobal ["Mk_48_DES_EP1", 1];
_box1 addWeaponCargoGlobal ["DMR", 3];
_box1 addWeaponCargoGlobal ["M249_DZ", 2];
_box1 addWeaponCargoGlobal ["RH_m14", 1];
_box1 addWeaponCargoGlobal ["RH_m1stsp", 2];
_box1 addWeaponCargoGlobal ["BAF_AS50_scoped", 1];
_box1 addWeaponCargoGlobal ["M60A4_EP1", 1];
_box1 addWeaponCargoGlobal ["BAF_AS50_TWS", 1];
_box1 addWeaponCargoGlobal ["M249_TWS_EP1", 1];
_box1 addWeaponCargoGlobal ["M110_TWS_EP1", 1];
_box1 addWeaponCargoGlobal ["M110_NVG_EP1", 1];
_box1 addWeaponCargoGlobal ["USSR_cheytacM200_sd", 1];

// AMMO
_box1 addMagazineCargoGlobal ["30Rnd_556x45_Stanag", 40];
_box1 addMagazineCargoGlobal ["100Rnd_762x54_PK", 6];
_box1 addMagazineCargoGlobal ["100Rnd_556x45_BetaCMag", 6];
_box1 addMagazineCargoGlobal ["PG7V", 2];
_box1 addMagazineCargoGlobal ["20Rnd_762x51_DMR", 16];
_box1 addMagazineCargoGlobal ["200Rnd_556x45_M249", 16];
_box1 addMagazineCargoGlobal ["5Rnd_127x99_AS50", 14];
_box1 addMagazineCargoGlobal ["100Rnd_762x51_M240", 10];
_box1 addMagazineCargoGlobal ["20Rnd_762x51_B_SCAR", 8];
_box1 addMagazineCargoGlobal ["USSR_5Rnd_408", 8];

//BACKPACKS
_box1 addBackpackCargoGlobal ["DZ_LargeGunBag_EP1", 3];

Do you see any problems in these two files of code? To me that looks exactly how it should be, I don't understand why it's only spawning. This is all that ever spawns;

 

fxta2e.jpg

Link to comment
Share on other sites

  • 0

i dunno if you are still having this issue... but you did define Sector_B_Weapons inside of server_functions right?  Otherwise it will create the standard box but then will fail to spawn the weapons in as your sector_B_Weapons call is undefined. Not sure if you did this and didn't say you did or not but hope it helps.

 

inside of server_functions with all of the defines you will need

 

Sector_B_Weapons   =                    compile preprocessFileLineNumbers "\z\addons\dayz_server\INSERT FOLDER NAME HERE\Sector_B_Weapons.sqf";

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...