MsTopHat Posted August 23, 2016 Share Posted August 23, 2016 (edited) Hi everyone! I am coming here today because I have run into a major bug with my new character mod that is causing a lot of issues. My character is able to change between two forms, but on one form I wanted the character to have night vision. I wanted the character to have real night vision though and not the glow variable as I feel the glow variable is to powerful in together. I figures out a solution by making these codes for my character: Night vision form: inst.components.playervision:ForceNightVision(true) inst.components.playervision:SetCustomCCTable(NIGHTVISION_COLOURCUBES) Non vision form: inst.components.playervision:ForceNightVision(false) inst.components.playervision:SetCustomCCTable(nil) This actually worked great! I experienced no issues while running testing and playing the game. Until I added a caves server. Every time I try to load a game with a caves server it instantly crashes when I change to the night vision form. If I don't have caves it's great, but starting a world with caves causes crashes. I found a slight solution using a PrefabPostinit I found from another mod: [this goes in the modmain.lua folder] AddPrefabPostInit("eclipse"[character name], function(inst) inst.nightvision = GLOBAL.net_bool(inst.GUID, "player.customvision", "flipvision") inst.nightvision:set_local(false) local function FlipFn(inst) local val = inst.nightvision:value() inst.components.playervision:ForceNightVision(val) inst.components.playervision:SetCustomCCTable(NIGHTVISION_COLOURCUBES) end inst:ListenForEvent("flipvision", FlipFn) end) This works but it is permanent. I have tried a lot of things to make it only activate for one form but I am at a dead end. If anyone has any ideas please let me know! Thanks, MsTopHat Edited August 23, 2016 by MsTopHat Link to comment 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