From 1e1eeda287bcbfdc32863f998f3fddcea2dbbf17 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Wed, 27 May 2026 09:52:31 +0800 Subject: [PATCH] Corrected the object ID range for party members --- artifacts/scripting/functions.yml | 6 +++--- artifacts/scripting/sfall function notes.md | 6 +++--- sfall/Modules/Objects.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/artifacts/scripting/functions.yml b/artifacts/scripting/functions.yml index 8d23b860..374d5eaa 100644 --- a/artifacts/scripting/functions.yml +++ b/artifacts/scripting/functions.yml @@ -958,7 +958,7 @@ doc: | 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. + - Starting from sfall 4.5/3.8.50, the maximum possible NPC level is 10. - name: get_npc_level detail: int get_npc_level(string npc) opcode: 0x8241 @@ -1503,7 +1503,7 @@ - __NOTE:__ if the msg file does not exist in the current language directory, the function will try to load it from the `text\English\game\` directory. Alternative form: `int add_extra_msg_file(string fileName, int fileNumber)` **[DEPRECATED]** - - __Deprecation notice:__ Starting from sfall 4.4.10/3.8.50, the two-argument form is deprecated. The `fileNumber` argument is ignored, and the function behaves the same as the one-argument form. + - __Deprecation notice:__ Starting from sfall 4.5/3.8.50, the two-argument form is deprecated. The `fileNumber` argument is ignored, and the function behaves the same as the one-argument form. macro: sfall.h - name: void sfall_func0("remove_timer_event") @@ -2086,7 +2086,7 @@ - items with unique IDs will not stack with other items of the same type in the inventory - to just get the current ID number of an object, use `get_object_data(object, OBJ_DATA_ID)` - unique ID numbers are saved in your savegame, and have a range from 0x10000000 to 0x7FFFFFFF - - there is also a unique ID number range for the player and party members from 18000 to 83535 + - there is also a unique ID number range for the player and party members from 18000 to 16795215 - to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument macro: sfall.h diff --git a/artifacts/scripting/sfall function notes.md b/artifacts/scripting/sfall function notes.md index 559bfe48..2087ab4c 100644 --- a/artifacts/scripting/sfall function notes.md +++ b/artifacts/scripting/sfall function notes.md @@ -120,7 +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. +- Starting from sfall 4.5/3.8.50, the maximum possible NPC level is 10. ----- #### `int get_npc_level(int pid/string name)` @@ -831,7 +831,7 @@ sfall_funcX metarule functions - Items with unique IDs will not stack with other items of the same type in the inventory - To just get the current ID number of an object, use `sfall_func2("get_object_data", object, OBJ_DATA_ID)` - Unique ID numbers are saved in your savegame, and have a range from `0x10000000` to `0x7FFFFFFF` -- There is also a unique ID number range for the player and party members from 18000 to 83535 +- There is also a unique ID number range for the player and party members from 18000 to 16795215 - To assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument ---- @@ -865,7 +865,7 @@ sfall_funcX metarule functions - Loads a custom message file and returns the file ID number assigned to it, in the range of `0x3000` to `0x3FFF`, for use with the `message_str_game` function - `fileName`: the name of the custom message file (including the **.msg** extension) in the `text\\game\` directory - __NOTE:__ if the msg file does not exist in the current language directory, the function will try to load it from the `text\English\game\` directory -- __Deprecation notice:__ Starting from sfall 4.4.10/3.8.50, the two-argument form is deprecated. The `fileNumber` argument is ignored, and the function behaves the same as the one-argument form. +- __Deprecation notice:__ Starting from sfall 4.5/3.8.50, the two-argument form is deprecated. The `fileNumber` argument is ignored, and the function behaves the same as the one-argument form. ---- #### unwield_slot diff --git a/sfall/Modules/Objects.cpp b/sfall/Modules/Objects.cpp index b4e2113b..bdbf1e30 100644 --- a/sfall/Modules/Objects.cpp +++ b/sfall/Modules/Objects.cpp @@ -32,7 +32,7 @@ static int maxCountLoadProto = 512; long Objects::uniqueID = UniqueID::Start; // current counter id, saving to sfallgv.sav bool Objects::IsUniqueID(long id) { - return (id > UniqueID::Start || (id >= fo::PLAYER_ID && id < 83536)); // 65535 maximum possible number of prototypes + return (id > UniqueID::Start || (id >= fo::PLAYER_ID && id < 16795216)); // party member ID = (pid & 0xFFFFFF) + PLAYER_ID } void Objects::SetScriptObjectID(fo::GameObject* obj) { @@ -98,11 +98,11 @@ identical: static __declspec(naked) void new_obj_id_hook() { __asm { - mov eax, 83535; + mov eax, 16795215; cmp ds:[FO_VAR_cur_id], eax; jle pickNewID; retn; -pickNewID: // skip PM range (18000 - 83535) +pickNewID: // skip PM range (18000 - 16795215) mov ds:[FO_VAR_cur_id], eax; jmp fo::funcoffs::new_obj_id_; }