• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Fixed Reputation and PcharRepPhrase code

Talisman

Smuggler
Storm Modder
Reputation

Reputation ( original game ) - in Program\Characters\CharacterUtilite.c

Code:
// table service
string GetReputationName(int reputation)
{
  if(reputation<11)
  return ReputationTable[REPUTATIONT_HORROR];
  if(reputation<21)
  return ReputationTable[REPUTATIONT_BASTARD];
  if(reputation<31)
  return ReputationTable[REPUTATIONT_SWINDLER];
  if(reputation<41)
  return ReputationTable[REPUTATIONT_RASCAL];
  if(reputation<51)
  return ReputationTable[REPUTATIONT_NEUTRAL];
  if(reputation<61)
  return ReputationTable[REPUTATIONT_PLAIN];
  if(reputation<71)
  return ReputationTable[REPUTATIONT_GOOD];
  if(reputation<81)
  return ReputationTable[REPUTATIONT_VERYGOOD];
  if(reputation<90)
  return ReputationTable[REPUTATIONT_HERO];
   return "";
}

Reputation ( New Horizons build 14 ) - in Program/Characters/CharacterUtilite.c

Code:
string GetReputationName(int reputation)
{
// KK -->
   int delta = roundup(makefloat(REPUTATION_MAX - REPUTATION_MIN + 1) / makefloat(REPUTATION_TABLE_SIZE));
   int rep = makeint(makefloat(reputation) / makefloat(delta) - 0.5);   // GR: Add -0.5
   if (rep < 0) rep = 0;                         // GR: Needed because reputation < 5 will give rep < 0
   return ReputationTable[rep];
// <-- KK
}

this gives:-

Reputation range

1-14 Horror of the High Seas - Femme Fatale
15-24 Bloody Terror - Scarlet
25-34 Swindler - Vixen
35-44 Rascal - Floozy
45-54 Neutral - Damsel
55-64 Bloke - Lass
65-74 Matey - Maiden
75-84 Dashing - Lady
85-89(max) Hero - Heroine


PcharRepPhrase

PcharRepPhrase - ( original game & New Horizons Build 14 ) unchanged

in Program\Dialog_func.c

Code:
string PCharRepPhrase (string Var1, string Var2)
{
   ref pchar = GetMainCharacter();

   if(makeint(pchar.reputation) < 41)
   {
     return Var2;
   }
   else
   {
     return Var1;
   }
}


This means that at the moment if a player has a reputation below 41 they will get a different dialog text ( & possibly link ) than a player with a higher reputation

For example in Sylvie Bondies_dialog.c

Code:
case "goddaughter_denied":
       Dialog.snd = "voice\SYBO001\SYBO013";
       dialog.text = DLG_TEXT[63];
       link.l1 = pcharrepphrase(DLG_TEXT[64], DLG_TEXT[65]);
       link.l1.go = pcharrepphrase("goddaughter_denied_1", "goddaughter_denied_2");
     break;

leading to EITHER

Code:
case "goddaughter_denied_1":
       Dialog.snd = "voice\SYBO001\SYBO014";
       dialog.text = DLG_TEXT[66] + GetMyAddressForm(NPChar, PChar, ADDR_CIVIL, false, false) + DLG_TEXT[67] + GetMyName(&Characters[GetCharacterIndex(DLG_TEXT[68])]) + DLG_TEXT[69];
       link.l1 = DLG_TEXT[70];
       link.l1.go = "goddaughter_denied_confirm";
       link.l2 = DLG_TEXT[71];
       link.l2.go = "goddaughter";
     break;

OR

Code:
case "goddaughter_denied_2":
       Dialog.snd = "voice\SYBO001\SYBO016";
       dialog.text = DLG_TEXT[75] + GetMyAddressForm(NPChar, PChar, ADDR_CIVIL, false, false) + DLG_TEXT[76];
       link.l1 = DLG_TEXT[77];
       link.l1.go = "goddaughter_denied_confirm_1";
     break;



The problem is that in New Horizons the player can have the same reputation ( Rascal - Floozy) and get a different outcome depending on where they are in the ( Rascal - Floozy) reputation band (35-44) - above or below 41.

This means they have no idea why they are getting different outcomes because their F2>Character screen will show the same reputation of ( Rascal - Floozy).

The value of 41 for the PcharRepPhrase function appears unchanged since the original game when it was the lowest value for the Neutral Reputation.

To make the PcharRepPhrase function work as originally intended, the value in New Horzons should be changed to 45.
So that the different outcomes happen when the player's reputation drops from Neutral (Damsel) to Rascal (Floozy). And thus the player sees that they get different outcomes when their reputation drops.


Am I talking sense here or have I misunderstood something?

I am not sure about the string GetReputationName(int reputation) code in Build 14. - Is my assumption about the reputation bands correct?

Thanks


:cheers
 
@Grey Roger once made a correction to the 'GetReputationName' function.

It wouldn't surprise me though if 'PCharRepPhrase' was never correctly updated to match, so you are most likely correct that this should indeed be changed.

Apart from your example above, is that function ever used for anything other than changing the displayed text?
I always assumed it was intended only for that, so was quite surprised to see its use in Sylvie Bondies_dialog.c .
 
PcharRepPhrase - appears to be used to change both the displayed dialog text and also the link to the next case ( see the Sylvie Bondies_dialog.c example above ).

Did a search - it is used in approx 125 dialog files - most seem the be traders ( storekeepers - stallholders etc) and tavernkeepers.

There are also dialog files specific to @Grey Roger 's Ardent story. Which is why I don't want to change anything without checking carefully first. :D

:drunk
 
I don't recall doing anything specifically with that function. Doing a search of my own, the only storyline-specific dialogs which use it are those for the Indians on Isla Mona, and that's only because their dialog is based on the standard citizen type dialog. (Additionally, the 28th July installer still copies several obsolete dialog files into the story-specific folder which shouldn't be there any more because I updated the versions in the general dialog file instead - "Charles Windem_dialog.c", for example.) So I've no objection to 'PcharRepPhrase' being corrected - it won't do anything to the story and will mean those NPC's react correctly to non-story dialog. :onya
 
Additionally, the 28th July installer still copies several obsolete dialog files into the story-specific folder which shouldn't be there any more because I updated the versions in the general dialog file instead - "Charles Windem_dialog.c", for example.
I remember you mentioned that, but I don't think I did anything about it yet.
Just to be certain I won't forget, could you make a Bug Tracker entry for it?

I don't recall doing anything specifically with that function.
It was the 'GetReputationName' function that you made a change to.
 
I remember you mentioned that, but I don't think I did anything about it yet.
Just to be certain I won't forget, could you make a Bug Tracker entry for it?
Will do.

It was the 'GetReputationName' function that you made a change to.
What I meant was, I don't recall making any use of 'PCharRepPhrase' for storyline purposes. So if @Talisman alters it, the storyline should not be affected.
 
What I meant was, I don't recall making any use of 'PCharRepPhrase' for storyline purposes. So if @Talisman alters it, the storyline should not be affected.
What I meant is that I was hoping, since you're somewhat familiar with the logic, if you could indeed confirm that @Talisman's interpretation is correct. :doff
 
This is 'PCharRepPhrase':
Code:
string PCharRepPhrase (string Var1, string Var2)
{
   ref pchar = GetMainCharacter();

   if(makeint(pchar.reputation) < 41)
   {
     return Var2;
   }
   else
   {
     return Var1;
   }
}
So yes, that interpretation is correct - it returns one or other of two strings depending on whether your reputation is lower than 41.

Reputation bands are defined in "PROGRAM\characters\characters.h" and, as @Talisman says, the border for "Neutral" is 45. So you can be borderline "Rascal" and 'PCharRepPhrase' will return the "good" alternative.

I couldn't remember what I did to 'GetReputationName' but looking at it, I can see what I did and why. Reputation boundaries presumably used to be multiples of 10, but now they're (multiples of 10) + 5. 'GetReputationName' involves a calculation which, due to that change, now needs an offset of -0.5 to make it round correctly. And, as @Talisman has noticed, 'PCharRepPhrase' needs the 41 to be replaced by 45 for exactly the same reason.
 
It's "PROGRAM\Dialog_func.c". Here's the one from your 27th September zip with the "41" replaced by "45".

You already have "CharacterUtilite.c" with the correct version of 'GetReputationName'. It's not a new modification and is in the .tar archive which is the base for any half-recent version of Beta 4. ;)

Edit: the problem is hardcoded values. The line now reads:
Code:
if(makeint(pchar.reputation) < REPUTATION_NEUTRAL)
REPUTATION_NEUTRAL is defined in "characters.h", currently as 45. If it changes again, this function won't care now.
 

Attachments

  • Dialog_func.c
    101.5 KB · Views: 161
Last edited:
Open characters.h and replace 41 with 45?
"characters.h" already has 4o replaced by 45, and all the other boundary values replaced as well. The problem is the occasional function such as 'PCharRepPhrase' which still uses the old values. ;)
 
It's "PROGRAM\Dialog_func.c". Here's the one from your 27th September zip with the "41" replaced by "45".

You already have "CharacterUtilite.c" with the correct version of 'GetReputationName'. It's not a new modification and is in the .tar archive which is the base for any half-recent version of Beta 4. ;)

Edit: the problem is hardcoded values. The line now reads:
Code:
if(makeint(pchar.reputation) < REPUTATION_NEUTRAL)
REPUTATION_NEUTRAL is defined in "characters.h", currently as 45. If it changes again, this function won't care now.


So it appears that reputation variables can now be coded in two different ways

So this in Arnaud Matton_dailog.c

Code:
case "quests":
       iTest = 0;
       dialog.snd = "Voice\ARMA\ARMA008";
       Dialog.text = DLG_TEXT[26];
       //////////////////////////////
       // Выдача квестов
       //////////////////////////////
       if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "blaze_begin" && makeint(pchar.reputation) > 40) // NK bugfix  
       {
         Link.l6 = DLG_TEXT[163];
         link.l6.go = "daughter";


could also be written as :-

Code:
case "quests":
       iTest = 0;
       dialog.snd = "Voice\ARMA\ARMA008";
       Dialog.text = DLG_TEXT[26];
       //////////////////////////////
       // Выдача квестов
       //////////////////////////////
       if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "blaze_begin" && makeint(pchar.reputation) > REPUTATION_NEUTRAL) // NK bugfix  
       {
         Link.l6 = DLG_TEXT[163];
         link.l6.go = "daughter";


or am I misunderstanding something? :confused:

:drunk
 
So it appears that reputation variables can now be coded in two different ways
Indeed you can use the number or refer to the #define.
Referring to the #define is preferred because then if those definitions are ever changed, the code still works as intended.
 
Perhaps make that:
Code:
if (characters[GetCharacterIndex("Sabine Matton")].quest.hire == "blaze_begin" && makeint(pchar.reputation) >= REPUTATION_NEUTRAL) // NK bugfix
REPUTATION_NEUTRAL is the minimum reputation to be neutral. If he's going to accept "Neutral" then he has to accept that minimum. Otherwise we're back to the problem where you can be borderline "Neutral" (not entirely unlikely, it's probably your default starting condition) and he'll treat you as if you were "Rascal".
 
Idea: Don't mark issues as "Fixed" until the fix is either in the Fixes Thread, your game version or my own.
Otherwise they might get archived without ever being included. :facepalm
 
Back
Top