Gather Manager | Page 88 | Oxide
GatherManager
Moved
Total Downloads: 59,075 - First Release: Oct 23, 2014 - Last Update: Aug 27, 2017
- 4.93893/5, 131 likes
-
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 -
-
-
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; }
-
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 -
-
-
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] -
-
-
Last edited by a moderator: Jul 4, 2017
-
HQ = Base metal drop * 50 (your rate) *(1 to 10) % -
-
To
int HQ = 1; -
-
int HQ = item.amount;
HQ *= rands;
HQ /= 100;
To
Int HQ = 0;
Replace the 3 lines with the one above -
int HQ = 0;
HQ *= rands;
HQ /= 100;
if(HQ < 0)
??? sorry, i dont know much about coding and how it works so -
if(HQ < 0) -
HQ *= rands;
HQ /= 100;