Solved Item stacking
Discussion in 'Plugin Requests' started by Robo2929, Dec 11, 2015.
-
I made a stack plugin for my server but there are annoying limitations. First off, the 255 most items stack to is hardcoded. I didn't investigate if bypassing that hardcoded limit is possible.
The other issue is that most item classes are internal and thus not usable within a plugin. I imagine there are ways using reflection to get around this but I haven't done enough of that to know for sure.
I was able to stack owrongs and steaks because they happen to be in a public class (ConsumableItem) but arrows are in another class which I can't use in the plugin. Even the base class for items is internal so I can't use that either.
Kinda limiting!
Also, stacking owrongs and steaks had unintended side effects. Owrongs in a stack will mould 1 at a time, so you need to split the stack up to have the same conversion rate as before.. Also steaks seem to act the same, steaks go rancid one at a time so when you have a huge stack, instead of having steaks go bad after 20 mins, you only ever get 1 go bad every 20 min. -
They will stack as high as you want. It will count down to zero then go back to max stack of two hundred fifty five. You can also split the stack and get the max as well. Tried with building walls (stone, metal, and wood) When it went down it reset to max. I've only tested up to ~1200 and it was still going.
Hope that helps! -
and steaks? will go bad 1 by 1 or all the stack in same time? -
Owrongs its mostly annoying.. A stack of 255 takes forever to mould.. -
-
Was actually more of a test than a full fledged plugin but here goes:
Code:namespace Oxide.Plugins { class Stacks : HurtworldPlugin { private void OnServerInitialized() { GlobalItemManager itemmanager = Singleton<GlobalItemManager>.Instance; (itemmanager.GetItem(25) as ConsumableItem)?.StackSize(5); // fresh owrong (itemmanager.GetItem(4) as ConsumableItem)?.StackSize(5); // raw steak (itemmanager.GetItem(5) as ConsumableItem)?.StackSize(5); // cooked steak } } }
-
edit: worked thank youLast edited by a moderator: Jan 7, 2016 -
For me if the plugin already help manage the other game items would be great
rotting of oranges and easy the player can separate in slots -
How do i use that owrong plugin on my server?
-
Just save the code to a .cs...
-
Wulf Community Admin
-
That would be awesomeeeee
-
-
-
-
Wulf Community Admin
[DOUBLEPOST=1453657302][/DOUBLEPOST] -