From fc930ff7fbd6e0cb819b5b62b2c87ffe75229693 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Tue, 25 Jul 2017 23:10:14 +0800 Subject: [PATCH] Added a note for argnum in set_sfall_arg(). Fixed incorrect set_sfall_arg usage in the example. Removed a redundant line in sfall opcode list.txt. --- artifacts/scripting/hookscripts.txt | 12 ++++++------ artifacts/scripting/sfall opcode list.txt | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index 76e45804..ad3e57a4 100644 --- a/artifacts/scripting/hookscripts.txt +++ b/artifacts/scripting/hookscripts.txt @@ -42,7 +42,7 @@ Returns all hook arguments as a new temp array. Used to return the new values from the script. Each time it's called it sets the next value, or if you've already set all return values it does nothing. > void set_sfall_arg(int argnum, int value) -Changes argument value. This is usefull if you have several hook scripts attached to one hook point (see below). +Changes argument value. The argument number (argnum) is 0-indexed. This is usefull if you have several hook scripts attached to one hook point (see below). > void register_hook(int hooktype) Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, "start" proc will be execuded in a current global script. You can use all above functions like normal. @@ -58,13 +58,13 @@ Example: let's say we have a Mod A which reduces all "to hit" chances by 50%. Th Mod B also want to affect hit chances globally, by increasing them by 50%. Now in order for both mods to work well together, we need to add this line to Mod A hook script: - set_sfall_arg(original_chance / 2); + set_sfall_arg(0, (original_chance / 2)); This basically changes hook argument for the next script. Mod B code: original_chance = get_sfall_arg; set_sfall_return(original_chance * 1.5); - set_sfall_arg(original_chance * 1.5); + set_sfall_arg(0, (original_chance * 1.5)); So if you combine both mods together, they will run in chain and the end result will be a 75% from original hit chance (hook register order doesn't matter in this case, if you use "set_sfall_arg" in both hooks). @@ -447,7 +447,7 @@ Also happens on other screens, like barter. NOTE: FID has following format: 0x0ABBCDDD, where A is object type, BB - animation code (always 0 in this case), C - weapon code, DDD - FRM index in LST file. -int arg1 - the vanilla fid calculated by the engine according to critter base FID and armor/weapon being used +int arg1 - the vanilla fid calculated by the engine according to critter base FID and armor/weapon being used int ret1 - overrides the calculated FID with provided value @@ -457,7 +457,7 @@ HOOK_COMBATTURN (hs_combatturn.int) Runs before and after each turn in combat (for both PC and NPC). -int arg1 - event type: 1 - start of turn, 0 - normal end of turn, -1 - combat ended abruptly (by script or by pressing Enter during PC turn) +int arg1 - event type: 1 - start of turn, 0 - normal end of turn, -1 - combat ended abruptly (by script or by pressing Enter during PC turn) int arg2 - critter doing the turn int arg3 - unknown boolean argument @@ -469,7 +469,7 @@ HOOK_CARTRAVEL (hs_cartravel.int) Runs continously during worldmap travel on car. -int arg1 - vanilla car speed (between 3 and 8 "steps") +int arg1 - vanilla car speed (between 3 and 8 "steps") int arg2 - vanilla fuel consumption (100 and below) int ret1 - car speed override (pass -1 if you just want to override fuel consumption) diff --git a/artifacts/scripting/sfall opcode list.txt b/artifacts/scripting/sfall opcode list.txt index e1dd9d61..6da70942 100644 --- a/artifacts/scripting/sfall opcode list.txt +++ b/artifacts/scripting/sfall opcode list.txt @@ -208,9 +208,8 @@ 0x81e3 - void reset_critical_table(int crittertype, int bodypart, int level, int valuetype) 0x81e4 - int get_sfall_arg() -0x823d - void set_sfall_arg(int arg, int value) 0x823c - array get_sfall_args() -0x823d - void set_sfall_arg(int arg, int value) +0x823d - void set_sfall_arg(int argnum, int value) 0x81e5 - void set_sfall_return(int value) 0x81ea - int init_hook()