xovoxx Posted September 9, 2020 Share Posted September 9, 2020 Hello! I'm working on a mod where you have to take care of a moleworm. I want to make various things happen when that moleworm is fed. I succeeded in overwriting the moleworm's prefab script. I added the line inst.components.eater:SetOnEatFn(OnEat) local function OnEat(inst) inst.components.inspectable:SetDescription("updated mole inpsection 1") end But unfortunately, nothing happens when the mole eats : inspecting it afterwards still displays the normal description. It really seems as if my function "OnEat" was not called. I suspect I might be using the wrong parameters, but I don't know how to fix it. Any help is welcome! 1 Link to comment https://forums.kleientertainment.com/forums/topic/121596-need-help-making-something-happen-when-a-player-interacts-in-a-specific-way/ Share on other sites More sharing options...
krylincy Posted September 11, 2020 Share Posted September 11, 2020 where did you add this line? in the prefab post init? can you share your whole code? i think in lua it is not allowed to use a function before define it (but not sure). Link to comment https://forums.kleientertainment.com/forums/topic/121596-need-help-making-something-happen-when-a-player-interacts-in-a-specific-way/#findComment-1370690 Share on other sites More sharing options...
xovoxx Posted September 30, 2020 Author Share Posted September 30, 2020 I actually figured it out! The problem was elsewhere. Thanks for your help! Link to comment https://forums.kleientertainment.com/forums/topic/121596-need-help-making-something-happen-when-a-player-interacts-in-a-specific-way/#findComment-1376038 Share on other sites More sharing options...
Serpens Posted September 30, 2020 Share Posted September 30, 2020 6 hours ago, xovoxx said: I actually figured it out! The problem was elsewhere. Thanks for your help! 1) write what the problem was so other with the same problem can read it. 2) Don't overwerite the whole mole prefab file, unless you want your mod be broken everytime the devs change sth within that file. Use AddPrefabPostInit("mole"function(inst) yourcode end) within modmain instead. Link to comment https://forums.kleientertainment.com/forums/topic/121596-need-help-making-something-happen-when-a-player-interacts-in-a-specific-way/#findComment-1376091 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