OSP Code SP [WB v1.127] Expanded dialog system kit (v1.0)

Users who are viewing this thread

jrider

Veteran
I thought some dialogs were a little bland, especially the ones where you have list of things (such as the tavern minstrel maiden list or the looking for from lord/ladies), things are also a bit cumbersome there, since you have to go into the notes from the dialog and manually search for the character to have some basic information like relatives or feeling toward the player.

I also changed the mechanic of browsing the lord/lady so that you're brought back to the list instead of being brought back to the dialog where you ask for the list (didn't apply the same change to the minstrel dialog).

  • Lord/Ladies location of someone dialog:
    • Relation string toward player added ("knows of you" is a new one, used when player has relation but no string).
    • A married lady display its husband's name
    • Lord's display their father (and/or mother)
    • Prisoner status for male Lords is displayed
    • Changes to Maiden is identical to the ones made for minstrel
    • loop back to list after selecting an entry, use the leave entry to go back to the main lord/lady dialog
  • Minstrel eligible maiden dialog:
    • Maiden's closest male relative is displayed as well as their relation (daughter or pupil for sisters/nieces)
    • Betrothal status and name of the suitor displayed
  • Select emissary dialog:
    • Adds a string (title like) to companion name, to reflect skill level (strings for persuasion only for now) according to tiers (same as the party bonus tiers).
                NB: this one a bit of a work in progress, it has starting elements to extend it for use with other skills and set the new string, title like, for the duration of the mission
  • Select kingdom for action dialog:
    • Adds player's relation to ruler string and kingdom relation string to the dialog
Screenshots:
wbdialogsystem1.jpg
wbdialogsystem2.jpg

Just new scripts, new strings and hooks so using this with a previous savegame shouldn't cause any problem.

NB: I use this with my modified title system (see thread in The Forge) so the lord/ladies' land ownership and relation to ruler informations automatically appears when their name is used.

Strings' font in the ingame dialogs scale automatically, so you can put quite a bit in there.

Note that the new scripts are highly context sensitive, using them in another dialog context than the ones used here should check the global strings and register in the new context to ensure compatibility.

here is the code (for Warband v1.127), feel free to reuse anywhere  (this is v1.0):
Changelog:
v1.0:
  • Initial release.

  • in module_strings.py add these the end of the tuple:
Code:
## Jrider + DIALOGS v1.0 faction relation strings (20)
  ("faction_relation_mnus_100_ns", "vengeful"), # -100
  ("faction_relation_mnus_90_ns",  "vengeful"),  # -90
  ("faction_relation_mnus_80_ns",  "vengeful"), # -80
  ("faction_relation_mnus_70_ns",  "revengeful"), # -70
  ("faction_relation_mnus_60_ns",  "hateful"), # -60
  ("faction_relation_mnus_50_ns",  "angry"), # -50
  ("faction_relation_mnus_40_ns",  "resentful"), # -40
  ("faction_relation_mnus_30_ns",  "hostile"), # -30
  ("faction_relation_mnus_20_ns",  "grumbling"), # -20
  ("faction_relation_mnus_10_ns",  "suspicious"), # -10...
  ("faction_relation_plus_0_ns",   "indifferent"),# 0...9
  ("faction_relation_plus_10_ns",  "acceptive"), # 10...
  ("faction_relation_plus_20_ns",  "cooperative"),
  ("faction_relation_plus_30_ns",  "favorable"),
  ("faction_relation_plus_40_ns",  "supportive"),
  ("faction_relation_plus_50_ns",  "friendly"),
  ("faction_relation_plus_60_ns",  "gracious"),
  ("faction_relation_plus_70_ns",  "fond"),
  ("faction_relation_plus_80_ns",  "devoted"),
  ("faction_relation_plus_90_ns",  "loyal"),
## Jrider -

  • in module_scripts.py add these new scripts at the end of the tuple:
Code:
  ## DIALOGS v1.0 #########################################################################
  ## Script troop_get_relation_to_player_string (to include in dialogs)
  ## Use reg0, reg1 (unused here, though can be used to set a display context or use the faction relation number)
  ## fills s60 for storage of troop relation and s61 for storage of faction relation
  ("get_relation_to_player_string",
   [
     (store_script_param, ":target_no", 1),
     (store_script_param, ":troop_or_faction", 2),

     (assign, reg0, 0),
     (assign, reg1, 0),
     (try_begin), # target is troop
         (eq, ":troop_or_faction", 0),
         (str_clear, s60),

         (call_script, "script_troop_get_player_relation", ":target_no"),
         (assign, ":relation", reg0),
     
         (store_add, ":normalized_relation", ":relation", 100),
         (val_add, ":normalized_relation", 5),
         (store_div, ":str_offset", ":normalized_relation", 10),
         (val_clamp, ":str_offset", 0, 20), # does 20 works ? only 20 strings in there
         (store_add, ":str_rel_id", "str_relation_mnus_100_ns",  ":str_offset"),

         ## Make something if troop has relation but not strong enought to warrant a string
         (try_begin),
           (neq, ":str_rel_id", "str_relation_plus_0_ns"),
           (str_store_string, s60, ":str_rel_id"),
         (else_try),
           (neg|eq, reg0, 0),
           (str_is_empty, s60),
           (str_store_string, s60, "@ knows of you"),
         (try_end),
     (else_try), # target is Faction
         (eq, ":troop_or_faction", 1),
         (str_clear, s61),

         (store_relation, ":relation", "fac_player_supporters_faction", ":target_no"),
         (try_begin), # update reg0
           (neg|eq, ":relation", 0),
           (assign, reg1, ":relation"),
         (try_end),

         (store_add, ":normalized_relation", ":relation", 100),
         (store_div, ":str_offset", ":normalized_relation", 10),
         (val_clamp, ":str_offset", 0, 20),
         (store_add, ":str_rel_id", "str_faction_relation_mnus_100_ns",  ":str_offset"),
         (str_store_string, s61, ":str_rel_id"),
     (try_end),
   ]),

  ## Script change_looking_for_dialog_string
  ## Modify string s1
  ## Use s60 (from relation script), s3, s5, s6
  ## Use reg0, reg1 and reg4
  ("change_looking_for_dialog_string",
   [
     (store_script_param, ":troop_no", 1),

     ## Get general relation to use in name strings
     (call_script, "script_get_relation_to_player_string", ":troop_no", 0),

     ## Add family relationship for ladies and relation to player computed earlier and prisoner status
     (try_begin), ## wife of | relation
          (is_between, ":troop_no", kingdom_ladies_begin, kingdom_ladies_end), # gender check, only for ladies
          (troop_slot_ge, ":troop_no", slot_troop_spouse, 0),
          (troop_get_slot, ":spouse_of", ":troop_no", slot_troop_spouse),
          (str_store_troop_name, s3, ":spouse_of"),
          (str_store_string, s1, "@{s1}, wife of {s3}{reg0?,{s60}:}"),
     (else_try), ## unmarried daughter/sister of | relation
          (is_between, ":troop_no", kingdom_ladies_begin, kingdom_ladies_end), # gender check, for ladies only
          (troop_slot_eq, ":troop_no", slot_troop_spouse, -1), # unmarried ones
          (assign, reg1, -1),
          (try_begin),
              (troop_slot_ge, ":troop_no", slot_troop_father,0), # daughters first
              (troop_get_slot, ":daughter_of", ":troop_no", slot_troop_father),
              (str_store_troop_name, s3, ":daughter_of"),
              (assign, reg1, 1),
          (else_try),
              (troop_slot_ge, ":troop_no", slot_troop_guardian,0), # else sister or niece
              (troop_get_slot, ":sister_of", ":troop_no", slot_troop_guardian),
              (str_store_troop_name, s3, ":sister_of"),
              (assign, reg1, 0),
      (try_end),

          # check if betrothed
          (assign, reg4, 0),
          (try_begin),
            (troop_slot_ge, ":troop_no", slot_troop_betrothed, 0),
            (troop_get_slot, ":fiance", ":troop_no", slot_troop_betrothed),
            (str_store_troop_name, s5, ":fiance"),
            (assign, reg4, 1),
          (try_end),
          (str_store_string, s1, "@{s1}, {reg1?daughter of:pupil of} {s3}{reg4?, betrothed to {s5}:}{reg0?,{s60}:}"),
     ## For prisoners                                                              
     (else_try), # male
          (neg|is_between, ":troop_no", kingdom_ladies_begin, kingdom_ladies_end),

          (assign, reg1, 0),
          (assign, reg4, 0),

          (try_begin), # check if both parents are assigned
            (troop_slot_ge, ":troop_no", slot_troop_father, 0),
            (troop_slot_ge, ":troop_no", slot_troop_mother, 0),

            (troop_get_slot, ":father", ":troop_no", slot_troop_father),
            (troop_get_slot, ":mother", ":troop_no", slot_troop_mother),
            (is_between, ":father", active_npcs_begin, active_npcs_end), # keep only if active npc
            (is_between, ":mother", active_npcs_begin, kingdom_ladies_end), # keep only if active npc

            (str_store_troop_name, s3, ":father"),
            (str_store_troop_name, s6, ":mother"),

            (assign, reg4, 1,),
            (str_store_string, s5, "@{s3} and {s6}"),
          (else_try),
            (troop_slot_ge, ":troop_no", slot_troop_father, 0),
            (troop_get_slot, ":father", ":troop_no", slot_troop_father),
            (is_between, ":father", active_npcs_begin, active_npcs_end), # keep only if active npc

            (str_store_troop_name, s3, ":father"),
            (assign, reg4, 1,),
            (str_store_string, s5, "@{s3}"),
          (else_try),
            (troop_slot_ge, ":troop_no", slot_troop_mother, 0),
            (troop_get_slot, ":mother", ":troop_no", slot_troop_mother),
            (is_between, ":mother", active_npcs_begin, kingdom_ladies_end), # keep only if active npc

            (str_store_troop_name, s3, ":mother"),
            (assign, reg4, 1,),
            (str_store_string, s5, "@{s3}"),
          (try_end),

          # prisoner 
          (try_begin),
            (troop_slot_ge, ":troop_no", slot_troop_prisoner_of_party, 0),
            (assign, reg1, 1),
          (try_end),

          (str_store_string, s1, "@{s1}{reg4?, son of {s5}{reg1?,:{reg0?,:}}:}{reg1? prisoner{reg0?,:}:}{reg0?{s60}:}"),
     (try_end),
   ]),

  ## Script change_minstrel_maiden_dialog_string
  ## Modify string s10
  ## Use s60 (from relation script), s3 and s5
  ## Use reg0, reg1 and reg4
  ("change_minstrel_maiden_dialog_string",
   [
     (store_script_param, ":troop_no", 1),

     ## Get general relation to use in name strings
     (call_script, "script_get_relation_to_player_string", ":troop_no", 0),

     ## modify maiden display name to include closest male relative and current relation with player
     (assign, reg1, -1),
     (try_begin),
       (troop_slot_ge, ":troop_no", slot_troop_father,0), # daughters first
       (troop_get_slot, ":daughter_of", ":troop_no", slot_troop_father),
       (str_store_troop_name, s3, ":daughter_of"),
       (assign, reg1, 1),
     (else_try),
        (troop_slot_ge, ":troop_no", slot_troop_guardian,0), # else sister or niece
        (troop_get_slot, ":sister_of", ":troop_no", slot_troop_guardian),
        (str_store_troop_name, s3, ":sister_of"),
        (assign, reg1, 0),
     (try_end),

     # check if betrothed
     (assign, reg4, 0),
     (try_begin),
        (troop_slot_ge, ":troop_no", slot_troop_betrothed, 0),
        (troop_get_slot, ":fiance", ":troop_no", slot_troop_betrothed),
        (str_store_troop_name, s5, ":fiance"),
        (assign, reg4, 1),
     (try_end),
     ## Modify the display string
     (str_store_string, s10, "@{s10}, {reg1?daughter of:pupil of} {s3}{reg4?, betrothed to {ss5}:}{reg0?,{s60}:}"),
   ]),

  ## Script set_diplomatic_emissary_skill_level_string
  ## diplomatic emissary is evaluated by tiers of the Persuation skill
  ## Use s65
  ## Replace s11
  ## Note: this one is in a slightly unfinished state, as it provides only persusuation skill strings,
  ##       the idea is to extend it other skills, like spotting which is used in diplomacy for some mission types
  ("set_diplomatic_emissary_skill_level_string",
   [
       (store_script_param, ":troop_no", 1),
       (store_script_param, ":skill_selected", 2),
       (store_script_param, ":set_title", 3), # don't forget to reset at end of mission

       # store plural name of troop, (ie. without the title)
       (str_store_troop_name_plural, s65, ":troop_no"),

       (try_begin),       
           # get skill level
           (store_skill_level, ":skill_level", ":skill_selected", ":troop_no"),

           # get title index according to tiers of the selected skill
           (assign, ":title_index", -1), # no change by default
           (try_begin),
             (eq, ":skill_level", 1), # tier 0, novice
             (assign, ":title_index", 0),
             (str_store_string, s65, "@Messenger {s65}"),
           (else_try), # tier 1, between 2-4, some experience
             (is_between, ":skill_level", 2, 4),
             (assign, ":title_index", 1),
             (str_store_string, s65, "@Envoy {s65}"),
           (else_try),  # tier 2, between 5-7, good experience
             (is_between, ":skill_level", 5, 7),
             (assign, ":title_index", 2),
             (str_store_string, s65, "@Consul {s65}"),
           (else_try),  # tier 3, between 8-9, very good experience
             (is_between, ":skill_level", 8, 9),
             (assign, ":title_index", 3),
             (str_store_string, s65, "@Legate {s65}"),
           (else_try),  # tier 4, 10 or higher, the best
             (ge, ":title_index", 10),
             (assign, ":title_index", 4),
             (str_store_string, s65, "@Missi Dominici {s65}"),
           (try_end),

           # TODO: use strings

           # replace dialog display string (only if there's something to change)
           (try_begin),
               (ge, ":title_index", 0),
               (str_store_string, s11, "@{s65}"),

               # set title if you want to keep it
               (eq, ":set_title", 1),
               (troop_set_name, ":troop_no", s65),
           (else_try), # reset standard troop name in s11
               (str_store_troop_name, s11, ":troop_no"),
           (try_end),
       (try_end),
   ]),

  ## Script change_diplomatic_action_ruler_kingdom_strings
  ## Add ruler's relation to you and kingdom's relation in dialog string
  ## Modify s10 (ruler relation) and s1 (kingdom relation)
  ## Use s60 and s61 from get_relation_to_player
  ## Modify s10 (for ruler relation) and s11 (for kingdom relation)
  ("change_diplomatic_action_ruler_kingdom_strings",
   [
     (store_script_param, ":target_ruler", 1),
     (store_script_param, ":target_faction", 2),

     ## Get general relation to use in ruler name string
     (call_script, "script_get_relation_to_player_string", ":target_ruler", 0),

     ## Get faction relation to use in kingdom string
     (call_script, "script_get_relation_to_player_string", ":target_faction", 1),

     # replace dialog display strings
     (str_store_string, s10, "@{s10}{reg0? (who{s60}):}"),
     (str_store_string, s11, "@{s11} ({s61})"),
   ]),

  • Dialogs hooks in module_dialogs.py:
for the lord/lady ask location dialog, change the lord_talk_ask_location_2 dialog entry with the tagged code :
Code:
  [anyone|plyr|repeat_for_troops,"lord_talk_ask_location_2", [
      (store_repeat_object, ":troop_no"),
      (neq, "$g_talk_troop", ":troop_no"),
      (is_between, ":troop_no", active_npcs_begin, kingdom_ladies_end),
      (neq, ":troop_no", "trp_player"),
      (this_or_next|troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_hero),
      (troop_slot_eq, ":troop_no", slot_troop_occupation, slto_kingdom_lady),
      (store_troop_faction, ":faction_no", ":troop_no"),
      (eq, "$g_encountered_party_faction", ":faction_no"),
      (str_store_troop_name, s1, ":troop_no"),
                                                              
      (try_begin),
    (faction_slot_eq, "$players_kingdom", slot_faction_marshall, ":troop_no"),
        (str_store_string, s1, "@Our marshal, {s1}"),
      (try_end),

      ## Jrider + DIALOGS v1.0 modify displayed string to include extra informations
      (call_script, "script_change_looking_for_dialog_string", ":troop_no"),
      ## Jrider -
   ],
   "{s1}", "lord_talk_ask_location_3",[(store_repeat_object, "$hero_requested_to_learn_location")]],

to loop back to the list after seeing an entry, in the lord_talk_ask_location_2 dialog entries, comment the lady_pretalk / lord_pretalk lines and add (for each) the following line:
Code:
   "{s1}", "lord_talk_ask_location",[]],  ## Jrider : DIALOGS v1.0 loop back to list

for the minstrel eligible maiden dialog, insert the tagged code in the following minstrel_gossip_select dialog entry :
Code:
  [anyone|plyr|repeat_for_troops,"minstrel_gossip_select",
   [
   (store_repeat_object, "$temp"),
   (troop_slot_eq, "$temp", slot_troop_occupation, slto_kingdom_lady),
   (troop_slot_eq, "$temp", slot_troop_spouse, -1),
   (store_faction_of_troop, ":lady_faction", "$temp"),
   (store_faction_of_party, ":town_faction", "$g_encountered_party"),
   (eq, ":lady_faction", ":town_faction"),

   (str_store_troop_name, s10, "$temp"),
   ## Jrider + DIALOGS v1.0 modify the display string with relation
   (call_script, "script_change_minstrel_maiden_dialog_string", "$temp"),
   ## Jrider -
   ],  
   "{s10}",
   "minstrel_gossip_maiden_selected", [
    (store_repeat_object, "$lady_selected"),
   ]],

for the select kingdom for action dialog, insert the tagged code in the following minister_diplomatic_kingdoms_select dialog entry :
Code:
  [anyone|plyr|repeat_for_factions, "minister_diplomatic_kingdoms_select",
   [
     (store_repeat_object, ":faction_no"),
     (is_between, ":faction_no", kingdoms_begin, kingdoms_end),
     (neq, ":faction_no", "fac_player_supporters_faction"),
     (faction_slot_eq, ":faction_no", slot_faction_state, sfs_active),
     (faction_get_slot, ":leader_no", ":faction_no", slot_faction_leader),
     (str_store_troop_name, s10, ":leader_no"),
     (str_store_faction_name, s11, ":faction_no"),
     ## Jrider + DIALOGS v1.0 modify ruler and kingdom strings to add relations
     (call_script, "script_change_diplomatic_action_ruler_kingdom_strings", ":leader_no", ":faction_no"),
     ## Jrider -
     (str_clear, s14),
     #Has/has not recognized us a monarch
     ],
   "{s10} of the {s11}{s14}", "minister_diplomatic_initiative_type",
   [
     (store_repeat_object, "$g_faction_selected"),
     ]],

for the select emissary dialog, insert the tagged code in the following minister_emissary_select dialog entry :
Code:
  [anyone|plyr|repeat_for_troops, "minister_emissary_select",[
  (store_repeat_object, ":emissary"),
  (main_party_has_troop, ":emissary"),
  (is_between, ":emissary", companions_begin, companions_end),
  (troop_slot_eq, ":emissary", slot_troop_prisoner_of_party, -1),
  (is_between, ":emissary", active_npcs_begin, active_npcs_end),
  ## Jrider + DIALOGS v1.0 evaluate emissary skill level
  #(str_store_troop_name, s11, ":emissary"),
  (call_script, "script_set_diplomatic_emissary_skill_level_string", ":emissary", "skl_persuasion", 0),
  ## Jrider -
  ], "{s11}", "minister_emissary_dispatch",[
  (store_repeat_object, "$g_emissary_selected"),
  ]],
 
In this kit, this is error
Initializing...
Compiling all global variables...
Exporting strings...
Exporting skills...
Exporting tracks...
Exporting animations...
Exporting meshes...
Exporting sounds...
Exporting skins...
Exporting map icons...
Creating new tag_uses.txt file...
Creating new quick_strings.txt file...
Exporting faction data...
Exporting item data...
Exporting scene data...
Exporting troops data
Exporting particle data...
Exporting scene props...
Exporting tableau materials data...
Exporting presentations...
Exporting party_template data...
Exporting parties
Exporting quest data...
Exporting info_page data...
Exporting scripts...
Error: Unable to find object:str_faction_relation_mnus_100_ns
ERROR: Illegal Identifier:str_faction_relation_mnus_100_ns
Exporting mission_template data...
Exporting game menus data...
exporting simple triggers...
exporting triggers...
exporting dialogs...
Checking global variable usages...
Exporting postfx_params...

______________________________

Script processing has ended.
Press any key to exit. . .
 
Panzercracker said:
In this kit, this is error

sorry, I forgot to put in the new strings I added in module_strings.py (OP updated), I really shouldn't make these post late at night :smile:
 
Back
Top Bottom