• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Status
Not open for further replies.

jordarkelf

01_TITLE_STRING
164 Badges
Jul 13, 2005
8.040
648
erbkaiser.nl
  • Impire
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For The Glory
  • For the Motherland
  • Galactic Assault
  • Gettysburg
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Divine Wind
  • Europa Universalis III Complete
  • Iron Cross
  • King Arthur II
  • Knights of Pen and Paper +1 Edition
  • Lead and Gold
  • Legio
  • Leviathan: Warships
  • The Kings Crusade
  • Lost Empire - Immortals
  • Magicka
  • Majesty 2
  • Victoria 3 Sign Up
  • Crusader Kings II: Sons of Abraham
  • Ancient Space
  • Hearts of Iron Anthology
  • Arsenal of Democracy
  • Hearts of Iron II: Armageddon
  • Cities in Motion
  • Cities in Motion 2
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • A Game of Dwarves
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Commander: Conquest of the Americas
  • Darkest Hour
  • Deus Vult
  • Diplomacy
  • Dungeonland
  • East India Company
  • East India Company Collection
  • Europa Universalis III
The Duel Engine adds functional duels handled by the events system to Crusader Kings 2.

Get it on the STEAM WORKSHOP.
(manual download below)

Latest changelog.

duels.jpg

The Duel Engine was originally coded by Galle and others of the GoT team for the Game of Thrones Mod. With their permission I have updated the port to Crusader Kings 2 for the current version and added many features.

Features:

* Fighters on the battlefield have a chance of singling each other out for a duel, which is handled by events.
Before the duel starts, both opponents have a chance to back down. If they both accept to fight the actual duel starts.

Duels last for one or more rounds, and can end in two outcomes:
1) the loser yields to the winner and is captured (taken prisoner)
2) the loser is killed by the winner

During each round, both fighters risk getting hurt or killed. People with high martial skill or fighting skill are more likely to win, but there are numerous traits and other things taken into account. The system is still somewhat random, but not utterly so.

* The following event series also use the Duel Engine instead of random outcome duels:
*) Two vassals duel at their liege's feast (feast_events.txt)
*) You ask your liege's permission to engage your fierce rival into a duel (friends_rivals_events.txt)
*) You accuse your rival of cheating at a tournament (friends_rivals_events.txt)
*) Regent is challenged by another courtier for the regency (regency_events.txt)

For these combats, so-called friendly duels are possible, which will not necessarily end in death. It is also possible for the loser to stop the fight by yielding if he is wounded, maimed, or "afraid" (weighted for the AI, an option for the player).

The duel engine seemlessly takes over the original event chain and then returns to the normal event chain once the winner has been determined.

The player nearly always has a choice on what to do, the AI is scripted in the event series to act somewhat logically. A weak character going up against a strong one will usually try to yield; a rival will try to kill his rival; two friends or family fighting will try to avoid death; etc..

View attachment c7IzZ.jpgView attachment 8q6vf.jpg

Known issues:
None

Mod compatibility:
If you're playing without other mods, just download NewDuelEngine.zip and unzip in the MOD folder, then select in the launcher.

If you're playing with HIP do not use this with the PB module, PB has a version of the NDE integrated.

For other mods: while most of the Duel Engine is more-or-less self contained, several vanilla files had to be changed to get it to work.
The most likely conflict will be in common\on_actions (battlefield duels).
I will gladly lend support to making a compatible version of the DE for any mods that require it, as a mod author just let me know if you want to do the compatibility yourself or if you want me to keep it updated.

Mods that have (a form of) the Duel Engine integrated:

*) A Game of Thrones: the original! Listed here simply for clarity, my code is based on their work, not the other way around.
*) ProjectBalance
*) Lux Invicta

Thanks to:
Galle and Knuckey from the GoT team, for letting me release this and for the original work.
(rest in no particular order)
meneth, bugfixing and improvements (too many to count)
richvh, for some good suggestions and bug hunting
gedsaro, for tracking down the cause of a very nasty bug that stopped the DE from working correctly.
Ivan37, for updated French localization
ash001, for nice event pictures
lutharien, for bug hunting and suggestions for the jousts
AnaxXiphos, neat new images for the combat traits
zijlstark for the CTA advancement system
many others for helping me bugfix

Please see the original mod for more info and usage instructions.
 

Attachments

  • NewDuelEngine.zip
    367,4 KB · Views: 593
Last edited:
This post has somewhat outdated info. I will see about updating it soon(ish).

-----

FAQ

How does it work?
The Duel Engine itself is in duel_engine_events.txt, the output event that calls the other events is in duel_engine_output_events.txt. This event calls outputs in various files.

Basically the chain is this:

Calling event: sets the flags on the combatants, then calls the duel engine with hidden_tooltip = { e_rebels = { holder_scope = { character_event = { id = duel.1 } } } }
For battlefield duels this is event 5556002 (5556000 and 5556001 allow attacker and defender to fight or run).

Once the duel is over, it outputs to duel_engine_events.txt where you should clear up the flags, and call the follow-up event. For example with battlefield duels, the output event for a kill is duel_battle_events.txt event 5556100, and for spared opponent it is 5556101.
Since the DE tracks several different flags you can potentially have a different outcome for all of these:

-opponent killed
-opponent wounded
-opponent maimed
-opponent spared
-opponent ran away

Plus of course you can use any flags set by the calling or receiving events based on winner (FROM in output event) and loser (FROMFROM in output event).

Which Duels use the Duel Engine?

Currently the duel engine is called for the following cases:

-Battlefield combats: through the on_action on_combat_pulse (in duel_battle_events.txt)
-feast rival duel (feast_events.txt)
-shared liege rival duel (friends_rivals_events.txt)
-regency challenge (regency_events.txt)
-tournament jousting (tournament_duel_events.txt)
-tournament rival duel (tournament_events.txt)
-Norse Holmgardr duel (oldgods_holmgang_events.txt)

The battlefield duel/on_combat_pulse is currently the only on_action event, all others are called directly from their events by matching triggers.

In most cases the output events are in the same events that call them, but some of them are in various_duel_events.txt.

What changed with Tournaments and Jousting?
In vanilla, tournaments pick a random winner after around 50 days, and that is all that a tournament essentially does.
With the new Duel Engine, whenever a tournament is started jousting will start among tournament participants. These are mostly men with a military or ruling background, but some courtiers and women may also be eligible (although especially women are very rare).
At random, two of these will be pitched against each other in a joust, which uses a modified version of the Duel Engine to get results. Unlike duels, jousts will only ever last a single round. A winner will score a point, a loser will lose a point. It is possible to back down, in which case the person backing down is kicked from the tournament, and the opponent gets a half point.
After a period of time a winner is picked by selecting the person who has won the most jousts during the tournament, as well as a runner up and a third. In the case not enough people jousted, random characters will be created as winner/second/third to make sure the tournament can still end.

At random, an unmarried female in the realm is picked as the 'Queen of Love and Beauty', and the winner as by default a 50% chance of attempting to gain her favour (and love).

The winner/second/third part, queen of love and beauty, and some of the ancillary events during tournaments come from the A Game of Thrones mod, but the jousting system and tying this in to the winner selection is all new to this mod.


What are the combat traits for?

Combat traits are four new traits that indicate how good at fighting someone is, this is distinct from the martial education traits. Someone may know all about battle in theory, but have little idea on how to put them in practice.
The Duel Engine adds four combat traits which are very important in deciding how well someone actually fights in a duel.

The event files combat_trait_events.txt is the main file that sets the combat traits like poor_warrior, although characters can also gain them through actually fighting.
Further combat traits can be given by:
- battle_events.txt: characters can gain or go up a rank if they become brave or show heroism during combat, and can get demoted if they show they are craven
- traits_effects_events.txt: a character with the duelist trait has a chance of getting a combat trait, or going up a rank, if he fought a duel.

Is this compatible with existing games?
It is not recommended to add this mod to an existing game mainly because:
*) It adds new traits, which means that the save game can be messed up. There is nothing I can do about this, it is an issue with how traits are stored in the save game.

What about upgrades of the Duel Engine itself?
I cannot recommended to play existing saves with a newer version. Many times I had to change event series which means that you might get stuck with a broken event chain from which the game cannot always recover.
 
Last edited:
This is really good. Thanks for the update, Jordarkelf.
I'll take a look at the files, see if I can understand a bit better how this is working.

One thing I'd like to do, and maybe, it could be added into the Duel Engine, is:
having the option, right at the start of the event-chain, to go on the offensive, or go on the defensive.
If both characters go on the offensive, there's a higher chance for a kill (and maybe prestige associated with it?).
If one is on the offensive, and the other defensive, the guy on the defensive is more likely to loose but there's still hope to beat the other.
And if both are on the defensive, kills are less likely but so is the prestige involved...

Do you have any suggestions on how to go about it?
 
There are two existing flags you can use for this:
a char with the character_flag flag_duel_friendly will try NOT to kill his opponent,
a char with the flag flag_duel_to_the_death WILL try to kill his opponent

Currently the rival duel sets flag_duel_friendly on both (as the liege prohibits a fight to the death), and the regency duel sets flag_duel_to_the_death for example on the attacker.
Note that during the duel a char may decide to go for the kill anyway, in which case flag_duel_to_the_death is set.
 
Found a problem in event 100040 in friends_rivals_events.txt, which really doesn't have a bearing on the duel engine. In the triggers the original age limits are 11-16, and in the options the original limits are erroneously changed to 15-25 on the random courtier. However you've changed the options age limits to not adult and under 25, which means there's no lower limit on the other girl. I think you ought to re-examine that event.
 
There's another (non-Duel Engine related) bug in that file that I reported a while ago and still exists in your file.
 
They're learned by people mentored by:
1) People with one of those traits, or
2) People with any of the martial education traits.

(In the version integrated into the next release of Lux Invicta, I also allowed Marshals, people with the Duelist lifestyle, or people with the Veteran or Champion traits to teach these these as well.)

At the moment, there's no way for adults to learn these skills (though the elderly can lose a skill level), which I think is something lacking in the current implementation of the Duel Engine.
 
They're given to children whose educator has a martial trait. I usually educate my own sons so I've seen them getting them. With good skills/traits on the educator, they improve over time.
Richvh: I actually use some something to give them to more chars as well, but as the original Duel Engine didn't have that I didn't include it.
Basically I added to on_action event 260 (battle won) this:
Code:
		if = { 
			limit = {  
				NOT = { trait = poor_warrior }
				NOT = { trait = trained_warrior }
				NOT = { trait = skilled_warrior }
				NOT = { trait = master_warrior }
			}
			add_trait = poor_warrior
		}
		if = { 
			limit = { trait = poor_warrior }
			add_trait = trained_warrior
		}
		if = { 
			limit = { trait = trained_warrior }
			add_trait = skilled_warrior
		}
		if = { 
			limit = { trait = skilled_warrior }
			add_trait = master_warrior
		}
 
Last edited:
I think there should be an Ambition that allows learning them, plus random events for those with the Duelist lifestyle (is that vanilla or from some integrated mod? Not sure.) that permits them to learn them, at a minimum. Either as a part of the Duel Engine, or as an optional module.
 
I think there should be an Ambition that allows learning them, plus random events for those with the Duelist lifestyle (is that vanilla or from some integrated mod? Not sure.) that permits them to learn them, at a minimum. Either as a part of the Duel Engine, or as an optional module.
Duelist is vanilla, and I agree, it would be nice. Not necessarily a priority, though, if the second generation in the game will have the traits generated for them.
 
Validator's reporting that duel.305 in duel_engine_events.txt "is set to be triggered only, but it is never called." Ditto for feast_events.txt's event 72032, but that's a vanilla event you've bypassed, duel.305 is something you added.
 
Damn, thought I had that linked up correctly. Doesn't matter for the release as duel.300 is the tourney stuff, but I'll make sure to fix it by the time I get around to the tournament series.

//Edit: found it, it's because I swapped the two around while coding them. duel.7 option B in duel_engine_events.txt calls duel.306 but should call duel.305, which in turn calls duel.306.
I should really have run this through the validator I guess :(
 
Not compatible.
I changed
common\on_actions\00_on_actions.txt
events\feast_events.txt
events\friends_rivals_events.txt
events\regency_events.txt

in this mod, so the files would need to be merged.

//
File updated with above changes.
 
Last edited:
Status
Not open for further replies.