Introduction to Modding Divinity: Original Sin 2

As an avid modder and fan of Divinity: Original Sin 2, I've spent countless hours tinkering with the game's inner workings. Today, I'm excited to share my knowledge on how to create a custom quest mod for this beloved RPG. This tutorial will walk you through the process step-by-step, from setting up your modding environment to implementing your very own quest. So, grab your Source points, and let's dive into the world of modding!

Prerequisites and Setting Up Your Modding Environment

Before we embark on our modding adventure, let's make sure we have everything we need:

1. A copy of Divinity: Original Sin 2 Definitive Edition

2. The Divinity Engine 2 (available for free on Steam)

3. Basic understanding of XML and Lua scripting

4. Patience and a willingness to learn

To get started, install the Divinity Engine 2 through Steam. Once installed, launch it and create a new mod project. Name it something catchy like "MyFirstQuestMod" - this will be the foundation for our custom quest.

Planning Your Custom Quest

Every great quest starts with a solid plan. For this tutorial, we'll create a simple quest called "The Forgotten Tome." Here's a brief outline:

- Quest Giver: A mysterious scholar in Driftwood

- Objective: Find a lost magical tome in the Blackpits

- Reward: A unique skill book

Now that we have our quest concept, let's start bringing it to life!

Creating the Quest Giver NPC

First, we need to create our quest giver. In the Divinity Engine 2:

1. Navigate to the Characters tab

2. Right-click and select "Create New Character"

3. Name the character "Mysterious_Scholar"

4. Set the race to Human and choose appropriate visuals

Now, let's give our NPC some dialogue. Create a new dialogue file:

<?xml version="1.0" encoding="UTF-8"?>
<save>
    <header version="2" time="0" />
    <version major="3" minor="6" revision="6" build="0" />
    <region id="DialogManager">
        <node id="root">
            <children>
                <node id="Dialog">
                    <attribute id="Id" value="Mysterious_Scholar_Dialogue" type="22" />
                    <attribute id="Name" value="Mysterious Scholar" type="23" />
                    <children>
                        <node id="Nodes">
                            <children>
                                <node id="Node">
                                    <attribute id="ID" value="1" type="5" />
                                    <attribute id="Text" value="Greetings, traveler. I seek a brave soul to recover a lost tome of great power." type="23" />
                                </node>
                            </children>
                        </node>
                    </children>
                </node>
            </children>
        </node>
    </region>

Save this file as "Mysterious_Scholar_Dialogue.lsj" in your mod's Dialogs folder.

Implementing the Quest Logic

Now, let's create the quest logic using Lua scripting. Create a new file called "ForgottenTomeQuest.lua" in your mod's Scripts folder:

local ForgottenTomeQuest = {}

function ForgottenTomeQuest.StartQuest()
    Osi.DB_CustomQuest("ForgottenTome", "Active")
    Osi.ShowNotification("New Quest: The Forgotten Tome")
end

function ForgottenTomeQuest.CompleteQuest()
    Osi.DB_CustomQuest("ForgottenTome", "Completed")
    Osi.ShowNotification("Quest Completed: The Forgotten Tome")
    -- Add reward logic here
end

function ForgottenTomeQuest.CheckTomeFound(character)
    if Osi.HasItemTemplate(character, "LOOT_Forgotten_Tome_abc123") == 1 then
        ForgottenTomeQuest.CompleteQuest()
    end
end

Ext.Osiris.RegisterListener("ItemTemplateAddedToCharacter", 2, "after", ForgottenTomeQuest.CheckTomeFound)

return ForgottenTomeQuest

This script sets up the basic structure for our quest, including starting and completing it, as well as checking if the player has found the tome.

Creating the Quest Item

We need to create the lost tome as an item. In the Divinity Engine 2:

1. Go to the Items tab

2. Right-click and select "Create New Item"

3. Set the Template ID to "LOOT_Forgotten_Tome_abc123"

4. Name it "Forgotten Tome of Power"

5. Set appropriate stats and description

Placing the Quest Item in the World

To place the tome in the Blackpits:

1. Open the Blackpits level in the Level Editor

2. Drag and drop the Forgotten Tome item into the desired location

3. Optionally, add some environmental storytelling around the tome's location

Connecting Everything Together

Now, let's connect all the pieces. Update the Mysterious Scholar's dialogue:

<node id="Node">
    <attribute id="ID" value="2" type="5" />
    <attribute id="Text" value="Will you help me recover the Forgotten Tome of Power from the Blackpits?" type="23" />
    <children>
        <node id="Answer">
            <attribute id="ID" value="3" type="5" />
            <attribute id="Text" value="I accept your quest." type="23" />
            <attribute id="EventID" value="StartForgottenTomeQuest" type="22" />
        </node>
    </children>

Create a new script called "QuestTriggers.lua" to handle the quest start:

Ext.Osiris.RegisterListener("DialogEnded", 2, "after", function(dialog, instanceID)
    if dialog == "Mysterious_Scholar_Dialogue" then
        local event = Osi.GetLastDialogEvent(instanceID)
        if event == "StartForgottenTomeQuest" then
            ForgottenTomeQuest.StartQuest()
        end
    end
end)

Testing Your Custom Quest Mod

To test your mod:

1. Package your mod in the Divinity Engine 2

2. Enable it in the Divinity: Original Sin 2 mod menu

3. Start a new game or load a save in Driftwood

4. Find the Mysterious Scholar and interact with them

5. Accept the quest and journey to the Blackpits

6. Find the Forgotten Tome and see if the quest completes

Troubleshooting Common Issues

If you encounter issues:

- Double-check all file names and paths

- Ensure your Lua scripts are free of syntax errors

- Verify that the item Template ID matches in both the item creation and the Lua script

- Check the Divinity Engine 2 console for any error messages

Expanding Your Mod

Once you've got the basics down, consider expanding your mod:

- Add multiple quest stages

- Implement choices that affect the quest outcome

- Create custom skills or items as rewards

- Integrate your quest with existing game lore

Conclusion

Congratulations! You've just created your first custom quest mod for Divinity: Original Sin 2. This is just the tip of the iceberg when it comes to modding this fantastic game. As you become more comfortable with the tools and scripting, you'll be able to create increasingly complex and engaging content.

Remember, modding is an iterative process. Don't be afraid to experiment, make mistakes, and learn from them. The Divinity modding community is incredibly supportive, so don't hesitate to reach out for help or share your creations.

Now go forth, Godwoken, and shape the world of Rivellon to your heart's content!

Share

Lukasz Jedrak

Content AI Powered

Leave a Reply

Your email address will not be published.*