Mount & Blade II: Bannerlord

File information

Last updated

Original upload

Created by

LogRaam

Uploaded by

LogRaam

Virus scan

Safe to use

Tags for this mod

About this mod

Tool for writers who want a simplified way to write events for CaptivityEvents mod.
Facilitates the creation of complex scenarios by simplifying the creation of events. Keeps you immersed in the story you create.
Include simplified scripting language and compiler.
This tool use PowerShell 7+.

Requirements
Permissions and credits
Changelogs
Welcome to LogRaam's Captivity Event Compiler




by LogRaam  (Gabriel Mailhot)


NOW SUPPORTING text extraction for easier translation
You can now automatically extract text from your events and generate an XML resource file for translation.

NOW SUPPORTING Twine published files

You can download Twine and start writing new Captivity Events chain.


Twine is an open-source tool for telling interactive, nonlinear stories.
You don't need to write any code to create a simple story with Twine.  You can test your story easily before publishing it for Captivity Events.


This solution allow you to create Events for TheBadListener's M&B2 Bannerlord Mod called Captivity Events.

This compiler use PowerShell.  You can install PowerShell on several OS including Windows, Mac, Linux, ...
Go to Powershell's Github page and find the Release suitable for your computer.

*Note that there is a bug when running on PowerShell 5.1.  Please install PowerShell 7+.

Latest PowerShell 7 build :  POSH 7 latest build link

Support me


WHAT IT DOES:

- Script Captivity Events with a simplified and easy to read scripting language;
- Compile Simple Script to CEEvent xml file;
- Compile Twine exported HTML to CEEvent xml file;
- Compile Twine exported HTML to Simple Script;
- Decompile CEEvent xml file to Simple Script;
- Automatically extract text from XML and generate a resource file for translation.





HOW TO USE THE COMPILER


5 scripts available:

CreateCEEventXML-FromSimpleScript.ps1
CreateCEEventXML-FromTwinExport.ps1
CreateSimpleScript-FromCEEventXML.ps1
CreateSimpleScript-FromTwineExport.ps1
(new) ExtractText-FromCEEventXML.ps1

Just follow the steps in each script.

Example found in CreateCEEventXML-FromSimpleScript.ps1:


using module .\Classes\CEEventProcessor.psm1

# 1. Open this file in VSCode or PowerShell ISE (Windows).
# 2. Write down the file paths for SimpleScriptPath and XMLOutputPath at line 8 and 9.

$SimpleScriptPath = "Put the simple script file path to import here..."
$XMLOutputPath = "Put the output xml file path here..."

# 3. Run the script.  You can run it by selecting Run/Start Debugging in menu, or just press F5 (VSCode).

$proc = [CEEventProcessor]::new()$story = $proc.CreateScenarioFromSimpleScriptFile($SimpleScriptPath)

$proc.GenerateXMLCode($story, $XMLOutputPath)Write-Output "$XMLOutputPath file generated."

# All is done.  you should find a new file at the place you specified for XMLOutputPath.



HOW TO SCRIPT Events

You can find a SCRIPT example in .\Tutorial\EventScriptExample.ps1 or .\Tutorial\EventScriptExample.txt.
..the file extension is not important.  Use .ps1 if you want to enable the Enums.  Use .txt or anything else if Enums intellisense isn't needed.

The scripting language follow this sctructure:

ACT n
Name:
Text:
Image:  

[Restriction]::Random
[Restriction]::Captor
[Restriction]::Captive
[Restriction]::Overwriteable
[Restriction]::HeroGenderIsFemale
[Restriction]::HeroGenderIsMale
#TODO: Add [Restriction] here

Option:
OptionText:
  [Consequences]::EmptyIcon
  [Consequences]::PlayerIsNotBusy
  #TODO: Add [Consequences] here
  #TODO: Add Triggers here if applicable
#

[Requirements]::ReqCustomCode = true
[Requirements]::SexualContent = true
[Requirements]::ReqHeroMinAge = 18
#TODO: Add Requirement(s) here

END



Look at the EventScriptExample to figure out how to write your scenario.
Enums folder contains all the options you can use in your script.
Read .\Resources\CEEventsModal*version*.xsd file for further information.


Greetings to TheBadListener for his mod.  This have a lot of potential.

For any support, contact me (LogRaam) on Nexus.


Enjoy!


Use Twine to design your own story:




Use simplified script syntax in Twine:




Test your events chain directly in your Web browser:





Simplified scripting language syntax from this mod:





Equivalent script you should do in a text editor when NOT using this mod: