Jump to content

Recommended Posts

Quote

 

inst:ListenForEvent("daytime", function()
            if GetClock():IsDay() and not GetWorld():IsCave() then
                GetClock():SetNightVision(false)
                GetWorld().components.colourcubemanager:SetOverrideColourCube(nil, .5)
            end
        end, GetWorld())
            
    inst:ListenForEvent("nighttime", function()
            if GetClock():IsNight() and not GetWorld():IsCave() then
                GetClock():SetNightVision(true)
                GetWorld().components.colourcubemanager:SetOverrideColourCube("images/colour_cubes/mole_vision_on_cc.tex", 2)
            end
        end, GetWorld())

    inst:ListenForEvent("enterinterior", function()
            if GetClock():IsDay() or GetWorld():IsCave() then
                GetClock():SetNightVision(true)
                GetWorld().components.colourcubemanager:SetOverrideColourCube("images/colour_cubes/mole_vision_on_cc.tex", 2)
            else
                GetClock():SetNightVision(true)
                GetWorld().components.colourcubemanager:SetOverrideColourCube("images/colour_cubes/mole_vision_on_cc.tex", 2)
            end
        end, GetWorld())
        
    inst:ListenForEvent("exitinterior", function()
            if GetClock():IsNight() and not GetWorld():IsCave() then
                GetClock():SetNightVision(true)
                GetWorld().components.colourcubemanager:SetOverrideColourCube("images/colour_cubes/mole_vision_on_cc.tex", 2)
            else
                GetClock():SetNightVision(false)
                GetWorld().components.colourcubemanager:SetOverrideColourCube(nil, .5)
            end
        end, GetWorld())

 

Mostly, adapted from "Moogles"
This script almost done, except I still can't manage to fix the morning night vision trigger while in the cave or interior.
Like, when the time change from night to morning, the night vision will disappear, but will come back again once go out and get back in again.

Any ideas?

The section of code should explain it all

 if GetClock():IsDay() or GetWorld():IsCave() then
                GetClock():SetNightVision(true)
                GetWorld().components.colourcubemanager:SetOverrideColourCube("images/colour_cubes/mole_vision_on_cc.tex", 2)
            else
                GetClock():SetNightVision(true)
                GetWorld().components.colourcubemanager:SetOverrideColourCube("images/colour_cubes/mole_vision_on_cc.tex", 2)
            end

That line executes nightvision if its day time and if your in the cave, the else executes true if its not in a cave or its another time besides daytime. So Thats why your night vision activates if you go into a cave and executes because both booleans are set to true.

Edited by K1NGT1GER609

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