Jump to content
aetumae

Mount and blade: Bannerlord sex mods?

Recommended Posts

4 hours ago, YoungSailorGlitter said:

I suck at tech stuff, but I can take this existing and put the events into an XML and then post examples of the code and the XML examples I am talking about if I can make it work.

edit: figured it out C:\ProgramData\Mount and Blade II Bannerlord

This sounds exciting if you work it all out! Would be so useful for people wanting to add custom stuff, without knowing too much complicated code

Link to post
2 hours ago, YoungSailorGlitter said:

If someone can point me to the crash log file? I have a mod that just crashes the game at startup and I cannot figure out how/why?

 

 

It's in C:\ProgramData\Mount and Blade II Bannerlord\logs but note that the game will always crash no matter what if you have more than 11 mods downloaded

Link to post
1 hour ago, iikata said:

This sounds exciting if you work it all out! Would be so useful for people wanting to add custom stuff, without knowing too much complicated code


I was hoping that we could come up with a simple XML format for sex events

Just from the top of my head something like this:

 

<?xml version="1.0" encoding="UTF-8"?>
<CaptivityEvents>
  <EventLists>
  
	<CommonEvents>
	
		<CommonEvent>
			<Name>MOTY_captivity_interest</Name>
			<Text>You notice that your captors have been staring at you more than usual. You feel that they won't be content with just looking for long. You need to escape soon.</Text>
			<OnInitDelegate>null</OnInitDelegate>
			<OnConditionDelegate>null</OnConditionDelegate>
			<OnConsequenceDelegate>null</OnConsequenceDelegate>
			<MenuOverlayType>null</MenuOverlayType>
			<MenuFlags>null</MenuFlags>
            <Options>
            	<Option>
                  <Name>MOTY_captivity_interest</Name>
                  <Text>Resign to your fate as a prisoner.</Text>
                  <OnInitDelegate>null</OnInitDelegate>
                  <OnConditionDelegate>null</OnConditionDelegate>
                  <OnConsequenceDelegate>MOTY_captivity_interest_continue</OnConsequenceDelegate>
                  <MenuCallbackArgs>true</MenuCallbackArgs>
                  <MenuFlags>null</MenuFlags>
                  <PregnancyRiskModifier>30</PregnancyRiskModifier>
                  <EscapeChance>10</EscapeChance>
                  <WeightedChanceOfOccuring>50</WeightedChanceOfOccuring>
                  <CanHappenAgain>True</CanHappenAgain>
                  <ChanceOfMainHeroDeath>0</ChanceOfMainHeroDeath>
                </Option>
              	<Option>
              	</Option>
              	<Option>
              	</Option>
          	</Options>
          	
		</CommonEvent>
		<CommonEvent>
			
			
		</CommonEvent>
	
	</CommonEvents>
	
	<PrisonEvents>
	</PrisonEvents>
	
	<SettlerEvents>
	</SettlerEvents>
	
	<FemdomEvents>
	</FemdomEvents>
	
	<xxxEvents>
	</xxxEvents>
	
  </EventLists>
  
</CaptivityEvents> 


And then all the non-programmers can write a lot of naughty text events, and the easier it is to do it and add it, perhaps just add .xml files in a folder and the 'sex event' mods will read and use ALL xml files in that folder..

Basically anyone can make more events and just add another xml file in the /sexevents folder.

That way we can use whatever sex event mod that supports that format.

 

What I am looking to create here is a XML Sex Event Format Standard! Lets call it XSEFS!!!??


Would there be intrest in a XSEFS library to use? I can base my working first version of the xsefs.lib on @ioe23 's published working code. Because its easiest to compile and run honestly. That would also give an example on how to use it.


Edit: Note that this would also VERY elegantly solve the issue with different taste. If someone wants to enable / write for Neotare Gay or Bestiality, it would be really damn easy to just throw it on. And it would not interfere with the legality etc of any other contributors context. They would be totally separate entities.


Edit: and yes I just realised that entities like these would be needed

<PregnancyRiskModifier>30</PregnancyRiskModifier>
<EscapeChance>10</EscapeChance>
<WeightedChanceOfOccuring>50</WeightedChanceOfOccuring>
<CanHappenAgain>True</CanHappenAgain>
<ChanceOfMainHeroDeath>0</ChanceOfMainHeroDeath>

//I think the way to go is to abstract it, and also allow for custom code


Edit: I just learned about XML schemas, so -- what one basically have to start with to make XSEFS a reality is to create an XML schema for it.Then if someone write new event texts they can just use various online checkers or various software to make sure that the custom XML events are consistent with the XSEFS XML Schema and then either mods that are 'XSEFS' compatible or using a potential xsefs.lib use them.

 


The goal would be that it would be as simple for a content creator, just

- Write naughty stuff using a example to begin on
- Check their naught stuff xml against the XSEFS schema (online for example - https://www.freeformatter.com/xml-validator-xsd.html)
- Publish / Share the xml file with their custom events anyhow they want
- Anyone that wants to use it - could use it in any 'XSEFS compatible' mod by just throwing them into the /XSEFS folder in that mod subfolder or similar

This way anyone could write a XSEFS compatible mod without being interested in necro and bestiality stuff, and anyone interested could write events for that sort of thing - and 'most of it' would simple work.




 

Link to post

Like in Crusader Kings 2 - seducing, prostituting, impregnating, paternity fraud to the limit (cuckoldry). This is obtainable.

Best cuckoo scenario - corrupting enemy's woman, impregnating her. Then she convinces her husband the child is his. He dies. Child inherits and... Joins out Kingdom. W/o one siege :)

That was netori. Netorare stuff: spouse/daughter is captured...
MC and his spouse/daughter are captured...
Someone want's to seduce MC's spouse/daughter/love insterest. We can't kill him just like that. He is a rival, not enemy.. yet. For example another prince.
Spouse is pregnant. She tells that the child is our. Well, it may not be...

Link to post

Mmmmh... Ok, certain things are interesting BUT i see some useless fields that should be directly associated with the type of the event and so on.

 

Will look into later when i'm done doing the base for the mod. And well, it's up to the one doing the code for the mod to choose the format in the end. Got to find something at the same time user friendly AND easy to code.

Link to post
39 minutes ago, Scypio said:

Mmmmh... Ok, certain things are interesting BUT i see some useless fields that should be directly associated with the type of the event and so on.

 

Will look into later when i'm done doing the base for the mod. And well, it's up to the one doing the code for the mod to choose the format in the end. Got to find something at the same time user friendly AND easy to code.


I am just brainstorming as crazy. Lets collectively discuss and come up with a format that works for everyone, and -- certain fields can be totally be set as optional in the schema.

https://stackoverflow.com/questions/9243772/how-to-make-an-element-in-xml-schema-optional

 

Link to post

 

More brainstorming as I am learning more

 

<?xml version="1.0" encoding="UTF-8"?>
<XSEFSEvents>
 
		<XSEFSEvent>
		    <Type>Common</Type>
			<Option>False</Starter>
			<Name>MOTY_captivity_interest</Name>
			<Text>You notice that your captors have been staring at you more than usual. You feel that they won't be content with just looking for long. You need to escape soon.</Text>
			<OnInitDelegate>null</OnInitDelegate>
			<OnConditionDelegate>null</OnConditionDelegate>
			<OnConsequenceDelegate>null</OnConsequenceDelegate>
			<MenuOverlayType>null</MenuOverlayType>
			<MenuFlags>null</MenuFlags>
		</XSEFSEvent>
		<XSEFSEvent>
			<Type>Common</Type>
			<Option>True</Starter>
			<Name>MOTY_captivity_interest</Name>
			<Text>Resign to your fate as a prisoner.</Text>
			<OnInitDelegate>null</OnInitDelegate>
			<OnConditionDelegate>null</OnConditionDelegate>
			<OnConsequenceDelegate>MOTY_captivity_interest_continue</OnConsequenceDelegate>
          	<MenuCallbackArgs>true</MenuCallbackArgs>
          	<MenuFlags>null</MenuFlags>
          	<PregnancyRiskModifier>30</PregnancyRiskModifier>
          	<EscapeChance>10</EscapeChance>
          	<WeightedChanceOfOccuring>50</WeightedChanceOfOccuring>
          	<CanHappenAgain>True</CanHappenAgain>
          	<ChanceOfMainHeroDeath>0</ChanceOfMainHeroDeath>
                
		</XSEFSEvent>
  
</XSEFSEvents> 

.. brainstorming .. example .. schema file coming soon

 

Link to post
1 hour ago, Scypio said:

Mmmmh... Ok, certain things are interesting BUT i see some useless fields that should be directly associated with the type of the event and so on.

 

Will look into later when i'm done doing the base for the mod. And well, it's up to the one doing the code for the mod to choose the format in the end. Got to find something at the same time user friendly AND easy to code.


My first draft for a Schema for the LEGENDARY standard XML format called XSEF ..

 

If I understood you correct @Scypio - what you wanted is to not be required to implement all sorts of fields, nor think that people writing need that many, just the 'type'?

We would then need to standardize the 'type' and set up some ground rules around what is 'common' and what is 'femdom' I assume.

The great thing with having some of these fields optional is that it makes it possible for Modder Nr1 to make it possible for the text writer to decide the chance of pregnancy from an event, and Modder Nr2 want to decide that herself. And the same XML file created by the content/eventcreator/writer will work with both mods.

Success!? Right?

 

 


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="XSEFSEvents">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="XSEFSEvent"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="XSEFSEvent">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Type"/>
        <xs:element ref="Option"/>
        <xs:element ref="Text"/>
		<xs:element ref="OnInitDelegate"/>
		<xs:element ref="OnConditionDelegate"/>
		<xs:element ref="OnConsequenceDelegate"/>
		<xs:element ref="MenuOverlayType"/>
		<xs:element ref="MenuFlags"/>
		<xs:element ref="PregnancyRiskModifier"/>
		<xs:element ref="EscapeChance"/>
		<xs:element ref="WeightedChanceOfOccuring"/>
		<xs:element ref="CanHappenAgain"/>
		<xs:element ref="ChanceOfMainHeroDeath"/>
		<xs:element ref="ReqHeroMinAge"/>
		<xs:element ref="ReqHeroMaxAge"/>
		<xs:element ref="ReqHeroGender"/>
		<xs:element ref="ReqCaptorGender"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <!-- Required elements of each event -->
  <xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Option" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Text" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="OnInitDelegate" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="OnConditionDelegate" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="OnConsequenceDelegate" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="MenuOverlayType" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="MenuFlags" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  
  
  <!-- Optional elements of each event -->
  <xs:element name="PregnancyRiskModifier" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="EscapeChance" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="WeightedChanceOfOccuring" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="CanHappenAgain" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ChanceOfMainHeroDeath" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMinAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMaxAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGender" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGender" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
 
</xs:schema>


 

 

Link to post

You don't need to name your delegates you just need to know what they have to do. You'll probably end up with just one delegate to process your events anyway. Otherwise you'll restrict the users to only those named delegates that are compiled into the mod. In code it would be something like:

 

gameStarter.AddGameMenuOption{optionId, optionText (MenuCallbackArgs args) => { /* process condition returning true/false */ }, (MenuCallbackArgs args) => { /* process consequence */}, false, -1};

 

What's more complex is the way you're going to trigger the events. In the "example" mod posted in this thread this is done by inheriting a class from DefaultPlayerCaptivityModel and putting specific code inside it to trigger the menus/events that are related to one another. Unless you only want to trigger a random menu/event for the ones defined in the xml, you'll have to find a way to define what you want to happen and when and maybe also add rules preventing one event happening before another. 

Link to post
41 minutes ago, Prometeus5879 said:

You don't need to name your delegates you just need to know what they have to do. You'll probably end up with just one delegate to process your events anyway. Otherwise you'll restrict the users to only those named delegates that are compiled into the mod. In code it would be something like:

 

gameStarter.AddGameMenuOption{optionId, optionText (MenuCallbackArgs args) => { /* process condition returning true/false */ }, (MenuCallbackArgs args) => { /* process consequence */}, false, -1};

 

What's more complex is the way you're going to trigger the events. In the "example" mod posted in this thread this is done by inheriting a class from DefaultPlayerCaptivityModel and putting specific code inside it to trigger the menus/events that are related to one another. Unless you only want to trigger a random menu/event for the ones defined in the xml, you'll have to find a way to define what you want to happen and when and maybe also add rules preventing one event happening before another. 

 

Please more feedback like this. But I want to mention that if it gains interest, I wanted to kind of do some definitions.

Many of the things you talk about is due to that I have started from the code that came from someone unknown and then was reverse engineered and provided to me in project form by a wonderful human being. So the events that are in the code which I read first and have learned from, have these sort of delegates. But yes, of course I realize that perhaps we might skip delegates all together and instead relying on for example 'type' and 'subtype' and then letting the coders/modders to implement in whatever way they see best?

One one side there is content creators, that surely can contribute but do not want to code. We can provide for them a format to do this, and folder to throw their XML files in.

In the middle I was trying to find a useful niche, by creating a standard that the content creators can understand and use. While it being alluring and functional for the modders that code various mods.

My vision was of course that these events were not going to be limited to only 'events when held captive' even if it started there.

There is nothing in the system that would prevent someone making a mod that activates events when being Victorious in a battle 'defeatedFoe' type. Or leaving a tavern 'druggedAtTheTavern' type. 

And then there are modders, who really like writing code. And I hope to be able to give them a library if they want one, like that will read various XML files and will provide them with a nice and fine list with XSEFS event objects.

Now I will surely try to mod and use my own stuff, but the modders that code a LOT and BETTER then me will run lapses around me.

 


 

Link to post
1 hour ago, YoungSailorGlitter said:


My first draft for a Schema for the LEGENDARY standard XML format called XSEF ..

 

If I understood you correct @Scypio - what you wanted is to not be required to implement all sorts of fields, nor think that people writing need that many, just the 'type'?

We would then need to standardize the 'type' and set up some ground rules around what is 'common' and what is 'femdom' I assume.

The great thing with having some of these fields optional is that it makes it possible for Modder Nr1 to make it possible for the text writer to decide the chance of pregnancy from an event, and Modder Nr2 want to decide that herself. And the same XML file created by the content/eventcreator/writer will work with both mods.

Success!? Right?

 

 



<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="XSEFSEvents">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="XSEFSEvent"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="XSEFSEvent">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Type"/>
        <xs:element ref="Option"/>
        <xs:element ref="Text"/>
		<xs:element ref="OnInitDelegate"/>
		<xs:element ref="OnConditionDelegate"/>
		<xs:element ref="OnConsequenceDelegate"/>
		<xs:element ref="MenuOverlayType"/>
		<xs:element ref="MenuFlags"/>
		<xs:element ref="PregnancyRiskModifier"/>
		<xs:element ref="EscapeChance"/>
		<xs:element ref="WeightedChanceOfOccuring"/>
		<xs:element ref="CanHappenAgain"/>
		<xs:element ref="ChanceOfMainHeroDeath"/>
		<xs:element ref="ReqHeroMinAge"/>
		<xs:element ref="ReqHeroMaxAge"/>
		<xs:element ref="ReqHeroGender"/>
		<xs:element ref="ReqCaptorGender"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <!-- Required elements of each event -->
  <xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Option" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Text" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="OnInitDelegate" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="OnConditionDelegate" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="OnConsequenceDelegate" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="MenuOverlayType" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="MenuFlags" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  
  
  <!-- Optional elements of each event -->
  <xs:element name="PregnancyRiskModifier" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="EscapeChance" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="WeightedChanceOfOccuring" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="CanHappenAgain" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ChanceOfMainHeroDeath" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMinAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMaxAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGender" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGender" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
 
</xs:schema>


 

 

Maybe you can add more events? Like rape or something? I have seen an example, that may be a good reference, in previous pages. Anyway, your work will be admired by all of us!

Link to post

Example.png.ee6490eaf3eceb56b4c5bed890ebece6.png

 

Alright, got it to work on my side, check whether we're in a dungeon or in a party and so on, can also do specific stuff depending on the player gender, if the settlement where the player is held on a brigands hideout or not, now onto more interesting stuff to do. There's just this into the game's code that is a bit triggering me.

 

image.png.8a6eb82df05958bcfc0d026b6c503817.png

I don't know where it is used though if this value is used by the game's code. Again another mistery to solve.

 

Well, going to post a mod here soon for some first testing.

Link to post

Maybe an idea for the xml is to implement a system of flags.  Simplified example:

 

<Event>

    <Text>I've received some food and water.</Text>

    <SetFlags>

          <Flag Name="HasFood" />

          <Flag Name="HasWater" />

    </SetFlags>

</Event>

<Event>

    <Text>I eat my food.</Text>

    <RequiresFlags>

          <Flag Name="HasFood" ResetFlag="true" />

    </RequiresFlags>

</Event>

<Event>

    <Text>I drink my wine.</Text>

    <RequiresFlags>

          <Flag Name="HasWine" ResetFlag="true" />

    </RequiresFlags>

</Event>

 

The first event sets two user defined flags. The second event requires the "HasFood" flag to be known by the mod (stored in a list or something) and would trigger in the above example.  The last event wouldn't trigger because it's flag is not known by a mod. When checking for a flag you should also have the option to reset it.

 

A small remark on your previous examples: an event can have several options.

Link to post
1 hour ago, Scypio said:

image.png.8a6eb82df05958bcfc0d026b6c503817.png

I don't know where it is used though if this value is used by the game's code. Again another mistery to solve.

 

Well, going to post a mod here soon for some first testing.

If that's decompiled code of a mod, then it can't be used by the game because it's declared as private.

 

edit: by game I ment WB itself. If the mod uses it if you would find a reference to it.

Link to post
51 minutes ago, Prometeus5879 said:

Maybe an idea for the xml is to implement a system of flags.  Simplified example:

 

<Event>

    <Text>I've received some food and water.</Text>

    <SetFlags>

          <Flag Name="HasFood" />

          <Flag Name="HasWater" />

    </SetFlags>

</Event>

<Event>

    <Text>I eat my food.</Text>

    <RequiresFlags>

          <Flag Name="HasFood" ResetFlag="true" />

    </RequiresFlags>

</Event>

<Event>

    <Text>I drink my wine.</Text>

    <RequiresFlags>

          <Flag Name="HasWine" ResetFlag="true" />

    </RequiresFlags>

</Event>

 

The first event sets two user defined flags. The second event requires the "HasFood" flag to be known by the mod (stored in a list or something) and would trigger in the above example.  The last event wouldn't trigger because it's flag is not known by a mod. When checking for a flag you should also have the option to reset it.

 

A small remark on your previous examples: an event can have several options.


To begin with, lets have modders / coders lead primarily lead on what they really need.

 

 

OBS ////  I am sitting right now and working myself backwards by implementing my own XSEFS library and consuming a List<XSEFSEvent> to figure out what is needed in the standard.

Then we make some examples and takes change requests from content creators.

Would really like to avoid one more nested list, but the same thing can be accomplished by adding more required elements.. and I really like more booleans, it reduces the amount of errors due to missspelling in the xml files.

Check this out?

Note that some are boolean and some are string, the booleans ARE more or less flags.
 

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="XSEFSEvents">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="XSEFSEvent"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="XSEFSEvent">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Type"/>
        <xs:element ref="Option"/>
        <xs:element ref="Text"/>
		<xs:element ref="PregnancyRiskModifier"/>
		<xs:element ref="EscapeChance"/>
		<xs:element ref="WeightedChanceOfOccuring"/>
		<xs:element ref="CanHappenAgain"/>
		<xs:element ref="ChanceOfMainHeroDeath"/>
		<xs:element ref="ReqHeroMinAge"/>
		<xs:element ref="ReqHeroMaxAge"/>
		<xs:element ref="ReqHeroGenderFemale"/>
		<xs:element ref="ReqHeroGenderMale"/>
		<xs:element ref="ReqCaptorGenderFemale"/>
		<xs:element ref="ReqCaptorGenderMale"/>
		<xs:element ref="ReqHeroPartyHaveItem"/>
		<xs:element ref="ReqCaptorPartyHaveItem"/>
		<xs:element ref="ReqHeroHaveOffspring"/>
		<xs:element ref="ReqHeroHaveSpouse"/>
		<xs:element ref="ReqHeroPregnant"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <!-- Required elements of each event -->
  <xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Option" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Text" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  
  
  <!-- Optional elements of each event -->
  <xs:element name="PregnancyRiskModifier" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="EscapeChance" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="WeightedChanceOfOccuring" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="CanHappenAgain" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ChanceOfMainHeroDeath" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMinAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMaxAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGenderFemale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGenderMale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGenderFemale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGenderMale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorPartyHaveItem" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroPartyHaveItem" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroHaveOffspring" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroHaveSpouse" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroPregnant" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
	   
</xs:schema>


Of course, let me repeat that this is an XSD, the schema that controls how the XMLs are allowed to look like. Just saying, because it was not clear to me earlier today.




 

Link to post
22 minutes ago, Prometeus5879 said:

If that's decompiled code of a mod, then it can't be used by the game because it's declared as private.

 

edit: by game I ment WB itself. If the mod uses it if you would find a reference to it.

But it's not a mod, it's the game's core code uncompiled here. Hence why i'm getting triggered because if that was a mod i could fix it. But it's not used anywhere in the class. So i'm getting perplex here.

Link to post

I now have started giving proper versions to these, this is version 0.2. I will keep pushing new versions until people are decently happy. Then there will be more clear examples how the XML have to look like to match the XSD / THIS IS AN XSD for those less techy.

 


<?xml version="0.2" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="XSEFSEvents">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="XSEFSEvent"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="XSEFSEvent">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Type"/>
        <xs:element ref="Option"/>
        <xs:element ref="Text"/>
		
		<xs:element ref="AgreeText"/>
		<xs:element ref="IsCancelOptional"/>
		<xs:element ref="CancelText"/>
		<xs:element ref="AgreeResultText"/>
		
		<xs:element ref="ReqCustomCode"/>
		<xs:element ref="NSFW"/>
		
		<xs:element ref="PregnancyRiskModifier"/>
		<xs:element ref="EscapeChance"/>
		<xs:element ref="WeightedChanceOfOccuring"/>
		<xs:element ref="CanHappenAgain"/>
		<xs:element ref="ChanceOfMainHeroDeath"/>
		<xs:element ref="ReqHeroMinAge"/>
		<xs:element ref="ReqHeroMaxAge"/>
		<xs:element ref="ReqHeroGenderFemale"/>
		<xs:element ref="ReqHeroGenderMale"/>
		<xs:element ref="ReqCaptorGenderFemale"/>
		<xs:element ref="ReqCaptorGenderMale"/>
		<xs:element ref="ReqHeroPartyHaveItem"/>
		<xs:element ref="ReqCaptorPartyHaveItem"/>
		<xs:element ref="ReqHeroHaveOffspring"/>
		<xs:element ref="ReqHeroHaveSpouse"/>
		<xs:element ref="ReqHeroPregnant"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <!-- Required elements of each event -->
  <xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Option" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Text" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  
  <!-- This being false means its a 'fastgamemenu' that requires no delegate function calls -->
  <xs:element name="ReqCustomCode" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/> 
  
  <xs:element name="NSFW" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/>   <!-- Aka is it adult content or not -->
  
  <!-- If ReqCustomCode is false and the event is a 'fastgamemenu', then these are all needed to generate the event -->
  <xs:element name="AgreeText" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>    <!-- Should be short-->
  <xs:element name="IsCancelOptional" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/>  <!-- If player can choose to avoid resulttext, triggers cancel text -->
  <xs:element name="CancelText" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>  <!-- Should be short-->
  <xs:element name="AgreeResultText" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>  <!-- Can be longer -->
  
  <!-- Optional elements of each event NOTE that some of these flags might be irrelevant if the ReqCustomCode is false and the event is a simple aka 'fastgamemenu' event -->
  <xs:element name="PregnancyRiskModifier" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="EscapeChance" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="WeightedChanceOfOccuring" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="CanHappenAgain" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ChanceOfMainHeroDeath" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMinAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMaxAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGenderFemale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGenderMale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGenderFemale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGenderMale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorPartyHaveItem" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroPartyHaveItem" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroHaveOffspring" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroHaveSpouse" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroPregnant" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
	   
</xs:schema>

 

Link to post


So, I have made it work more or less the whole way

The module have a folder for XMLs, where you can throw any XML that contains events that matches the XSD standard format I created. I throw in the XML with an event, and it happens in game.

Just for simple events right now, but is adding complexity. And I have an integration library to use with your mod that will do most of the work for you! :) Also I have example code snippets here for you how to integrate the library resource.

Will release the actual library when its good and ready. It will be completely stand-alone from any existing code, and its main function is to read the xml in the folder and provide them in a list of Event objects for an actual mod. See code below how I successfully integrated it into the mod that was released earlier in this thread.


Some code snippets for modders, and my latest version 0.3 of the XSD below.
 


TO CATCH THE TICK

YourClass : DefaultPlayerCaptivityModel

----- CheckCaptivityChange

			List<XSEFS.XSEFSEvent> eventList = XSEFS.XSFShandler.TestEventList();
			List<string> eventNames = new List<string>();

			int totalNumEvents = 0;

			foreach (XSEFSEvent myevent in eventList)
			{
				PrintDebugInGameTextMessage("Event" + myevent.Name);
				for (int a = myevent.WeightedChanceOfOccuring; a > 0; a = a - 1) //It will be added as many times on the list as its weight, thus changing the odds
				{
					eventNames.Add(myevent.Name);
					totalNumEvents = totalNumEvents + 1;
				}
			}

				string randomWeightedChoice = eventNames[MBRandom.Random.Next(0, (totalNumEvents - 1))];
				return randomWeightedChoice;

TO SET UP THE EVENTS THAT WILL BE CALLED AT TICK
              
YourModule : MBSubModuleBase

------  OnGameStart

private void AddEventsBasedOnXSEFS(List<XSEFSEvent> eventList)
		{
			foreach (XSEFSEvent myevent in eventList)
			{
				if (!myevent.ReqCustomCode)
				{
					AddSimpleMenuEvent(myevent);
				} 
				else
				{
					AddComplexMenuEvent(myevent);
				}
			}
		}

		//VZE CHANGE
		private void AddComplexMenuEvent(XSEFSEvent myevent)
		{
			throw new NotImplementedException();
		}

		//VZE CHANGE
		private void AddSimpleMenuEvent(XSEFSEvent myevent)
		{
			if (myevent.IsCancelOptional)
			{
				this.addFastMultiGameMenu((CampaignGameStarter)_gameStarter, myevent.Name, myevent.Text, myevent.AgreeText, myevent.CancelText, myevent.AgreeResultText);
			} else
			{
				this.addFastGameMenu((CampaignGameStarter)_gameStarter, myevent.Name, myevent.Text, myevent.AgreeText, null);
			}
		}

and the newest XSD
 


<?xml version="0.3" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="XSEFSEvents">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="XSEFSEvent"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="XSEFSEvent">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="Type"/>
        <xs:element ref="Option"/>
        <xs:element ref="Text"/>
		<xs:element ref="Location"/>
		
		<xs:element ref="AgreeText"/>
		<xs:element ref="IsCancelOptional"/>
		<xs:element ref="CancelText"/>
		<xs:element ref="AgreeResultText"/>
		
		<xs:element ref="ReqCustomCode"/>
		<xs:element ref="NSFW"/>
		
		<xs:element ref="PregnancyRiskModifier"/>
		<xs:element ref="EscapeChance"/>
		<xs:element ref="WeightedChanceOfOccuring"/> <!-- How many multitudes higher chance it will have of occuring, an event with weight 5 will have five times greater chance of happening then an event with weight 1, please do not use negative numbers.  -->
		<xs:element ref="CanHappenAgain"/>
		<xs:element ref="ChanceOfMainHeroDeath"/>
		<xs:element ref="ReqHeroMinAge"/>
		<xs:element ref="ReqHeroMaxAge"/>
		<xs:element ref="ReqHeroGenderFemale"/>
		<xs:element ref="ReqHeroGenderMale"/>
		<xs:element ref="ReqCaptorGenderFemale"/>
		<xs:element ref="ReqCaptorGenderMale"/>
		<xs:element ref="ReqHeroPartyHaveItem"/>
		<xs:element ref="ReqCaptorPartyHaveItem"/>
		<xs:element ref="ReqHeroHaveOffspring"/>
		<xs:element ref="ReqHeroHaveSpouse"/>
		<xs:element ref="ReqHeroPregnant"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  
  <!-- Required elements of each event -->
  <xs:element name="Type" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Option" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Text" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
  <xs:element name="Location" type="xs:string" minOccurs="1" maxOccurs="unbounded"/> <!-- party, dungeon, hideout, tavern, village, city and castle -->
  
  <!-- This being false means its a 'fastgamemenu' that requires no delegate function calls -->
  <xs:element name="ReqCustomCode" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/> 
  
  <xs:element name="NSFW" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/>   <!-- Aka is it adult content or not -->
  
  <!-- If ReqCustomCode is false and the event is a 'fastgamemenu', then these are all needed to generate the event -->
  <xs:element name="AgreeText" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>    <!-- Should be short-->
  <xs:element name="IsCancelOptional" type="xs:boolean" minOccurs="1" maxOccurs="unbounded"/>  <!-- If player can choose to avoid resulttext, triggers cancel text -->
  <xs:element name="CancelText" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>  <!-- Should be short-->
  <xs:element name="AgreeResultText" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>  <!-- Can be longer -->
  
  <!-- Optional elements of each event NOTE that some of these flags might be irrelevant if the ReqCustomCode is false and the event is a simple aka 'fastgamemenu' event -->
  <xs:element name="PregnancyRiskModifier" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="EscapeChance" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="WeightedChanceOfOccuring" type="xs:integer" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="CanHappenAgain" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ChanceOfMainHeroDeath" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMinAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroMaxAge" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGenderFemale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroGenderMale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGenderFemale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorGenderMale" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqCaptorPartyHaveItem" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroPartyHaveItem" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroHaveOffspring" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroHaveSpouse" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="ReqHeroPregnant" type="xs:boolean" minOccurs="0" maxOccurs="unbounded"/>
	   
</xs:schema>


My plan is to

1) Finish up my module so I can share it with you guys&girls -- this means among other things to be able to do complex events that do delegation from XML
2) Try to integrate it with @Scypio 's code if he wants me to - making sure it works there as well

I've just learned about this stuff. So the code is mostly examples copy pasted from StackOverflow and modified to work for me.


 

Link to post

If anyone is making a team to attempt to tackle some lewd mods I'd be willing to join I have some experience with C# and modding in general.

 

Also maybe it could be a good idea to make a Bannerlord modding discord for loverslab

Link to post

Looks like people more dedicated than I have started doing this the right way, but here's an update to my edits to the example mod

 

- Fixed settlements/prisons

- Reduced pregnancy chance across the board

- If you are taken prisoner by a non hero party (bandits, minor factions, settlements) the child's "father" will be yourself. Might get weird if it happens multiple times. I haven't tested that far.

- Events only happen if taken by a non hero party, or a hero with certain traits, or a hero that has 0 or less relationship with you

 

Seems to pair well with https://www.nexusmods.com/mountandblade2bannerlord/mods/134

 

CaptivityEvents.zip

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...