OSP Code QoL Adding your wife as a companion

Users who are viewing this thread

Lathrael

Recruit
  Proably most people working on mod making know this, but for amateurs like me, i would like to share source codes to add your wife to your party as an effective companion.

First, add this somewhere in spouse_talk;


  [anyone|plyr, "spouse_talk",
  [
    (troop_get_slot, ":player_spouse", "trp_player", slot_troop_spouse),
    (eq, "$g_talk_troop", ":player_spouse"),     
  ],
    "I want you to join my party", "spouse_join",
    []],
  [anyone, "spouse_join",
  [
  ],
  "Of course my love!", "close_window",
  [
    (party_add_members, "p_main_party", "$g_talk_troop", 1),
    (assign, "$g_leave_encounter", 1),
      ]],

Now she's in your party! But having no options... for that we do this next;

At start of member_talk:

  [anyone,"member_chat",
  [
  (store_conversation_troop,"$g_talk_troop"),
  (troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_lady),
  (troop_slot_eq, "trp_player", slot_troop_spouse, "$g_talk_troop"),
  ], "Yes, my love?", "member_talk",
  []],

Now, she can use member menus! But this can lead (and will) lots of bugs and NO STRING errors, unless we do some changes on;


  [anyone,"member_chat",
  [
    (store_conversation_troop,"$g_talk_troop"),
    (troop_is_hero,"$g_talk_troop"),
    (troop_get_slot, ":honorific", "$g_talk_troop", slot_troop_honorific),
    (str_store_string, s5, ":honorific"),
    (neg|troop_slot_eq, "trp_player", slot_troop_spouse, "$g_talk_troop"),
  ], "Yes, {s5}?", "member_talk",....................................................

and to keep things clean;


  [anyone|plyr,"member_talk", [
        (neg|troop_slot_eq, "trp_player", slot_troop_spouse, "$g_talk_troop"),
      ], "We need to separate for a while.", "member_separate",[.....................


  [anyone|plyr,"member_talk", [
                      (neg|troop_slot_eq, "trp_player", slot_troop_spouse, "$g_talk_troop"),
      ], "I'd like to ask you something.", "member_question",[]],

Now, you cannot ask her questions or send her on to errands, (which may lead errors).
Well, if you watched Coupling, you may know the term the "unflushable"... To prevent that let's make an option to send her away to court;



  [anyone|plyr,"member_talk", [
  (troop_slot_eq, "$g_talk_troop", slot_troop_occupation, slto_kingdom_lady),
  (troop_slot_eq, "trp_player", slot_troop_spouse, "$g_talk_troop"),
  ], "This is unsafe for you. You should get back to our court.", "spouse_leave",[]],

  [anyone, "spouse_leave", [

  ], "Are you sure, my love?", "spouse_leave_confirm", []],

  [anyone|plyr,"spouse_leave_confirm", [], "Yes.", "close_window",
  [(remove_member_from_party, "$g_talk_troop"),
      ]],
  [anyone|plyr,"spouse_leave_confirm", [], "No, I'd rather have you at my side.", "do_member_trade",[]],


and now, to see her morale bar on conversation screen;

[anyone ,"member_chat", [
(store_conversation_troop, "$g_talk_troop"),
                    (try_begin),
                        (is_between, "$g_talk_troop", companions_begin, companions_end),
                        (talk_info_show, 1),
                        (call_script, "script_setup_talk_info_companions"),
                    (else_try),
                      (troop_is_hero, "$g_talk_troop"),
                      (talk_info_show, 1),
                      (call_script, "script_setup_talk_info"),
                    (else_try),

                        (is_between, "$g_talk_troop", pretenders_begin, pretenders_end),
                        (talk_info_show, 1),
                        (call_script, "script_setup_talk_info"),
                    (try_end),

Now it's done!

She basicly stays as your wife in game mechanics, but can do anything a companion does. So she will appear in your court when you are at and all options will be avaiable. But there are few glitches, if she wears any "non-civilian" armors, she will appear naked at castle. And this happened to me few times, her weapon slots got messed up. But if you make her unequip all weapons, back to menu and go to her inv again it will be fixed!


Feel free to use it :smile:
Cheers!
-Lath
 
I always wanted a tutorial for this, thanks!

Now if we can figure out how to make her clothes work like the other companions...

One thing... what file is "spouse_talk" in?
 
All of this goes in module_dialogs.
Code:
                       (troop_is_hero, "$g_talk_troop"),
                       (talk_info_show, 1),
                       (call_script, "script_setup_talk_info"),
                    (else_try),
You should use (this_or_next|troop_slot_eq, "trp_player", slot_troop_spouse, "$g_talk_troop"), to avoid duplicate code.
What you can do to circumvent the issue with civilian items being removed is to add them to her inventory again - by either storing her previous civilian clothing inside troop slots or calling script_add_lady_items in spouse_leave_confirm, which does have a degree of randomization. Pretend she went on a shopping spree afterwards or something.
 
will this let her heradlic banner be the same as yours? or is she going to carry around random banners whereever she is
 
Trying to figure out this for MB Warband with Prophesy of Pendor, could not find this sectionin "conversation.txt".
 
sifsilver said:
will this let her heradlic banner be the same as yours? or is she going to carry around random banners whereever she is

In cities she will use the owner's heraldy. But in other battle maps she is going to use yours.

Also it's for module files, not conversations.txt
 
maxya said:
Trying to figure out this for MB Warband with Prophesy of Pendor, could not find this sectionin "conversation.txt".
Somebody said:
All of this goes in module_dialogs.
Code:
                       (troop_is_hero, "$g_talk_troop"),
                       (talk_info_show, 1),
                       (call_script, "script_setup_talk_info"),
                    (else_try),
You should use (this_or_next|troop_slot_eq, "trp_player", slot_troop_spouse, "$g_talk_troop"), to avoid duplicate code.
What you can do to circumvent the issue with civilian items being removed is to add them to her inventory again - by either storing her previous civilian clothing inside troop slots or calling script_add_lady_items in spouse_leave_confirm, which does have a degree of randomization. Pretend she went on a shopping spree afterwards or something.

You also would need the PoP module system
 
SeRgYu said:
What kind of deutschebag would send his wife to participate in a war? :lol:

Many ancient cultures had a place for warrior women, sarmatian tribes, Japanese samurai-wives, and many matriachal cultures had it for example. It's the greek culture's point of view to the women -which adopted by Roman empire later-places the women out of "manly" business, such as war. But m&b setting is mostly unexplained and&or have different cultures which are open to  many possibilities, so I say, why we shouldn't let her? :razz:

Edit:fixed some typos&grammar massacres.
 
This guide is kind of terrible. It's supposed to be directed towards amateurs, but I have no idea where he's saying to put things. And then some people are saying to put this here. And another says no, it's supposed to go there. Just so confusing. :/ Can anyone help me with a more precise step by step?
 
It's supposed to be directed towards amateurs, but I have no idea where he's saying to put things.
If you're not yet familiar with Module System, you need to learn to crawl before you can walk, and be a little more patient.

Anyhow, here's a little more help:  all of these bits of code need to go into module_dialogs; they're modifying the various bits of code one uses to talk to one's Companions. 

Do a search of that code for "member talk" and you'll start finding the bits he's referring to, and then it's pretty straightforward to modify it to match his examples.
 
Is there a way to do this without the module system?  As I understand it, if I use the module system, it will over-write all the other direct changes I've made to the various txt files.
 
ah oke sounds intresting have think many times why not recruit some villagers as companion ..tavern is okey but simple ride into village ask some roaming peoples if some one join your party,(otherwise same with wedding i dont want a noble lady,they want live most in castles lol a normal girl froma village ^^is enough)...is way better and not only this trade thingy lol i have give up to ask in villages peoples XD

ah and its hard to understand where a non script guy have to put this commands in a list....its better you put some finished copy here for download or well as paste ^^ and im  used  alots mods where ive to rewrite modules txt...example the face mod or narfs millanese armor..

btw nice idea=D
 
I hope not to insult the OP by adding this here, but if somebody is looking to more "wife oriented" stuff I've done a little addition to Diplomacy here:

http://forums.taleworlds.com/index.php?topic=231247.msg5533074#msg5533074

It differentiates between the wife personality when asking her to become a companion: only two out of five types will join you, and with different equipment and starting characteristics. There are also instructions to add wife quests, but it's only the barebone.
 
Back
Top Bottom