Nicodesu Posted December 25, 2018 Share Posted December 25, 2018 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? Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted December 29, 2018 Share Posted December 29, 2018 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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.