Basic Tutorial - BannerlordCE/TutorialCE GitHub Wiki

In this tutorial, we will be going over how to make basic element to create a captive event for the mod.

Module Creation

Captivity Events will be able to detect your mod when it detects a dependency. CE will attempt to load pictures/flags/sounds/events from the module into the game.

Steps

  1. Navigate to your modules folder (Mount & Blade II Bannerlord\Modules).
  2. Create a folder called zNAMEOFMOD (This will be your module folder).
  3. Create an xml file called SubModule.xml (This should contain the content below)
<!-- SubModule.xml -->
<?xml version="1.0" encoding="utf-8"?>
<Module>
  <Name value="NAME OF MOD" />
  <Id value="zNAMEOFMOD" />
  <Version value="v1.0.0" />
  <SingleplayerModule value="true" />
  <MultiplayerModule value="false" />
  <DependedModules>
    <DependedModule Id="zCaptivityEvents" DependentVersion="v1.8.0.1035"/>
  </DependedModules>
  <SubModules>
  </SubModules>
</Module>
  1. Create Images and Events folders inside of the zNAMEOFMOD folder.
  2. Inside of the Events folder create a file called DefaultExample.xml
// Your file structure should look like this
📂 zNAMEOFMOD
┣ 📄 SubModule.xml
┣ 📂 Images
┣ 📂 Events
┃ ┗ 📄 **DefaultExample.xml**
┗ 📂 ModuleData
  ┗ 📂 Languages
    ┗ 📂 English
      ┣ 📄 language_data.xml
      ┗ 📄 DefaultExample.xml

Basic Events

Here is a sample of a basic captivity event. You can copy and paste this into DefaultExample.xml.

<?xml version="1.0" encoding="UTF-8"?>
<CEEvents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file://CEEventsModal.xsd">

    <!-- SampleEvent -->
    <CEEvent>
        <Name>CE_common_example_1</Name>
        <Text>Event Text Here.</Text>
        <BackgroundName>CE_custom_background</BackgroundName>
        <MultipleRestrictedListOfFlags>
            <!-- Category Flag -->
            <RestrictedListOfFlags>Common</RestrictedListOfFlags>
            <!-- Type Flag -->
            <RestrictedListOfFlags>Captive</RestrictedListOfFlags>
            <!-- Location Flags -->
            <RestrictedListOfFlags>LocationTavern</RestrictedListOfFlags>
            <RestrictedListOfFlags>LocationCity</RestrictedListOfFlags>
        </MultipleRestrictedListOfFlags>
        <Options>
            <Option>
                <Order>0</Order>
                <MultipleRestrictedListOfConsequences>
                    <RestrictedListOfConsequences>EmptyIcon</RestrictedListOfConsequences>
                </MultipleRestrictedListOfConsequences>
                <OptionText>Option One.</OptionText>
                <TriggerEventName>CE_common_example_alt_1</TriggerEventName>
            </Option>
            <Option>
                <Order>1</Order>
                <MultipleRestrictedListOfConsequences>
                    <RestrictedListOfConsequences>ChangeHealth</RestrictedListOfConsequences>
                    <RestrictedListOfConsequences>EmptyIcon</RestrictedListOfConsequences>
                </MultipleRestrictedListOfConsequences>
                <OptionText>Option Two.</OptionText>
                <HealthTotal>-10</HealthTotal>
            </Option>
        </Options>
        <ReqCustomCode>true</ReqCustomCode>
        <SexualContent>false</SexualContent>
        <WeightedChanceOfOccuring>20</WeightedChanceOfOccuring>
    </CEEvent>
    <CEEvent>
        <Name>CE_common_example_alt_1</Name>
        <Text>Event Text Here.</Text>
        <BackgroundName>CE_custom_background_2</BackgroundName>
        <MultipleRestrictedListOfFlags>
            <RestrictedListOfFlags>Captive</RestrictedListOfFlags>
            <!-- CanOnlyBeTriggeredByOtherEvent Flag (Make sure this is set for events that you don't want to randomly call) -->
            <RestrictedListOfFlags>CanOnlyBeTriggeredByOtherEvent</RestrictedListOfFlags>
        </MultipleRestrictedListOfFlags>
        <Options>
            <Option>
                <Order>0</Order>
                <MultipleRestrictedListOfConsequences>
                    <RestrictedListOfConsequences>ChangeHealth</RestrictedListOfConsequences>
                    <RestrictedListOfConsequences>EmptyIcon</RestrictedListOfConsequences>
                </MultipleRestrictedListOfConsequences>
                <OptionText>Option One.</OptionText>
                <HealthTotal>10</HealthTotal>
            </Option>
        </Options>
        <ReqCustomCode>true</ReqCustomCode>
        <SexualContent>false</SexualContent>
        <WeightedChanceOfOccuring>20</WeightedChanceOfOccuring>
    </CEEvent>
</CEEvents>

As you may notice it is actually two events. With one event calling another when the player selects the first option.

<Option>
    <Order>0</Order>
    <MultipleRestrictedListOfConsequences>
      <RestrictedListOfConsequences>EmptyIcon</RestrictedListOfConsequences>
    </MultipleRestrictedListOfConsequences>
    <!-- Text of Option -->
    <OptionText>Option One.</OptionText>
    <!-- Trigger is Here (occurs by name) -->
    <TriggerEventName>CE_common_example_alt_1</TriggerEventName>
</Option>

WORK IN PROGRESS

⚠️ **GitHub.com Fallback** ⚠️