mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
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.
This commit is contained in:
@@ -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.
|
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)
|
> 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)
|
> 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.
|
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:
|
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:
|
This basically changes hook argument for the next script. Mod B code:
|
||||||
|
|
||||||
original_chance = get_sfall_arg;
|
original_chance = get_sfall_arg;
|
||||||
set_sfall_return(original_chance * 1.5);
|
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).
|
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).
|
||||||
|
|
||||||
|
|||||||
@@ -208,9 +208,8 @@
|
|||||||
0x81e3 - void reset_critical_table(int crittertype, int bodypart, int level, int valuetype)
|
0x81e3 - void reset_critical_table(int crittertype, int bodypart, int level, int valuetype)
|
||||||
|
|
||||||
0x81e4 - int get_sfall_arg()
|
0x81e4 - int get_sfall_arg()
|
||||||
0x823d - void set_sfall_arg(int arg, int value)
|
|
||||||
0x823c - array get_sfall_args()
|
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)
|
0x81e5 - void set_sfall_return(int value)
|
||||||
0x81ea - int init_hook()
|
0x81ea - int init_hook()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user