Cyrus
-
Posts
62 -
Joined
-
Last visited
-
Days Won
4
Content Type
Profiles
Forums
Articles
Posts posted by Cyrus
-
-
Can anyone familiar with DZAI help me with a way to time my custom crates to respawn with DZAI custom static AI. I have the randomized crate spawn at server startup, and essentially will be looted once the base has been cleared from all AI. Currently it will "refill" the crate based on a sleep timer. I would like to have the crate refill once the next round of AI spawns based on these values set:
DZAI_respawnTimeMin = 300; DZAI_respawnTimeMax = 600;
Any help will be appreciated. This is my current loot crate configuration. Thanks for @DAmNRelentless who guided me in creating this script.
Spoilerif (isServer) then { _vehicle_999999 = objNull; while {true} do { _refreshTime = 180; _this = createVehicle ["TKVehicleBox_EP1", [726.63354, 9610.8154, 0], [], 0, "CAN_COLLIDE"]; _vehicle_999999 = _this; _this setDir 20; _vehicle_999999 setVariable ["ObjectID","1",true]; _vehicle_999999 setVariable ["permaLoot",true]; _vehicle_999999 allowDamage false; clearWeaponCargoGlobal _this; clearMagazineCargoGlobal _this; _weaponAmmoArray = [[["DMR_DZ",2],["20Rnd_762x51_DMR",5]],[["L115A3_DZ",2],["5Rnd_86x70_L115A1",5]],[["m107_DZ"],["10Rnd_127x99_m107",5]],[["PMC_AS50_scoped"],["5Rnd_127x99_as50",5]],[["M249_m145_EP1_DZE",2],["200Rnd_556x45_M249",5]]]; _toolArray = [["ItemEtool",5],["ItemCrowbar",5]]; _magazineArray = [["150Rnd_127x107_DSHKM",7],["150Rnd_127x108_KORD",7],["2000Rnd_762x51_M134",7],["CinderBlocks",20],["FoodCanRusPork",10],["FoodMRE",10],["ItemBriefcase100oz",2],["ItemComboLock",5],["ItemLightBulb",5],["ItemLockbox",2],["ItemMorphine",10],["ItemPainkiller",10],["ItemPole",2],["ItemSodaMzly",10],["ItemSodaR4z0r",10],["ItemVault",2],["cinder_door_kit",5],["cinder_garage_kit",5],["full_cinder_wall_kit",10],["metal_floor_kit",10],["ItemBloodbag",10]]; _gemArray = [["ItemEmerald",2],["ItemSapphire",2],["ItemTopaz",2],["ItemCitrine",2],["ItemAmethyst",2]]; _counterWeaponsAmmo = 0; while {_counterWeaponsAmmo < 5} do { _randomWeapAmmo = _weaponAmmoArray call BIS_fnc_selectRandom; _weaponAmmoArray = _weaponAmmoArray - _randomWeapAmmo; _weapon = _randomWeapAmmo select 0; _ammo = _randomWeapAmmo select 1; _randomAmmo = round(random(_ammo select 1)); _ammo set[1,_randomAmmo]; _this addWeaponCargoGlobal _weapon; _this addMagazineCargoGlobal _ammo; _counterWeaponsAmmo = _counterWeaponsAmmo + 1; }; _counterTool = 0; while {_counterTool < 2} do { _randomTool = _toolArray call BIS_fnc_selectRandom; _tooldArray = _toolArray - _randomTool; _this addMagazineCargoGlobal _randomTool; _counterTool = _counterTool + 1; }; _counterMagazine = 0; while {_counterMagazine < 25} do { _randomMagazine = _magazineArray call BIS_fnc_selectRandom; _magazineArray = _magazineArray - _randomMagazine; _this addMagazineCargoGlobal _randomMagazine; _counterMagazine = _counterMagazine + 1; }; _counterGem = 0; while {_counterGem < 3} do { _randomGem = _gemArray call BIS_fnc_selectRandom; _gemArray = _gemArray - _randomGem; _this addMagazineCargoGlobal _randomGem; _counterGem = _counterGem + 1; }; sleep _refreshTime; }; };
-
Thanks @killerkiwi Very useful info. I have been looking for some of these classnames for a while.
-
i have seen a lot of people looking for epoch 1.0.6.2 class names with very little information available on where to find the full lists if you are planning on doing some custom loot crates for static mission spawns. I found on the Epoch Github Repo all the items available to 1.0.6.2.
I hope that others find it as useful as I have.
-
This is a really nice safezone script and works like a dream on chernarus. My question is, if i change the locations in the sqf to the trader zones on Panthera will it work for this map?
-
11 hours ago, JasonTM said:
Thanks. The only real problem with the mod is when the player dies. The helicopter pilot does not follow instructions after the player dies. The reason for this is because after death, your client resets and any scripts you were running are terminated and you are sent back to the lobby. The only way around this is to send some of the code server side so the server can execute the script even if the player dies. I might do this in the future, but I'm not sure it's worth putting extra stress on the server.
Thats a good idea. maybe, as a suggestion and based on the hardware the server is running on that that continuous script execute on player death can be an optional feature. I for one would welcome it. My server currently runs on a KVM to which i have allocated 500gb ssd space from 4tb striped raid, 16 cores xenon @2.2 ghz and 16gb 2400mhz ram. I have a bunch of custom added bases and buildings, 2 static AI bases with 30 AI each, 3 mission systems, your evac system, single coin system with global banking, refuel/rearm, mystery corpse event, infected pools and dams, zombie camps, zombie hordes, supply drops, dynamic weather, customized loadouts..and with all of this im still only utilizing on 50% server performance. server running at 45fps with 10 people online.
Here are some screenshots, first two are my custom AI bases and last one is our Evacs baricaded by barbed fence, lockbox for keys and refuel point:
http://steamcommunity.com/sharedfiles/filedetails/?id=1287907026
http://steamcommunity.com/sharedfiles/filedetails/?id=1287906859
http://steamcommunity.com/sharedfiles/filedetails/?id=1287906710
-
11 hours ago, JasonTM said:
Glad it worked. I updated the install instructions so this won't happen to anyone else.
Thank you, much appreciated. Keep up the good work
-
6 minutes ago, kingpapawawa said:
Why not just change it in the init where the devs have so conveniently placed it?
// Uncomment the lines below to change the default loadout DefaultMagazines = ["ItemBandage","ItemBandage","ItemBandage","ItemBandage","ItemPainkiller","ItemMorphine","ItemBloodbag","15Rnd_9x19_M9","15Rnd_9x19_M9","15Rnd_9x19_M9","15Rnd_9x19_M9"]; DefaultWeapons = ["ItemMap","ItemFlashlight","ItemCompass","ItemWatch","ItemToolbox","ItemRadio","ItemHatchet","M9_DZ"]; DefaultBackpack = "DZ_ALICE_Pack_EP1"; DefaultBackpackItems = []; // Can include both weapons and magazines i.e. ["PDW_DZ","30Rnd_9x19_UZI"];
I have tried that. For me that method doesnt work. nor calling a custom sqf
-
I found this on another forum, but seeing as I am truly dedicated to this one, I thought I'd share what i have found concerning the question I see a lot of people ask regarding default loadouts for everyone, including respawns and new players to the server. Its customizable with current 1.0.6.2 class IDs.
Unpack dayz_server.pbo and navigate to the compiles folder. Open the file named server_playerlogin.sqf. Find the follow block of code :
_config = (configFile >> "CfgSurvival" >> "Inventory" >> "Default"); _mags = getArray (_config >> "magazines"); _wpns = getArray (_config >> "weapons"); _bcpk = getText (_config >> "backpack"); _randomSpot = true; _key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]]; _key call server_hiveWrite;
and comment this out by adding /* */ to the top and bottom of this code block. Like this
/* _config = (configFile >> "CfgSurvival" >> "Inventory" >> "Default"); _mags = getArray (_config >> "magazines"); _wpns = getArray (_config >> "weapons"); _bcpk = getText (_config >> "backpack"); _randomSpot = true; _key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]]; _key call server_hiveWrite; */
Then directly underneath this paste the following and configure to your liking. I have tried this and it works. To understand the logic, it is pointless to add a custom sqf in the mission folder, whether it be inside the init.sqf or a "exeVM" or a "call" method pointing to another custom sqf file seeing as the init is processed before server_playerlogin.sqf.
_randomSpot = true; _inventory = [["ItemFlashlight","ItemMap","ItemGPS","NVGoggles","AK_74"],["ItemBandage","ItemPainkiller","30Rnd_545x39_AK"]]; _backpack = ["DZ_ALICE_Pack_EP1",[],[]]; _key = format["CHILD:203:%1:%2:%3:",_charID,_inventory,_backpack]; _key call server_hiveWrite;
Here is a list of most of the class ID's currently being used. Not all of them are there, but for this purpose you will find it more than adequate.
https://forums.dayz.com/topic/137361-dayz-chernarus-class-ids/
Finally we can now lay this beast to rest. Hope this will help many solve their default loadouts. I can recommend <ESSV3> by @ebayShopperif you need more than a single loadout for all spawns.
-
12 hours ago, server steve21k said:
DZE_permanentPlot = true;
Thanks for the help @JasonTM @steve21k. I realized that being a tool comes with disadvantages like asking dumb questions like mine. I realized this morning that in your features description you said that if the heli gets destroyed and by putting another heli on the pad will accept it as the new recue heli. So i went to buy another little bird, put it on the pad and i was allowed to remove the existing helipad. Initially my thinking in terms of removing them was too technical. So i can conclude that you have rebuilt an awesome mod and 99.9% flawless.
-
1 hour ago, JasonTM said:
If you have the key for the heli in your gear, you should get the option to clear the evac chopper when you point at it. That will remove the rescue heli pad.
Thanks. but what if the key is lost due to death?
-
All working perfectly now. One question.. How do i delete an instance of the Heli rescue that is linked to a players UID? Like say if i want to move my Heli Rescue pad elsewhere? I found in the object_data table my UID is linked to HeliHRescue
-
I found this in the variables.sqf from dayz_code.pbo inside @dayz_epoch
respawn_west_original = getMarkerPos "respawn_west"; //Prevent problems caused by cheaters moving respawn_west marker with setMarkerPos or deleteMarker switch (toLower worldName) do { case "napf"; case "ruegen"; case "sauerland" : {dayz_minpos = -1000; dayz_maxpos = 26000;}; case "tavi" : {dayz_minpos = -26000; dayz_maxpos = 26000;}; case "chernarus" : {dayz_minpos = -1; dayz_maxpos = 16000;}; case default {dayz_minpos = -20000; dayz_maxpos = 20000;}; };
which would fall in line with this spawn location from server RPT :
20:57:06 "INFO: Cannot Sync Character Peace near respawn_west [-18700,25800,0.00149536]
-
Saw this in the RPT server side after loading the new version ESSV3 :
15:05:49 "INFO: OnPlayerDisconnect exiting. Player is not in playableUnits. ["76561198133712970","Charlie Chaplin"]"
and still spawning outside the map. Does this have anything have to do location?
Spoilerclass_level1 = ["0","0","0"]; class_level2 = ["0","0","0"]; class_level3 = ["0","0","0"]; class_levelCount = 3; //If you add more class levels then increase this number. // To give higher level VIPs access to lower level VIP classes uncomment the two lines below: // class_level1 = class_level1 + class_level2 + class_level3; // class_level2 = class_level2 + class_level3;
-
I think i might know what the problem is. The copy of ESSv3 i downloaded was from epochmod.com and if i compare the files on github to the zip file i have, there are a lot of differences. Im going to download the latest version from github and test again later tonight.
-
2 hours ago, salival said:
Yeah, that's not normal.
You'll be spawning in the debug due to an error.
Please share your client and server RPT logfiles
To find this logfile:
C:\users\<YOUR WINDOWS USERNAME>\AppData\Local\Arma 2 OA\ArmA2OA.RPT
strange part is, because im the only admin on the server i did not have the issue using ESSV3. ill have to ask on of the players quick, there are some online at the moment
Edit link to Dropbox.. https://www.dropbox.com/s/7fql4fvezdsokyy/RPT.txt?dl=0
ps..i see a file called spawntool.exe not sure if that is legal. But I see it only comes up prior to him joining my server. He first joined 24.01.2018 and would have the issue of spawning off map after this. ESSV3 was already present when he joined the server
Due to playerID's and other safe codes in the Server RPT i will only post some lines where another player died and the logs directly after that. I will share the file directly but not in a public post.
14:38:43 "P1ayer PID#9(Wurmsous) hit by AI with M24/B_762x51_noTracer <ammo left:0> from 70 meters in head_hit for 0.319593 damage" 14:38:47 "PLAYER COMBAT LOGGED: Wurmsous([hidden player ID]) at location [4262.19,10927.8,0.00143433]" 14:38:47 "INFO - Player: Wurmsous(UID:[hidden player ID]/CID:250) Status: LOGGED OUT, Location airfield [042044]" 14:38:47 Client: Remote object 9:894 not found 14:38:47 Client: Remote object 9:893 not found 14:38:56 [DZMS]: Running Major Mission SM2. 14:38:56 "INFO - Player: PID#9(Wurmsous)(UID:[hidden player ID]/CID:251) Status: LOGGING IN" 14:38:58 "INFO - Player: PID#9(Wurmsous)(UID:[hidden player ID]/CID:251) Status: LOGIN PUBLISHING, Location Kamenka [020131]" 14:39:08 No owner 14:39:08 No owner 14:39:08 No owner 14:39:09 No owner 14:39:09 No owner 14:39:09 No owner 14:39:12 [DZMS]: (DZMSUnitsMajor) 6 AI Spawned, 6 units in mission. 14:39:15 "INFO - Player: Wurmsous(UID:[hidden player ID]/CID:251) Status: CLIENT LOADED & PLAYING" 14:39:16 No owner 14:39:16 No owner 14:39:16 No owner 14:39:16 No owner 14:39:20 No owner 14:39:20 No owner 14:39:20 No owner 14:39:20 No owner 14:39:22 No owner 14:39:22 No owner 14:39:22 No owner 14:39:25 [DZMS]: (DZMSUnitsMajor) 6 AI Spawned, 12 units in mission. 14:39:27 "INFO: Cannot Sync Character Wurmsous near respawn_west [-18700,25800,0.00149536]. This is normal when relogging or changing clothes."
20:57:06 "INFO: Cannot Sync Character Peace near respawn_west [-18700,25800,0.00149536]. This is normal when relogging or changing clothes."
-
20 minutes ago, salival said:
Cyrus, why not use ESSv3 for custom loadouts? You can turn the spawn function off:
I have used it until recently. ESSV3 is awesome. The only downside is that every player on my server, when they respawn after death the end up 30km off the playable map, regardless if they use ground spawn or halo spawn. I use infistar 1448 if that matters.
-
Nox's Custom Loadouts, is that compatible with epoch 1.0.6.2? Are there any battleye script exceptions needed? I have tried it and so far players only spawn with 1 handflare and 2 bandages, nothing from the lists called inside the loadouts.sqf file.
I have now added the if (isServer) then {} encapsulation to the loadouts.sqf to see if this makes a difference. (Busy testing now)
I do have the []execVM "custom/loadouts.sqf" at the bottom of my init.sqf and the file in the custom folder with in my missions folder
Edit : I can confirm this doesnt work either. Only possibility is to move it server side and test again
-
I have been finding that some people on my server has been losing base walls and floors even though DZE_godmodebase = true; , it has no effect on anything built inside the plot radius. So i have come to the conclusion that base items might receive damage on age and this ultimately being removed by server cleanup script. So my question is if I drop this event below will that stop me and others from losing base walls and floor? Or at the minimum update it without any cinder wall items?
SpoilerDROP EVENT IF EXISTS `setDamageOnAge`; DELIMITER ;; CREATE EVENT `setDamageOnAge` ON SCHEDULE EVERY 1 DAY COMMENT 'This sets damage on a wall so that it can be maintained' DO UPDATE `Object_DATA` SET `Damage`=0.1 WHERE `ObjectUID` <> 0 AND `CharacterID` <> 0 AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Classname` IN ('Land_DZE_GarageWoodDoorLocked','Land_DZE_LargeWoodDoorLocked','Land_DZE_WoodDoorLocked', 'CinderWallDoorLocked_DZ','CinderWallDoorSmallLocked_DZ','Plastic_Pole_EP1_DZ')) ) ;; DELIMITER ;
like this and set damage to 0.001:
SpoilerDROP EVENT IF EXISTS `setDamageOnAge`; DELIMITER ;; CREATE EVENT `setDamageOnAge` ON SCHEDULE EVERY 1 DAY COMMENT 'This sets damage on a wall so that it can be maintained' DO UPDATE `Object_DATA` SET `Damage`=0.001 WHERE `ObjectUID` <> 0 AND `CharacterID` <> 0 AND `Datestamp` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Classname` IN ('Plastic_Pole_EP1_DZ')) ) ;; DELIMITER ;
-
Very nice mod, thanks! only problem i have is some players, most of them, after selecting halo spawn, they spawn 30km outside of map boundaries. Where can i start looking to fix this?
-
Will you please have a look and see if this will do what I am trying to achieve? And if the syntax is correct? I'm only applying what I have learned from the info you have given me.
Spoilerif (isServer) then { _vehicle_9090 = objNull; if (true) then { _ammoCrate = createVehicle ["USSpecialWeaponsBox", [4434.3223, 10632.069, 0], [], 0, "CAN_COLLIDE"]; _vehicle_9090 = _ammoCrate; _ammoCrate setDir -182.5; _vehicle_9090 setVariable ["ObjectID","1",true]; _vehicle_9090 setVariable ["permaLoot",true]; clearWeaponCargoGlobal _ammoCrate; clearMagazineCargoGlobal _ammoCrate; //Classed Arrays _toolArray = [["ItemToolbox",5],["ItemCrowbar",5],["ItemEtool",5],["Binocular_Vector",5],["ItemGPS",5],["ItemHatchet",5],["NVGoggles",5]]; _buildArray = [["ItemLockbox",2],["ItemPole",20],["ItemComboLock",2],["ItemGenerator",3],["ItemVault",2],["ItemCorrugated",20],["plot_pole_kit",2],["ItemWire",10],["ItemTankTrap",10],["ItemSandbag",10],["CinderBlocks",40],["MortarBucket",20]]; _medArray = [["ItemBloodbag",5],["ItemEpinephrine",5],["ItemMorphine",5],["ItemPainkiller",5],["ItemAntibiotic",5],["ItemBandage",5]]; _foodArray = [["ItemSeaBassCooked",10],["ItemTunaCooked",10],["ItemSodaR4z0r",5],["ItemSodaMdew",5],["ItemSodaOrangeSherbet",5],["ItemSodaRbull",5]]; _vehprtArray = [["PartEngine",5],["PartVRotor",5],["PartGlass",5],["PartWheel",5],["PartGeneric",5]["ItemJerrycan",5]]; _weaponAmmoArray = [[["BAF_LRR_scoped",2],["5Rnd_86x70_L115A1", 20]],[["DMR_DZ",1],["20Rnd_762x51_DMR",20]],[["FN_FAL_ANPVS4_DZE",2],["20Rnd_762x51_FNFAL",20]],[["Mk48_CCO_DZ",2],["100Rnd_762x54_PK",20]],[["M240_DZ",2],["100Rnd_762x51_M240",20]],[["G17_FL_DZ",2],["17Rnd_9x19_glock17",20]],[["M9_SD_DZ",2],["15Rnd_9x19_M9SD",20]]]; //Random Item selection weapons and ammo in a multidimentional array _rngWepAmmoSelect = _weaponAmmoArray call BIS_fnc_selectRandom; //Filling the crate //Weapons _wepCounter = 0; while {_wepCounter < 7} do { _weapon = _rngWepAmmoSelect select 0; _wepSelect = _wepSelect - _weapon; _ammoCrate addWeaponCargoGlobal _weapon; _wepCounter = _wepCounter + 1; }; //Ammo _ammoCounter = 0; while {_ammoCounter < 7} do { _ammo = _rngWepAmmoSelect select 1; //Random amount of respective ammo _rngAmmo = round(random(_ammo select 1)); //Replace max ammo amount with random amount _ammo set[1,_rngAmmo]; _ammoSelect = _ammoSelect - _ammo; _ammoCrate addMagazineCargoGlobal _ammo; _ammoCounter = _ammoCounter + 1; }; //Toolbelt items. 7 total yields 3 random items _toolCounter = 0; while {_toolCounter < (round(count _toolArray / 2))} do { _rngToolSelect = _toolArray call BIS_fnc_selectRandom; _toolSelect = _toolSelect - _rngToolSelect; _ammoCrate addWeaponCargoGlobal _rngToolSelect; _toolCounter = _toolCounter + 1; }; //Medical Supplies. 6 total yields 3 random items _medCounter = 0; while {_medCounter < (round(count _medArray / 2))} do { _rngMedSelect = _medArray call BIS_fnc_selectRandom; _medSelect = _medSelect - _rngMedSelect; _ammoCrate addMagazineCargoGlobal _rngMedSelect; _toolCounter = _toolCounter + 1; }; //Building Materials. 12 total yields 6 random items. _buildCounter = 0; while {_buildCounter < (round(count _buildArray /2))} do { _rngBuildSelect = _buildArray call BIS_fnc_selectRandom; _buildSelect = _buildSelect - _rngBuildSelect; _ammoCrate addMagazineCargoGlobal _rngBuildSelect; _buildCounter = _buildCounter + 1; }; //Food Supplies. 6 total yields 3 random items. _foodCounter = 0; while {_foodCounter < (round(count _foodArray /2))} do { _rngFoodSelect = _foodArray call BIS_fnc_selectRandom; _foodSelect = _foodSelect - _rngFoodSelect; _ammoCrate addMagazineCargoGlobal _rngFoodSelect; _foodCounter = _foodCounter + 1; }; //Vehicle Parts. 6 total yields 3 random items. _vehprtCounter = 0; while {_vehprtCounter < (round(count _vehprtArray /2))} do { _rngVehprtSelect = _vehprtArray call BIS_fnc_selectRandom; _vehprtSelect = _vehprtSelect - _rngVehprtSelect; _ammoCrate addMagazineCargoGlobal _rngVehprtSelect; _vehprtCounter = _vehprtCounter + 1; }; _ammoCrate setPos [4434.3223, 10632.069, 0]; }; };
-
Quick question.. When creating the crate this is the default script for it :
_this = createVehicle ["USSpecialWeaponsBox", [4434.3223, 10632.069, 0], [], 0, "CAN_COLLIDE"];
Can i change it to this, to tie in with your method?
_ammoCrate = createVehicle ["USSpecialWeaponsBox", [4434.3223, 10632.069, 0], [], 0, "CAN_COLLIDE"];
and then fill _ammoCrate by calling globals like this?
_buildArray = [["ItemLockbox",2],["ItemPole",20],["ItemComboLock",2],["ItemGenerator",3],["ItemVault",2],["ItemCorrugated",20],["plot_pole_kit",2],["ItemWire",10,["ItemTankTrap",10],["ItemSandbag",10],["CinderBlocks",40],["MortarBucket",20]]; _rngBuildSelect = _buildArray call BIS_fnc_selectRandom; _ammoCrate addMagazineCargoGlobal _rngBuildSelect;
-
@DAmNRelentless I will definitely be using your code, i was just curious at the possibilities of generating randoms from arrays. I more familiar with python and C#. Probably why i find SQF interesting. With practice im learning to change my mindset in terms of more effecting coding essentially improving across the board. I really appreciate the help that you are offering though
-
5 minutes ago, DAmNRelentless said:
That's fairly easy to do aswell. Returning a weapon works just like I mentioned before. To get its respective ammo, you can random select with a multidimensional array and store it into different variables. I guess by "random amount of its respective ammo" you mean an amount between 0 and the amount you set in your array.
_weaponAmmoArray = [ [["BAF_LRR_scoped",2],["5Rnd_86x70_L115A1", 20]], [["DMR_DZ",1],["20Rnd_762x51_DMR",20]], [["FN_FAL_ANPVS4_DZE",2],["20Rnd_762x51_FNFAL",20]], [["Mk48_CCO_DZ",2],["100Rnd_762x54_PK",20]], [["M240_DZ",2],["100Rnd_762x51_M240",20]], [["G17_FL_DZ",2],["17Rnd_9x19_glock17",20]], [["M9_SD_DZ",2],["15Rnd_9x19_M9SD",20]] ]; //Pick random weapon with ammo _weaponWithAmmo = _weaponAmmoArray call BIS_fnc_selectRandom; //Optionally remove it from array to prevent double pick _weaponAmmoArray = _weaponAmmoArray - _weaponWithAmmo; //Storing weapon and ammo into different variables _weapon = _weaponWithAmmo select 0; _ammo = _weaponWithAmmo select 1; //Random amount of respective ammo _randomAmmo = round(random(_ammo select 1)); //Replacing maximum ammo amount with random ammo amount _ammo set[1,_randomAmmo]; //Fill crate _crate addWeaponCargoGlobal _weapon; _crate addWeaponCargoGlobal _ammo;
Very nice, I learn more everyday. this scripting is really versatile. BTW this is what i was looking at in the past couple of min. Would this work ? Instead of multiple iterations i use a loop with a counter?
_weaponsArray = [["BAF_LRR_scoped",2],["DMR_DZ",1],["FN_FAL_ANPVS4_DZE",2],["Mk48_CCO_DZ",2],["M240_DZ",2],["G17_FL_DZ",2],["M9_SD_DZ",2]] _ammoArray = [["20Rnd_762x51_DMR",20],["5Rnd_86x70_L115A1", 20],["20Rnd_762x51_FNFAL",20],["100Rnd_762x54_PK",20],["100Rnd_762x51_M240",20],["17Rnd_9x19_glock17",20],["15Rnd_9x19_M9SD",20]] _rngWeaponSelect = _weaponsArray call BIS_fnc_selectRandom; _rngAmmoSelec = _ammoArray call BIS_fnc_selectRandom; _wepCount = 0; _ammoCount = 0; //Adding weapons to the crate with a loop statement while {_wepCount != 7} do { _this addWeaponCargoGlobal _rngWeaponSelect; _wepCount = _Wepcount + 1 } while {_ammoCount != 7} do { _this addMagazineCargoGlobal _rngAmmoSelect; _ammoCount = _ammoCount + 1; }
-
1 hour ago, DAmNRelentless said:
@Cyrus I don't think that would work since it's not matching the function's syntax anymore. But due to the fact that different amounts of items are stored in a array as well, you could pick a random array.
_someWeaponArray = [ ["DMR_DZ",2], ["M24_des_EP1,4]", ["FNFAL_DZ",2], ["Mk48_CCO_DZ",1], ["M240_DZ,1"], ["G17_FL_DZ",5], ["M9_SD_DZ",5] ]; //Pick 1 random item array from it format: ["weapon",amount] //Keep in mind that it's saved as array this time _randomWeapon = _someWeaponArray call BIS_fnc_selectRandom; //Optionally remove it from the array afterwards //You don't need to set it as array now. Since it is already an array, you can just do _someWeaponArray = _someWeaponArray - _randomWeapon; //Adding the item to the crate if it's already set up //the variable is enough because it's already an array _this addWeaponCargoGlobal _randomWeapon;
Now to not do this everytime, you could specify how many items from which arrays are picked. There can't be duplicate ones since the code is already removing the _randomWeapon from the origin array.
_someWeaponArray = [ ["DMR_DZ",2], ["M24_des_EP1,4]", ["FNFAL_DZ",2], ["Mk48_CCO_DZ",1], ["M240_DZ,1"], ["G17_FL_DZ",5], ["M9_SD_DZ",5] ]; //Always pick 3 items from an array _itemCounter = 0; while {_itemCounter < 3} do { _randomWeapon = _someWeaponArray call BIS_fnc_selectRandom; _someWeaponArray = _someWeaponArray - _randomWeapon; _crate addWeaponCargoGlobal _randomWeapon; //store you crate in a variable, don't know if _this could also be the itemCounter cause it's in an if-statement _itemCounter = _itemCounter + 1; }; //Always pick an amount depending on the array size //If you array has 5 items, it will pick 1 from it, if it has 10 items it will pick 2 for it (adjustable by changing the 5) _itemCounter = 0; while {_itemCounter < (round(count _someWeaponArray / 5))} do { _randomWeapon = _someWeaponArray call BIS_fnc_selectRandom; _someWeaponArray = _someWeaponArray - _randomWeapon; _crate addWeaponCargoGlobal _randomWeapon; _itemCounter = _itemCounter + 1; };
@DAmNRelentless Thank you, logically that makes a lot more sense. I will play around with this method and see what i come up with.
EDIT : for the sake of argument, pairing weapons with their respective ammo would not work seeing as the _this addWeaponCargoGlobal would require a weapon and _this addMagazineCargoGlobal would require a magazine? Something like this?
_weaponAmmoArray = [ [["BAF_LRR_scoped",2],["5Rnd_86x70_L115A1", 20]], [["DMR_DZ",1],["20Rnd_762x51_DMR",20]], [["FN_FAL_ANPVS4_DZE",2],["20Rnd_762x51_FNFAL",20]], [["Mk48_CCO_DZ",2],["100Rnd_762x54_PK",20]], [["M240_DZ",2],["100Rnd_762x51_M240",20]], [["G17_FL_DZ",2],["17Rnd_9x19_glock17",20]], [["M9_SD_DZ",2],["15Rnd_9x19_M9SD",20]] ]; _rngAmmoWeaponPairSelect = _weaponAmmoArray call BIS_fnc_selectRandom; _this addWeaponCargoGlobal _rngAmmoWeaponPairSelect;
The aim is to return a random weapon, with a random amount of its respective ammo?
Adding Custom loot crates when using DZAI mission system.
in A2: Epoch Mods
Posted
I know of some questions in the forums regarding custom loot crates with available missions systems. I have managed to create a custom loot crate thanks to @DAmNRelentless help, that randomizes items and weapons from user customizable arrays and integrate this with the mission system. This for the time being works for DZAI on Epoch 1.0.6.2.
Following is my custom lootcrate.sqf , all the classnames used is from the official epoch 1.0.6.2 github repo with thanks to @salival found >here<
if (isServer) then { // Delete if crate exists deleteVehicle _vehicle_999999; //Then recreate it at the same position. _vehicle_999999 = objNull; while {true} do { _refreshTime = 180; _this = createVehicle ["TKVehicleBox_EP1", [726.63354, 9610.8154, 0], [], 0, "CAN_COLLIDE"]; _vehicle_999999 = _this; _this setDir 20; _vehicle_999999 setVariable ["ObjectID","1",true]; _vehicle_999999 setVariable ["permaLoot",true]; _vehicle_999999 allowDamage false; //Clears the possible random content from the crate clearWeaponCargoGlobal _this; clearMagazineCargoGlobal _this; //All items and Weapons arrays. User customizable. _weaponAmmoArray = [[["DMR_DZ",2],["20Rnd_762x51_DMR",5]], [["L115A3_DZ",2],["5Rnd_86x70_L115A1",5]], [["m107_DZ"],["10Rnd_127x99_m107",5]], [["PMC_AS50_scoped"],["5Rnd_127x99_as50",5]], [["M249_m145_EP1_DZE",2],["200Rnd_556x45_M249",5]] ]; _toolArray = [["ItemEtool",5], ["ItemCrowbar",5] ]; _magazineArray = [["150Rnd_127x107_DSHKM",7], ["150Rnd_127x108_KORD",7], ["2000Rnd_762x51_M134",7], ["CinderBlocks",20],["FoodCanRusPork",10], ["FoodMRE",10],["ItemBriefcase100oz",2], ["ItemComboLock",5], ["ItemLightBulb",5], ["ItemLockbox",2], ["ItemMorphine",10], ["ItemPainkiller",10], ["ItemPole",2], ["ItemSodaMzly",10], ["ItemSodaR4z0r",10], ["ItemVault",2], ["cinder_door_kit",5], ["cinder_garage_kit",5], ["full_cinder_wall_kit",10], ["metal_floor_kit",10], ["ItemBloodbag",10] ]; _gemArray = [["ItemEmerald",2], ["ItemSapphire",2], ["ItemTopaz",2], ["ItemCitrine",2], ["ItemAmethyst",2] ]; _counterWeaponsAmmo = 0; //Random Crate filling while {_counterWeaponsAmmo < 5} do { _randomWeapAmmo = _weaponAmmoArray call BIS_fnc_selectRandom; _weaponAmmoArray = _weaponAmmoArray - _randomWeapAmmo; _weapon = _randomWeapAmmo select 0; _ammo = _randomWeapAmmo select 1; _randomAmmo = round(random(_ammo select 1)); _ammo set[1,_randomAmmo]; _this addWeaponCargoGlobal _weapon; _this addMagazineCargoGlobal _ammo; _counterWeaponsAmmo = _counterWeaponsAmmo + 1; }; _counterTool = 0; while {_counterTool < 2} do { _randomTool = _toolArray call BIS_fnc_selectRandom; _tooldArray = _toolArray - _randomTool; _this addMagazineCargoGlobal _randomTool; _counterTool = _counterTool + 1; }; _counterMagazine = 0; while {_counterMagazine < 25} do { _randomMagazine = _magazineArray call BIS_fnc_selectRandom; _magazineArray = _magazineArray - _randomMagazine; _this addMagazineCargoGlobal _randomMagazine; _counterMagazine = _counterMagazine + 1; }; _counterGem = 0; while {_counterGem < 3} do { _randomGem = _gemArray call BIS_fnc_selectRandom; _gemArray = _gemArray - _randomGem; _this addMagazineCargoGlobal _randomGem; _counterGem = _counterGem + 1; }; sleep _refreshTime; }; };
From here I have added the following script to my custom DZAI spawns found in \z\addons\dayz_server\DZAI\init\world_spawn_configs\custom_spawns\cust_spawns_panthera2.sqf. Obviously you will use the sqf appropriate to your map etc.
["staticspawn",10,2,true] call DZAI_spawn_units; if {DZAI_spawn_units && DZAI_despawnWait == true} then { execVM "\z\addons\dayz_server\custom\lootcrate.sqf"; };
This method might need some tweaking and someone else might have a more effective way of doing this, but for me this works perfectly. Fully tested with random loot spawns after new AI group spawned.