mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Some edits to hookscripts.txt & function notes.txt
This commit is contained in:
@@ -41,13 +41,13 @@ Used to return the new values from the script. Each time it's called it sets the
|
||||
> void set_sfall_arg(int argNum, int value)
|
||||
Changes argument value. The argument number (argNum) is 0-indexed. This is useful if you have several hook scripts attached to one hook point (see below).
|
||||
|
||||
> void register_hook(int hooktype)
|
||||
> void register_hook(int hookID)
|
||||
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 executed in a current global script. You can use all above functions like normal.
|
||||
|
||||
> void register_hook_proc(int hook, procedure proc)
|
||||
> void register_hook_proc(int hookID, procedure proc)
|
||||
The same as register_hook, except that you specifically define which procedure in the current script should be called as a hook (instead of "start" by default). Pass procedure the same as how you use dialog option functions. This IS the recommended way to use hook scripts, as it gives both modularity (each mod logic in a separate global script, no conflicts if you don't use "hs_*.int" scripts) and flexibility (you can place all related hook scripts for specific mod in a single script!).
|
||||
|
||||
> void register_hook_proc_spec(int hook, procedure proc)
|
||||
> void register_hook_proc_spec(int hookID, procedure proc)
|
||||
Works very similar to register_hook_proc, except that it registers the current script at the end of the hook script execution chain (i.e. the script will be executed after all previously registered scripts for the same hook, including the hs_*.int script). All scripts hooked to a single hook point with this function are executed in exact order of how they were registered, as opposed to the description below, which refers to using register_hook/register_hook_proc functions.
|
||||
|
||||
NOTE: you can hook several scripts to a single hook point, for example if it's different mods from different authors or just some different aspects of one larger mod. In this case scripts are executed in reverse order of how they were registered. When one of the scripts in a chain returns value with "set_sfall_return", the next script may override this value if calls "set_sfall_return" again. Sometimes you need to multiply certain value in a chain of hook scripts.
|
||||
@@ -69,7 +69,7 @@ This basically changes hook argument for the next script. Mod B code:
|
||||
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).
|
||||
|
||||
|
||||
The defines to use for the hooktype are in sfall.h.
|
||||
The defines to use for the hookID are in sfall.h.
|
||||
|
||||
-------------------------------------------
|
||||
----------- HOOK SCRIPT TYPES -------------
|
||||
@@ -189,9 +189,11 @@ Critter arg1 - The critter that just died
|
||||
|
||||
HOOK_FINDTARGET (hs_findtarget.int)
|
||||
|
||||
Runs when the ai is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the ai caps of the attacker. This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way. Use sfall_return to give the 4 targets, in order of preference. If you want to specify less than 4 targets, fill in the extra spaces with 0's. Pass -1 to skip the return value.
|
||||
Runs when the ai is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the ai caps of the attacker.
|
||||
This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way.
|
||||
|
||||
The return values can include critters that weren't in the list of possible targets, but the additional targets may still be discarded later on in the combat turn if they are out of the attackers perception or the chance of a successful hit is too low. The list of possible targets often includes duplicated entries.
|
||||
Use sfall_return to give the 4 targets, in order of preference. If you want to specify less than 4 targets, fill in the extra spaces with 0's or pass -1 to skip the return value.
|
||||
|
||||
critter arg1 - The attacker
|
||||
critter arg2 - A possible target
|
||||
|
||||
@@ -561,7 +561,7 @@ optional arguments:
|
||||
- removes all timer events with the specified 'fixedParam' value for the current global script
|
||||
|
||||
> mixed sfall_func1("get_sfall_arg_at", int argNum)
|
||||
- gets the value of hook argument with the specified argument number (argNum, first argument of hook starts from 0)
|
||||
- gets the value of hook argument with the specified argument number (first argument of hook starts from 0)
|
||||
|
||||
> void sfall_func0("hide_window")
|
||||
> void sfall_func1("hide_window", string winName)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
|
||||
#include "main.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user