• 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 An officer with the reputation 90 causes RT errors.

jsv

Freebooter
Storm Modder
The first officer I hired in that new game happens to have reputation of 90 (which is 1 above REPUTATION_MAX):

index = 1465
id = Enc_Officer_0
model = korsar
entity = NPCharacter
animation = man
height = 1.8000000
sex = man
faceid = 19
headmodel = h_korsar
reputation = 90
friend = 1
nation = 5
name = 5
name = Sansгo
lastname = De Menses

When I look at his character screen, I see a blank line where his reputation is supposed to be, and when I look at error.log I see this:

Code:
RUNTIME ERROR - file: characters\characterUtilite.c; line: 1886
invalid index 9 [size:9]
RUNTIME ERROR - file: characters\characterUtilite.c; line: 1886
invalid array index
RUNTIME ERROR - file: characters\characterUtilite.c; line: 1886
Unknown data type
RUNTIME ERROR - file: characters\characterUtilite.c; line: 1886
Unknown data type
RUNTIME ERROR - file: characters\characterUtilite.c; line: 1886
string function return UNKNOWN value
RUNTIME ERROR - file: characters\characterUtilite.c; line: 1873
Unknown data type
RUNTIME ERROR - file: characters\characterUtilite.c; line: 1873
Unknown data type

The function where that happens:

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));
    return ReputationTable[rep];
// <-- KK
}
 
I see this in the function which handles increases to rep:
Code:
    int newVal = iclamp(REPUTATION_MIN, REPUTATION_MAX, prevVal + incr);
    chref.reputation = newVal;

Reputation max is 89 so it must be happening somewhere else...

A new officer gets created by using this:
Code:
ch.reputation = rand(88) + 1;

So that can't be it either ... somewhere after the officer is created the reputation must be increased further...

But found it in the fantomcharacter which is used for encounters :)
Code:
chr.reputation = 20 + rand(70);

Search for that line in LAi_utils and change the 70 to 69 or use the attached file. It might be this one is outdated. I haven't had time to update my game yet with the new installer.
 

Attachments

  • LAi_utils.c
    22.8 KB · Views: 99
Back
Top