MagpieVRaven Posted October 3, 2024 Share Posted October 3, 2024 Hi ! I'm trying to make a mod where the character switches appearance and has different stats when insane (mostly simple stuff like add a damage multiplier in the insane form, add strong stomach, and if possible at all, have the health slowly go down in the insane form) Is there a tutorial for something like this anywhere or would anyone be willing to come up with a code for me as a commission ? I'm very new to modding so my knowledge stops at putting a character in game and changing the numbers on the base stats, so anything more complex than that would be pretty much impossible for me to do without a tutorial :')) Link to comment https://forums.kleientertainment.com/forums/topic/160053-mod-how-do-i-switch-appearancestats-when-insane/ Share on other sites More sharing options...
Baguettes Posted October 3, 2024 Share Posted October 3, 2024 (edited) I don't do art, but for the coding part, honestly feels entirely possible. --Put anywhere above master and common postinits local function FormChangeFN(inst, data) --stuff here. I'll write it in VSCode later; doing it here on the forums editor doesn't help. end --Put inside character's master_postinit inst:ListenForEvent("sanitydelta", FormChangeFN) Edited October 3, 2024 by Baguettes Link to comment https://forums.kleientertainment.com/forums/topic/160053-mod-how-do-i-switch-appearancestats-when-insane/#findComment-1751600 Share on other sites More sharing options...
MagpieVRaven Posted October 3, 2024 Author Share Posted October 3, 2024 1 hour ago, Baguettes said: I don't do art, but for the coding part, honestly feels entirely possible. --Put anywhere above master and common postinits local function FormChangeFN(inst, data) --stuff here. I'll write it in VSCode later; doing it here on the forums editor doesn't help. end --Put inside character's master_postinit inst:ListenForEvent("sanitydelta", FormChangeFN) OMG thank you so much !! I only need the code, I have a mod already and can do art no problem, it's just adding specific code stuff I have no idea how to do ! I'll check the forum again later then to see the second line if you update it, thank you so much again !! Link to comment https://forums.kleientertainment.com/forums/topic/160053-mod-how-do-i-switch-appearancestats-when-insane/#findComment-1751604 Share on other sites More sharing options...
Baguettes Posted October 3, 2024 Share Posted October 3, 2024 (edited) --Put anywhere above master and common postinits local function FormChangeFN(inst, data) if inst.components.sanity:IsInsane() then --x2 damage (changeable; the number is a multiplier) inst.components.combat.externaldamagemultipliers:SetModifier(inst, 2, "insanitybuff") --Can eat raw and monster meat inst.components.eater:SetStrongStomach(true) inst.components.eater:SetCanEatRawMeat(true) --Loses 1 health every 3 seconds; you can change this (-1 is the amount, 3 is the period in seconds) inst.components.health:AddRegenSource(inst, -1, 3, "insanitybuff") elseif inst.components.sanity:IsSane() then inst.components.combat.externaldamagemultipliers:RemoveModifier(inst, "insanitybuff") inst.components.eater:SetStrongStomach(false) inst.components.eater:SetCanEatRawMeat(false) inst.components.health:RemoveRegenSource(inst, "insanitybuff") end end --Put inside character's master_postinit inst:ListenForEvent("sanitydelta", FormChangeFN) Not gonna guarantee it's going to be compatible with other mods that tamper with how you're able to eat monster / raw meat. There's probably a better way to do that. Edit: This does not change your appearance. I'm horrible at AnimState code, so uhh, you may need someone else to help on that, sorry. Edited October 3, 2024 by Baguettes Link to comment https://forums.kleientertainment.com/forums/topic/160053-mod-how-do-i-switch-appearancestats-when-insane/#findComment-1751605 Share on other sites More sharing options...
MagpieVRaven Posted October 3, 2024 Author Share Posted October 3, 2024 25 minutes ago, Baguettes said: --Put anywhere above master and common postinits local function FormChangeFN(inst, data) if inst.components.sanity:IsInsane() then --x2 damage (changeable; the number is a multiplier) inst.components.combat.externaldamagemultipliers:SetModifier(inst, 2, "insanitybuff") --Can eat raw and monster meat inst.components.eater:SetStrongStomach(true) inst.components.eater:SetCanEatRawMeat(true) --Loses 1 health every 3 seconds; you can change this (-1 is the amount, 3 is the period in seconds) inst.components.health:AddRegenSource(inst, -1, 3, "insanitybuff") elseif inst.components.sanity:IsSane() then inst.components.combat.externaldamagemultipliers:RemoveModifier(inst, "insanitybuff") inst.components.eater:SetStrongStomach(false) inst.components.eater:SetCanEatRawMeat(false) inst.components.health:RemoveRegenSource(inst, "insanitybuff") end end --Put inside character's master_postinit inst:ListenForEvent("sanitydelta", FormChangeFN) Not gonna guarantee it's going to be compatible with other mods that tamper with how you're able to eat monster / raw meat. There's probably a better way to do that. Edit: This does not change your appearance. I'm horrible at AnimState code, so uhh, you may need someone else to help on that, sorry. thank you that's already super helpful !! As for the character visual switch, I was told this one can change appearance but I don't really know where to look for that in the code, someone told me something about it being called "skin", as in shedding a skin https://steamcommunity.com/sharedfiles/filedetails/?id=3031948499 There's also this character in the main game who can turn into a beaver, moose and goose, maybe there's code there that could be copy pasted ? I'm assuming it would be about switching from one build to another, I don't need custom animations or anything, I would just want the character to change from a set of sprites to another pretty much Link to comment https://forums.kleientertainment.com/forums/topic/160053-mod-how-do-i-switch-appearancestats-when-insane/#findComment-1751608 Share on other sites More sharing options...
Baguettes Posted October 3, 2024 Share Posted October 3, 2024 11 minutes ago, MagpieVRaven said: thank you that's already super helpful !! As for the character visual switch, I was told this one can change appearance but I don't really know where to look for that in the code, someone told me something about it being called "skin", as in shedding a skin https://steamcommunity.com/sharedfiles/filedetails/?id=3031948499 There's also this character in the main game who can turn into a beaver, moose and goose, maybe there's code there that could be copy pasted ? I'm assuming it would be about switching from one build to another, I don't need custom animations or anything, I would just want the character to change from a set of sprites to another pretty much Much as I'd like to help you, I'm afraid I don't really know most of the AnimState functions and what their args are. Woodie also uses those, so I pretty much am clueless. Sorry again. Link to comment https://forums.kleientertainment.com/forums/topic/160053-mod-how-do-i-switch-appearancestats-when-insane/#findComment-1751609 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