Jump to content

First Mod Character! Problem with GetClock and GetWorld


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)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...