Jump to content

Recommended Posts

Hi! I'm using a translator, So what I'm trying to say may not be expressed.T-T 

-

 

I wanted to create the ability for my custom characters to increase sanity as health goes down, but I can't get the slightest hint.

I'm such a idiot... Please give me a clue? If I could make this ability, I would be so happy that I would want nothing more. T-T

I'm sorry if I made some mistake!

Edited by kokoekwjd
On 5/19/2024 at 1:31 PM, kokoekwjd said:

Hi! I'm using a translator, So what I'm trying to say may not be expressed.T-T 

-

 

I wanted to create the ability for my custom characters to increase sanity as health goes down, but I can't get the slightest hint.

I'm such a idiot... Please give me a clue? If I could make this ability, I would be so happy that I would want nothing more. T-T

I'm sorry if I made some mistake!

local function checkhealth(inst)
    local healpc = inst.components.health:GetPercent()
    if healpc ~= nil and not inst.components.health:IsDead() then
        inst.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE * (1 - healpc)
    end
end

In master_postinit
 

inst:ListenForEvent("healthdelta", checkhealth)

 

On 5/21/2024 at 3:30 PM, Haruhi Kawaii said:
local function checkhealth(inst)
    local healpc = inst.components.health:GetPercent()
    if healpc ~= nil and not inst.components.health:IsDead() then
        inst.components.sanity.dapperness = TUNING.DAPPERNESS_LARGE * (1 - healpc)
    end
end

In master_postinit
 

inst:ListenForEvent("healthdelta", checkhealth)

 

I was too late to check T.T

You are amazing and wonderful!!! It works perfectly.

You have been a huge help to me:wilson_love: Thank you SO much!!!

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
×
  • Create New...