Author Topic: [WB v1.127, SP, code] Expanded nobility title system kit (v0.3.3)  (Read 35675 times)

0 Members and 1 Guest are viewing this topic.

jrider

  • Veteran
  • *
    • View Profile
  • Faction: Neutral
  • WB
Playing for some time, I became somewhat frustrated by the native title system, being unable to distinguish between Rhodoks and Swadian lords and all the Ladies being Lady whatever faction or status they had, looking for something in the notes took forever.

What I wanted was, basicaly, a title system that would allow to identify clearly a lord's faction and his land ownership (ie. ruler, town, castle, village, landless), as well as their wife's position (titled according to her husband), and to distinguish between all the unmarried daughter and sister of the various factions.

after some research I didn't see anything like this existing and the only mention of it was as a suggestion in the Privy Council (here's the link for reference: http://forums.taleworlds.com/index.php/topic,118571.0.html ).

Most of the new titles comes from the suggestions in that thread (or from external material referenced in it).
NB: notable exceptions are for unmarried women titles and rhodoks titles (went for Scot Gaelic instead of Italian) and I chose latin for player faction.

Here is what I came up with:
  • Faction based titles for ruler, town, castle, village, landless (based on the biggest fief owned) and unmarried status.
  • Wife-husband relationship taken into account for the spouse not holding land (if both hold land the best title is applied).
  • Lords and Ladies' titles are updated for fief grant, faction change and weddings.
  • Unmarried daughters and sisters have a title equivalent to Mistress (not a very noble one, but the best I could come with to set them apart).
  • v0.3:  Added title suffix to reflect relation with liege (from caprera's questions) (used latin non-faction specific ones).
  • v0.3.1: enabled the player for titles (also derived from caprera's questions).
  • Titles for companions (not as vassals, they get the standard title in that case) in the party (unique title so they're all next to each others in the notes) or outside the party (according to major skills).
  • Companions' titles are changed when they join/leave the party (except when vassals).
  • since the aim was to have a nice sorted list in game Notes, the mongol titles have been swapped.
  • The titles come from Latin [player], English [swadian], Russian  [vaegir], Mongol (or chinese) [khergit], Old Norse (or mid-norwegian)  [nords], Scots Gaelic [rhodoks] and Arabic [sarranid].

    Almost no source were available for them so most female Mongol titles are made up (I'm no linguist but I tried my best).
NB: the title system, as of v0.3.1, includes the player himself.

Screenshots:
(click to show/hide)
(click to show/hide)

Using this with a previous savegame, shouldn't cause major problems, there may be some displaced strings due to the extension of the existing titles strings.

Following Caprera's questions, here is a break down of the general principle if you want to adapt/expand the code:
(click to show/hide)

here is the changelog and code (for Warband v1.127), feel free to reuse anywhere (this is v0.3.3):

Changelog:
(click to show/hide)

  • New tags used in the scripts to put in module_constants.py :
    NB: I use the second tag in an extended note system, it has no direct use for the title code itself.
(click to show/hide)

  • New titles strings (and descriptions for companion titles) to put in module_strings.py :
    NB: I use the descriptions in an extended game note system they are not used in this code.
(click to show/hide)
(click to show/hide)

  • New scripts to put in module_scripts.py (v0.3.3 change)
(click to show/hide)

  • The module_info_pages.py entry, if you want the historical background :
(click to show/hide)
for suffix added in v0.3 :
(click to show/hide)

... out of available space, hooks and native code modifications are described in post #6 (http://forums.taleworlds.com/index.php/topic,129691.msg3128066.html#msg3128066)
« Last Edit: August 21, 2010, 03:30:19 PM by jrider »

SPD_Phoenix

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #1 on: August 11, 2010, 12:03:34 AM »
Something that I plan to add to my personal mod in the future but haven't got much time to think about it yet. Thanks for all the hard work.

Similarly, I would like to add some custom suffix in the future. Something like "Baron Rolf the Cunning" ... Base on the npc personally and some other factor which decide whether the npc get the suffix or not. May be I would use the suffix for non vassal companions. Adding a little flavor to the game.

raziriel

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #2 on: August 11, 2010, 03:18:39 AM »
really cool, will try out it out asap  :D

Panzercracker

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Swadian
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #3 on: August 11, 2010, 08:23:14 AM »
I tried this kit, it work for original lords, but player faction lords still keep "Lord/Lady/Tribune'. Where I missed?

sourblood

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #4 on: August 11, 2010, 09:06:46 AM »
Nifty, I will check it out as soon as I get of from work, just six more hours to go...  :?

FrisianDude

  • Coitus non Awesome
  • Archduke
  • *
  • Zis is Tshörman tärritorie!
    • View Profile
  • Faction: Neutral
  • MP nick: Liudulf Ward/Léodwulf
  • M&BWB
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #5 on: August 11, 2010, 10:26:31 AM »
Wow, that looks very good. Nice. :)
Nords ruled by King Ragnar, Khergits ruled by Sanjar Khan, Rhodoks ruled by King Graveth, Swadians ruled by King Harlaus, Vaegirs ruled by King Yaroglek. All those peoples live, fight, and die in the continent of Calradia. The Nords and Rhodoks field solely infantry and archers, the Swadians and Vaegirs have infantry, archers and cavalry and the Khergit field almost exclusively cavalry. No such things as "infarty" or "calvary" exist. Play Vikingr!

jrider

  • Veteran
  • *
    • View Profile
  • Faction: Neutral
  • WB
[WB, SP, code] Expanded nobility title system kit, second part
« Reply #6 on: August 11, 2010, 11:45:36 AM »
recycling this post since I'm out of space in in original one (and forgot to reserve one, honestly I didn't think I would be so verbose  :shock: ), this describes the hooks and native code modifications:

now, to make this work you also need to modify the following in the native code (code changes and call hooks), I reorderd the modifications according to their placement in native code :

in module_dialogs.py, insert the tagged code in the member_separate_yes dialog entry to update the companion title with skills when he leaves the party (not by becoming a vassal, he becomes a standard lord in that case) :
(click to show/hide)

still in module_dialogs.py comment the following in the member_fief_grant_3 to avoid companion title override when initially giving them a fief :
(click to show/hide)

in module_scripts.py:
to initialize the new titles when starting a new game, add this at the end of the game_start script:
Tip: if you want to bootstrap the titles in an existing savegame, I suggest also adding this code at the end of the game_reset_player_party_name script so that it can be executed when you manually change the player name from the character sheet.
(click to show/hide)

to enable player to have a title and update it when changing player's name, add the tagged line in the  script :
NB: remember to remove any existing title when changing the name since the value is used as the new plural for player.
(click to show/hide)

to set the new title when a lord defects or is indicted, in the change_troop_faction script, comment the following (this is to take into account his new lands of lack of thereof):
(click to show/hide)

and still in the same script, move the "#Dependant kingdom ladies switch faction" block after the "#Remove his control over villages under another fortress" block and add these a bit lower (added code tagged) to set the title and update his/her wife/husband and dependant ladies (i.e. daughters and sisters) :
(click to show/hide)

to reduce native code changes, we replace the content of the standard troop_set_title_according_to_faction script, comment everything inside the try_begin block (not including it) and add the call to the new script :
(click to show/hide)

to update when a lord is given a new fief, insert the following code (tagged changes) at the end of the give_center_to_lord script (v0.3.3 change) :
(click to show/hide)

to update title (and player's vassals) with the relation suffix, insert the tagged line in the change_player_relation_with_troop script just before try_begin block with the display_message calls (v0.3.2 change) :
(click to show/hide)

to change to companion title when he joins the party, add this at the end of the recruit_troop_as_companion script :
(click to show/hide)

to update player's title (and his spouse), when joining a faction, modify the following blocks in the player_join_faction script :
(click to show/hide)
(click to show/hide)

similarly, to update player's title (and his spouse), when leaving a faction, modify the following blocks in the player_leave_faction script :
(click to show/hide)
(click to show/hide)

to set player's title when he taken his first town as an independant faction, add the tagged lines near the end of the activate_player_faction script just above the call to update_all_notes (v0.3.2 change) :
(click to show/hide)

to reflect relation changes to the liege (player or otherwise) in the suffix, insert tagged lines in the troop_change_relation_with_troop script just before the cheat block (v0.3.2 change) :
(click to show/hide)

to update title after a wedding, modify the following near the end of the courtship_event_bride_marry_groom script :
(click to show/hide)
« Last Edit: August 14, 2010, 11:38:55 AM by jrider »

caprera

  • Squire
  • *
  • you're welcome
    • View Profile
  • Faction: Neutral
  • MP nick: caprera
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #7 on: August 12, 2010, 12:24:14 PM »
Could it be linked to a relation value at the same time ?

jrider

  • Veteran
  • *
    • View Profile
  • Faction: Neutral
  • WB
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #8 on: August 12, 2010, 06:27:07 PM »
Could it be linked to a relation value at the same time ?

sure,

I assume that would be for relation to ruler, right ?

you can either mix it in the quality computation to determine the title index (you would need to add extra titles in the strings in order to have it still understandable at a glance) or maybe add a relation string as prefix (or suffix if you want to keep the order in the notes, in that case the title strings construction should be modified in module_strings.py) the title either standard (ie. Loyal Duke, Hateful Baron, etc.) or personalized (Grand Duke, Sub Baron).

that second solution is probably the easiest, you'll need a set of strings to link prefix to reputation value range (existing ones or new ones if you want to keep the title more in character) and a bit of code to clip the value to the nearest prefix (the way the relation toward you strings are handled for the characters game notes)

you'll need to add a few more hooks in the native code too after the relation is modified , internal faction politics has a least 3 scripts that I can think of (though there's probably more hidden here and there):
cf_random_political_event,
battle_political_consequences,
give_center_to_lord

and some hooks in dialogs too if the player is the liege.

finally, since you would be adding this to new places, you'd have to make sure the global registers and strings used in the script wouldn't interfere with the one used in that context (main script use s0 and s1).

quick and dirty (no dialog hook and no check for global register and string incompatibility):

Edit: removed code, since I included this in main posts 
« Last Edit: August 13, 2010, 02:06:29 PM by jrider »

caprera

  • Squire
  • *
  • you're welcome
    • View Profile
  • Faction: Neutral
  • MP nick: caprera
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #9 on: August 12, 2010, 06:33:20 PM »
Ok thanks, but what about a mix of the two ? I mean having titles for relation AND for merits.  In my mod i need the player as well as other lords to be nominated in different military ranks that have a direct effect on recruitment. Then again titles should also activate a script for the settlement to be created and so on with others...

jrider

  • Veteran
  • *
    • View Profile
  • Faction: Neutral
  • WB
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #10 on: August 12, 2010, 07:08:06 PM »
Ok thanks, but what about a mix of the two ? I mean having titles for relation AND for merits.  In my mod i need the player as well as other lords to be nominated in different military ranks that have a direct effect on recruitment. Then again titles should also activate a script for the settlement to be created and so on with others...

well, if you want a second separate title, the principle is the same, you can simply
  • add a set of military titles strings (plain ones),
  • add a new computation for rank (similar to the one for quality, first one should be 0),
  • add a rank string search similar to the one based on quality
  • if you don't use faction specific ranks, initialize the index to 0 and simply add the rank value (skip the store_sub and male/female multiplication)
  • if you use faction specific ranks, be sure to have the same number of entries in each and multiply by that (instead of male/female).
  • assign the result to a temporary storage string like I did above for the suffix in s61
since otherwise this is only cosmetic, don't forget to store each title (quality and rank, before adding the base string index would be the logical way to go) to it's own troop slot to reuse during gameplay.

NB: note that in my script I specifically exclude the player, haven't played with it too much since it's handled in a different manner using a global variable and didn't dig too much into the code yet to see if the plural form of the name was updated so that you have an uncorrupted form of the name available.

caprera

  • Squire
  • *
  • you're welcome
    • View Profile
  • Faction: Neutral
  • MP nick: caprera
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #11 on: August 12, 2010, 07:10:19 PM »
Ok thanks i'll give it a try asap  :wink:

jrider

  • Veteran
  • *
    • View Profile
  • Faction: Neutral
  • WB
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #12 on: August 12, 2010, 07:51:24 PM »
hm, perhaps I should lay out a breakdown of the way this works, will be simpler than reading the code if you want to adapt it, here goes :

  • basic conditions to check troop is eligible for title (faction, lords, ladies and such)
  • store the plural form of the troop name (for named characters this one is never modified thus providing the uncorrupted base character name, player is handled differently so you may have to create a global to store the uncorrupted form and insert that somewhere in the start game menus).
  • External computation block for the conditions to be used to attribute the rank (example: biggest fief in my original code)
  • Rank calculation block (which translate to the index of the rank string starting at 0)
  • find the corresponding string index in the module_strings.py
  • build the new character name string using that string index
  • replace the old character name by the new one
  • rename the character's party (if he has one) according to its new name.
steps 3 and 4 can be done several times for as many titles as you need
step 6 can mix the result of the various 3 & 4 steps' blocks (if you made several)

keeping the rank value for other things should use the one computed in step 4 to stay generic (unless you love long try_begin/else_try blocks or want to make something unique for each rank).

and one important last thing, even if you have only one condition keep the whole thing into a try_begin/try_end block (except for the script parameters and common stuff that can be derived from them).

GetAssista

  • Baron
  • *
  • TLD corovan robber
    • View Profile
  • Faction: Neutral
  • M&BWF&SWB
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #13 on: August 12, 2010, 09:23:33 PM »
Nice piece of code.

And moreover, this is the exemplar way to make first post on the forum!  Kudos
If only other recruits were like you :)

Panzercracker

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Swadian
Re: [WB, SP, code] Expanded nobility title system kit
« Reply #14 on: August 13, 2010, 03:47:27 AM »
Only some problem give fief for NPCs to become faction lords, I gave them village/town/castle, they just keep only 1 tile: "Domina"/'Dominus" - basic player faction title, not any higher title like Dux v.v...