Hey, i'm new to coding with C# but have quite a bit of r-lua experience. ( About 2 years) And I wanted to get into modding in rust, I'am currently attempting to make a furnace generate pookies ( For a event ). But when i attempt to create the pookies that work's fine. After i attempt to put them in a furnace it tells me the OnConsumeFuel hook failed to call. Any help would be greatly appreciated
Heres my code so far. ( Please don't give me a entire answer to how to make it generate them. Just hint me somewhere please )
And here's the entire error messageCode:using System.Collections.Generic; using System; using Newtonsoft.Json; using Oxide.Core.Plugins; using Oxide.Core.Configuration; using System.Linq;namespace Oxide.Plugins { [Info("FurnaceModifier", "CasperYep", "0.0.1")] [Description("Generates pookies from furnaces,")] public partial class FurnaceModifier : RustPlugin { void OnConsumeFuel(BaseOven oven, Item fuel, ItemModBurnable burnable) { var pookie = ItemManager.CreateByName("Pookie Bear", 1); if (!pookie.MoveToContainer(oven.inventory)); { } } } }
Sorry if my post violates any rules.Code:Failed to call hook 'OnConsumeFuel' on plugin 'FurnaceModifier v0.0.1' (NullReferenceException: Object reference not set to an instance of an object) at Oxide.Plugins.FurnaceModifier.OnConsumeFuel (BaseOven oven, Item fuel, ItemModBurnable burnable) [0x0000e] in <7a251d0bf75c4f8784bc5f1578af8199>:0 at Oxide.Plugins.FurnaceModifier.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00032] in <7a251d0bf75c4f8784bc5f1578af8199>:0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <9affce1cd15c4ec183941adef8db1722>:0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000d8] in <4452f821def6406d834e4149849fe7ea>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <4452f821def6406d834e4149849fe7ea>:0
Failed to call hook 'OnConsumeFuel'
Discussion in 'Rust Development' started by CasperYep, Aug 19, 2018.
-
Your mistake is here
Code:var pookie = ItemManager.CreateByName("Pookie Bear", 1);
-
Currently the pookies go like this if the X represents a slot.
X X X X
I want it to be
X = 1 + 1 +1 +1 Etc
This is probably really simple to fix. I sadly can't find any documentation on it nor any documentation of MoveToContainer. Thanks jet again. <3 -
Wulf Community Admin
-
Code:Item PookieItem = oven.inventory.FindItemByItemID(definition.itemid);
-
Can always do something like this,
Code:void OnItemAddedToContainer(ItemContainer container, Item item) { // IF Container has pookies, Count them // Delete existing pookies // Create new stack of pookies, use ItemManager.CreateBy with pookies equal to the current count of pookies + the amount you want to add }