Fallout 2 mod How to make Dialogue Background change for Companions

Goat_Boy

Still Mildly Glowing
Hi there,

I recently made a mod that adds Talking Heads (portraits) to all companions in Fallout 2.
Sadly, unlike vanilla party members, their background doesn't change in base to their location and that slightly ruins the immersion for me.

By analysing Sulik's script I noticed that in the line where you add the talking head and backdrop (G_StartDialog if I remember right), instead of putting the number representing the background, you'd put something like PartyMemberBackground (don't remember the exact name).
I tried doing that but that didn't work for me, I'm very new to scripting.

Does anybody know the proper command? Or would anybody be willing to edit those scripts?
 
It should be this line (342) where you define Suliks talking head and backdrop (KCSULIK.SSL).
Code:
start_gdialog(NAME,self_obj,4,HEAD_SULIK,PartyMemberBackground);

If you right click at the macro "find_party_background;" on line (329) in the Sfall Script Editor and select "Go to declaration" or press "Strg+F12", you'll open file PARTYBKG.H.

Behind "find_party_background;" hides this:
Code:
#define find_party_background       if (cur_town == AREA_ARROYO) then begin                                                    \
                                        if (cur_map_index == MAP_ARROYO_CAVES) then                                           \
                                            PartyMemberBackground:=BACKGROUND_CAVE;                                            \
                                        else if (cur_map_index == MAP_ARROYO_WILDERNESS) then                                  \
                                            PartyMemberBackground:=BACKGROUND_WASTELAND;                                       \
                                        else                                                                                   \
                                            PartyMemberBackground:=BACKGROUND_RAIDERS;                                         \
                                    end                                                                                        \
                                    else if (cur_town == AREA_KLAMATH) then begin                                              \
                                        PartyMemberBackground:=BACKGROUND1;                                                    \
                                    end                                                                                        \
                                    else if (cur_town == AREA_DEN) then begin                                                  \
                                        PartyMemberBackground:=BACKGROUND_HUB;                                                 \
                                    end                                                                                        \
                                    else if (cur_town == AREA_MODOC) then begin                                                \
                                        PartyMemberBackground:=BACKGROUND_HUB;                                                 \
                                    end                                                                                        \
                                    else if (cur_town == AREA_VAULT_CITY) then begin                                           \
                                        PartyMemberBackground:=BACKGROUND_SHADY;                                               \
                                    end                                                                                        \
                                    else if (cur_town == AREA_GECKO) then begin                                                \
                                        PartyMemberBackground:=BACKGROUND_JUNKTOWN;                                            \
                                    end                                                                                        \
                                    else if (cur_town == AREA_BROKEN_HILLS) then begin                                         \
                                        PartyMemberBackground:=BACKGROUND_JUNKTOWN;                                            \
                                    end                                                                                        \
                                    else if (cur_town == AREA_NEW_RENO) then begin                                             \
                                        PartyMemberBackground:=BACKGROUND_FOLLOWER;                                            \
                                    end                                                                                        \
                                    else if (cur_town == AREA_SIERRA_ARMY_BASE) then begin                                     \
                                        if (cur_map_index == MAP_SIERRA_BATTLE) then                                           \
                                            PartyMemberBackground:=BACKGROUND_WASTELAND;                                       \
                                        else                                                                                   \
                                            PartyMemberBackground:=BACKGROUND_MILITARYBS;                                      \
                                    end                                                                                        \
                                    else if (cur_town == AREA_VAULT_15) then begin                                             \
                                        if (cur_map_index == MAP_VAULT_15) then                                                \
                                            PartyMemberBackground:=BACKGROUND_VAULT;                                           \
                                        else                                                                                   \
                                            PartyMemberBackground:=BACKGROUND_WASTELAND;                                       \
                                    end                                                                                        \
                                    else if (cur_town == AREA_NCR) then begin                                                  \
                                        PartyMemberBackground:=BACKGROUND_SHADY;                                               \
                                    end                                                                                        \
                                    else if (cur_town == AREA_VAULT_13) then begin                                             \
                                        if (cur_map_index == MAP_VAULT_13) then                                                \
                                            PartyMemberBackground:=BACKGROUND_VAULT;                                           \
                                        else                                                                                   \
                                            PartyMemberBackground:=BACKGROUND_CAVE;                                            \
                                    end                                                                                        \
                                    else if (cur_town == AREA_MILITARY_BASE) then begin                                        \
                                        if (cur_map_index == MAP_MILITARY_BASE_ENTRANCE) then                                  \
                                            PartyMemberBackground:=BACKGROUND_WASTELAND;                                       \
                                        else                                                                                   \
                                            PartyMemberBackground:=BACKGROUND_CAVE;                                            \
                                    end                                                                                        \
                                    else if (cur_town == AREA_REDDING) then begin                                              \
                                        if ((cur_map_index == MAP_REDDING_DTOWN_TUNNEL) or                                     \
                                            (cur_map_index == MAP_REDDING_MINE_TUNNEL) or                                      \
                                            (cur_map_index == MAP_REDDING_WANAMINGO_12)) then                                  \
                                            PartyMemberBackground:=BACKGROUND_CAVE;                                            \
                                        else                                                                                   \
                                            PartyMemberBackground:=BACKGROUND_HUB;                                             \
                                    end                                                                                        \
                                    else if (cur_town == AREA_SAN_FRANCISCO) then begin                                        \
                                        PartyMemberBackground:=BACKGROUND_FOLLOWER;                                            \
                                    end                                                                                        \
                                    else if (cur_town == AREA_NAVARRO) then begin                                              \
                                        if (elevation(self_obj) == 1) then                                                     \
                                            PartyMemberBackground:=BACKGROUND_JUNKTOWN;                                        \
                                        else                                                                                   \
                                            PartyMemberBackground:=BACKGROUND_MILITARYBS;                                      \
                                    end                                                                                        \
                                    else                                                                                       \
                                        Call Check_Next_Third_Of_Areas

Code:
procedure Check_Next_Third_Of_Areas begin
   if (cur_town == AREA_THE_ENCLAVE) then begin
       PartyMemberBackground:=BACKGROUND_ENCLAVE;
   end

   else if (cur_town == AREA_ABBEY) then begin
      PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_PRIMITIVE_TRIBE) then begin
      PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_EPA) then begin
      PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_GHOST_TOWN) then begin
   end

   else if (cur_town == AREA_CAR_OUTTA_GAS) then begin
      PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_ARROYO_DESTROYED) then begin
      PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_KLAMATH_TOXIC_CAVES) then begin
       PartyMemberBackground:=BACKGROUND_CAVE;
   end
   else if (cur_town == AREA_DEN_SLAVE_RUN) then begin
      PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_RAIDERS) then begin
      if (cur_map_index == MAP_RAIDERS_CAMP1) then begin
        if (elevation(self_obj) == 0) then
            PartyMemberBackground:=BACKGROUND_WASTELAND;
        else
            PartyMemberBackground:=BACKGROUND_NECROPOLIS;
      end
      else
        PartyMemberBackground:=BACKGROUND_CAVE;
   end

   else if (cur_town == AREA_RND_DESERT) then begin
      PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_RND_MOUNTAIN) then begin
        if (elevation(self_obj) == 1) then
            PartyMemberBackground:=BACKGROUND_CAVE;
        else
            PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_RND_CITY) then begin
      PartyMemberBackground:=BACKGROUND_NECROPOLIS;
   end

   else if (cur_town == AREA_RND_COAST) then begin
        if (elevation(self_obj) == 1) then
            PartyMemberBackground:=BACKGROUND_CAVE;
        else
            PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_GOLGATHA) then begin
        if (elevation(self_obj) == 1) then
            PartyMemberBackground:=BACKGROUND_CAVE;
        else
            PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else
       call Check_Second_Third_Of_Areas;
end

Code:
procedure Check_Second_Third_Of_Areas begin
   if (cur_town == AREA_SPECIAL_RND_WHALE) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_WOODSMAN) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_HEAD) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_SHUTTLE) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_UNWASHED) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_BRIDGE) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_CAFE) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_HOLY1) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_HOLY2) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_GUARDIAN) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_PRIMITIVE_TRIBE) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_TOXIC) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_PARIAH) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SPECIAL_RND_MAD_COW) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_CARAVAN_ENCOUNTER) then begin
       PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else
       call Check_Final_Third_Of_Areas;
end

Code:
procedure Check_Final_Third_Of_Areas begin
   if (cur_town == AREA_FAKE_VAULT_13A) then begin
       if (elevation(self_obj) == 1) then
           PartyMemberBackground:=BACKGROUND_CAVE;
       else
           PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_FAKE_VAULT_13B) then begin
       if (elevation(self_obj) == 1) then
           PartyMemberBackground:=BACKGROUND_CAVE;
       else
           PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_SHADOW_MAPS) then begin
        if (elevation(self_obj) == 1) then
            PartyMemberBackground:=BACKGROUND_CAVE;
        else
            PartyMemberBackground:=BACKGROUND_WASTELAND;
   end

   else if (cur_town == AREA_RENO_STABLES) then begin
       PartyMemberBackground:=BACKGROUND_HUB;
   end
end

So, when talking to Sulik, the procedure talk_p_proc will be called.
The engine works off the procedure from top to bottom.
It will encounter "find_party_background;" and jumps into PARTYBKG.H and here again it will work off the macro from top to bottom until it determines in what location the current spoken to npc is.

Let's assume you and Sulik are inside the Arroyo caves, then this will match:
Code:
#define find_party_background       if (cur_town == AREA_ARROYO) then begin                                                    \
                                        if (cur_map_index == MAP_ARROYO_CAVES) then                                           \
                                            PartyMemberBackground:=BACKGROUND_CAVE;
And the constant "BACKGROUND_CAVE;" will be saved into the variable "PartyMemberBackground" and so Suliks head will appear on the Arroyo cave background.

I hope I could help you.
 
Last edited:
Don't know if this is of any use, but with your mod the companions change background on the Raiders map. It's isn't the correct one though.
 
It should be this line (342) where you define Suliks talking head and backdrop (KCSULIK.SSL).
Code:
start_gdialog(NAME,self_obj,4,HEAD_SULIK,PartyMemberBackground);

If you right click at the macro "find_party_background;" on line (329) in the Sfall Script Editor and select "Go to declaration" or press "Strg+F12", you'll open file PARTYBKG.H.

Thank you for the detailed response Femic!

My knowledge of scripting is really limited so this all sounds like Chinese to me :lol::lol:

I'm going to try this out, best way to learn things is by trial and error!
 
Don't know if this is of any use, but with your mod the companions change background on the Raiders map. It's isn't the correct one though.

Huh that's interesting.

By Raiders map, do you mean the small raider base south of Vault City? The one you have to find the coordinates for?
And the companions from my mod change their background there?
 
Can you show me your script Goat_Boy? Maybe I'll manage to find the error.

Let me explain you how line 342 in KCSULIK.SSL works.

Code:
start_gdialog(NAME,self_obj,4,HEAD_SULIK,PartyMemberBackground);

When you hover over "start_gdialog" it says following:

Code:
void start_qdialog(int msgFileNum, ObjectPtr who, int mood, int headNum, int backgroundldx

Start the dialogue system focusing on a critter (who) and starting in a given (mood). This call sets up the appropriate dialog windows, head art, etc. If this call is not made before the normal dialog calls (sayReply, sayMessage, sayOption, etc.) then the dialog windows will not come up, and only grey boxes will appear with the text.

Let examinate it step by step.

The function "start_gdialog" is a basic function that invokes the dialog system.
It has 5 parameters that need to be handed over.
1. Parameter is the message file of Sulik.
At line 31 it says:
Code:
#define NAME                    SCRIPT_KCSULIK
NAME is simply the constant, the placeholder for SCRIPT_KCSULIK.
You don't need to use NAME as a placeholder for SCRIPT_KCSULIK.

2. Parameter is the object pointer. The pointer points on itself.
So if this scripit is attached to Sulik the pointer points on Sulik.

3. Paramter is the characters mood. I think 4 is neutral.

4. Parameter is the image for the chars head.

5. Parameter is the image for the backdrop.

Inside file ACKLINT.SSL you see this:
Code:
start_gdialog(NAME,self_obj,4,-1,-1);

Everything is the same except for the last two parameters.
Because Klint doesn't have a talking head, so set -1 and he has no talking head backdrop, so even this has -1.
If you don't use -1 on non talking head, the engine will be going nuts.
 
Can you show me your script Goat_Boy? Maybe I'll manage to find the error.

Let me explain you how line 342 in KCSULIK.SSL works.

Code:
start_gdialog(NAME,self_obj,4,HEAD_SULIK,PartyMemberBackground);
.

Hi Femic, I managed to do this!

Thank you so much for your help! This is something I've been wanting to fix for ages, you made this mod a lot more interesting.

Only small issue is that sometimes the backgrounds are different than what they should be, it doesn't happen often only in a couple of maps that I noticed: the Enclave encounter outside Gecko and the Slavers camp where Sulik's sister is, could that be cause they are Restoration Project maps? Over maps from the RP work fine (like the EPA).
 
You're welcome. I'm glad I could help.

In file DEFINE.H beginning at line 152 to 171 you'll find every background used inside the game.

Code:
#define BACKGROUND1           (2)    // rstymetl
#define BACKGROUND_HUB        (3) //hub.frm
#define BACKGROUND_NECROPOLIS (4) //necro.frm
#define BACKGROUND_BHOOD      (5) //bhood.frm
#define BACKGROUND_MILITARYBS (6) //military.frm
#define BACKGROUND_JUNKTOWN   (7) //junktown.frm
#define BACKGROUND_CATHEDRAL  (8) //cath.frm
#define BACKGROUND_SHADY      (9) //shady.frm
#define BACKGROUND_VAULT     (10) //vault.frm
#define BACKGROUND_MASTER    (11) //master.frm
#define BACKGROUND_FOLLOWER  (12) //follow.frm
#define BACKGROUND_RAIDERS   (13) //raider.frm
   // Start of Fallout 2: Backgrounds
#define BACKGROUND_CAVE      (14) //cave0001.frm
#define BACKGROUND_ENCLAVE   (15) //enclave.frm
#define BACKGROUND_WASTELAND (16) //wastelnd.frm
#define BACKGROUND_BOSS      (17) // boss.frm
#define BACKGROUND_PRESIDENT (18)       // pres.frm
#define BACKGROUND_TENT      (19)       // tent.frm
#define BACKGROUND_ADOBE     (20)       // Adobe.frm

Enclave encounter outside Gecko and the Slavers camp where Sulik's sister is
Maybe you can show me the error?

could that be cause they are Restoration Project maps?
It the maps are called the same like in the original game, it shouldn't be a problem.
But if they are called differently at Restoration Project it could be a problem.
 
You're welcome. I'm glad I could help.
Maybe you can show me the error?


It the maps are called the same like in the original game, it shouldn't be a problem.
But if they are called differently at Restoration Project it could be a problem.

Thank you for showing me that, it's not really an error in the script just the wrong background appearing ingame.

Although I reloaded those saves and everything is working fine now with no issues :lol:
 
Back
Top