Jump to content

Recommended Posts

Hi, I've been making some changes to a character and I decided to fidget with Night Vision, so far the nightvision works, and every night its up and running.
I haven't tested in Caves (yet), and so far it also makes the fullmoon extremely bright, althought I coded what I think would fix it I haven't tested yet.

Here's the NightVision: https://imgur.com/a/5mRcZ 

The Deal Is: The Default NightVision makes the whole world go red and black, I know that is because of the mole hat, but I also know that in instances like Full Moon or the Beaver Woodie form the colors of the NightVision are different, I wanted to know how exactly can I change the nightvision colors to be exactly that of the full moon or at least a blue coloring instead of the red one.

Here's the code:

	local function NightVision(inst)
    if TheWorld.state.isnight then
    inst.components.playervision:ForceNightVision(true)
	else
	inst.components.playervision:ForceNightVision(false)
	end
end
	
	local function OnIsFullmoon(inst, isfullmoon)
    if isfullmoon then
    inst.components.playervision:ForceNightVision(false)
    end
end

I'm still not sure if the FullMoon bit will work, but I know so far that if I remove the fullmoon part of it the code works, worth nothing that in Woodie's code, it's not a specific color but a specific... asset?

local function SetBeaverVision(inst, enable)
    if enable then
        inst.components.playervision:ForceNightVision(true)
        inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)
    else
        inst.components.playervision:ForceNightVision(false)
        inst.components.playervision:SetCustomCCTable(nil)
    end
end

I want to know if there is a specific "ColorTable" for Fullmoon for me to add to my character's night vision, or if I can add a custom coloring that is not the default mole vision... pls help?

Edited by SintiePie

 

Actually the real default nightvision was Woodie's Beaver vision, when he would turn into a wearbever as he was in the game with nightvision before the reign of giants dlc, this is the code that sets the colorcubes. This character has the normal day or autumn day for the day time, Autumn dusk for dust, and Ruins during the nightmare phase. And of course the full moon for full moon. I can give you a list of all the color cubes that are default in the game.

This code goes out side of masterposinit I put it after the startinv

Spoiler

local BEAVERVISION_COLOURCUBES =
{
    day = "images/colour_cubes/day05_cc.tex",
    dusk = "images/colour_cubes/dusk03_cc.tex",
    night = "images/colour_cubes/ruins_light_cc.tex",
    full_moon = "images/colour_cubes/purple_moon_cc.tex",
}

 

 

These codes go under common_postinit

Spoiler

inst.components.playervision:ForceNightVision(true)
	inst:AddTag("nightvision")
    inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)

 

 

And this one in master_postinit.

Spoiler

inst:AddTag("nightvision")

 

'

 

 

 

colour_cubes.zip

Edited by Andreasgamming
9 hours ago, Andreasgamming said:

 

Actually the real default nightvision was Woodie's Beaver vision, when he would turn into a wearbever as he was in the game with nightvision before the reign of giants dlc, this is the code that sets the colorcubes. This character has the normal day or autumn day for the day time, Autumn dusk for dust, and Ruins during the nightmare phase. And of course the full moon for full moon. I can give you a list of all the color cubes that are default in the game.

This code goes out side of masterposinit I put it after the startinv

  Hide contents


local BEAVERVISION_COLOURCUBES =
{
    day = "images/colour_cubes/day05_cc.tex",
    dusk = "images/colour_cubes/dusk03_cc.tex",
    night = "images/colour_cubes/ruins_light_cc.tex",
    full_moon = "images/colour_cubes/purple_moon_cc.tex",
}

 

 

These codes go under common_postinit

  Hide contents


inst.components.playervision:ForceNightVision(true)
	inst:AddTag("nightvision")
    inst.components.playervision:SetCustomCCTable(BEAVERVISION_COLOURCUBES)

 

 

And this one in master_postinit.

  Hide contents


inst:AddTag("nightvision")

 

'

 

 

 

colour_cubes.zip

Thank you so much! It works even better than my initial code (for some reason my nightvision wouldn't work at all on servers that have caves in them, regardless of being in one or not.)

Do you happen to also have a way to separate the cave vision? I really wanted to limit the night vision or to simply get rid of it while in caves because that is just way too overpowered... But couldn't find a way of limiting it.

Regardless, thank you for your help~

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