Looking for resources for a simple mod
I want to do a simple mod that adds a keybinding to toggle crouch, so that i can ctrl normally and an other key or some situations where i would have to hold crtl for a long period of time.

I'm not familiar with LUA, but this should be simple enough to do with just general programming knowledge and a bit of trial and error. However, i've looked online a bit and i can't find documentation about how the game works, and how to introduce this mechanic. I've looked at the LuaJIT source over here, at the modworkshop wiki and on reddit, but i can't find what i'm looking for.

So far, i've managed to create a leybinding option by looking at some other BLT mods' source, but i'm a bit lost here. I've tried a few things, but nothing succeeded.

My mod.txt looks like this :

    "name" : "Toggle Crouch",
    "keybinds": [
            "keybind_id": "toggle_crouch",
            "name": "Crouch (toggle)",
            "script_path": "toggle.lua",
            "run_in_menu": false,
            "run_in_game": true,
            "localized": false

and toggle.lua looks like this :

if alive(managers.player:player_unit()) then
        if not managers.player:player_unit().ducking() then
        elseif managers.player:player_unit().ducking() then

I would like it if you guys could help me or show me where to find solutions.

Messages In This Thread
Looking for resources for a simple mod - by l33ttleboy - 07-07-2019, 08:51 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)