Skip to content

Commit 1e1eeda

Browse files
committed
Corrected the object ID range for party members
1 parent 17383db commit 1e1eeda

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

artifacts/scripting/functions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@
958958
doc: |
959959
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.
960960
- 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.
961-
- Starting from sfall 4.4.10/3.8.50, the maximum possible NPC level is 10.
961+
- Starting from sfall 4.5/3.8.50, the maximum possible NPC level is 10.
962962
- name: get_npc_level
963963
detail: int get_npc_level(string npc)
964964
opcode: 0x8241
@@ -1503,7 +1503,7 @@
15031503
- __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.
15041504
15051505
Alternative form: `int add_extra_msg_file(string fileName, int fileNumber)` **[DEPRECATED]**
1506-
- __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.
1506+
- __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.
15071507
macro: sfall.h
15081508

15091509
- name: void sfall_func0("remove_timer_event")
@@ -2086,7 +2086,7 @@
20862086
- items with unique IDs will not stack with other items of the same type in the inventory
20872087
- to just get the current ID number of an object, use `get_object_data(object, OBJ_DATA_ID)`
20882088
- unique ID numbers are saved in your savegame, and have a range from 0x10000000 to 0x7FFFFFFF
2089-
- there is also a unique ID number range for the player and party members from 18000 to 83535
2089+
- there is also a unique ID number range for the player and party members from 18000 to 16795215
20902090
- 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
20912091
macro: sfall.h
20922092

artifacts/scripting/sfall function notes.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ FUNCTION REFERENCE
120120
#### `void inc_npc_level(int pid/string name)`
121121
- 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.
122122
- 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.
123-
- Starting from sfall 4.4.10/3.8.50, the maximum possible NPC level is 10.
123+
- Starting from sfall 4.5/3.8.50, the maximum possible NPC level is 10.
124124

125125
-----
126126
#### `int get_npc_level(int pid/string name)`
@@ -831,7 +831,7 @@ sfall_funcX metarule functions
831831
- Items with unique IDs will not stack with other items of the same type in the inventory
832832
- To just get the current ID number of an object, use `sfall_func2("get_object_data", object, OBJ_DATA_ID)`
833833
- Unique ID numbers are saved in your savegame, and have a range from `0x10000000` to `0x7FFFFFFF`
834-
- There is also a unique ID number range for the player and party members from 18000 to 83535
834+
- There is also a unique ID number range for the player and party members from 18000 to 16795215
835835
- 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
836836

837837
----
@@ -865,7 +865,7 @@ sfall_funcX metarule functions
865865
- 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
866866
- `fileName`: the name of the custom message file (including the **.msg** extension) in the `text\<language>\game\` directory
867867
- __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
868-
- __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.
868+
- __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.
869869

870870
----
871871
#### unwield_slot

sfall/Modules/Objects.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static int maxCountLoadProto = 512;
3232
long Objects::uniqueID = UniqueID::Start; // current counter id, saving to sfallgv.sav
3333

3434
bool Objects::IsUniqueID(long id) {
35-
return (id > UniqueID::Start || (id >= fo::PLAYER_ID && id < 83536)); // 65535 maximum possible number of prototypes
35+
return (id > UniqueID::Start || (id >= fo::PLAYER_ID && id < 16795216)); // party member ID = (pid & 0xFFFFFF) + PLAYER_ID
3636
}
3737

3838
void Objects::SetScriptObjectID(fo::GameObject* obj) {
@@ -98,11 +98,11 @@ static __declspec(naked) void item_identical_hack() {
9898

9999
static __declspec(naked) void new_obj_id_hook() {
100100
__asm {
101-
mov eax, 83535;
101+
mov eax, 16795215;
102102
cmp ds:[FO_VAR_cur_id], eax;
103103
jle pickNewID;
104104
retn;
105-
pickNewID: // skip PM range (18000 - 83535)
105+
pickNewID: // skip PM range (18000 - 16795215)
106106
mov ds:[FO_VAR_cur_id], eax;
107107
jmp fo::funcoffs::new_obj_id_;
108108
}

0 commit comments

Comments
 (0)