From ae1e17d3594f6c5f19dc3407fb33a06987f6eb85 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Tue, 25 Jul 2017 23:14:50 +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 | 6 +++--- artifacts/scripting/sfall opcode list.txt | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/artifacts/scripting/hookscripts.txt b/artifacts/scripting/hookscripts.txt index 01aec0bc..9701821b 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). 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()