Jump to content

Need help with character transform mod!


Recommended Posts

Hi there,
I'm new to the modding, and not really good at coding. After a week of digging through the tutorial on the forum, I managed to make my 1st personal character mod, and I gave him the ability to transform base on sanity lvl.
Finally got him playable just yesterday. But then I run into the new problem when testing the mod with my friend.
When the character became a ghost when still in the "wereform",if then resurrected (*I'm using "fire resurrection mod" on the workshop in game), some how he still in the state of the "wereform", Just the skin was changed back to normal form.
I can't figgure out how to fix this issue yet, so I hope some veteran modder could give me some advices on how to fix it.
Thanks!

*Here is the workshop link to the mod: https://steamcommunity.com/sharedfiles/filedetails/?id=2645347354
*I'll upload the prefab lua in here:

thobeo.lua

Link to comment
Share on other sites

Im not sure if about that but you can try to add OnSanityDrop function under onbecamehuman function like that

local function onbecamehuman(inst)
	-- Set speed when not a ghost (optional)
	inst.components.locomotor:SetExternalSpeedMultiplier(inst, "thobeo_speed_mod", 1)
	OnSanityDrop(inst, data)
end

im not sure if its the proper way to do it but i think this will trigger the code when u become human

Link to comment
Share on other sites

7 hours ago, AkaiNight said:

Im not sure if about that but you can try to add OnSanityDrop function under onbecamehuman function like that


local function onbecamehuman(inst)
	-- Set speed when not a ghost (optional)
	inst.components.locomotor:SetExternalSpeedMultiplier(inst, "thobeo_speed_mod", 1)
	OnSanityDrop(inst, data)
end

im not sure if its the proper way to do it but i think this will trigger the code when u become human

Thanks for the reply!
I've tried your suggestion, but the game crashed.

Screenshot_42.png

Link to comment
Share on other sites

3 hours ago, AkaiNight said:

Try to remove "data" from

 

Thank so much for your help, but I figure out what wrong in my prefab file.
It's because I set the transformation happen <50  and revesre back to normal form on > 100 sanity ^^  but when I revived, I only got 75 sanity <100.
LOL ... silly me.
I just change the gap to 50-70 then it's work fine.
Again, thanks for taking time to reply, and try to help out!
Have a nice day!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...