diff --git a/artifacts/scripting/sfall function notes.md b/artifacts/scripting/sfall function notes.md index ca04c99d..f9224ba8 100644 --- a/artifacts/scripting/sfall function notes.md +++ b/artifacts/scripting/sfall function notes.md @@ -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)` diff --git a/sfall/Modules/BugFixes.cpp b/sfall/Modules/BugFixes.cpp index e13dc5a2..ff5491c6 100644 --- a/sfall/Modules/BugFixes.cpp +++ b/sfall/Modules/BugFixes.cpp @@ -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)) {