Author Topic: [Code] Adding your wife as a companion  (Read 6853 times)

0 Members and 1 Guest are viewing this topic.

Lathrael

  • Recruit
  • *
    • View Profile
  • Faction: Bandit
[Code] Adding your wife as a companion
« on: May 16, 2011, 06:03:11 PM »
   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 :)
Cheers!
-Lath
« Last Edit: May 17, 2011, 03:10:53 PM by Lathrael »

Drachen

  • Regular
  • *
    • View Profile
  • Faction: Neutral
  • WBWF&S
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?

Somebody

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Bandit
  • WBWF&S
All of this goes in module_dialogs.
(click to show/hide)
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.
« Last Edit: May 27, 2011, 06:09:36 AM by Somebody »

Drachen

  • Regular
  • *
    • View Profile
  • Faction: Neutral
  • WBWF&S
Sorry, I'm something of a noob, what does "storing her previous civilian clothing inside troop slot " mean?

Drachen

  • Regular
  • *
    • View Profile
  • Faction: Neutral
  • WBWF&S
And, what text file does Module_Dialoges get written to?

sifsilver

  • Recruit
  • *
    • View Profile
  • Faction: Sarranid
will this let her heradlic banner be the same as yours? or is she going to carry around random banners whereever she is

SPD_Phoenix

  • Master Knight
  • *
    • View Profile
  • Faction: Neutral
And, what text file does Module_Dialoges get written to?
Conversations.txt

maxya

  • Recruit
  • *
    • View Profile
  • Faction: Neutral
Trying to figure out this for MB Warband with Prophesy of Pendor, could not find this sectionin "conversation.txt".

Lathrael

  • Recruit
  • *
    • View Profile
  • Faction: Bandit
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

SeRgYu

  • Sergeant at Arms
  • *
  • Zinger the Royal Stargazer
    • View Profile
  • Faction: Nord
  • WB
What kind of deutschebag would send his wife to participate in a war? :lol:

Specialist

  • Master Knight
  • *
  • Coder
    • View Profile
  • Faction: Neutral
  • MP nick: TheSpecialist
  • WB
Trying to figure out this for MB Warband with Prophesy of Pendor, could not find this sectionin "conversation.txt".
All of this goes in module_dialogs.
(click to show/hide)
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

Lathrael

  • Recruit
  • *
    • View Profile
  • Faction: Bandit
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? :P

Edit:fixed some typos&grammar massacres.
« Last Edit: October 14, 2011, 12:28:29 AM by Lathrael »

KidStein

  • Sergeant
  • *
    • View Profile
  • Faction: Neutral
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?
« Last Edit: February 26, 2012, 05:32:44 PM by KidStein »


xenoargh

  • Grandmaster Knight
  • *
    • View Profile
  • Faction: Neutral
Quote
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.

danest

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: [Code] Adding your wife as a companion
« Reply #14 on: May 14, 2012, 05:04:42 PM »
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.