Jump to content

Recommended Posts

So there was a mod on the workshop that got deleted, and it doesnt exist anymore and i really liked that mod(debug/testing map- believe me or not i dont really care if you think im using it to cheat) it changes the player vision to the moggle vision

it uses a simple code but i lost it, id like to know what i did wrong with the following file. if i change something it crashes and if it doesnt it doesnt do anything
Managed to change the nightvision color but if the local night vision absolutely needs the moggle filter i can make a new colour tube set with the moggle filter

Currently it crashes cause of a inst error?
[00:00:44]: [string "../mods/Nightvision/modmain.lua"]:15: attempt to index local 'inst' (a nil value)
LUA ERROR stack traceback:
    ../mods/Nightvision/modmain.lua:15 in (field) fn (Lua) <10-26>
    scripts/events.lua:46 in (method) HandleEvent (Lua) <42-49>
    scripts/input.lua:189 in (method) OnRawKey (Lua) <184-191>
    scripts/input.lua:396 in () ? (Lua) <395-397>

Thanks in advance

Managed to do it myself :

local _G = GLOBAL

local function GetKeyFromConfig(config)
    local key = GetModConfigData(config)
    return key and (type(key) == "number" and key or _G[key])
end

local function InGame()
    return ThePlayer and ThePlayer.HUD and not ThePlayer.HUD:HasInputFocus()
end

_G.TheInput:AddKeyUpHandler(GetKeyFromConfig("nv"), function ()
    
        nvk = not nvk
    
        if nvk == true then
        
        _G.ThePlayer.components.playervision:ForceNightVision(true)
        _G.ThePlayer.components.talker:Say("Night Vision enabled")
else
        _G.ThePlayer.components.playervision:ForceNightVision(false)
        _G.ThePlayer.components.talker:Say("Night Vision disabled")
end
end
)

 

 

night vision mod.zip

Edited by Rockou_
Link to comment
https://forums.kleientertainment.com/forums/topic/103915-night-visionclient/
Share on other sites

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