Jump to content
na_palm

Lootspawner, configurable building loot system

Recommended Posts

Hello and welcome to the Lootspawner system!

I'am not great at writing long text so to make it short...

The LS system here at hand evolved from the loot spawn system used in 404's and GOT's older Wasteland versions.

This version however is completly rewriten and evolves around the idea to spawn the loot as near as possible to

the player position and therefore gain speed and reduce lag.

It is compatible with every island/map that uses buildings that have buildingpositions.

It is configurable to a great degree and almost, NOT completly ofcourse, Lag and FPS neutral.

The last part, about Lag and FPS for high player counts, has to be tested as i have only a few friends that play ArmA,

but here you all can help me! For small playercounts on Altis, with my PC running client and server simultan on an

Phenom X4 965, it is almost unnoticeable even with a bit edited A3Wasteland dev. build i use.

DOWNLOADS

MultiPlayer example maps for Altis and AiA/Chernarus are available at:

Testmission for Altis and

Testmission for AiA/Chernarus

SinglePlayer example maps for Altis and AiA/Chernarus are available at:

Testmission for Altis(SP) and

Testmission for AiA/Chernarus(SP)

Fix for flying loot as of ArmA 3 v1.12 REUPLOADED

LSUpdf112.zip

(replace existing file with this new version)

The download is replacing following files:

- fn_LSgetBuildingstospawnLoot.sqf

- Lootspawner.sqf

- Lootspawner_SP.sqf

Script as Zip:

LootSpawner_v101.zip

old Version's:

Lootspawner as ZIP

HOWTO:

MultiPlayer: create a init.sqf file in your mission folder and paste this code inside:

if (isServer) then {
fn_getBuildingstospawnLoot = compile preProcessFileLineNumbers "fn_LSgetBuildingstospawnLoot.sqf"; 
LSdeleter = compile preProcessFileLineNumbers "LSdeleter.sqf";
execVM "Lootspawner.sqf";
};

SinglePlayer: create a init.sqf file in your mission folder and paste this code inside:

fn_getBuildingstospawnLoot = compile preProcessFileLineNumbers "fn_LSgetBuildingstospawnLoot.sqf"; 
LSdeleter = compile preProcessFileLineNumbers "LSdeleter.sqf";
execVM "Lootspawner_SP.sqf";

to configure the system, open:

1. 'Lootspawner.sqf' to change the available variables as needed.

(ex. spawninterval, chance of loot, categories of loot...)

2. 'LSlootLists.sqf' to customize the items inside the categories

3. 'LSlootBuildings.sqf' to change the lootcategory of a building or add/remove buildings

credits go to: Ed! (404Forums) and [GoT] JoSchaap (GoT2DayZ.nl) for the initial spawnsystem for Wasteland

greetings Na_Palm

Edited by Na_Palm
realined the post a bit
  • Like 2

Share this post


Link to post
Share on other sites

Cheers Na_Palm, it sounds very great.

Pac Man :

4 defaults loot types (military, civil, research, industrial).

Just edit "LSlootLists.sqf" to see exactly items/weapons/mag/etc spawn.

Share this post


Link to post
Share on other sites

Loottypes are weapons, magazines, item/cloth/vests, backpacks and general objects, here under you can put in any 'small' object thats spawned throught createVehicle directly. Whereas the first 4 types are spawned in a 'GroundWeaponHolder' throught 'create...Cargoglobal' accordingly.

Than you have by default 4 categories as MikeMuir mentioned. You can easily add or remove them as needed and junction them to buildingtypes as you wish.

//"spawnClassChance_list" array of [class, %weapon, %magazine, %ICV, %backpack, %object]
//									class   	: same classname as used in "Buildingstoloot_list"
//									%weapon 	: % chance to spawn a weapon on spot
//									%magazine 	: % chance to spawn magazines on spot
//									%ICV	   	: % chance to spawn item/cloth/vests on spot
//									%backpack 	: % chance to spawn a backpack on spot
//									%object 	: % chance to spawn an world object on spot
//-------------- A VALUE OF '-1' RESULTS IN NO LOOT FOR THIS CLASS AND TYPE ----------------
spawnClassChance_list = [
[0, 13, 21, 24, 18, 22],	// civil
[1, 26, 40, 28, 26, 18],	// military
[2, 10, 21, 28, 26, 40],	// industrial
[3, 12, 40, 40, -1, -1]		// research
];

greetings Na_Palm

Share this post


Link to post
Share on other sites

Does your scripts works in editor ?

I tried few times, checked lot of buildings, but nothing spawn.

Share this post


Link to post
Share on other sites

Not out of the box. MP only till now...

for SP i think you need to change these:

1. in your init.sqf got rid off the isServer query so it looks as this

fn_getBuildingstospawnLoot = compile preProcessFileLineNumbers "fn_LSgetBuildingstospawnLoot.sqf"; 
LSdeleter = compile preProcessFileLineNumbers "LSdeleter.sqf";
execVM "Lootspawner.sqf";

maybe you can put it into a GameLogic but account for the use of ("").

2. in Lootspawner.sqf change the forEach condition line 230 to something SP compatible.

That should be all to change... i think

greetings Na_Palm

P.S.: on 2. after looking at available commands try 'player' instead of 'playableUnits'

Edited by Na_Palm
see PS

Share this post


Link to post
Share on other sites

I made it playable for SP now,too.

Changed first post to include SP file and instructions.

Share this post


Link to post
Share on other sites

Nice to hear! Thanks

if you need more info or have a prob with it ask.

Share this post


Link to post
Share on other sites

Hey just a quick question scripts work great and all but cant seem to get the loot to delete when going away from the loot no matter how far i go doesnt disappear, is there any way to set the timer or distance to despawn loot or did a recent patch just bugger it up?

Share this post


Link to post
Share on other sites

Hi JB, good to here from someone that its working good. :)

Take a look into 'LSdeleter.sqf' if you want to change something in the delete behavior. The file as such is untouched since release and should work.

The routine checks first if the lifetime "_spInterval" in 'Lootspawner.sqf' is expired and secondly if a player is in 500m distance to the object in question (so it don't delete an object the player could see or wants to grab, and also as i thought it would be bad for immersion otherwise).

If you know what to do change it as desired, otherwise say how you want it.

greetings Na_Palm

PS: welcome to the forums!

Edited by Na_Palm

Share this post


Link to post
Share on other sites
Hi JB, good to here from someone that its working good. :)

Take a look into 'LSdeleter.sqf' if you want to change something in the delete behavior. The file as such is untouched since release and should work.

The routine checks first if the lifetime "_spInterval" in 'Lootspawner.sqf' is expired and secondly if a player is in 500m distance to the object in question (so it don't delete an object the player could see or wants to grab, and also as i thought it would be bad for immersion otherwise).

If you know what to do change it as desired, otherwise say how you want it.

greetings Na_Palm

PS: welcome to the forums!

Hey thanks for the quick reply Na_Palm, I changed the 500m distance in the LSDeleter.sqf and changed the _SPInterval time down to 15min, I think it was the 500m distance that was the problem. And one more question, would kind of buildings would fall under the research category?

Thanks for the Welcome as well :cool:

edit: Tested it out and all is working perfectly

Edited by JB

Share this post


Link to post
Share on other sites

How are you finding the elevation of items?

I not long ago wrote a similar script and tried using both WeaponHolderSimulated and GroundWeaponHolder and found the arma internal building placements meant too often items were elevated in the air or half sunk in the ground.

In the end I used modelToWorld and mapped out my own placements.

Share this post


Link to post
Share on other sites
Hey thanks for the quick reply Na_Palm, I changed the 500m distance in the LSDeleter.sqf and changed the _SPInterval time down to 15min, I think it was the 500m distance that was the problem. And one more question, would kind of buildings would fall under the research category?

Thanks for the Welcome as well :cool:

edit: Tested it out and all is working perfectly

Take a look into 'LSlootBuildings.sqf' there you have all buildings listed and linked to the lootclasses. To give you an shortcut the research class reverse to the red and white container buildings fount in some military bases and inside the domes, namely thats are: "Land_Research_house_V1_F" and "Land_Research_HQ_F"

You are free to change it however you see fit for your mission/mod.

You can also make new loot classes as ex. shop or garage and the like...

How are you finding the elevation of items?

I not long ago wrote a similar script and tried using both WeaponHolderSimulated and GroundWeaponHolder and found the arma internal building placements meant too often items were elevated in the air or half sunk in the ground.

In the end I used modelToWorld and mapped out my own placements.

hi shinkicker,

For now i create, locally, at mission start, at the server, a building for each entry in 'LSlootBuildings.sqf' and then check the building positions and store them in an ARRAY.

Take a look into 'Lootspawner.sqf' or the SP one, don't matter for that part, and look in function "getListBuildingPositionjunction", beginning line 87.

Hope that helps you. Don't want to write a PAP (program flow chart) here :)

greetings Na_Palm

---------- Post added at 12:49 ---------- Previous post was at 12:37 ----------

As i wrote the auto logout kicked in and i had to write part answers new so missed somethink....

@shinkicker: also look at var "_genZadjust" in 'LSlootBuildings.sqf' and its use in 'fn_LSgetBuildingstospawnLoot.sqf' as it's an general high adjust i used too.

Share this post


Link to post
Share on other sites

How difficult would it be to replace the loot with furniture so there would finally be some furniture in the buildings?

Share this post


Link to post
Share on other sites

Just tested it and it works very well.

as Lightspeed says, this would be a GREAT way to spawn lovely furniture !

Share this post


Link to post
Share on other sites

Excellent! I'll have a closer look at this now, would be hugely popular by majority of gamers to get even a little furniture in all these buildings!

Share this post


Link to post
Share on other sites

Hi Lightspeed_aust & Kremator,

unfortunately, as far as i have investigated, it would look extremely silly/dull to place somewhat random furniture onto the spawnpoints in houses. It would in no way resemble the look of somewhat real placements or the way it looks like in DayZ SA.

To archive this it would be necessary to begin with a new approach based on manually placing furniture to each house type, saving the layouts and then maybe control the "real" creation in all houses by a seed to get an a bit of randomness but also have MP consistency.

Would be a lot to code but it could pay off.

BTW: Does we have a list of possible furniture thats already in A3?

And could/has someone tested the lootspawner with higher playercounts?

greetings Na_Palm

Share this post


Link to post
Share on other sites
Does we have a list of possible furniture thats already in A3?

/*
- Print furniture, market and small_item class names to the rpt.
- Fill the _objArray with the class names and copy it to your clip board after the loop is done.
*/

private ["_cfg","_typeArray","_objArray","_selection","_className","_scope","_vehClass"];

_cfg = configFile >> "cfgVehicles";
_typeArray = ["Furniture", "Market", "Small_items"];
_objArray = [];

for "_i" from 0 to (count _cfg) - 1 do {
_selection = _cfg select _i;

if (isClass _selection) then {
	_className = configName _selection;
	_scope = getNumber (_cfg >> _className >> "scope");
	_vehClass = getText (_cfg >> _className >> "vehicleClass");
	if (_vehClass in _typeArray && {_scope >= 2}) then {
		diag_log format ["%1", _className];
		_objArray set [count _objArray, _className];
	};
};
};

copyToClipBoard format ["%1", _objArray];

Edited by Iceman77

Share this post


Link to post
Share on other sites

1.12.115915 breaks the z-height of the loot piles. Now at random heights in all buildings.

Share this post


Link to post
Share on other sites

Thanks for pointing out. Will investigate later in the evening...

greetings Na_Palm

PS: How is the global var "swSpZadjust" in lootspawner.sqf line 10 set to?

Share this post


Link to post
Share on other sites

I have been playing around with it a bit. If it is set to false it spawns everything about 1.5m off the ground, with the towers having some loot placed OK, and other piles 2m in the air. With it set to true, and the adjustment set to 0.1 it looks like this: http://i.imgur.com/STaRzqA.jpg

Hope that helps.

Share this post


Link to post
Share on other sites

i could narrow it down to a junction with "GroundWeaponHolder" thats causing this behavior. If i spawn objects, like boxes/wheels/chairs/...., directly without it, it works all well.

But as soon as i use the "GroundWeaponHolder" i get the floating ones.

Further to note, that an increase in distance between Terrain ground and the "GroundWeaponHolder" seems to increase the discrepancy even more. 1/2 an meter on first floor, above the roof for 2nd floor loot...

For now I'am not entirely sure how to fix it. Maybe it has something to do with the new "Holders" thats mentioned, under Intelligence, here: http://dev.arma3.com/sitrep-00046

will investigate further...

greetings Na_Palm

PS: the old Bug, thats causing loot to become inaccessible after first interaction seems to be gone for good. :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×