Jump to content

Recommended Posts

Hello!

So, I'm looking to make a mod character that, when hit, instead of taking the damage instantly, they slowly take the damage over time.

For instance, If they take 120 damage, they don't instantly get hurt, but now they take 1 damage every second until their pool of negative health is gone.

I'm afraid I don't know where to start.. oO

Thanks a ton for your time!

I imagine it being something like this:

local function onhealthchange(inst, data)
            inst.components.health:StartRegen(-[damagetaken], 60)
end

So, alike to adding a negative health regeneration effect with the damage taken being divided up over the course of, say, one minute. This could happen every instance of damage, but would need to trigger multiple times without messing itself up. It would also need to stop after it's done so something like:

local function onhealthchange(inst, data)
            inst.components.health:StartRegen(-[damagetaken], 60)
            inst:DoTaskInTime(60, function()kill command here end)
        end

(this is just an idea kindler, but yeah, not currently optimal by any means)

On 8/6/2022 at 9:24 PM, Col_Crescendo said:

I imagine it being something like this:

local function onhealthchange(inst, data)
            inst.components.health:StartRegen(-[damagetaken], 60)
end

So, alike to adding a negative health regeneration effect with the damage taken being divided up over the course of, say, one minute. This could happen every instance of damage, but would need to trigger multiple times without messing itself up. It would also need to stop after it's done so something like:

local function onhealthchange(inst, data)
            inst.components.health:StartRegen(-[damagetaken], 60)
            inst:DoTaskInTime(60, function()kill command here end)
        end

(this is just an idea kindler, but yeah, not currently optimal by any means)

Prob should use dodelta instead, also an kill command would be inst.components.health:Kill()

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...