GatherManager

Moved

Total Downloads: 59,075 - First Release: Oct 23, 2014 - Last Update: Aug 27, 2017

4.93893/5, 131 likes
  1. Gather Manager | Page 88 | Oxide
     
  2. Have you tried in rcon
    gather.rate dispenser "High Quality Metal Ore" 50
    This does work in rcon ok and its added to the config but I have not tested it in game you will need to do that
     
  3. It will not work as the HQ you get isn't from gathering but from another method now
     
  4. I know some changes are coming in the next wipe and I dont use this plugin but when I did this did work
     
  5. Code:
    private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
    {
        if (!entity.ToPlayer()) return;
       
        var player = entity.ToPlayer();
        var amount = item.amount;
        var gatherType = dispenser.gatherType.ToString("G");
       
        if (GatherResourceModifiers.ContainsKey(item.info.displayName.english))
            item.amount = (int)(item.amount * GatherResourceModifiers[item.info.displayName.english]);
        else if (GatherResourceModifiers.ContainsKey("*"))
            item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
        if(item.info.displayName.english.Contains("Metal"))
        {
            var rands = rand.Next(1, 10);
            int HQ = item.amount;
            HQ *= rands;
            HQ /= 100;
            if(HQ < 0)
            {
                var gatherRate = 1;
                if (GatherResourceModifiers.ContainsKey("High Quality Metal Ore"))
                    gatherRate = item.amount = (int)(item.amount * GatherResourceModifiers["High Quality Metal Ore"]);
                else if (GatherResourceModifiers.ContainsKey("*"))
                    gatherRate = item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
                HQ = 1 * gatherRate;
            }
            player.inventory.GiveItem(ItemManager.CreateByItemID(2133577942, HQ), player.inventory.containerMain);
        }
        if (!GatherDispenserModifiers.ContainsKey(gatherType)) return;    var dispenserModifier = GatherDispenserModifiers[gatherType];    dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier;    if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0)
            item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount;
    }
    
    Here a fixed code, you have to open GatherManager.cs and replace the code "private void OnDispenserGather..........." to the one above
     
  6. error CS0103: The name `rand' does not exist in the current context
    comes from this line
    var rands = rand.Next(1, 10);

    This will work
    Code:
    private void OnDispenserGather(ResourceDispenser dispenser, BaseEntity entity, Item item)
            {
                System.Random rand = new System.Random();
                if (!entity.ToPlayer()) return;
      
                var player = entity.ToPlayer();
                var amount = item.amount;
                var gatherType = dispenser.gatherType.ToString("G");
      
                if (GatherResourceModifiers.ContainsKey(item.info.displayName.english))
                    item.amount = (int)(item.amount * GatherResourceModifiers[item.info.displayName.english]);
                else if (GatherResourceModifiers.ContainsKey("*"))
                    item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
                if(item.info.displayName.english.Contains("Metal"))
            {
            var rands = rand.Next(1, 10);
            int HQ = item.amount;
            HQ *= rands;
            HQ /= 100;
            if(HQ < 0)
            {
                var gatherRate = 1;
                if (GatherResourceModifiers.ContainsKey("High Quality Metal Ore"))
                    gatherRate = item.amount = (int)(item.amount * GatherResourceModifiers["High Quality Metal Ore"]);
                else if (GatherResourceModifiers.ContainsKey("*"))
                    gatherRate = item.amount = (int)(item.amount * GatherResourceModifiers["*"]);
                HQ = 1 * gatherRate;
            }
            player.inventory.GiveItem(ItemManager.CreateByItemID(2133577942, HQ), player.inventory.containerMain);
            }
                if (!GatherDispenserModifiers.ContainsKey(gatherType)) return;            var dispenserModifier = GatherDispenserModifiers[gatherType];            dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount += amount - item.amount / dispenserModifier;            if (dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount < 0)
                    item.amount += (int)dispenser.containedItems.Single(x => x.itemid == item.info.itemid).amount;
            }
     
    Last edited by a moderator: Jul 3, 2017
  7. Yeah sorry i just miss to add is back to the function, in my plugin it's a global variable ^^
     
  8. its ok your busy easy to miss
     
  9. How can I get scrap *3. I always get 1. And nearly every barrel is scrap I can see any other things. How to solve it. Thank u
    [DOUBLEPOST=1499156759][/DOUBLEPOST]
    And everything I found in the barrel is not *3.
     
  10. You have to install a barrel drop modifier. Best out is alpha loot, magic/better loot are good too.
     
  11. when i use magic and better loot, the scrap always 1 in the barrel. And I cant find the alpha loot. How to solve it?
     
  12. i have just change to this and it is giving me 1,626 ore when i have it set too x50. i also noticed that it was giving me HQM on every hit of the node too but random amounts and it never showed me receiving the HQM in bottom left of my screen
     
    Last edited by a moderator: Jul 4, 2017
  13. It's normal base
    HQ = Base metal drop * 50 (your rate) *(1 to 10) %
     
  14. which means what? i want to be able to get 50 hqm from the metal ore so how do i go about achieving that?
     
  15. From the code replace int HQ = item.amount;
    To
    int HQ = 1;
     
  16. done that i got 2 hqm metal from the last hit
     
  17. Well replace
    int HQ = item.amount;
    HQ *= rands;
    HQ /= 100;
    To
    Int HQ = 0;

    Replace the 3 lines with the one above
     
  18. so it will end up like this;
    int HQ = 0;
    HQ *= rands;
    HQ /= 100;
    if(HQ < 0)
    ??? sorry, i dont know much about coding and how it works so
     
  19. int HQ = 0;
    if(HQ < 0)
     
  20. so i need to remove these 2 lines so i am just left with them 2 yes?
    HQ *= rands;
    HQ /= 100;