Col_Crescendo Posted August 7, 2022 Share Posted August 7, 2022 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! Link to comment https://forums.kleientertainment.com/forums/topic/142431-need-assistance-with-a-string-of-code/ Share on other sites More sharing options...
Col_Crescendo Posted August 7, 2022 Author Share Posted August 7, 2022 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) Link to comment https://forums.kleientertainment.com/forums/topic/142431-need-assistance-with-a-string-of-code/#findComment-1592601 Share on other sites More sharing options...
Boogiepop210 Posted October 8, 2022 Share Posted October 8, 2022 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() Link to comment https://forums.kleientertainment.com/forums/topic/142431-need-assistance-with-a-string-of-code/#findComment-1601674 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