Jump to content

Make Character deal more damage when insane?


Recommended Posts

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

@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

 

  • Like 1
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...