Skip to content

Commit 653ab70

Browse files
authored
Update make-a-bg3-mod-with-lua.mdx
1 parent f3daf0e commit 653ab70

File tree

1 file changed

+30
-21
lines changed

1 file changed

+30
-21
lines changed

projects/make-a-bg3-mod-with-lua/make-a-bg3-mod-with-lua.mdx

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Make a Baldur's Gate 3 Mod With Lua
2+
title: Make a Baldur's Gate 3 Mod with Lua
33
author: Julien Kris
44
uid: Jps14SaCwqgdbbnYvoMpvMKv92P2
55
datePublished: 2025-09-03
@@ -19,7 +19,7 @@ tags:
1919
cl="for-sidebar"
2020
/>
2121

22-
# Make a Baldur's Gate 3 Mod With Lua
22+
## Make a Baldur's Gate 3 Mod With Lua
2323

2424
<AuthorAvatar
2525
author_name="Julien Kris"
@@ -39,9 +39,7 @@ tags:
3939

4040
# Introduction: Companion Creatures
4141

42-
[Baldur’s Gate 3](https://en.wikipedia.org/wiki/Baldur%27s_Gate_3) (BG3) is a 2023 RPG by Larian Studios, adapted from the fifth edition of Dungeons & Dragons. It's earned over 10 million players due to its expansive worldbuilding, fleshed out characters, and stunning visuals.
43-
44-
Anyone who's played knows it features some truly epic battles, with animal allies who fight alongside you, like our best boy, Scratch.
42+
[Baldur’s Gate 3](https://en.wikipedia.org/wiki/Baldur%27s_Gate_3) (BG3) is a 2023 RPG by Larian Studios, adapted from Dungeons & Dragons. It's earned over 10 million players due to its expansive worldbuilding, fleshed out characters, and stunning visuals. Anyone who's played knows it features some truly epic battles, with animal allies who fight alongside you, like our best boy, Scratch.
4543

4644
<ImageZoom src="https://i.imgur.com/rxAJDtM.png" style={{ width: "80%", height: "auto" }} alt="Scratch"/>
4745

@@ -51,9 +49,9 @@ Well, remember the Addled Frog you met in Auntie Ethel’s swamp? It’s normall
5149

5250
We're going to do just that by making our own mod!
5351

54-
<ImageZoom src="https://i.imgur.com/8NiJnGA.png" style={{ width: "80%", height: "auto" }} alt="Baldur's Gate 3 frog"/>He’s literally so babygirl.
52+
<ImageZoom src="https://i.imgur.com/8NiJnGA.png" style={{ width: "80%", height: "auto" }} alt="Baldur's Gate 3 frog"/>
5553

56-
**Mods** (short for modifications) are a way of writing code to alter features, graphics, or gameplay of an existing game, even for huge titles like Baldur's Gate 3. Special thanks to [Jon Hinkerton](https://next.nexusmods.com/profile/jonhinkerton?gameId=3474) for creating the original mod that inspired this tutorial.
54+
**Mods** (short for modifications) are a way of writing code to alter features, graphics, or gameplay of an existing game, even for huge titles like Baldur's Gate 3.
5755

5856
We’ll create a mod that lets your character cast a spell to spawn their frog friend anywhere. That frog friend is a playable character who can help out during battles!
5957

@@ -64,6 +62,8 @@ By the end of this tutorial, you’ll know how to:
6462
- Customize the companion’s stats
6563
- Test your mod in-game
6664

65+
**Note:** Special thanks to [Jon Hinkerton](https://next.nexusmods.com/profile/jonhinkerton?gameId=3474) for creating the original mod that inspired this tutorial.
66+
6767
## Getting Started
6868

6969
Make sure you have Baldur's Gate 3 installed on your machine! If not, start [installing](https://store.steampowered.com/app/1086940/Baldurs_Gate_3) it in the background while you create your mod.
@@ -72,21 +72,27 @@ If you don't already have a code editor installed, download [Visual Studio Code]
7272

7373
### BG3 Script Extender
7474

75-
**BG3 Script Extender (BG3SE)** is a program that adds Lua scripting and console support to Baldur's Gate 3. Download it from [GitHub](https://github.com/Norbyte/bg3se).
75+
**BG3 Script Extender (BG3SE)** is a program created by a developer named @Norbyte that adds Lua scripting and console support to Baldur's Gate 3. Download it from [GitHub](https://github.com/Norbyte/bg3se).
76+
77+
Right click on the downloaded **.zip** file, select [Extract All], and extract the files to a new folder in your **Documents** directory, and name it something like **ModdingTools**. Next to your **ModdingTools** folder, create a new folder called **Mods**.
7678

77-
Right click on the downloaded .zip file, select [Extract All], and extract the files to a new folder called in your Documents directory, and name it something like `ModdingTools`. Next to your `ModdingTools` folder, create a new folder called `Mods`. We'll be keeping our modding apps in the `ModdingTools` folder, and our working files in the `Mods` folder.
79+
We'll be keeping:
7880

79-
Here's the structure you'll be working with inside the Mods folder (you'll learn how to create the meta.lsx files and both .lua files in a bit!)
81+
- Our modding apps in the **ModdingTools** folder.
82+
- Our working files in the **Mods** folder.
83+
84+
Here's the structure you'll be working with inside the **Mods** folder (you'll learn how to create the **meta.lsx** files and both **.lua** files in a bit!)
8085

8186
### Starter files
82-
[Here’s](LINK) a zip folder containing the starter files for this project! It contains the basic file structure you’ll be working with.
87+
88+
[Here’s a zip folder](LINK) containing the starter files for this project! It contains the basic file structure you’ll be working with.
8389
```
8490
Mods/Frog/Mods/Frog
8591
├── meta.lsx
8692
└── ScriptExtender/
8793
└── Lua/
88-
├── BoostrapServer.lua
89-
└── Server/
94+
├── BoostrapServer.lua
95+
└── Server/
9096
└── Frog.lua
9197
```
9298

@@ -118,9 +124,9 @@ Without this file, the game doesn’t know your mod exists.
118124

119125
## Setting up .txt files
120126

121-
In Baldur’s Gate 3, most of the game’s data, like characters, spells, and items, is stored inside .pak files. These are packed files that the game reads directly, so you can’t edit them in a normal text editor.
127+
In Baldur’s Gate 3, most of the game’s data, like characters, spells, and items, is stored inside **.pak** files. These are packed files that the game reads directly, so you can’t edit them in a normal text editor.
122128

123-
To make modding easier, the BG3 modding community uses tools to export, convert, and edit these files in a readable .txt format before putting them back into the game.
129+
To make modding easier, the BG3 modding community uses tools to export, convert, and edit these files in a readable **.txt** format before putting them back into the game.
124130

125131
Inside the **Data** folder, you should see three text files.
126132
- **Character.txt** is empty right now but it will define the stats for your frog, including Strength, Dexterity, Constitution, and other abilities. It will also include special boosts, resistances, and spells that the frog can use.
@@ -199,9 +205,9 @@ The first script is **BootstrapServer.lua**. Write the following code inside:
199205
```lua
200206
Ext.Require("Server/Frog.lua")
201207
print("BootstrapServer.lua loaded")
202-
203208
```
204-
Here, we are telling Script Extender to load our frog.lua file which contains the game logic, and once it's finished loading, we tell the game to run the code inside (in this case, a print message that says the mod has loaded!).
209+
210+
Here, we are telling Script Extender to load our **frog.lua** file which contains the game logic, and once it's finished loading, we tell the game to run the code inside (in this case, a print message that says the mod has loaded!).
205211

206212
The second script is **Frog.lua**.
207213

@@ -210,6 +216,7 @@ By default, the `Target_Summon_Frog` spell just spawns a new frog every time it
210216
This script fixes that by ensuring that any existing frog is removed before a new one is created. That way, you’ll always have exactly one frog active.
211217

212218
Write the following code:
219+
213220
```lua
214221
local function KillFrog()
215222
local summons = Osi.DB_PlayerSummons:Get(nil)
@@ -220,6 +227,7 @@ local function KillFrog()
220227
end
221228
end
222229
```
230+
223231
`Osi.DB_PlayerSummons:Get(nil)` queries the game for all currently active summons belonging to the player. The script checks them one by one.
224232

225233
`string.match(summon[1], "Frog")` says that if the summon’s identifier (its internal name) contains "Frog", we’ve found a frog.
@@ -279,7 +287,7 @@ You’ll be able to find the teapot containing the frog in the Tutorial Chest at
279287

280288
<ImageZoom src="insert image before publishing" style={{ width: "80%", height: "auto" }} alt="Discovering the teapot containing Frog"/>
281289

282-
# Bonus Challenges
290+
## Bonus Challenges
283291

284292
Try changing the frog’s stats! For example, you can scale the frog into a **giant** frog by altering the number inside `ScaleMultiplier()` in the Character.txt file.
285293

@@ -289,7 +297,7 @@ You can also try summoning other creatures! The best way to understand Mod files
289297

290298
Download one of these mods that use similar logic and let you summon a [Ghost Cat](https://www.nexusmods.com/baldursgate3/mods/5720), a [Tressym](https://www.nexusmods.com/baldursgate3/mods/5742), or even a [Pet Rock](https://www.nexusmods.com/baldursgate3/mods/7217).
291299

292-
# Conclusion
300+
## Conclusion
293301

294302
Congrats! You just made your first Baldur’s Gate 3 mod! 🎉
295303

@@ -299,7 +307,7 @@ We created a frog companion that can fight by your side in battle!
299307

300308
May you win every battle, and have fun breaking Faerûn!
301309

302-
# Additional Resources
310+
### Additional Resources
303311

304312
Here are some more resources to explore:
305313

@@ -309,7 +317,8 @@ Here are some more resources to explore:
309317
- [Manual Modding in BG3 for MacOS Users](https://www.youtube.com/watch?v=8BNi0uNOvrE)
310318
- [Jon Hinkerton’s other mods](https://next.nexusmods.com/profile/jonhinkerton/mods?gameId=3474&page=1)
311319

312-
Scratch told us he wants you to share your projects with the team [@codedex_io](https://www.twitter.com/codedex_io)! Let us know what you come up with!
320+
Scratch told us he wants you to share your projects with the team [@codedex_io](https://www.twitter.com/codedex_io) and [@baldursgate3](https://x.com/baldursgate3)! Let us know what you come up with!
321+
313322
<span style={{ fontSize: "16px", lineHeight: 1 }}>
314323
<img
315324
src="https://i.imgur.com/H6GXsjP.png"

0 commit comments

Comments
 (0)