Faerl Posted January 13, 2020 Share Posted January 13, 2020 (edited) I created a character mod. Started it years ago with the kids and finally got back to finishing it up. https://steamcommunity.com/sharedfiles/filedetails/?id=1967645933&searchtext=nyx Everything seems to work fine except... for some reason when the unique item the character has is dropped to the ground it's causing others to get an out of memory error. I'm not doing any special logic as near as I can tell when this occurs. I do have logic calculating my distance to beefalo as well as logic that should cause others to not be able to pick up the item but I've disabled both to test and that doesn't seem to be causing it. Any assistance would be greatly appreciated. Updated mod file. Made a few adjustments but doesn't seem to have helped. The other user is getting a message about inventory item being nil. But i it has logic for that which as near as I can tell is identical to another working mod. mod.zip Edited January 13, 2020 by Faerl Updated data Link to comment https://forums.kleientertainment.com/forums/topic/114946-could-use-some-help-please/ Share on other sites More sharing options...
Ultroman Posted January 13, 2020 Share Posted January 13, 2020 I don't see what would be wrong with that code. But maybe you can try another way of doing the "item can only be picked up by its owner"-thing. Take a look at the "Thor's Hammer" part of this post. Note that the example makes it so the item can only be picked up by the FIRST player using that character to pick it up. Loading the game also re-adds and reequips all your items, so it's fine if your character simply starts with the item. But you can also make it craftable in a way that only your character can craft it (also in that post). It would help a lot if you uploaded the error logs from the client that crashed. Link to comment https://forums.kleientertainment.com/forums/topic/114946-could-use-some-help-please/#findComment-1298616 Share on other sites More sharing options...
Faerl Posted January 14, 2020 Author Share Posted January 14, 2020 (edited) So, that sent me in the right direction on tracking it down. You were right, it was that code. I thought I had disabled it last time in tracking it down but apparently not. Ultimately what I did was update the equip logic and the inventory logic and remove that separate block entirely. Seems to work and better yet doesn't crash! Also did some cleanup, the detection of beefalo nearby was a bit verbose and the crook was supposed to be indestructable (which is why I didn't have it as an buildable item). All working good now. Only last thing is at some point I'll make it so that I can see it on the minimap. Thank you Ultroman! local function OnEquip(inst, owner) if owner.prefab == "nyx" then --Set your custom tag for configure who can use the item. owner.AnimState:OverrideSymbol("swap_object", "swap_nyxcrook", "wand") owner.AnimState:Show("ARM_carry") owner.AnimState:Hide("ARM_normal") owner:AddTag("beefalo") owner:AddTag("Crook") else inst:DoTaskInTime(0, function() if owner and owner.components and owner.components.inventory then owner.components.inventory:GiveItem(inst) owner.components.inventory:DropItem(inst) if owner.components.talker then owner.components.talker:Say("It seems to slip right out of my hands!") end end end) end end Then below is in the fn() inst.components.inventoryitem.OnPickup = function(self, owner) if owner.prefab ~= "nyx" then inst:DoTaskInTime(0, function() if owner and owner.components and owner.components.inventory then owner.components.inventory:DropItem(inst) if owner.components.talker then owner.components.talker:Say("It seems to slip right out of my hands!") end end end) end end Edited January 14, 2020 by Faerl 1 Link to comment https://forums.kleientertainment.com/forums/topic/114946-could-use-some-help-please/#findComment-1298711 Share on other sites More sharing options...
Ultroman Posted January 14, 2020 Share Posted January 14, 2020 You are very welcome Godspeed! Link to comment https://forums.kleientertainment.com/forums/topic/114946-could-use-some-help-please/#findComment-1298831 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now