Want to make all loot spawn like heli crash sites--once and permanent

Would it be possible to spawn all of the objects (not zombies) just once initially like the loot is doing now?
 
Ah, I missed the commented out "if" part. Thank you.

After editing dayz_server.pbo were you able to simply replace the current pbo?
 
isathar, I might have done something wrong, but when I implement this code, my user gets kicked for script #20. Can you verify the files I am to add this too? last post you make reference to removing (_id = [] call server_permaLootInit) from server_monitor, but I dont see that code in that file?
 
Sorry about that. I'm not using BE on my lan server and don't have the current scripts.txt handy, but based on my completely outdated file it's most likely the createVehicle commands in the script (line 20 is createMine in my file, but that wouldn't make sense). Just look at line 20 in scripts.txt in your serverconfig/BattlEye folder to see which script is causing the kick. You can remove the line from scripts.txt, but I wouldn't do that on a public server as it would open the door for hackers, especially with a command like createVehicle...

I'm no expert on BE, but I'm pretty sure it's possible to create exceptions to rules in the file without completely removing the offending script from the filter. Let me know what the offender in scripts.txt is and I'll see what I can do.

EDIT: It's probably not createVehicle since it isn't run client-side; if you're using the client-side version (Approach 2), add the following to the end of the line that starts with setVariable in scripts.txt (hopefully line 20 :D):
Code:
" !"_x setVariable [\"cleared\",true,true];";" !"_x setVariable [\"cleared\",false,true];";" !"_item setVariable [\"permaloot\",true,true];"
I haven't found anything else that may go against BE's ruleset, but I'll post if I do.


About the line in server_monitor: it's just a change to one of the last steps in my first post, so if you didn't set up the permaloot script, just ignore that instruction. I probably should have clarified that.


joikd: I think so (make a backup to be sure), but I believe you'll have to disable signature checking (bad for security if your server is Online) or sign the pbo yourself and send the key to anyone you want to be able to join.
 
isathar, I am trying to use approach 1 to spawn all loot, but I do not have this file in dayz_server.pbo: dayz_server/system/server_monitor.sqf.

I do have it in dayz_code\system\server_monitor.sqf, which has only two lines of code.
One is: execVM "\z\addons\dayz_server\system\server_monitor.sqf";

My helicopter crash spawn code is in dayz_server\init\server_functions.sqf. I did add the line there underneath the heli spawn, but no loot spawned (I gave it 10 minutes).

This is with the manual Bliss install.

I really want this to work from the server. Any ideas?
 
I am very confused. Isathar, or anyone else who understands, please clarify the following:

EDIT:

Approach 1: Server-Side loot spawn on Init

Create the following sqf in dayz_server/compile/

What do we name this file? server_spawnLoot.sqf?

Code:
private["_positions","_iArray","_iPos","_item","_obj","_type","_nearBy","_itemType","_itemChance","_lootChance","_weights","_index"];
_obj = _this select 0;
 
_type = typeOf _obj;
_config = configFile >> "CfgBuildingLoot" >> _type;
 
_positions = [] + getArray (_config >> "lootPos");
_lootChance = getNumber (_config >> "lootChance");
_itemType = [] + getArray (_config >> "itemType");
_itemChance = [] + getArray (_config >> "itemChance");
 
{
_iPos = _obj modelToWorld _x;
_rnd = random 1;
//Place something at each position
if (player distance _iPos > 5) then {
if (_rnd < _lootChance) then {
_nearBy = nearestObjects [_iPos, ["WeaponHolder","WeaponHolderBase"],1];
if (count _nearBy == 0) then {
_weights = [_itemType,_itemChance] call fnc_buildWeightedArray;
_index = _weights call BIS_fnc_selectRandom;
if (_index >= 0) then {
_iArray = +(_itemType select _index);
_iArray set [2,_iPos];
_iArray set [3,0];
_iArray call spawn_loot;
_iArray = [];
//diag_log ("LOOTSPAWN");
};
_item setVariable ["created",(DateToNumber date),true];
_item setVariable ["permaloot",true,true];
};
};
};
} forEach _positions;

Then add this to dayz_server/init/server_functions.sqf:
Code:
server_spawnPermaLoot = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_spawnLoot.sqf";

I'm not sure if this is needed, to be honest, but in dayz_code_system/building_monitor.sqf, you may have to comment this line out (I changed the system around a few times until it worked so I'm not sure, but objects marked with the permaloot variable may be immune to this):
Code:
{deleteVehicle _x;} forEach _items;

Then create an sqf named "server_permaLoot.sqf" in dayz_server/compile/ with the following:
Code:
private["_center","_allBldngs","_type","_config","_canLoot","_cleared"];
 
if (isServer) then {
_center = getMarkerPos "center";
_allBldngs = _center nearObjects ["building",8500]; // (root(225000) / 2) + 1000 should get everything in Chernarus
 
{
_type = typeOf _x;
_config = configFile >> "CfgBuildingLoot" >> _type;
_canLoot = isClass (_config);
_cleared = (_x getVariable ["cleared",true]);
 
if (_canLoot) then {
if (isNil("_cleared")) then {
_x setVariable ["cleared",true,true];
_cleared = true
};
 
if (_cleared) then {
[_x] call server_spawnLoot;
_x setVariable ["cleared",false,true];
};
};
} forEach _allBldngs;
};

Last, add the following to the bottom of dayz_server/system/server_monitor.sqf below the heli wreck spawns:
I do not have the above file. Please advise.


I do not have this file. Is this the same as the one further up, but misnamed?
Code:
_id = call server_spawnPermaLoot;
 
Weird, the server monitor should be there if nothing changed recently, especially since it's referenced in your server_init. The helicrash code in init is just the function that gets called in the monitor to actually spawn them, so the code never got executed when you put it there.
What method of pbo extraction do you use? I had issues with some files not extracting with one of the tools out there (not sure which, may have been cpbo), so would try using another tool. I'm using a command-line tool called extractpbo.
 
More confusion on my part. Please clarify.

What do I need to remove and from which init.sqf?
To get loot to spawn from these objects with the above script, I'm calling it at the end of this one, so you will have to remove it from init.sqf if using this, as well.

Do I change anything if I want to spawn everything (just want vanilla DayZ with all loot spawned?
If you want to only spawn specific objects or stop some from spawning, take a look at the commented if statement

Create a new sqf named server_fillLocs.sqf in dayz_server/compile/ with the following:

Code:
private ["_configBase","_tempList"];
 
if (isServer) then {
_tempList = ["Chernogorsk","Elektrozavodsk","Balota","Komarovo","Kamenka","Kamyshovo","Prigorodki","Kabanino","Solnichniy","StarySobor","NovySobor","SouthernAirport","NorthernAirport","Berezino","Lopatino","GreenMountain","Zelenogorsk","Nadezhdino","Kozlovka","Mogilevka","Pusta","Bor","Pulkovo","Vyshnoye","Drozhino","Pogorevka","Rogovo","Guglovo","Staroye","Pavlovo","Shakhovka","Sosnovka","Msta","Pustoshka","Dolina","Myshkino","Tulga","Vybor","Polana","Gorka","Orlovets","Grishino","Dubrovka","Nizhnoye","Gvozdno","Petrovka","Khelm","Krasnostav","Olsha"];
for "_j" from 0 to ((count _tempList) - 1) do
{
_configBase = configFile >> "CfgTownGenerator" >> (_tempList select _j);
 
for "_i" from 0 to ((count _configBase) - 1) do
{
private ["_config","_type","_position","_dir","_onFire","_object"];
 
_config = (_configBase select _i);
if (isClass(_config)) then {
//filter:
 
_type = getText (_config >> "type");
//if (((getText (_config >> "type")) != "Body1") and ((getText (_config >> "type")) != "Body2")) then {
_position = [] + getArray (_config >> "position");
_dir = getNumber (_config >> "direction");
_onFire = getNumber (_config >> "onFire");
 
_object =  _type createVehicle _position;
_object setPos _position;
_object setDir _dir;
_object allowDamage false;
 
//diag_log format["CreateObj: %1 / %2",_type,_position];
/*
if (_onFire > 0) then {
nul=[_object,_onFire,time,false,false] spawn BIS_Effects_Burn;
};
*/
//};
};
sleep 0.1; // for longer load, but better startup performance
};
//sleep 0.5; //comment the other sleep and uncomment this for faster load but slower startup performance
diag_log ("Creating Objects: " + str(_configBase));
};
//diag_log ("Spawning all loot.");
_id = [] call server_permaLootInit;
};

add it to server_functions
Code:
server_fillLocs = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_fillLocs.sqf";

Remove it from the server_fillLocs.sqf that we just made? If so, is it spawning itself (spawn server_fillLocs)?

remove "_id = [] call server_permaLootInit;" from server_monitor from above post, and replace it with
Code:
_id = [] spawn server_fillLocs;

Have fun, it's been pretty entertaining so far having to actually go from town to town to get supplies.
 
Weird, the server monitor should be there if nothing changed recently, especially since it's referenced in your server_init. The helicrash code in init is just the function that gets called in the monitor to actually spawn them, so the code never got executed when you put it there.
What method of pbo extraction do you use? I had issues with some files not extracting with one of the tools out there (not sure which, may have been cpbo), so would try using another tool. I'm using a command-line tool called extractpbo.

With the Bliss manual install, it creates the dayz_server.pbo during installation. So, I'm not sure what to do about that. What server version are you running (bliss, Pwnoz0r's, etc.)?
 
Thanks for pointing out my omission of the file name on the first one, I'll edit it in a minutes. Yes, the file should be named server_spawnLoot.sqf and placed in dayz_server/compile/. Also, ignore the init.sqf thing, it was a leftover from before I updated my post, and will be removing it shortly.

I'm not sure what's going on with server_monitor, it's even being referenced in your server_init. Try extracting the pbo using another method, cpbo sometimes ignored files for me.

The last one: I added the second post as an optional addition to the permaloot thing outlined in the first, so the instruction about removing the line just means replace "_id = [] call server_permaLootInit;" with "_id = [] spawn server_fillLocs;" . The server_fillLocs script executes the loot initialization when it's finished so it can catch all the objects added by fillLocs.
 
With the Bliss manual install, it creates the dayz_server.pbo during installation. So, I'm not sure what to do about that. What server version are you running (bliss, Pwnoz0r's, etc.)?

I'm also using bliss. Take a look in the bliss install folder under (folder)/util/dayz_server/
 
I'm also using bliss. Take a look in the bliss install folder under (folder)/util/dayz_server/
Thanks for all of your help, isathar!

I can't find extractpbo that doesn't require a password to download, so I will just edit the files that bliss uses to create the dayz_server.pbo. Thanks for directing me to that folder. I found the rest, but missed that one.

For some reason I'm still confused about server_fillLocs. So, you are saying that the actual file server_fillLocs.sqf file should have the line "_id = [] spawn server_fillLocs;" at the bottom instead of "_id = [] call server_permaLootInit;"? It just seems like it's going: code from file says to go to the file where the code from file resides--circular.


EDIT: I reread your post s-l-o-w-l-y. I will ignore this part.
Lastly, I'm still unclear about this one: "To get loot to spawn from these objects with the above script, I'm calling it at the end of this one, so you will have to remove it from init.sqf if using this, as well."
I am not sure what to remove and from where.

Thanks!
 
The fillLocs script should be executed from server_monitor, by "above post" I meant my previous post that outlined the permanent loot script, the second one was just the cfgTownGenerator objects.

No problem at all, I helped create this monster, so I may as well help people use it :D
 
So, is it "_id = call server_spawnPermaLoot;" or "_id = [] call server_permaLootInit;" that I am supposed to change to "_id = [] spawn server_fillLocs;"? Both of these exist in two different files. You seem to indicate the first one, but the directions state the second.

I suck. After many hours failing, I am done for the night. I, finally, found extractpbo, which extracted fine. But, it's partner makepbo would not work (of course--every inch of this process has been a battle). Command line cpbo finally made a pbo that worked without errors in-game. But, no loot ever spawned. This was using approach one with the streaming option. Something is not right. I think I am still screwing up something. All I want is for all loot to spawn once using the server.pbo when the server starts (no options or anything).

I need the complete idiot's guide version. Step 1, do exactly this and only this (don't think just do). Use this tool with these exact commands. Step 2, forget about Step 1, only do this, and so on. Right now there is too much wiggle room for a blockhead like me to screw something up (obviously). Anyone other than isathar get this to work? I hate to keep bothering him with my ineptitude.
 
It should be _id = [] call server_permaLootInit; ... I was confused. The same one that's the last line of server_fillLocs.sqf.
 
Well, I'm back at it today, and already have a question. Is this "_id = [] call server_permaLootInit;" supposed to be "_id = [] call server_permaLoot;" (no "Init" in the name)? I ask because the instructions have us create a file with the name "server_permaLoot", but not a file named "server_permaLootInit". Thanks!
 
I'll take a loot at my files and see what I messed up in the instructions and update the instructions. I just noticed I never added at least one step to the instructions... Sorry about that, I was just so excited to have it working that I rushed things.
 
Thanks for your continued help, isathar. Unfortunately, even with your updated instructions, I was unable to get any loot to spawn (approach 1 w/streaming from 2nd post). The .rpt file shows the heli spawning, but no mention of anything else relating to this. This was with both editing the dayz_server.pbo directly, and altering the dayz_server files before a Bliss install (I am a master at a full re-install now! Ha!).

Any ideas? I have an altered player_spawnCheck in dayz_code (all loot code removed). I didn't see any reference to this in your files, so I don't think it should affect anything, but does it?
 
Back
Top