Added "picking up item" event to HOOK_INVENTORYMOVE.

Added "set_unique_id" script function.
This commit is contained in:
NovaRain
2019-04-12 12:15:55 +08:00
parent dcf0561653
commit 7a2b7dee6a
10 changed files with 48 additions and 7 deletions
@@ -361,6 +361,7 @@
#define ai_chem_always (5)
// common object data offsets
#define OBJ_DATA_ID (0x00)
#define OBJ_DATA_TILENUM (0x04)
#define OBJ_DATA_CUR_FRM (0x18) // current frame number
#define OBJ_DATA_ROTATION (0x1C)
+1
View File
@@ -288,6 +288,7 @@
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
#define set_rest_heal_time(time) sfall_func1("set_rest_heal_time", time)
#define set_rest_mode(mode) sfall_func1("set_rest_mode", mode)
#define set_unique_id(object) sfall_func1("set_unique_id", object)
#define set_unjam_locks_time(time) sfall_func1("set_unjam_locks_time", time)
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define tile_refresh_display sfall_func0("tile_refresh_display")
+4 -5
View File
@@ -416,17 +416,16 @@ HOOK_INVENTORYMOVE (hs_inventorymove.int)
Runs before moving items between inventory slots in dude interface. You can override the action.
What you can NOT do with this hook:
- force moving items to inappropriate slots (like gun in armor slot)
- block picking up items
What you can do:
- restrict player from using specific weapons or armors
- add AP costs for all inventory movement including reloading
- apply or remove some special scripted effects depending on PC's armor
int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo, 5 - container, like bag/backpack, 6 - dropping on the ground)
int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo, 5 - container, like bag/backpack, 6 - dropping on the ground, 7 - picking up item)
Item arg2 - Item being moved
Item arg3 - Item being replaced, weapon being reloaded, or container being filled (can be 0)
int ret1 - Override setting (-1 - use engine handler, any other value - prevent relocation of item/reloading weapon)
int ret1 - Override setting (-1 - use engine handler, any other value - prevent relocation of item/reloading weapon/picking up item)
-------------------------------------------
@@ -626,8 +625,8 @@ Runs when the Sneak skill is activated, or when the game rolls another Sneak che
You can override the result of a random Sneak check or the duration time for the current result.
int arg1 - Sneak check result: 1 - success, 0 - failure
int arg2 - the duration in ticks for the current Sneak check (time is based on the Sneak skill level)
int arg2 - the duration in ticks for the current Sneak check (time depends on Sneak skill level)
Critter arg3 - the critter (usually dude_obj)
int ret1 - overrides the Sneak check result
int ret1 - overrides the result of the Sneak check
int ret2 - overrides the duration time for the current result
@@ -578,6 +578,12 @@ Some utility/math functions are available:
- type: 0 - changes the value of NumEffects for the drug (see Drugs.ini for the description of NumEffects)
1 - changes the duration of the addiction effect for the drug (a value of 1 = one game minute)
> int sfall_func1("set_unique_id", object)
- assigns an unique ID number to the object and returns it. If an unique ID number has already been assigned to an object, then ID number is returned without reassignment
- 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 an unique ID number range for the player and party members from 18000 to 83535
------------------------
------ MORE INFO -------
------------------------