Increased the maximum party member level from 6 to 10

Updated scripting documents.

* the game reserves 10 level-up messages for each party member. More
level-ups require either more hacks or renumbering all level-up messages
in misc.msg. Otherwise, one will start using others' lines (e.g. Sulik
says Lenny's lines after lv10).
This commit is contained in:
NovaRain
2026-04-11 00:02:23 +08:00
parent c42bed9ee4
commit d4c223a313
2 changed files with 6 additions and 5 deletions
@@ -120,6 +120,7 @@ FUNCTION REFERENCE
#### `void inc_npc_level(int pid/string name)`
- Takes a party member PID or an NPC name (deprecated, for compatibility with sfall 4.1.5/3.8.15 or earlier) as an argument. The NPC must be in your party.
- This function ignores the player's minimum level and the required number of level-ups between NPC level gains. It also ignores the random element, regardless of sfall's **NPCAutoLevel** or **PartyMemberNonRandomLevelUp** setting.
- Starting from sfall 4.4.10/3.8.50, the maximum possible NPC level is 10.
-----
#### `int get_npc_level(int pid/string name)`
+5 -5
View File
@@ -991,7 +991,7 @@ static __declspec(naked) void op_wield_obj_critter_adjust_ac_hook() {
static __declspec(naked) void NPCStage6Fix1() {
static const DWORD partyMember_init_End = 0x493D16;
__asm {
imul eax, edx, 204; // multiply record size 204 bytes by number of NPC records in party.txt
imul eax, edx, 220; // multiply record size 220 bytes by number of NPC records in party.txt
mov ebx, eax; // copy total record size for later memset
call fo::funcoffs::mem_malloc_; // malloc the necessary memory
jmp partyMember_init_End; // call memset to set all malloc'ed memory to 0
@@ -1001,7 +1001,7 @@ static __declspec(naked) void NPCStage6Fix1() {
static __declspec(naked) void NPCStage6Fix2() {
static const DWORD partyMemberGetAIOptions_End = 0x49423A;
__asm {
imul edx, 204; // multiply record size 204 bytes by NPC number as listed in party.txt
imul edx, 220; // multiply record size 220 bytes by NPC number as listed in party.txt
mov eax, dword ptr ds:[FO_VAR_partyMemberAIOptions]; // get starting offset of internal NPC table
jmp partyMemberGetAIOptions_End; // eax + edx = offset of specific NPC record
}
@@ -3829,13 +3829,13 @@ void BugFixes::init() {
HookCall(0x476598, drop_ammo_into_weapon_hook);
//}
// Enable party members with level 6 protos to reach level 6
// Enable party members with level 6 protos to reach level 6 (increase the maximum level from vanilla 5 to 10)
//if (IniReader::GetConfigInt("Misc", "NPCStage6Fix", 1)) {
dlogr("Applying NPC Stage 6 Fix.", DL_FIX);
MakeJump(0x493CE9, NPCStage6Fix1); // partyMember_init_
MakeJump(0x494224, NPCStage6Fix2); // partyMemberGetAIOptions_
SafeWrite8(0x494063, 6); // loop should look for a potential 6th stage (partyMember_init_)
SafeWrite8(0x4940BB, 204); // move pointer by 204 bytes instead of 200
SafeWrite8(0x494063, 10); // loop should look for a potential 10th stage (partyMember_init_)
SafeWrite32(0x4940BB, 220); // move pointer by 220 bytes instead of 200
//}
//if (IniReader::GetConfigInt("Misc", "NPCLevelFix", 1)) {