Corrected the object ID range for party members

This commit is contained in:
NovaRain
2026-05-27 09:52:31 +08:00
parent 17383dbd64
commit 1e1eeda287
3 changed files with 9 additions and 9 deletions
+3 -3
View File
@@ -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
+3 -3
View File
@@ -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\<language>\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
+3 -3
View File
@@ -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_;
}