Jump to content

[Release] Lootspawner, configurable building loot system


Suppe

Recommended Posts

  • 1 month later...
  • 3 months later...

Thanks for sharing this @Suppe

This is great I was able to use it to spawn RHSUSAF loot on a Tanoa Life server :biggrin: 

I'm sure it will work on any map with any mod!

---------------------------

What I did:

1) edit the LSlootBuildings.sqf and add the building names from Tanoa. (or any map)

2) Edit the LSlootLists.sqf and add the weapons / gear / ammo and item names from the mod your using 

3) That's it - repack / upload / profit!

--------------------------

FOR TESTING ONLY - try using these variables in the Lootspawner.sqf 

//Variables
//local
_spawnradius = 50;                    //Radius (in meter) around players to spawn loot
_spInterval = 60;                         //Time (in sec.) to pass before an building spawns new loot
_chfullfuel = 35;                          //Chance (in %) of a spawned fuelcan to be full instead of empty
_genZadjust = -0.1;                    //High adjustment (in engine units) thats generally added to every spawnpoint
_tmpTstPlace = [];                     //Coord's, in [x,y,z] of a preferably flat and unocupied piece of land
_chperSpot = 100;                    //Chance (in %) if a spot gets loot

Link to comment
Share on other sites

  • 3 weeks later...
  On 2/27/2015 at 8:53 PM, Suppe said:

because now lazy people can no longer view or steal your settings.

Expand  

What ever happen to epoch being a place you come to share your information? It is the place to come and share. I have built a lot of custom AI cities and have given them out to admins trying to get started, hell there have been times I have given server, mission pbos out.

Just saying. :blink:  

Link to comment
Share on other sites

  On 7/18/2017 at 1:40 PM, Thug said:

What ever happen to epoch being a place you come to share your information? It is the place to come and share. I have built a lot of custom AI cities and have given them out to admins trying to get started, hell there have been times I have given server, mission pbos out.

Just saying. :blink:  

Expand  

That was written in 2015 @Thug There was a lot going on back in 2015 that caused some of the attitude you saw in that post.

I think most people in the community today are very, very sharing. I personally have learned many things from others here and received a lot of help on fixing problems and adding functionality.

Link to comment
Share on other sites

  • 3 weeks later...

Still struggling to add loot to buildings.
Running A3 Epoch v.5 + Open Chernarus Project
So problem I guess is adding loot positions to the new "enterable" buildings.
Just adding the buildings to the LSlootBuildings.sqf does not make loot spawn, right?

I'm guessing I have to somewhere add "loot positions" for those buildings.

Can someone please point me to where I can find "how to" do this?

Thanks in advance.

Link to comment
Share on other sites

OCP does not have the LODs defined for buildings yet afaik (lootspawner places loot where AI are defined to stand based on the buildings being defined for this)... This is as far as I understand being worked on. In the interim you would need to use the Epoch tools (specifically saveLootPositionsVector.sqf) to define Epoch loot container positions (beds, chairs, tables, etc.) for any loot to be in those buildings.

Link to comment
Share on other sites

  • 3 weeks later...

One of the reasons I first started using LootSpawner was the fact that I could tailor loot to a specific type of building (e.g. military loot predominantly in military buildings, medical in hospitals, etc.) but one failing has been its reliance on building positions being set up by map developers for each of the buildings used on the map. Recently, for example, I know of someone who really wanted to use Napf for an Epoch server but was really unable to do so because the buildings have not been defined for standard Epoch loot (the beds, tables, chairs, etc.) and the map's new buildings did not have building positions defined, so LootSpawner would not create ground loot.

Well, that got me thinking (as did the fact that I'm using @DirtySanchez's Open Chernarus Project to add additional new buildings to Chernarus. Of course the new buildings do not have positions defined that LootSpawner can use.... but Exile does... :ph34r:

Here I present some code fixes to allow you to use the Exile Loot Position files for any map with the old LootSpawner system. Credit for LootSpawner goes to the original developers and @Suppe(who produced so much good software for Epoch back in the old days).

So, in order to get this working you need to download the original LootSpawner files and make the following changes:

Replace LootSpawner.sqf with:

  Reveal hidden contents

If, like me you have altered the chances of loot spawning or added additional loot building classes do not forget to change that in this file.

Replace fn_LSgetBuildingstospawnLoot.sqf with:

  Reveal hidden contents

Now, find an Exile CfgBuildings.h for the map you are using. You need to create a new file in your mission file in epoch_config/Configs called CfgLootPositions.hpp. Copy the code from the CfgBuildings.h into this and wrap the whole thing in:

class CfgLootPositions {

... the original file contents ...

};

UPDATE: I did, of course, forget to mention that this new file must be loaded along with the standard Epoch config files in the mission's epoch_config/sandbox_config.hpp. Just add this line to that file:

#include "Configs\CfgLootPositions.hpp"

Now just make sure that all the buildings are listed in the LootSpawner LSlootBuildings.sqf file.

Rebuild the loot_spawner and mission PBOs and upload to your server. Now you have loot spawning on the ground, on bunks, under them, on tables and shelves, depending on what the original author of the loot position config provides.

If you want to change a building's loot positions or add a new building not covered in the CfgLootPositions then simply download the Exilemod Loot Position Creator which does not require that other mod to run and is pretty easy to use and set things up how you would like them.

TODO: Tidy up the code and add error checking on whether the buildings defined in LSlootBuildings.sqf are defined in the new CfgLootPositions.hpp

Link to comment
Share on other sites

  • 1 month later...

@Grahame

wow yet another top shelf solution thx

thou weapons spawn with no ammo

// what i use
if(_lootType == 1) exitWith {
	_lootholder = createVehicle ["WeaponHolderSimulated", _tmpPos, [], 0, "CAN_COLLIDE"];
	_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
	_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
	_lootholder addWeaponCargoGlobal [_loot, 1];
	//Function to add the right magazine for a weapon. added 12 feb 17 line 84 to 87 thx Cameltoe
	_ammo = [] + getArray (configFile >> "cfgWeapons" >> _loot >> "magazines");
	_lootholder addMagazineCargoGlobal [(_ammo select 0),(round(random 4))]; //max 4 magazines per weapon
	//end custom function
	_lootholder setdir (random 360);
	_lootholder setPosATL _spwnPos;
};

// what you put up
if(_lootType == 1) exitWith {
	_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
	_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
	_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
	_lootholder addWeaponCargoGlobal [_loot, 1];
	_lootholder setdir (random 360);
	_lootholder setPosATL _spwnPos;
};

hope it helps

Edited by natoed
added shit
Link to comment
Share on other sites

  On 9/23/2017 at 12:18 AM, natoed said:

@Grahame

wow yet another top shelf solution thx

thou weapons spawn with no ammo

// what i use
if(_lootType == 1) exitWith {
	_lootholder = createVehicle ["WeaponHolderSimulated", _tmpPos, [], 0, "CAN_COLLIDE"];
	_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
	_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
	_lootholder addWeaponCargoGlobal [_loot, 1];
	//Function to add the right magazine for a weapon. added 12 feb 17 line 84 to 87 thx Cameltoe
	_ammo = [] + getArray (configFile >> "cfgWeapons" >> _loot >> "magazines");
	_lootholder addMagazineCargoGlobal [(_ammo select 0),(round(random 4))]; //max 4 magazines per weapon
	//end custom function
	_lootholder setdir (random 360);
	_lootholder setPosATL _spwnPos;
};

// what you put up
if(_lootType == 1) exitWith {
	_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
	_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
	_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
	_lootholder addWeaponCargoGlobal [_loot, 1];
	_lootholder setdir (random 360);
	_lootholder setPosATL _spwnPos;
};

hope it helps

Expand  

LOL, true. I had added that functionality to my version after posting on the forum:

									if(_lootType == 1) exitWith {
										_lootholder = createVehicle ["GroundWeaponHolder", _tmpPos, [], 0, "CAN_COLLIDE"];
										_selecteditem = (floor(random(count((lootWeapon_list select _lootClass) select 1))));
										_loot = (((lootWeapon_list select _lootClass) select 1) select _selecteditem);
										_lootholder addWeaponCargoGlobal [_loot, 1];
										// Add a magazine with a random number of rounds in items
										_mags = getArray (configFile >> "CfgWeapons" >> _loot >> "magazines");
										if !(_mags isEqualTo []) then {
											_magazineSize = getNumber (configFile >> "CfgMagazines" >> (_mags select 0) >> "count");
											_lootholder addMagazineAmmoCargo[_mags select 0, 1, ceil(random(_magazineSize))];
										};
										_lootholder setdir (random 360);
										_lootholder setPosATL _spwnPos;
									};

I took the code from Epoch's loot generator, which is why it was not posted, but it includes a check that magazines returns an array with elements defined... 

Link to comment
Share on other sites

Also note that the code I use for random magazines, spawns one mag with a variable number of rounds left. I feel personally that that is more realistic but there should probably be a variable where you can specify whether you want that or a random number of mags (and be able to specify the maximum number of mags if so)

Link to comment
Share on other sites

LSlootBuildings.sqf

altis, Chernarus and Isla Abramia maps

btw i use second_coming version ie:

spawnClassChance_list = [
[0, 31, 28, 38, 28, -1],      // civil
[1, 31, 28, 42, 28, -1],    // military
[2, 12, 19, 16, 10, -1],    // industrial
[3, 22, 22, 32, 11, -1],      // research
[4, 10, 19, 17, 12, -1],    // medical
[5, -1, 50, 50, -1, -1],     // food
[6, 15, 15, 22, 10, -1]        // hangars
];

 

  Reveal hidden contents

 

Link to comment
Share on other sites

Since we are sharing, here's mine for Chernarus and all it's flavours (vanilla, OCP, DS Houses, Plus and Redux):

  Reveal hidden contents

I use the following building types:

[0, 8, 15, 20, 15, -1],	// civil
[1, 15, 25, 25, 20, -1],	// military
[2, 10, 18, 25, 20, -1],	// industrial
[3, 15, 25, 30, -1, -1],	// research
[4, 0, 0, 25, -1, -1],	// hospital
[5, 10, 18, 25, -1, -1],	// construction
[6, 12, 18, 20, -1, -1],	// airport
[7, 10, 15, 25, -1, -1]		// commercial

 

Link to comment
Share on other sites

And for those wondering why we like lootspawner so much, a lot of it is about tailoring loot for the type of building, something that is problematic with vanilla Epoch loot containers. For example, on my Origins server (just a name, it's an Epoch server not using the Origins mod), these are the building types (note that on this server I reversed the checking of types of loot so that the magazines category's percentage is first to reduce further the number of weapons spawned):

spawnClassChance_list = [
[0, 15, 3, 15, 10, 5, -1],			// Residential (village)
[1, 15, 3, 15, 10, 5, -1],		// Residential (urban)
[2, 15, 5, 10, 5, 5, -1],		// Hi-Value Military
[3, 15, 5, 10, 5, 5, -1],		// Lo-Value Military
[4, 15, 3, 10, 5, 5, -1],			// Light Industrial
[5, 15, 3, 10, 5, 5, -1],		// Heavy Industrial
[6, 15, 3, 10, 5, 5, -1],		// Commercial
[7, 25, 3, 40, 10, 5, -1],		// Medical
[8, 10, 3, 20, 5, 5, -1],		// Vehicle Repair
[9, 15, 5, 15, 10, 5, -1],		// Hanger
[10, 15, 3, 15, 10, 5, -1],		// Tourism
[11, 15, 5, 15, 10, 5, -1],		// Hunting
[12, 15, 5, 15, 10, 5, -1],		// Farming
[13, 15, 3, 15, 10, 5, -1],		// Construction
[14, 15, 3, 15, 10, 5, -1],		// Fire Station
[15, 15, 5, 15, 10, 5, -1],		// Police Station
[16, 15, 3, 15, 10, 5, -1],		// Maritime
[17, 15, 5, 15, 10, 5, -1]		// Airport
];

So, get with the program and deploy it today :wink:

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...