FurryEskimo Posted March 19, 2022 Share Posted March 19, 2022 (edited) I thought this would be relatively simple, but apparently the code for setting the player's current health and sanity aren't the same, so I'm looking for a little help. inst.components.sanity:SetCurrent(100) Anyone know for sure? Edited March 19, 2022 by FurryEskimo Link to comment https://forums.kleientertainment.com/forums/topic/138396-code-to-set-current-sanity-level/ Share on other sites More sharing options...
FurryEskimo Posted March 19, 2022 Author Share Posted March 19, 2022 Figured it out! Apparently it's different from setting health, for some reason.. inst.components.sanity.current = 120 vs inst.components.health:SetCurrentHealth(120) 1 Link to comment https://forums.kleientertainment.com/forums/topic/138396-code-to-set-current-sanity-level/#findComment-1550034 Share on other sites More sharing options...
CarlZalph Posted March 19, 2022 Share Posted March 19, 2022 1 hour ago, FurryEskimo said: Figured it out! Apparently it's different from setting health, for some reason.. inst.components.sanity.current = 120 vs inst.components.health:SetCurrentHealth(120) Yeah, these functions that exist are sometimes helper wrapper functions while sometimes they're not used elsewhere. You can find these inside the component file itself as to which functions exist for it. Most user applications will find SetPercent or DoDelta to be useful rather than setting a fixed number, but there's nothing wrong with setting it directly. 1 Link to comment https://forums.kleientertainment.com/forums/topic/138396-code-to-set-current-sanity-level/#findComment-1550051 Share on other sites More sharing options...
FurryEskimo Posted March 19, 2022 Author Share Posted March 19, 2022 @CarlZalph I was poking around in the component file, but perhaps I overlooked that! SetPercent would have been useful, but I didn't see that in the sanity config. I'll take another look. Link to comment https://forums.kleientertainment.com/forums/topic/138396-code-to-set-current-sanity-level/#findComment-1550286 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