Project Zomboid

Project Zomboid

Sixth Sense Trait - Zombie Detector
『Gecko』 16 Nov, 2022 @ 7:18pm
[Guide] Adding a shortcut button with keybinding option!
Don't know why people simply ignore this very simple and easy to code function, as they seem to be capable of programming in json/luascript, probably laziness, but here we go.

Hard requirement: You will need Mod Options for this to work.

First of all, go to your Sixth Sense modding folder. browse to:
.\media\lua\client\Ui
and open the file "SixthSenseUi.lua". Scroll down to the very bottom of that script and add my code to it:
------------------------------------------------------------------------ --GexNova: Adding key press functionality with key-re-bind setting local function GXHotkeyActionAdd() if ModOptions and ModOptions.getInstance and ModOptions:isHost() then local GXHotkeyBindings = { key = Keyboard.KEY_N, name = "SixthSense_Toggle", } local category = "[SixthSense_Toggle]"; ModOptions:AddKeyBinding(category, GXHotkeyBindings); ModOptions:getInstance(SETTINGS) ModOptions:loadFile() end end GXHotkeyActionAdd() SixthSenseUi.onKeyPressed = function(key) if key == getCore():getKey("SixthSense_Toggle") then SixthSenseUtils.ToggleSixthSense() end end Events.OnKeyPressed.Add(SixthSenseUi.onKeyPressed); ------------------------------------------------------------------------
Save it.

Now head to:
media\lua\shared\Translate\EN
and open the file "UI_EN.txt" and add the missing line
"UI_optionscreen_binding_SixthSense_Toggle = "Sixth Sense",
to it, so it looks like this:
UI_EN = { UI_optionscreen_binding_SixthSense_Toggle = "Sixth Sense", UI_trait_SixthSense = "Sixth Sense", UI_traitdesc_SixthSense = "You have the Sixth Sense, where you have the ability to sense that something just ain't right. This is an ability that allows you to know if zombies are nearby." }

This piece of code will make you able to use the N-key for toggling the perk on/off (I personally freed up this one, it was "mute music" before), which can also be changed ingame at the keybind settings.

I don't care about credits overall. This mediocre game needs to get better and the community is achieving this by adding stuff to the game which are making the game a lot better, which should be the very first and main priority of TIS' but they simply take ages to add some (more or less proper) stuff to the game, sadly.
So, thus said, me not caring about credits, use the code on any mod you like. Learn how it's fetching information from ongoing functions of a script and learn how to code it to work with other mods.

Save this game from being boring. Thanks.

Have fun.
Last edited by 『Gecko』; 16 Nov, 2022 @ 7:19pm
< >
Showing 1-1 of 1 comments
Hao 12 Dec, 2022 @ 4:11am 
Hello, can this be set on the PS4 handle?:steamhappy:
< >
Showing 1-1 of 1 comments
Per page: 1530 50