Jump to content
  • 0

Issue spawning custom crates at static AI position.


Cyrus

Question

I have a custom base set up at North West Airfield running Epoch 1.0.6.2 Chernarus. Im trying to spawn a custom loot crate called CustomLootCrate.sqf and it doesn't spawn as expected regardless if I am loading it via []exeVM " custom\CustomLootCrate.sqf"; in the init.sqf or using execVM "\z\addons\dayz_server\custom_crates\CustomLootCrate.sqf"; in the server_functions.sqf suggested elsewhere on these forums. I need some help from an experienced modder please. My CustomLootCrate.sqf is as follows: 

Spoiler

if (isServer) then {
        _vehicle_9090 = objNull;
        if (true) then
        {
          _this = createVehicle ["USSpecialWeaponsBox", [4434.3223, 10632.069, -339], [], 0, "CAN_COLLIDE"];
          _vehicle_9090 = _this;
          _this setDir -182.5;
                  _vehicle_9090 setVariable ["ObjectID","1",true];
                  _vehicle_9090 setVariable ["permaLoot",true];

          clearWeaponCargoGlobal _this;
          clearMagazineCargoGlobal _this;

          
          _this addWeaponCargoGlobal ["BAF_AS50_scoped",2];
          _this addWeaponCargoGlobal ["M107_DZ",2];
          _this addWeaponCargoGlobal ["BAF_LRR_scoped",2];
          _this addWeaponCargoGlobal ["USSR_cheytacM200",2];
          _this addWeaponCargoGlobal ["USSR_cheytacM200_sd",2];
          _this addWeaponCargoGlobal ["vil_M110",2];
          _this addWeaponCargoGlobal ["vil_M110sd",2];
          _this addWeaponCargoGlobal ["M110_NVG_EP1",2];
          _this addWeaponCargoGlobal ["M110_TWS_EP1",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_SD_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_NV_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_NV_SD_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_TWS_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_TWS_SD_DESERT",2];

         
          _this addMagazineCargoGlobal ["5Rnd_127x99_AS50",20];
          _this addMagazineCargoGlobal ["10Rnd_127x99_m107",20];
          _this addMagazineCargoGlobal ["5Rnd_86x70_L115A1",20];
          _this addMagazineCargoGlobal ["USSR_5Rnd_408",20];
          _this addMagazineCargoGlobal ["20Rnd_762x51_DMR",20];
          _this addMagazineCargoGlobal ["FHQ_rem_5Rnd_300Win_XM2010_NT",20];
          _this addMagazineCargoGlobal ["FHQ_rem_5Rnd_300Win_XM2010_NT_SD",20];

          
          _this addWeaponCargoGlobal ["ItemToolbox",5];
          _this addWeaponCargoGlobal ["ItemCrowbar",5];
          _this addWeaponCargoGlobal ["ItemEtool",5];
          _this addWeaponCargoGlobal ["ChainSawR",1];
          _this addWeaponCargoGlobal ["ChainSawP",1];
          _this addWeaponCargoGlobal ["ChainSawG",1];
          _this addWeaponCargoGlobal ["ChainSawB",1];

        
          _this addMagazineCargoGlobal ["ItemMixOil",2];
          _this addMagazineCargoGlobal ["ItemLockbox",2];
          _this addMagazineCargoGlobal ["ItemComboLock",2];
          _this addMagazineCargoGlobal ["ItemGenerator",3];
          _this addMagazineCargoGlobal ["ItemVault",2];
          _this addMagazineCargoGlobal ["ItemCorrugated",20];
          _this addMagazineCargoGlobal ["30m_plot_kit",2];
          _this addMagazineCargoGlobal ["ItemWire",10];
          _this addMagazineCargoGlobal ["ItemTankTrap",10];
          _this addMagazineCargoGlobal ["ItemSandbag",10];
          _this addMagazineCargoGlobal ["CinderBlocks",40];
          _this addMagazineCargoGlobal ["MortarBucket",20];
  
          
          _this addMagazineCargoGlobal ["ItemBloodbag",5];
          _this addMagazineCargoGlobal ["ItemEpinephrine",5];
          _this addMagazineCargoGlobal ["ItemMorphine",5];
          _this addMagazineCargoGlobal ["ItemPainkiller",5];
          _this addMagazineCargoGlobal ["ItemAntibiotic",5];
          _this addMagazineCargoGlobal ["ItemBandage",5];
          _this addMagazineCargoGlobal ["ItemSeaBassCooked",10];
          _this addMagazineCargoGlobal ["ItemTunaCooked",10];
          _this addMagazineCargoGlobal ["ItemSodaR4z0r",5];
          _this addMagazineCargoGlobal ["ItemSodaMdew",5];
          _this addMagazineCargoGlobal ["ItemSodaOrangeSherbet",5];
          _this addMagazineCargoGlobal ["ItemSodaRbull",5];
          _this addMagazineCargoGlobal ["PartEngine",5];
          _this addMagazineCargoGlobal ["PartVRotor",5];
          _this addMagazineCargoGlobal ["PartGlass",5];
          _this addMagazineCargoGlobal ["PartWheel",5];
          _this addMagazineCargoGlobal ["PartGeneric",5];
          _this addMagazineCargoGlobal ["ItemJerrycan",5];
		  _this setPos [4434.3223, 10632.069, -339];
 
        };
};

The x,y,z position i got from using the editor and placing a marker in the middle of the custom base i created.

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
14 minutes ago, Cyrus said:

I have a custom base set up at North West Airfield running Epoch 1.0.6.2 Chernarus. Im trying to spawn a custom loot crate called CustomLootCrate.sqf and it doesn't spawn as expected regardless if I am loading it via []exeVM " custom\CustomLootCrate.sqf"; in the init.sqf or using execVM "\z\addons\dayz_server\custom_crates\CustomLootCrate.sqf"; in the server_functions.sqf suggested elsewhere on these forums. I need some help from an experienced modder please. My CustomLootCrate.sqf is as follows: 

  Reveal hidden contents


if (isServer) then {
        _vehicle_9090 = objNull;
        if (true) then
        {
          _this = createVehicle ["USSpecialWeaponsBox", [4434.3223, 10632.069, -339], [], 0, "CAN_COLLIDE"];
          _vehicle_9090 = _this;
          _this setDir -182.5;
                  _vehicle_9090 setVariable ["ObjectID","1",true];
                  _vehicle_9090 setVariable ["permaLoot",true];

          clearWeaponCargoGlobal _this;
          clearMagazineCargoGlobal _this;

          
          _this addWeaponCargoGlobal ["BAF_AS50_scoped",2];
          _this addWeaponCargoGlobal ["M107_DZ",2];
          _this addWeaponCargoGlobal ["BAF_LRR_scoped",2];
          _this addWeaponCargoGlobal ["USSR_cheytacM200",2];
          _this addWeaponCargoGlobal ["USSR_cheytacM200_sd",2];
          _this addWeaponCargoGlobal ["vil_M110",2];
          _this addWeaponCargoGlobal ["vil_M110sd",2];
          _this addWeaponCargoGlobal ["M110_NVG_EP1",2];
          _this addWeaponCargoGlobal ["M110_TWS_EP1",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_SD_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_NV_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_NV_SD_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_TWS_DESERT",2];
          _this addWeaponCargoGlobal ["FHQ_XM2010_TWS_SD_DESERT",2];

         
          _this addMagazineCargoGlobal ["5Rnd_127x99_AS50",20];
          _this addMagazineCargoGlobal ["10Rnd_127x99_m107",20];
          _this addMagazineCargoGlobal ["5Rnd_86x70_L115A1",20];
          _this addMagazineCargoGlobal ["USSR_5Rnd_408",20];
          _this addMagazineCargoGlobal ["20Rnd_762x51_DMR",20];
          _this addMagazineCargoGlobal ["FHQ_rem_5Rnd_300Win_XM2010_NT",20];
          _this addMagazineCargoGlobal ["FHQ_rem_5Rnd_300Win_XM2010_NT_SD",20];

          
          _this addWeaponCargoGlobal ["ItemToolbox",5];
          _this addWeaponCargoGlobal ["ItemCrowbar",5];
          _this addWeaponCargoGlobal ["ItemEtool",5];
          _this addWeaponCargoGlobal ["ChainSawR",1];
          _this addWeaponCargoGlobal ["ChainSawP",1];
          _this addWeaponCargoGlobal ["ChainSawG",1];
          _this addWeaponCargoGlobal ["ChainSawB",1];

        
          _this addMagazineCargoGlobal ["ItemMixOil",2];
          _this addMagazineCargoGlobal ["ItemLockbox",2];
          _this addMagazineCargoGlobal ["ItemComboLock",2];
          _this addMagazineCargoGlobal ["ItemGenerator",3];
          _this addMagazineCargoGlobal ["ItemVault",2];
          _this addMagazineCargoGlobal ["ItemCorrugated",20];
          _this addMagazineCargoGlobal ["30m_plot_kit",2];
          _this addMagazineCargoGlobal ["ItemWire",10];
          _this addMagazineCargoGlobal ["ItemTankTrap",10];
          _this addMagazineCargoGlobal ["ItemSandbag",10];
          _this addMagazineCargoGlobal ["CinderBlocks",40];
          _this addMagazineCargoGlobal ["MortarBucket",20];
  
          
          _this addMagazineCargoGlobal ["ItemBloodbag",5];
          _this addMagazineCargoGlobal ["ItemEpinephrine",5];
          _this addMagazineCargoGlobal ["ItemMorphine",5];
          _this addMagazineCargoGlobal ["ItemPainkiller",5];
          _this addMagazineCargoGlobal ["ItemAntibiotic",5];
          _this addMagazineCargoGlobal ["ItemBandage",5];
          _this addMagazineCargoGlobal ["ItemSeaBassCooked",10];
          _this addMagazineCargoGlobal ["ItemTunaCooked",10];
          _this addMagazineCargoGlobal ["ItemSodaR4z0r",5];
          _this addMagazineCargoGlobal ["ItemSodaMdew",5];
          _this addMagazineCargoGlobal ["ItemSodaOrangeSherbet",5];
          _this addMagazineCargoGlobal ["ItemSodaRbull",5];
          _this addMagazineCargoGlobal ["PartEngine",5];
          _this addMagazineCargoGlobal ["PartVRotor",5];
          _this addMagazineCargoGlobal ["PartGlass",5];
          _this addMagazineCargoGlobal ["PartWheel",5];
          _this addMagazineCargoGlobal ["PartGeneric",5];
          _this addMagazineCargoGlobal ["ItemJerrycan",5];
		  _this setPos [4434.3223, 10632.069, -339];
 
        };
};

The x,y,z position i got from using the editor and placing a marker in the middle of the custom base i created.

 

[4434.3223, 10632.069, -339]

  try change to

[4434.3223, 10632.069, 0]

 

 

Link to comment
Share on other sites

  • 0
16 hours ago, khalcifer said:

[4434.3223, 10632.069, -339]

  try change to


[4434.3223, 10632.069, 0]

 

 

Thanks, I i have misinterpreted the Z-elevation as level below 0. Sea level being 0. I will change it to what you suggest and see if it works.

 

Edit :  I have reduced the item list for testing purposes and set the Z- coord to zero. Ammo box now spawns correctly. Thanks for the help. Ill go look for an updated list to correctly populate item arrays

Edit: I queried the trader_data table against the epoch database and built two raw CSV files containing weapons and items currently being used by the server. I will use this to compare what i have in my custom crate array. 

EDIT: If anyone is interested in manually searching the database for specific items this is a select query i wrote to find specific trader items in the game.

select tt.name, tt.trader, td.item, td.afile from trader_tids as tt
inner join traders_data as td
on tt.id = td.tid
where tt.name like "Sniper%"
order by td.item ASC

The word "Sniper%" is a wildcard search for any item starting 
with the word in the trader_tids table as is transmutable to 
other words such as "Assault%".

This is a typical result from the query.

name,trader,item,afile
'Sniper Rifle Ammo','144','[\"10Rnd_762x54_SVD\",1]','trade_items'

I have used Mysql Workbench for the database management. For a complete alpabetically ordered  list omit this line from the query "where tt.name like "Sniper%"

Edited by Cyrus
Adding info
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
  • Discord

×
×
  • Create New...