Jump to content

Recommended Posts

Guys i'm trying to do a perk to my character that he will regen HP during Night (Testing as Day) but call GetClock() crashes my game, anyone can help me with that??

inst:AddTag("notactive")
    local function CheckTime(inst)
        if GetClock() and GetWorld() then
            if not GetClock():IsDay() and inst:HasTag("active") and not GetWorld():IsCave() then
                inst.components.health:StopRegen()
                inst:AddTag("notactive")
                inst:RemoveTag("active")
            end
            if GetClock():IsDay() and inst:HasTag("notactive") and not GetWorld():IsCave() then
                components.health:StartRegen(1,5,true)
                inst:AddTag("active")
                inst:RemoveTag("notactive")
            end
        end
    end
    inst:DoPeriodicTask( 0.0, function(inst) 
        CheckTime(inst)
    end)

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