I added new companions - Now default companions have the wrong dialogue!

Users who are viewing this thread

Frankmuddy

Veteran
I am attempting to add about 35 new companions all at once. Unfortunately I screwed something up - When I try to recruit default NPCs they're using the wrong dialogue. For instance - If I approach Bunduk and try to hire him he'll use Alayen's greeting, The Matheld's backstory 1 dialogue, Lezalit's background 2 dialogue, and Jeremus's background recap dialogue. I can't see where I screwed up in the code. I'd like to paste up the code here but trying to do the entire modules_scripts.py crashes flash both here and on pastebin and I'm not sure what or where exactly I screwed up.

Help? Suggestions? Taunts?

If you could help me get this all straightened out I would be grateful.

UPDATE

I chopped out just the parts that deal with NPCs. Hopefully the bug is in there, somewhere.

http://pastebin.com/vGAivwya - Module_troops.py



 
Sorry, I've been awake too long and I'm having trouble formatting this sensibly.

I went through and added entries for all the new NPCs in module_strings.py and module_scripts.py

http://pastebin.com/hfFcNEJW - Modules_Scripts.py

And

http://pastebin.com/UaQKru7Z - Modules_Strings.py

Sorry I didn't put those up in the first place. Entering everything into Strings has me a little batty. Eitherway, I can't figure out what I screwed up that's causing all the NPCs to play madlibs and use the wrong dialogue. I just don't know the module system well enough yet, I guess. If you've got any ideas I'd appreciate hearing them. So far this error doesn't seem to be causing any problems beyond weird dialogue but I'd like to get it fixed if I can.

UPDATE -

Whatever the error is it only seems to apply to the original vanilla companions. And it is screwing up their recruiting dialogue after the second backstory block. So the first page of backstory is right and the second page of backstory is right but the third page is wrong - It goes to another NPCs dialogue.

And.... I'm going to go pass out because I have been awake far, far too long.
 
Adding a lot of new companions needs a lot of new strings and there are bound to be mistakes.

Here's how to add code that will warn you (at game start) if you have the wrong number of strings.

Just after the companion initialization in game_start (module_scripts.py), find this code:
        (store_sub, "$number_of_npc_slots", slot_troop_strings_end, slot_troop_intro),

        (try_for_range, ":npc", companions_begin, companions_end),


            (try_for_range, ":slot_addition", 0, "$number_of_npc_slots"),
                (store_add, ":slot", ":slot_addition", slot_troop_intro),

                (store_mul, ":string_addition", ":slot_addition", 16),
                (store_add, ":string", "str_npc1_intro", ":string_addition"),
                (val_add, ":string", ":npc"),
                (val_sub, ":string", companions_begin),

                (troop_set_slot, ":npc", ":slot", ":string"),
            (try_end),
        (try_end),

Change it to this:
        (store_sub, "$number_of_npc_slots", slot_troop_strings_end, slot_troop_intro),
       
        (store_sub, ":total_companions", companions_end, companions_begin),
        (try_begin),
          (store_sub, reg1, "str_companion_strings_end", "str_npc1_intro"), #total actual strings
          (store_mul, reg2, "$number_of_npc_slots", ":total_companions"), #total strings needed
          (neq, reg1, reg2),
          (display_message, "@ERROR: Companion strings actual/needed: {reg1}/{reg2}", 0xFFFF2222),
        (try_end),


        (try_for_range, ":npc", companions_begin, companions_end),

            (try_for_range, ":slot_addition", 0, "$number_of_npc_slots"),
                (store_add, ":slot", ":slot_addition", slot_troop_intro),

                (store_mul, ":string_addition", ":slot_addition", ":total_companions"),
                (store_add, ":string", "str_npc1_intro", ":string_addition"),
                (val_add, ":string", ":npc"),
                (val_sub, ":string", companions_begin),

                (troop_set_slot, ":npc", ":slot", ":string"),
            (try_end),
        (try_end),

And add this string in module_strings.py after "npc16_turn_against" or whatever is your last companion dialog string:
Code:
  ("companion_strings_end", "INVALID"),

Start a new game - there will be an error message telling you if and how many strings are missing. If the number is fine, there will be no error.
 
Back
Top Bottom