Randy Boggs Posted April 17, 2017 Share Posted April 17, 2017 (edited) So, I have my own mod character. I've managed to get him a night vision (like the moggles) during the night. But it only works if the server doesn't have caves. Also, the second problem is it only works if the player is the host. This is the local function: local function managenightvision(inst) if inst.components.playervision:HasNightVision() then if TheWorld.state.isday or TheWorld.state.isfullmoon or TheWorld.state.isdusk then inst.components.playervision:ForceNightVision(false) end else if TheWorld.state.isnight or TheWorld.state.iscaveday or TheWorld.state.iscavenight and not TheWorld.state.isfullmoon then inst.components.playervision:ForceNightVision(true) end end end And this is the master postinit: managenightvision(inst) --check when connecting inst:WatchWorldState("isnight", managenightvision) inst:WatchWorldState("isday", managenightvision) inst:WatchWorldState("isfullmoon", managenightvision) inst:WatchWorldState("iscaveday", managenightvision) inst:WatchWorldState("iscavenight", managenightvision) Edited April 17, 2017 by Randy Boggs Link to comment https://forums.kleientertainment.com/forums/topic/77853-night-vision/ 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