Jump to content
dodzh

[RELEASE] Lootsystem Script

Recommended Posts

#Lootsystem Script:

This script creates random loot on buildings based on predefined settings

 

#Installation:


Add the following line to your init.sqf:

// init lootsystem
[] execVM "lootsystem\init.sqf";

 

Add the following line to your description.ext: 

//lootsystem config
#include "lootsystem\config.cpp"

 

Move the lootsystem folder to your mission folder

 

#Customization:

Edit the config file: lootsystem\config.cpp

 

#Functions:

 

LSS_fnc_cleanup

    Usage:
    [] spawn LSS_fnc_cleanup;
    
    Notes:
    Manually cleans expired generated loot
    
LSS_fnc_cleanup_auto

    Usage:
    [] call LSS_fnc_cleanup_auto;
    
    Notes:
    Starts a thread and does cleanup based on config.cpp


LSS_fnc_spawn_loot

    Usage:
    [<pos>,<range>] spawn LSS_fnc_spawn_loot;
    example:
    [getpos player,80] spawn LSS_fnc_spawn_loot;
    
    Notes:
    Generates loot based on a given position and radius


LSS_fnc_spawn_loot_auto

    Usage:
    [] call LSS_fnc_spawn_loot_auto;

    Notes:
    Generates loot based on a given position and radius


LSS_fnc_spawn_loot_inBulding

    Usage:
    [<building_object>] call LSS_fnc_spawn_loot_inBulding;

    Returns:
    the building object where the loot was created

    Notes:
    Generates loot based on a given building object 

#Download
https://github.com/dodzh/lootsystem

#Problems Issues
https://github.com/dodzh/lootsystem/issues

#Steam
https://steamcommunity.com/sharedfiles/filedetails/?id=1537485467

#Positions Creator Tool
https://steamcommunity.com/sharedfiles/filedetails/?id=1560677855

This my first actual script posted :( hope you all like it
enjoy
   

Edited by dodzh
added link to "Positions Creator Tool"
  • Like 3
  • Thanks 4

Share this post


Link to post
Share on other sites

Believe it or not but even now (almost 2019) there wasn't a public script made for this purpose before so your work is filling a nice empty niche here!

 

Anyways, it fills my exact needs so I will be testing it out and giving feedback!

 

Thanks and please keep improving it if it is needed!

Share this post


Link to post
Share on other sites
1 hour ago, LSValmont said:

Believe it or not but even now (almost 2019) there wasn't a public script made for this purpose before so your work is filling a nice empty niche here!

 

Anyways, it fills my exact needs so I will be testing it out and giving feedback!

 

Thanks and please keep improving it if it is needed!

thanks, let me know how it goes, i have more ideas on this that ill be implementing but need to see if the core works under a stress test, dont have many people to test in multiplayer, was only able to test it with 2 people on coop and dedicated server and dont looks like there is much fps drop, unless you go crazy with the settings

  • Like 1

Share this post


Link to post
Share on other sites
17 minutes ago, dodzh said:

thanks, let me know how it goes, i have more ideas on this that ill be implementing but need to see if the core works under a stress test, dont have many people to test in multiplayer, was only able to test it with 2 people on coop and dedicated server and dont looks like there is much fps drop, unless you go crazy with the settings

 

Don't worry I will be testing in multiplayer with lots of players. 

 

Yeah, even default settings spawns a lot of items because buildings have so many possible locations. With the Ravage mod that spawns furniture for you there might be some issues of clipping but I will report later on that.

Share this post


Link to post
Share on other sites
19 minutes ago, LSValmont said:

 

Don't worry I will be testing in multiplayer with lots of players. 

 

Yeah, even default settings spawns a lot of items because buildings have so many possible locations. With the Ravage mod that spawns furniture for you there might be some issues of clipping but I will report later on that.

play with the settings, can limit all of that, can also set where smaller building get less than bigger ones as well as a cap overall

Share this post


Link to post
Share on other sites

Hi i have a Problem to config the script . Wen i put cup content in the script ist says ervery time :

lootsystem\config.cpp, line 47 (or whatever): Config:"" after 2(or whatever)

 

EDIT: My Bad im sorry i found a wrong line .... Have looking more then 3 times before i say this but found it now

 

But really good work !love this script

Share this post


Link to post
Share on other sites
8 hours ago, WaffenFetisch said:

Hi i have a Problem to config the script . Wen i put cup content in the script ist says ervery time :

lootsystem\config.cpp, line 47 (or whatever): Config:"" after 2(or whatever)

 

EDIT: My Bad im sorry i found a wrong line .... Have looking more then 3 times before i say this but found it now

 

But really good work !love this script

lol np, glad you find it useful. let me know any problems i'll try to help 

im planning to go back and rework this a bit better as well adding some new things to it.

 

at the moment im working on a new release that should be done soon, think you might like this one too 

  • Like 1

Share this post


Link to post
Share on other sites
19 minutes ago, dodzh said:

lol np, glad you find it useful. let me know any problems i'll try to help 

im planning to go back and rework this a bit better as well adding some new things to it.

 

at the moment im working on a new release that should be done soon, think you might like this one too 

Cant wait ^^

Share this post


Link to post
Share on other sites

this is great!

I love the ability to change the spawn occurence so quickyl and with the debug markers see the changes.

Share this post


Link to post
Share on other sites

I am loving this script! If you improve it even further please tweak the height the items spawn in certain buildings specially the CUP ones they spawn floating too high and it looks weird but other than that it is an almost perfect implementation that perhaps BI should be using on DAYZ Stand Alone!  

Share this post


Link to post
Share on other sites

@LSValmont ill try to look at this, can you provide me with the names of the buildings having this issues, ill try creating custom position for them, sometimes when using model positions this can happen.

 

im almost done with my the new script im working on and ill be able to look at this fully, 

 

in any rate ill try looking at this as soon as i can ty

  • Thanks 1

Share this post


Link to post
Share on other sites

Update:
 

Ive created a small mod to help deal with some of the problems with positions. using the builtin positions in building is not always the best thing, is why i also provided a way to deal with that.
this mod will help you create custom positions for any building you want.

 

https://steamcommunity.com/sharedfiles/filedetails/?id=1560677855

note: this mod is very simple and i did not put a lot of time to test it so is entirely possible some things might not work

thank you  

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

hey dodzh. the mod works really well thanks for that. I have managed to stop the items spawning on the barracks roof by using this.

 

is there an option to spawn just ammo magazines and not the weapons with them?

Share this post


Link to post
Share on other sites

@KevsNoTrev, yeah is easy. on your config under the section ratio, remove "weapons" line from it

 

        ratio[] = 
		{
			"backpacks",1,
			"uniforms",1,
			"items",2
		};

 

then on  "items[] =" add the magazines you want like 
 

		items[] = 
		{
			"11Rnd_45ACP_Mag",10,

or whatever magazines you want, just need the class names. the number after is weight meaning how likely is to spawn based on the weight or the other ones on the list

  • Like 1

Share this post


Link to post
Share on other sites

i knew I should have just tried that, thanks. it makes total sense now.

 

cheers.

Share this post


Link to post
Share on other sites

very nice scripts. Been looking for years for a loot spawner that spawns loot around player then deletes it. Loot spawning was always something i could never figure out. 

 

Quick question. With the class names in your script, this bit

 

Spoiler

class CfgLootTables
{
    class Military
    {
        ratio[] = 

 

The class military. Is it possible that after all that code we could put in a new class with a different loot list? Then if we use your #Positions Creator Tool on buildings define them with the new class name?

 

If that makes any sense at all.

 

Like this

Spoiler

class CfgLootTables
{
    class Military
    {
        ratio[] = 
        {
        };

 

        weapons[] = 
        {
        };

 

        backpacks[] = 
        {
        };      

 

        items[] = 
        {
        };

 

        uniforms[] = 
        {
        };

 

class Civilian
    {
        ratio[] = 
        {
        };
        
        weapons[] = 
        {
        };

 

        backpacks[] = 
        {
        };        

 

        items[] = 
        {
        };

 

        uniforms[] = 
        {
        };    
    };

Would be handy to know because one of the maps i like to make missions on doesnt have loot positions inside 90% of its buildings, one of the reasons i stopped using it. This would make that map a heap more useful. Also its to big to have loot always on the map anyway so your script will improve it even more

Share this post


Link to post
Share on other sites

@Chuc 

 

Yes you can change the "Military" to w/e you want but cant change the class names as those are provided by the game/mods,
 

with the position creator tool i provided you can edit create any positions you want. i was working on an update for this but been really busy.
https://pastebin.com/w7s8LM3k
that file buildings_a3.cpp, was something i was working on, have more classifications as well all (i think :P) a3 buildings can look at it and use as you wish. you'll have to create/edit loot tables to match building category names or simple make the position files less detailed for w/e you want.

 

#Positions Creator Tool
https://steamcommunity.com/sharedfiles/filedetails/?id=1560677855

 

that tool i created will help you create customize positions

 

hope this helps let me know if you have any other questions  

  • Like 1

Share this post


Link to post
Share on other sites

Cool thanks for that. Now with your pastebin position list. Whats the difference with the civilian_a and civilian_b tables? Then i also see a heap of different tables set for industrial and food. Is this so you can make different loot lists for each position? If so that is pretty much exactly what i am looking at doing.

 

Is 

Share this post


Link to post
Share on other sites
1 hour ago, Chuc said:

Cool thanks for that. Now with your pastebin position list. Whats the difference with the civilian_a and civilian_b tables? Then i also see a heap of different tables set for industrial and food. Is this so you can make different loot lists for each position? If so that is pretty much exactly what i am looking at doing.

 

Is 

Civ A and B are just to low class and high class areas, building that look rundown or poor are B and other A, and yes on that list also have other places like food and industrial.

you dont have to keep this classifications as i have them there but i tried to make them as unique as possible. having them classified like that helps getting the right items into the right buildings.

 

any question just let me know id be happy to help.

  • Like 1

Share this post


Link to post
Share on other sites
On 11/1/2019 at 9:03 AM, dodzh said:

Civ A and B are just to low class and high class areas, building that look rundown or poor are B and other A, and yes on that list also have other places like food and industrial.

you dont have to keep this classifications as i have them there but i tried to make them as unique as possible. having them classified like that helps getting the right items into the right buildings.

 

any question just let me know id be happy to help.

 

Hey Dodzh! I've been using you script in all my missions and I've used your Positions Creator Tool to improve some positions in some CUP buildings that were too high up in the air.

 

But I am still waiting for an official update on the regular arma buildings or even the CUP ones so if you ever get the time to improve those we would be extremely thankful! 

Share this post


Link to post
Share on other sites
1 hour ago, LSValmont said:

 

Hey Dodzh! I've been using you script in all my missions and I've used your Positions Creator Tool to improve some positions in some CUP buildings that were too high up in the air.

 

But I am still waiting for an official update on the regular arma buildings or even the CUP ones so if you ever get the time to improve those we would be extremely thankful! 

 

hey man, there is no update for a3 buildings, i use positions within in the models but that wasn't designed for that is why some dont look right. if you want 100% control need to create custom positions,

check on a previous post here i released a config for all a3 buildings, you have to look at them and change to your needs

 

https://pastebin.com/w7s8LM3k

 

ive mention few thing about that file above think you can find it useful

 

let me know if you have any questions

 

 

  • Like 1

Share this post


Link to post
Share on other sites

sweet i got everything working really well, the only problem is some loot floats and some sinks

Share this post


Link to post
Share on other sites
1 hour ago, Chuc said:

loot floats

13 hours ago, LSValmont said:

were too high up in the air.

 

Hello there guys + dodzh !

 

I don't know what's the code , because i haven't check it , but probably,

you should change your code  to "WeaponHolderSimulated"

 

ex:

_Loot = createVehicle ["WeaponHolderSimulated",[_Loot_Pos select 0, _Loot_Pos select 1,_Loot_Pos select 2], [], 0, "CAN_COLLIDE"];

I hope this helps !

 

  • Like 1

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

×