Wnyant Posted April 1, 2021 Share Posted April 1, 2021 Hi, so i wanted to make my character deal more damage when insane. Somehing like Wolfgang weaker when more hungry, but more damage and with sanity. Any idea how i could do that? Link to comment Share on other sites More sharing options...
FurryEskimo Posted April 1, 2021 Share Posted April 1, 2021 Sure. Look in the combat component, I bet there’s a damage multiplier you can use. Use the Sanity component to get the player’s percent sanity, and put that in a function in their prefab file. Tell that function to be called either every second, or when their sanity value changes. I don’t have the code in front of me now, but I could probably write this code for you if you need more instruction. Link to comment Share on other sites More sharing options...
FurryEskimo Posted April 2, 2021 Share Posted April 2, 2021 @Wnyant local common_postinit = function(inst) --Insert the following code into the character's common_postinit inst.task = inst:DoPeriodicTask(0.5, sanity_damage) --Also add this to the character's prefab, but Not in the common_postinit local function sanity_damage(inst) --This equation will work, but edit it however you like! :) inst.components.combat.damagemultiplier = 1.2 - 0.5 * inst.components.sanity:GetPercentWithPenalty() end 1 Link to comment Share on other sites More sharing options...
Wnyant Posted April 2, 2021 Author Share Posted April 2, 2021 @FurryEskimo Thank you very much for help. 1 Link to comment 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