I have been trying to save kits with stacked weapons in the inventory. The kit saves but when redeemed it gives one of each weapon instead of the stacked number when it was saved. No error messages anywhere.
Other various items redeem stacked without issue.
I have played other servers where you can redeem kits with stacked weapons. Am I doing something wrong or is there a limitation within this plugin which stops me adding stacked weapons into kits?
I've seen other posts with this same issue in the Rust Kits support category, but they just remain unanswered, so I am hoping someone might shed some light on this for me.
Thanks.
Merged postWell, with a little playing around with the code I figured it out. By default it appears for weapon type items, the GiveItem, specifically the BuildItem function is hard coded to only give 1 item, regardless of whatever the kit item number is saved as in the data file.
To fix it so it gave stacked weapons all I had to do was change a couple of lines. I changed line 757 from:
? BuildWeapon(kitem.itemid, kitem.skinid, kitem.mods)
to:
? BuildWeapon(kitem.itemid, kitem.amount, kitem.skinid, kitem.mods)
Then change line 789 from:
private Item BuildWeapon(int id, ulong skin, List<int> mods)
to:
private Item BuildWeapon(int id, int amount, ulong skin, List<int> mods)
And lastly change line 791 from:
Item item = CreateByItemID(id, 1, skin);
to:
Item item = CreateByItemID(id, amount, skin);
Attachments & ammo capacity are only applied to one weapon in the stack, whether that is something that can be changed I don't know. I'm thinking it might be a limitation which we will have to live with. It would be nice if every weapon in the stack had the attatchments we want.
Although I have worked with other programming languages previously, I have only been looking at C# for a few days, so if I have done something stupid please let me know. Perhaps the author of the plugin could add some input?
Anyway, this works for me, I hope it is of some use to others.
Merged postOn further thought, I can see why it was coded that way, it enables any kit weapons to have any attachments that werer added. While stacked weapons only allow one weapon to have attachments. Perhaps this is why? Anyway, this works better for me.