DerpCatThing Posted July 25, 2023 Share Posted July 25, 2023 I would like to make it so my mod character has night vision when it becomes night. Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/ Share on other sites More sharing options...
Terry_Rosario Posted July 26, 2023 Share Posted July 26, 2023 (edited) I have a character that I couldn't really get to have night vision, so I decided to give him a light that covers the entire screen. I feel that this way is also better because the night vision is quite annoying to the eyes. local function SeeDark(inst) if TheWorld.state.phase == "day" then inst.Light:Enable(false) elseif TheWorld.state.phase == "night" then inst.Light:Enable(true) inst.Light:SetRadius(19) inst.Light:SetFalloff(0.75) inst.Light:SetIntensity(.7) inst.Light:SetColour(70/255,230/255,12/170) end end local refreshTime = 1/5 inst:DoPeriodicTask(refreshTime, function() SeeDark(inst, refreshTime) end) I suppose you can try the same thing to put night vision on it, although I couldn't do it, but I work in DST I'll see if one of these days I decide to put on night vision but I feel satisfied with the light. Edited July 26, 2023 by Terry_Rosario I forgot to put the daylight :p Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/#findComment-1654472 Share on other sites More sharing options...
DerpCatThing Posted July 27, 2023 Author Share Posted July 27, 2023 On 7/26/2023 at 6:17 AM, Terry_Rosario said: I have a character that I couldn't really get to have night vision, so I decided to give him a light that covers the entire screen. I feel that this way is also better because the night vision is quite annoying to the eyes. local function SeeDark(inst) if TheWorld.state.phase == "day" then inst.Light:Enable(false) elseif TheWorld.state.phase == "night" then inst.Light:Enable(true) inst.Light:SetRadius(19) inst.Light:SetFalloff(0.75) inst.Light:SetIntensity(.7) inst.Light:SetColour(70/255,230/255,12/170) end end local refreshTime = 1/5 inst:DoPeriodicTask(refreshTime, function() SeeDark(inst, refreshTime) end) I suppose you can try the same thing to put night vision on it, although I couldn't do it, but I work in DST I'll see if one of these days I decide to put on night vision but I feel satisfied with the light. Ah i assume this would only be seen via the character on multiplayer right? Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/#findComment-1654768 Share on other sites More sharing options...
Terry_Rosario Posted July 29, 2023 Share Posted July 29, 2023 Well since this is the DS forum I assumed it was perfect because it's single player, but in multiplayer the others can see by being next to you because you're emitting a light. Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/#findComment-1655764 Share on other sites More sharing options...
Glommer2 Posted August 2, 2023 Share Posted August 2, 2023 --try this local function SetNightVision(inst) --This should be obvious if (TheWorld.state.isnight or TheWorld:HasTag("cave"))and getstate(inst)==0 then if not inst:HasTag("nightvision") then inst:AddTag("nightvision") end inst.components.playervision:ForceNightVision(true) inst.components.playervision:SetCustomCCTable("images/colour_cubes/purple_moon_cc.tex") else if inst:HasTag("nightvision") then inst:RemoveTag("nightvision") end inst.components.playervision:ForceNightVision(false) inst.components.playervision:SetCustomCCTable(nil) end end local common_postinit = function(inst) inst:WatchWorldState( "isday", function() SetNightVision(inst) end) inst:WatchWorldState( "isdusk", function() SetNightVision(inst) end) inst:WatchWorldState( "isnight", function() SetNightVision(inst) end) inst:WatchWorldState( "iscaveday", function() SetNightVision(inst) end) inst:WatchWorldState( "iscavedusk", function() SetNightVision(inst) end) inst:WatchWorldState( "iscavenight", function() SetNightVision(inst) end) SetNightVision(inst) end Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/#findComment-1656736 Share on other sites More sharing options...
Glommer2 Posted August 2, 2023 Share Posted August 2, 2023 --try this local function SetNightVision(inst) if (TheWorld.state.isnight or TheWorld:HasTag("cave")) then--getstate is useless here, my bad if not inst:HasTag("nightvision") then inst:AddTag("nightvision") end inst.components.playervision:ForceNightVision(true) inst.components.playervision:SetCustomCCTable("images/colour_cubes/purple_moon_cc.tex") else if inst:HasTag("nightvision") then inst:RemoveTag("nightvision") end inst.components.playervision:ForceNightVision(false) inst.components.playervision:SetCustomCCTable(nil) end end local common_postinit = function(inst) inst:WatchWorldState( "isday", function() SetNightVision(inst) end) inst:WatchWorldState( "isdusk", function() SetNightVision(inst) end) inst:WatchWorldState( "isnight", function() SetNightVision(inst) end) inst:WatchWorldState( "iscaveday", function() SetNightVision(inst) end) inst:WatchWorldState( "iscavedusk", function() SetNightVision(inst) end) inst:WatchWorldState( "iscavenight", function() SetNightVision(inst) end) SetNightVision(inst) end Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/#findComment-1656739 Share on other sites More sharing options...
DerpCatThing Posted September 6, 2023 Author Share Posted September 6, 2023 On 8/2/2023 at 5:15 PM, Glommer2 said: --try this local function SetNightVision(inst) if (TheWorld.state.isnight or TheWorld:HasTag("cave")) then--getstate is useless here, my bad if not inst:HasTag("nightvision") then inst:AddTag("nightvision") end inst.components.playervision:ForceNightVision(true) inst.components.playervision:SetCustomCCTable("images/colour_cubes/purple_moon_cc.tex") else if inst:HasTag("nightvision") then inst:RemoveTag("nightvision") end inst.components.playervision:ForceNightVision(false) inst.components.playervision:SetCustomCCTable(nil) end end local common_postinit = function(inst) inst:WatchWorldState( "isday", function() SetNightVision(inst) end) inst:WatchWorldState( "isdusk", function() SetNightVision(inst) end) inst:WatchWorldState( "isnight", function() SetNightVision(inst) end) inst:WatchWorldState( "iscaveday", function() SetNightVision(inst) end) inst:WatchWorldState( "iscavedusk", function() SetNightVision(inst) end) inst:WatchWorldState( "iscavenight", function() SetNightVision(inst) end) SetNightVision(inst) end Ah this works perfectly, tho i definatly will be changing the night vision to be either full moon or moggle vision Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/#findComment-1663717 Share on other sites More sharing options...
DerpCatThing Posted September 29, 2023 Author Share Posted September 29, 2023 How does the colour cube work. Link to comment https://forums.kleientertainment.com/forums/topic/149840-nightvision/#findComment-1668273 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