rons0n Posted July 18, 2015 Share Posted July 18, 2015 (edited) I have a small problem that i need tweaking, right now I used Koma's Friendship mod and edited it so that it also works on my custom chester. Basically what it does is make it impossible for anyone to rummage the chester without the eyebone in the characters inventory. But someone earlier today told me that they can still access the custom chester as long as you hover an item over the chester to put an item inside it. Turns out to be true, is there a fix for this? The code:local old_RUMMAGE = GLOBAL.ACTIONS.RUMMAGE.fn GLOBAL.ACTIONS.RUMMAGE.fn = function(act) if act.target and act.target.prefab == "personal_dogoo" then print("GLOBAL.ACTIONS.RUMMAGE--"..tostring(act.doer.components.inventory)) result = act.doer.components.inventory:FindItem(function(item) if item.prefab == "personal_dogoo_eyebone" then print("GLOBAL.ACTIONS.RUMMAGE--"..tostring(item).."--ok--") return true end end) if result then return old_RUMMAGE(act) else print("GLOBAL.ACTIONS.RUMMAGE--"..tostring(item).."--fail--") act.doer:DoTaskInTime(1, function () act.doer.components.talker:Say("No Can Do!") end) return false end else return old_RUMMAGE(act) endend This is for my character mod Plutia Edited July 18, 2015 by rons0n Link to comment https://forums.kleientertainment.com/forums/topic/56269-people-can-still-use-custom-chester/ Share on other sites More sharing options...
Ryuushu Posted July 18, 2015 Share Posted July 18, 2015 (edited) @rons0nThat's because opening a chest isn't the same as storing an item in it. So what you want to do is to modify STORE instead of RUMMAGE.Try with this:local function HasDogooBone(doer) if doer.components.inventory and doer.components.inventory:FindItem(function(item) if item.prefab == "personal_dogoo_eyebone" then return true end end) ~= nil then return true else return false endendlocal oldACTIONSTORE = GLOBAL.ACTIONS.STORE.fnGLOBAL.ACTIONS.STORE.fn = function(act) if act.target and act.target.prefab == "personal_dogoo" and act.target.components.container ~= nil and act.invobject.components.inventoryitem ~= nil and act.doer.components.inventory ~= nil then print(act.doer.name,"is trying to do something with a Dogoo") if HasDogooBone(act.doer) then print(act.doer.name,"has Dogoo Bone, proceed") return oldACTIONSTORE(act) else print(act.doer.name,"doesn't has the Dogoo Bone, exit") if act.doer.components.talker then act.doer.components.talker:Say("No Can Do!") end return true end else return oldACTIONSTORE(act) endend Edited July 18, 2015 by Ryuushu Link to comment https://forums.kleientertainment.com/forums/topic/56269-people-can-still-use-custom-chester/#findComment-655426 Share on other sites More sharing options...
rons0n Posted July 18, 2015 Author Share Posted July 18, 2015 @Ryuushu, Thanks Ryuushu! No need to worry about people raiding the custom chester anymore. You've been a great help with this Custom Chester, much appreciated. Link to comment https://forums.kleientertainment.com/forums/topic/56269-people-can-still-use-custom-chester/#findComment-655468 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