bigmarra 1 Posted February 24, 2022 Hi there, I am using Dodzh Lootsystem on my server and I'm enjoying the easy implementation of new classes and the ability to spawn loot from a vast range of mods. BUT, as I run a survival server, I am trying to make things scarce but also fairly balanced. I have quite a lot of 'trash' items in my loot table, to dilute the pool, but I am having a hard time understanding the weights. From what I understand the loot system uses BIS_fnc_selectRandomWeighted function to go through the arrays, but I am having a hell of a time figuring out what numbers I can go up to. Below I have added an example of the config with the loot tables from dodzh.https://github.com/dodzh/lootsystem/blob/1eb288be94d45df76d8ae80e88cf169031ffc2b5/lootsystem/config.cpp#L31 class CfgLootTables { class Military { ratio[] = { "weapons",3, "backpacks",1, "uniforms",1, "items",2 }; weapons[] = { "arifle_SDAR_F",1, "arifle_MXM_F",1, "srifle_LRR_F",1, "srifle_DMR_03_F",1, "srifle_DMR_02_F",1, "MMG_02_black_F",1, "launch_NLAW_F",0.5, "arifle_MX_F",3, "arifle_MX_GL_F",2, "arifle_MX_SW_F",2, "arifle_MXC_F",2, "SMG_01_F",2, "hgun_P07_F",4, "hgun_Pistol_heavy_01_F",2 }; backpacks[] = { "B_AssaultPack_dgtl",2, "B_AssaultPack_ocamo",2, "B_AssaultPack_khk",2, "B_AssaultPack_mcamo",2, "B_AssaultPack_sgg",2, "B_Carryall_ocamo",1, "B_Carryall_mcamo",1, "B_Carryall_oli",1, "B_FieldPack_ocamo",3 }; items[] = { "FirstAidKit",10, "Medikit",1, "ToolKit",1, "MineDetector",1, "ItemGPS",5, "acc_flashlight",5, "acc_pointer_IR",5, "muzzle_snds_acp",5, "muzzle_snds_L",5, "muzzle_snds_H",5, "muzzle_snds_B",5, "muzzle_snds_338_black",2, "muzzle_snds_338_green",2, "muzzle_snds_338_sand",2, "bipod_01_F_blk",2, "bipod_01_F_mtp",2, "bipod_01_F_snd",2, "muzzle_snds_H_khk_F",5, "bipod_01_F_khk",2, "NVGoggles",2, "NVGoggles_tna_F",2, "NVGogglesB_blk_F",2, "NVGogglesB_grn_F",2, "NVGogglesB_gry_F",2, "optic_Aco",1, "optic_Aco_smg",1, "optic_Hamr",1, "optic_SOS",1, "optic_Holosight",1, "optic_NVS",1, "optic_tws",1, "optic_tws_mg",1, "optic_MRD",1, "optic_DMS",1, "optic_LRPS",1, "optic_AMS",1, "optic_AMS_khk",1, "optic_AMS_snd",1 }; uniforms[] = { "U_B_CombatUniform_mcam",3, "U_B_CombatUniform_mcam_tshirt",4, "U_B_CombatUniform_mcam_vest",4, "U_B_CTRG_1","U_B_CTRG_3",4, "U_B_CTRG_2","U_B_HeliPilotCoveralls",4, "U_B_PilotCoveralls",4, "U_B_GhillieSuit",4, "U_B_FullGhillie_ard",4, "U_B_FullGhillie_lsh",4, "U_B_FullGhillie_sard",4, "U_B_Wetsuit",4, "U_B_T_Soldier_F",4, "U_B_T_Soldier_AR_F",4, "U_B_T_Soldier_SL_F",4, "U_B_T_Sniper_F",4, "U_B_T_FullGhillie_tna_F",4, "U_B_CTRG_Soldier_F",4, "U_B_CTRG_Soldier_2_F",4, "U_B_CTRG_Soldier_3_F",4, "U_C_Poloshirt_salmon",1 }; }; As you can tell he uses a vast amount of different numbers, 2, 3, 10, 0.5 and I have no idea how to figure out how to convert that into percentages in my head. What number does it go up to? From what I understood BIS_fnc_selectRandomWeighted goes to 1, right? So surely anything above 1 - like 2, 3, 4, 5 or 10 shouldn't make a difference or am I wrong? I really need help because I feel like I can't make the loot pool balanced without understanding how much of an impact the weight will have. I also suck at maths to the point where I am pretty embarrassed about it. Share this post Link to post Share on other sites
alpha993 122 Posted February 24, 2022 selectRandomWeighted does not require all weights to add up to 1, so there's no need to try and visualize the weights as percentages. I would just look at them relative to each other. So, an item with a value of 4 is more likely to appear than an item with any lower number, for example. Here's Killzone Kid's example from the wiki to illustrate the point: Quote 100,000 runs of the following code: _values = [0,1,2,3,4,5,6,7,8,9]; _weights = [0.109,0.65,0.01,1.01,1.24,0,1.59,0.09,1.15,0.55]; // Weights add up to 6.399 _result = _values selectRandomWeighted _weights; Gave this result: value(weight) --- frequency 5(0) 0 2(0.01) 144 7(0.09) 1409 0(0.109) 1633 9(0.55) 8673 1(0.65) 10127 3(1.01) 15668 8(1.15) 18059 4(1.24) 19518 6(1.59) 24769 2 Share this post Link to post Share on other sites
bigmarra 1 Posted February 24, 2022 37 minutes ago, alpha993 said: selectRandomWeighted does not require all weights to add up to 1, so there's no need to try and visualize the weights as percentages. I would just look at them relative to each other. So, an item with a value of 4 is more likely to appear than an item with any lower number, for example. Here's Killzone Kid's example from the wiki to illustrate the point: Thank you mate 😀 1 Share this post Link to post Share on other sites