PonyOfApocalips Posted November 5, 2024 Share Posted November 5, 2024 I tried to create mod that allow u to change character (same way as useing moonrock idol) when you eat specific food. Some ideas how to do this? I am trying to recreate this mod but with diffrent food https://steamcommunity.com/sharedfiles/filedetails/?id=2744621519 1 Link to comment https://forums.kleientertainment.com/forums/topic/160546-change-character-when-eating-something/ Share on other sites More sharing options...
gaymime Posted November 5, 2024 Share Posted November 5, 2024 i would like to know this too! Link to comment https://forums.kleientertainment.com/forums/topic/160546-change-character-when-eating-something/#findComment-1756024 Share on other sites More sharing options...
LeafyFly Posted November 8, 2024 Share Posted November 8, 2024 I know how to do that but it is a little complex. May you depend my mod directly. https://steamcommunity.com/sharedfiles/filedetails/?id=3362148629 Link to comment https://forums.kleientertainment.com/forums/topic/160546-change-character-when-eating-something/#findComment-1756318 Share on other sites More sharing options...
PonyOfApocalips Posted November 10, 2024 Author Share Posted November 10, 2024 On 11/8/2024 at 6:31 PM, LeafyFly said: I know how to do that but it is a little complex. May you depend my mod directly. https://steamcommunity.com/sharedfiles/filedetails/?id=3362148629 Sorry but i cant find folder with your mod files :c For now i have something like this but it didnt work local function OnEat(inst, food) if food.prefab == "mandrake" then TheWorld.components.world_reroll_data:Reroll(player) end end Link to comment https://forums.kleientertainment.com/forums/topic/160546-change-character-when-eating-something/#findComment-1756609 Share on other sites More sharing options...
yanecc Posted November 10, 2024 Share Posted November 10, 2024 3 hours ago, PonyOfApocalips said: Sorry but i cant find folder with your mod files :c For now i have something like this but it didnt work local function OnEat(inst, food) if food.prefab == "mandrake" then TheWorld.components.world_reroll_data:Reroll(player) end end Try replacing `player` with `inst`. Link to comment https://forums.kleientertainment.com/forums/topic/160546-change-character-when-eating-something/#findComment-1756632 Share on other sites More sharing options...
LeafyFly Posted November 10, 2024 Share Posted November 10, 2024 6 hours ago, PonyOfApocalips said: For now i have something like this but it didnt work local function OnEat(inst, food) if food.prefab == "mandrake" then TheWorld.components.world_reroll_data:Reroll(player) end end Put this in your modmain.lua. local mandrake_oneaten = function(inst, data) local eater = data and data.eater if eater and eater.userid and eater:HasTag("player") then GLOBAL.TheWorld.components.world_reroll_data:Reroll(eater) end end AddPrefabPostInit("mandrake", function(inst) if GLOBAL.TheWorld.ismastersim then inst:ListenForEvent("oneaten", mandrake_oneaten) end end) Link to comment https://forums.kleientertainment.com/forums/topic/160546-change-character-when-eating-something/#findComment-1756665 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