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 https://forums.kleientertainment.com/forums/topic/101067-scripting-a-little-help-on-night-vision/ Share on other sites More sharing options...
K1NGT1GER609 Posted December 29, 2018 Share Posted December 29, 2018 (edited) 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 December 29, 2018 by K1NGT1GER609 Link to comment https://forums.kleientertainment.com/forums/topic/101067-scripting-a-little-help-on-night-vision/#findComment-1137374 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