Loading a Lua script
File structure
Lua scripts should be placed in <MWR root folder>/h1-mod/scripts/
. You'll need to create a folder for your script and name it whatever you want (ex: my_basic_script
). After that, the main file called by H1-Mod is named __init__.lua
, so store your code that should be running first.
To figure out what your file structure should look like, refer to below:
Modern Warfare Remastered
โโโ h1-mod
โ โโโ scripts
โ โ โโโ my_basic_script
โ โ โ โโโ __init__.lua
โ โ โ โโโ other_script.lua
โ โ โโโ my_other_script
โ โ โ โโโ __init__.lua
โ โ โ โโโ script.lua
โโโ h1-mod.exe
After you setup your __init__.lua
entrypoint, you can include other scripts. If you want to include another script (ex: other_script.lua
), use the include
function. This function will load the script using H1-Mod's functionality for loading scripts.
include("other_script")
--- [...]