Developer rooks Posted March 30, 2020 Developer Share Posted March 30, 2020 Mod Instructions This is a preliminary how-to for mod creation. Please note that we are still in the *very* early stages for supporting mod development, but seeing as people have already begun to customize the game, we wanted to at least provide a way to add a couple things without having to mangle the actual game content. Running the game in debug Running the game in debug will unlock a slew of facilities to aid you in development. It is not strictly necessary to run in debug to either run or develop mods, but it will probably be helpful. To do this from the Epic launcher, go to Settings > Griftlands and check "Additional Command Line Parameters". In the edit box, enter --debug. A description of all the game's debug functionality is beyond the scope of this article, but for our purposes, it is useful to know that CTRL+5 will open a debug panel listing any mods the game has discovered. Once you create a mod or (eventually) install other user-created mod content, you will see their appearance here. You can enable or disable them from this panel. Eventually some of this functionality will be available through proper in-game UI. Creating an empty mod Browse to your Griftlands user settings directory. On windows, this will be in your Users directory under AppData\Roaming\Klei\Griftlands\. If you see a saves/ directory, a log.txt, and other game-generated files, you will know you are in the right place! Create a new folder named 'mods' if one doesn't already exist. This folder houses all local mod content. Inside the 'mods' folder, create another folder with the name of your mod. Inside that folder, create a text file called modinit.lua. This file will be executed when your mod is enabled and installed. You can call into the game's Content API to add things like cards and modifiers, but beware that things are extremely likely to change at this stage, and there is no official "how-to" for the various pieces of content. You can refer to the attached examplemod to learn how to add negotiation and battle cards. The havarian example mod shows the current way to add a new language setting. When you add or edit your mod files, you can use the CTRL+R hotkey to restart the game and reload content if debugging has been enabled. Have fun! examplemod.zip havarian.zip Link to comment Share on other sites More sharing options...
RageLeague Posted March 31, 2020 Share Posted March 31, 2020 I like how the example mods are from Invisible Inc. Link to comment Share on other sites More sharing options...
Developer Kevin Posted March 31, 2020 Developer Share Posted March 31, 2020 We're doing our part to unify the Klei Cinematic Universe. Link to comment Share on other sites More sharing options...
minespatch Posted March 31, 2020 Share Posted March 31, 2020 2 minutes ago, Kevin said: We're doing our part to unify the Klei Cinematic Universe. -Epic Emmet and Danny Elfman French horn crossover- Link to comment Share on other sites More sharing options...
ArtixBot Posted April 1, 2020 Share Posted April 1, 2020 I may be enjoying the debug tools a bit too much. Link to comment Share on other sites More sharing options...
minespatch Posted April 1, 2020 Share Posted April 1, 2020 We might need to see more cursed screencaps in the future. Link to comment Share on other sites More sharing options...
Wumpus the 19th Posted April 2, 2020 Share Posted April 2, 2020 On 3/31/2020 at 2:43 PM, Kevin said: We're doing our part to unify the Klei Cinematic Universe. On 3/31/2020 at 2:46 PM, minespatch said: -Epic Emmet and Danny Elfman French horn crossover- you are legally not allowed for this to be "just a joke". This had better become a reality Link to comment Share on other sites More sharing options...
RageLeague Posted April 6, 2020 Share Posted April 6, 2020 Is there an actual way to save plax after it is edited? I tried to edit the region map, but the changes won't save and all changes are reverted after restarting. Link to comment Share on other sites More sharing options...
Developer rooks Posted April 6, 2020 Author Developer Share Posted April 6, 2020 Saving the built-in plax scenes won't work currently due to the way the game data is archived. I'll add support for creating plaxes within mods to my backlog. Link to comment Share on other sites More sharing options...
Monochromia Posted April 19, 2020 Share Posted April 19, 2020 Is it just me, or are the links to the example mod and havarian.zip broken? Link to comment Share on other sites More sharing options...
C4stor Posted April 20, 2020 Share Posted April 20, 2020 On 4/19/2020 at 10:26 AM, Monochromia said: Is it just me, or are the links to the example mod and havarian.zip broken? Works for me Link to comment Share on other sites More sharing options...
RageLeague Posted April 20, 2020 Share Posted April 20, 2020 I tried to do something like engine.asset.Texture("UI/graft_bg.tex") in my custom mod. However, when this line is called, the game gives an error like this: 17:09.51-Lua: Error calling function from engine: scripts/encounter/encounter.lua:157: ERR running driver:SETTINGS:mods/CrossCharacterCampaign/modinit.lua:120: attempt to index a nil value (field 'asset') Is there a way to call the game engine in the mods? Link to comment Share on other sites More sharing options...
SpicyNiceCream Posted April 21, 2020 Share Posted April 21, 2020 Maybe adding self. somewhere will help? Link to comment Share on other sites More sharing options...
RageLeague Posted April 21, 2020 Share Posted April 21, 2020 Funny thing, actually. It worked in my other file, where i defined a custom modifier for a custom card, but somehow the exact same syntax crashes my game here. Apparently calling "engine" in another file and then use "require" to import that file causes no trouble. So the problem might have something to do with the mod loading function itself. Just don't call "engine" in modinit.lua. Link to comment Share on other sites More sharing options...
Developer Kevin Posted April 21, 2020 Developer Share Posted April 21, 2020 It’s sandboxed out. We will add it back in in an upcoming build. Link to comment Share on other sites More sharing options...
Monochromia Posted April 26, 2020 Share Posted April 26, 2020 Just finished making my own first card, here's some basic beginner tips from somebody who'd never coded in a dynamic language before this point. If anything is wrong please correct me, otherwise if/when official mod support comes out, feel free to throw this text on in an FAQ/Help section somewhere. Download Lua. I used https://github.com/rjpcomputing/luaforwindows to install on my windows machine. To see code of base game cards: 1. Unzip a copy of the data folder into a new folder. Make sure this folder is in a separate location from any of the game's files (for example, I put this new folder in my PC's documents folder). (By default, data will be a ~2,250,000 KB .zip file in Program Files/Epic Games/Griftlands/ ) 2. In the unzipped folder, go to /scripts/content . Battle cards are defined in the attacks folder (basic actions are character nonspecific, Sal actions are Sal's cards, rook actions are rook's cards, etc). Similarly, negotiation cards are under the negotiation folder. My mod doesn't show up in the game! Check the following list: You've saved all your currently opened files in your editor. Check for missing commas or '='. In my personal experience, often times bad code will just cause your mod to fail entirely (though as of this point I'm only working in a single file). If you just recently added in some code, try commenting it out and restarting the game (CTRL + R will do this if you have debug mode enabled, getting an up-to-date version of your mod files). Link to comment Share on other sites More sharing options...
Dartsy Posted April 29, 2020 Share Posted April 29, 2020 Is there a total idiots step by step guide on how to do all this? At this point I am staring blankly at the screen just blinking. Link to comment Share on other sites More sharing options...
RageLeague Posted April 30, 2020 Share Posted April 30, 2020 -- This sets what the game refers to this mod as. -- The game now refers to this mod as "NewExampleMod" -- Change this to your own mod name. -- From now on, you can use "NewExampleMod:" to refer to the mod's folder. -- For example, this modinit.lua is at "NewExampleMod:modinit" MountModData( "NewExampleMod" ) -- You can put constants, helper functions, and required libraries here. -- Don't put any game changing code outside of the OnLoad function. -- This function is called when this mod is loaded. Put everything that can change how the game behave here -- This way, when you "disable" the mod in-game, the mod is actually disabled. local function OnLoad() -- This code down here loads other files. -- You don't want to put code directly under OnLoad unless the code is extremely short. -- It is advised to put your code in a seperate file in the mod folder. -- The directory of where your code is. local self_dir = "NewExampleMod:content/" local LOAD_FILE_ORDER = { -- Put the file you want to load here. -- For example, if you want to load NewExampleMod:negotiation_cards.lua and -- NewExampleMod:battle_cards.lua, uncomment the code below -- "negotiation_cards", -- "battle_cards", } for k, filepath in ipairs(LOAD_FILE_ORDER) do require(self_dir .. filepath) end end -- Don't touch it. return { OnLoad = OnLoad } I am right now writing a comprehensive tutorials for adding negotiation cards to the game. Right now, you should create a new folder under mods and add modinit.lua to that folder, and copy and paste the above code to that file. You could use a code editor like notepad++ or visual studio code, or you can just use notepad. In the meantime, you should look at how some cards works under "[game file location]\data.zip\scripts\content\negotiation". Link to comment Share on other sites More sharing options...
Dartsy Posted April 30, 2020 Share Posted April 30, 2020 1 hour ago, RageLeague said: -- This sets what the game refers to this mod as. -- The game now refers to this mod as "NewExampleMod" -- Change this to your own mod name. -- From now on, you can use "NewExampleMod:" to refer to the mod's folder. -- For example, this modinit.lua is at "NewExampleMod:modinit" MountModData( "NewExampleMod" ) -- You can put constants, helper functions, and required libraries here. -- Don't put any game changing code outside of the OnLoad function. -- This function is called when this mod is loaded. Put everything that can change how the game behave here -- This way, when you "disable" the mod in-game, the mod is actually disabled. local function OnLoad() -- This code down here loads other files. -- You don't want to put code directly under OnLoad unless the code is extremely short. -- It is advised to put your code in a seperate file in the mod folder. -- The directory of where your code is. local self_dir = "NewExampleMod:content/" local LOAD_FILE_ORDER = { -- Put the file you want to load here. -- For example, if you want to load NewExampleMod:negotiation_cards.lua and -- NewExampleMod:battle_cards.lua, uncomment the code below -- "negotiation_cards", -- "battle_cards", } for k, filepath in ipairs(LOAD_FILE_ORDER) do require(self_dir .. filepath) end end -- Don't touch it. return { OnLoad = OnLoad } I am right now writing a comprehensive tutorials for adding negotiation cards to the game. Right now, you should create a new folder under mods and add modinit.lua to that folder, and copy and paste the above code to that file. You could use a code editor like notepad++ or visual studio code, or you can just use notepad. In the meantime, you should look at how some cards works under "[game file location]\data.zip\scripts\content\negotiation". Thanks for this, it is still way above my pay grade. My diploma in C++ was some years back now and it is mostly forgotten, I'll take a look though see if I can make more sense of it once I actually get going. This will be great reference during that procedure. Link to comment Share on other sites More sharing options...
Dartsy Posted May 1, 2020 Share Posted May 1, 2020 Link to comment Share on other sites More sharing options...
Hekateras Posted June 21, 2020 Share Posted June 21, 2020 YES! Wonderful, thank you, Klei! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.