BetterLoot

A complete re-implementation of the drop system

Total Downloads: 42,529 - First Release: Feb 26, 2015 - Last Update: Mar 20, 2018

4.95699/5, 93 likes
  1. How to add the new equipment to dive into the loot
    "Diving fins, Diving Mask, Diving Tank and Wetsuit" thanks
     
  2. I have these items configured so that they do not appear normally in the barrels, but they usually appear in these. [​IMG]
     
  3. navigate to oxide/data/betterloot/LootTable.json and add it to your item list

    "diving.fins": 1,
    "diving.mask": 1,
    "diving.tank": 1,
    "diving.wetsuit": 1,

    i would remove it from barrel list

    navigate to oxide/data/betterloot/LootTable.json and remove it from your barrel list


     
  4. So I was working with the BetterLoot coding, and I found that I could individually choose what crates would have what. (Separating them from the overall "crates" config) I think I have everything I need to have.

    As you can see, I have the Elite Crates matched with all of the other "Crate" options. I just don't know if I'm missing something....

    All Elite Crate additions are beneath the original "Crates" codes.

    Code:
    Regex crateEx;
    Regex eliteEx;         
    ----------------------------------------------------------------
    int totalItemsC
    int totalItemsE;
    ----------------------------------------------------------------
    int[] itemWeightsC = new int[5];
    int[]itemWeightsE = new int [5];
    ----------------------------------------------------------------
    int totalItemWeightC;
    intItemWeightE;
    ----------------------------------------------------------------
    List<ItemDefinition> originalItemsC;
    List<ItemDefinition> originalItemsE;
    ----------------------------------------------------------------
    bool refreshCrates;
    bool refreshElite;
    ----------------------------------------------------------------
    minItemsPerCrate = Convert.ToInt32(GetConfig("Crate", "minItemsPerCrate", 3));
    maxItemsPerCrate = Convert.ToInt32(GetConfig("Crate", "maxItemsPerCrate", 6));
    refreshCrates = Convert.ToBoolean(GetConfig("Crate", "refreshCrates", true));
    crateTypes = Convert.ToString(GetConfig("Crate","crateTypes","crate_normal|crate_tools"));
    enableCrates = Convert.ToBoolean(GetConfig("Crate", "enableCrates", true));
    randomAmountCrates = Convert.ToBoolean(GetConfig("Crate", "randomAmountCrates", true));minItemsPerElite = Convert.ToInt32(GetConfig("Elite", "minItemsPerElite", 3));
    maxItemsPerElite = Convert.ToInt32(GetConfig("Elite", "maxItemsPerElite", 6));
    refreshElite = Convert.ToBoolean(GetConfig("Elite", "refreshElite", true));
    eliteTypes = Convert.ToString(GetConfig("Elite", "eliteTypes", "crate_elite"));
    enableElite = Convert.ToBoolean(GetConfig("Elite", "enableElite", true));
    randomAmountElite = Convert.ToBoolean(GetConfig("Elite", "randomAmountElite", true));
    ----------------------------------------------------------------
    originalItemsC = new List<ItemDefinition>();
    originalItemsE = new List<ItemDefinition>();
    ----------------------------------------------------------------
    Puts("There are " + originalItemsC.Count+ " items in the global Crates LootTable.");
    Puts("There are " + originalItemsE.Count+ " items in the global Elite LootTable.");
    ----------------------------------------------------------------
    itemsC[i] = new List<string>();
    itemsE[i] = new List<string>();
    ----------------------------------------------------------------
    totalItemsC = 0;
    totalItemsE = 0;
    ----------------------------------------------------------------
    var notExistingItemsC = 0;
    varnotExistingItemsE = 0;
    ----------------------------------------------------------------
    foreach (var item in originalItemsC)
                    {
                        if (item == null) continue;
                        int index = RarityIndex(item.rarity);
                        object indexoverride;
                        if (rarityItemOverride.TryGetValue(item.shortname, out indexoverride))
                            index = Convert.ToInt32(indexoverride);
                        if (ItemExists(item.shortname)) {
                            if (!storedBlacklist.ItemList.Contains(item.shortname)) {
                                itemsC[index].Add(item.shortname);
                                ++totalItemsC;
                            }
                        }
                        else
                        {
                            ++notExistingItemsC;
                        }
                    }
                }}foreach (var item in originalItemsE)
    {
    if (item == null) continue;
    int index = rarityIndex(item.rarity);
    object indexoverride;
    if (rarityItemsOvverride.TryGetValue(item.shortname, out indexoverride))
    index = Convert.ToInt32(indexoverride);
    if (ItemExists(item.shortname)) {
    if (!storedBlacklist.ItemList.Contains(item.shortname)) {
    itemsE[index].Add(item.shortname)); {
    ++totalItemsE;
    }
    }
    else
    {++notExistingItemsE;
    }
    }
    }}
    ----------------------------------------------------------------
    totalItemWeightC = 0;
    totalItemWeightE = 0;
    ----------------------------------------------------------------
    totalItemWeightC += (itemWeightsC[i] = ItemWeight(baseItemRarity, i) * itemsC[i].Count);
    totalItemWeightE += (itemWeightsE[i] = ItemWeight(baseItemRarity, i) * itemsE[i].Count);
    ----------------------------------------------------------------
    if (randomAmountCrates || randomAmountBarrels)
    if (randomAmountCrate || randomAmountBarrels || randomAmountElite)
    ----------------------------------------------------------------
    case "crate":
                                    do {
                                        selectFrom = null;
                                        item = null;
                                        var r = rng.Next(totalItemWeightC);
                                        for (var i=0; i<5; ++i) {
                                            limit += itemWeightsC[i];
                                            if (r < limit) {
                                                selectFrom = itemsC[i];
                                                break;
                                            }
                                        }
                                        if (selectFrom == null) {
                                            if (--maxRetry <= 0) {
                                                PrintError("Endless loop detected: ABORTING");
                                                break;
                                            }
                                            continue;
                                        }
                                        itemName = selectFrom[rng.Next(0, selectFrom.Count)];
                                        item = ItemManager.CreateByName(itemName, 1);
                                        if (item == null) {
                                            continue;
                                        }
                                        if (item.info == null) {
                                            continue;
                                        }
                                        break;
                                    } while (true);
                                    if (item == null)
                                        return null;
                                    if (item.info.stackable > 1 && separateLootTable.ItemListCrates.TryGetValue(item.info.shortname, out limit))
                                    {
                                        if (limit > 0)
                                        {
                                            if (randomAmountCrates)
                                                item.amount = rng.Next(1, Math.Min(limit, item.info.stackable));
                                            else
                                                item.amount = Math.Min(limit, item.info.stackable);
                                        }
                                    }
                                    return item;case "Elite":
    do {
    selectFrom = null;
    item = null;
    var r = rng.Next(totalItemWeightE);
    for (var i=0; i<5; ++i) {
    limit += itemWeightsE[i];
    if (r < limit) {
    selectFrom = itemsE[i];
    break:
    }
    }
    if (selectFrom == null) {
    if (--max Retry <=0) {
    PrintError("Endless loop detected: ABORTING");
    break;
    }
    continue;
    }
    itemName = selectFrom[rng.Next(0, selectFrom.Count)];
    item = ItemManager.CreateByName(itemName,1);
    if (item ==null) {
    continue;
    }
    break;
    } while (true);
    if (item == null)
    return null;
    if (item.info.stackable > 1 && seperateLootTable.ItemListElite.TryGetValue(item.info.shortname, out limit))
    {
    if (limit > 0)
    {
    if (randomAmountElite)
    item.amount = rng.Next(1, Math.Min(limit, item.info.stackable));
    else
    item.amount = Math.Min(limit, item.info.stackable);
    }
    }
    return item;
    ----------------------------------------------------------------
    else if (crateEx.IsMatch(container.gameObject.name.ToLower()) && enableCrates) {
                    SuppressRefresh(container);
                    ClearContainer(container);
                    min = minItemsPerCrate;
                    max = maxItemsPerCrate;
                    if (seperateLootTables)
                        type = "crate";
                    else
                        type = "default";
                    refresh = refreshCrates;
                }else if (eliteEx.IsMatch(container.gameObject.name.ToLower()) && enableElite) {
                    SuppressRefresh(container);
                    ClearContainer(container);
                    min = minItemsPerCrate;
                    max = maxItemsPerCrate;
                    if (seperateLootTables)
                        type = "elite";
                    else
                        type = "default";
                    refresh = refreshElite;
                }
    ----------------------------------------------------------------
    Thanks for the help!!!
     
  5. Hi Guys

    Just wanna know if by using this Plug-in it's possible to set-up some items for crate_normal and others items crate_tools ?
    (exemple)

    Thanks for your help

    Best
    Darrell
     
  6. That's what I'm currently trying to get assistance on up above, currently it only over rides any crate selected in the config, right here.
    Code:
    "Crate": {
        "crateTypes": "crate_normal_2|crate_tools",
        "enableCrates": true,
        "maxItemsPerCrate": 6,
        "minItemsPerCrate": 4,
        "randomAmountCrates": true,
        "refreshCrates": true
     
  7. you can just have 2 loot tables, one for barrels and one for crates(set-up in config).

    if u read some threads above u can add some Code in the plugin and have for every crate your own loot table.

    or u google for AlphaLoot there u have for each crate a own loot table
     
  8. How would i change the loot that spawns in food crates, military crates, and elite crates. Also can i change the spawn times on them and where can I do that?
     
  9. Hi, Im curious on how the rarity function works in the betterloot.json file. Does a item with a 1 more or less rare than a item with the number 10?

    Thanks.

    },
    "Rarity": {
    "Override": {
    "autoturret": 4,
    "lmg.m249": 4,
    "targeting.computer": 3
    }
     
  10. look here >> BetterLoot <<
     
  11. Impossible to loot Chainsaw in the barrels.
    Is I doing the right thing?
    "ItemListBarrels": {
    "Chainsaw": 1,
     
  12. Does anyone have a file that would fit for a 5x server? decent barrels and crates with some guns etc? If so, could you share? Thanks!
     
  13. I will in about two more days once I figure out how to set subcategories for food and medical crates :p
     
  14. Awesome! You have some json file for any shop mods too?
     
    Last edited by a moderator: May 25, 2018
  15. That, I do not have. I'm still struggling with my ServerRewards shop. It's hefty to configure.
     
  16. may i have the config when your done please/
     
  17. I don't think it's going to work unfortunately -- I find that no matter how I try to set up the config, BetterLoot doesn't like reading multiple types of the crate. It lumps them all under one category same as it does barrels.
     
  18. How does one spawn blueprints in barrels?
     
  19. This literally doesn't work... I have no idea why, this is what I have in my rarity column but the items that are a 4 are more common than those with 1.
    Code:
    "Rarity": {
        "Override": {
    "scrap": 1,
    "antiradpills": 2,
    "black.rasberries": 2.
    "gears": 1,
    "largemedkit": 2,
    "metalblade": 1,
    "metalpipe": 1,
    "propanetank": 1,
    "pumpkin": 2,
    "roadsigns":  1,
    "rope": 1,
    "semibody": 1,
    "sewingkit": 1,
    "sheetmetal": 1,
    "smgbody": 1,
    "metalspring": 1,
    "syringe.medical": 2,
    "tarp": 1,
    "techparts": 1,
    "rug": 4,
    "rug.bear": 4,
    "tunalight": 4,
    "planter.large": 4,
    "planter.small": 4,
    "spikes.loor": 4,
    "shutter.wood.a": 4,
    "bucket.water": 4,
    "mask.bandana": 4,
    "shelves": 2,
    "spinner.wheel": 4,
    "fireplace.stone": 4,
    "hat.boonie": 4,
    "burlap.gloves": 4,
    "barricade.stone": 4,
    "pants.shorts": 4,
    "mailbox": 4,
    "hat.cap": 4,
    "mask.balaclava": 4,
    "barricade.wood": 4,
    "sign.wooden.large": 4,
    "fun.guitar": 4,
    "table": 4,
    "hat.beenie": 4,
    "sign.wooden.huge": 4,
    "water.barrel": 4
    }
    LMFAO I FOUND THE PROBLEM
     
    Last edited by a moderator: May 28, 2018
  20. Can anyone just modify the current loot tables of rust to be 5x, my simple mind is confused. And can you also make guns spawn from barrels to with a rarity of 2 i think thats how it works