Search the Community
Showing results for tags 'night vision'.
Found 2 results
Hello, i've been searching for hours now and can't find the solution to what i guess might be a simple task for somebody who really knows how to mod with lua-code. For myself i am just trying to mess around with it to see what i can get to work and what not and learning along the way, but this one i simply can't figure out. I just want to add to an abandoned character (that i fixed before with the help of the forums and reuploaded the working version) the ability to switch on the moggles smell-e-vision with a hotkey like "X". I thought it would be rather simple to do, but even after hours i am not able to find the code snippets i need and where to put them Only thing left for me to do is ask here for a kind soul who knows how to do this. Would be much appreciated. I hope if i see how it's done i can understand how to do it myself in the future and for similar tasks. (mod in question in attachments) workshop-1662813017.zip
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