404
Page not found :(
The requested page could not be found.
diff --git a/404.html b/404.html index 52476f73..0e59d49c 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -
Page not found :(
The requested page could not be found.
Page not found :(
The requested page could not be found.
The set_stat_max/min functions can be used to set the valid ranges on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only affects the player, the set_npc_ functions only affects other critters, and the set_ functions affects both.
void set_npc_stat_max(int stat, int value)
+ Alter min/max - sfall Alter min/max | sfall Alter min/max
The set_stat_max/min functions can be used to set the valid ranges on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only affects the player, the set_npc_ functions only affects other critters, and the set_ functions affects both.
Functions
set_npc_stat_max
void set_npc_stat_max(int stat, int value)
set_npc_stat_min
void set_npc_stat_min(int stat, int value)
set_pc_stat_max
void set_pc_stat_max(int stat, int value)
set_pc_stat_min
void set_pc_stat_min(int stat, int value)
diff --git a/animations/index.html b/animations/index.html
index 545a4b61..ec539c45 100644
--- a/animations/index.html
+++ b/animations/index.html
@@ -1,9 +1,9 @@
- Animations - sfall Animations | sfall Animations
Functions
- reg_anim_animate_and_hide
- reg_anim_callback
- reg_anim_change_fid
- reg_anim_combat_check
- reg_anim_destroy
- reg_anim_light
- reg_anim_take_out
- reg_anim_turn_towards
reg_anim_animate_and_hide
void reg_anim_animate_and_hide(ObjectPtr, int animID, int delay)
-
Exactly like reg_anim_animate but the object will automatically disappear after the last animation frame (but not destroyed).
reg_anim_callback
void reg_anim_callback(procedure proc)
+ Animations - sfall Animations | sfall Animations
Functions
- reg_anim_animate_and_hide
- reg_anim_callback
- reg_anim_change_fid
- reg_anim_combat_check
- reg_anim_destroy
- reg_anim_light
- reg_anim_take_out
- reg_anim_turn_towards
reg_anim_animate_and_hide
void reg_anim_animate_and_hide(ObjectPtr, int animID, int delay)
+
Exactly like reg_anim_animate but the object will automatically disappear after the last animation frame (but not destroyed).
reg_anim_callback
void reg_anim_callback(procedure proc)
Adds the given procedure to an animation sequence-list and executes it in the registered sequence.
reg_anim_change_fid
void reg_anim_change_fid(ObjectPtr, int FID, int delay)
-
Should work like art_change_fid_num but in reg_anim sequence.
reg_anim_combat_check
void reg_anim_combat_check(int enable)
-
Allows to enable all reg_anim_* functions in combat (including vanilla functions) if set to 0. It is automatically reset at the end of each frame, so you need to call it before reg_anim_begin - reg_anim_end block.
reg_anim_destroy
void reg_anim_destroy(ObjectPtr)
+
Should work like art_change_fid_num but in reg_anim sequence.
reg_anim_combat_check
void reg_anim_combat_check(int enable)
+
Allows to enable all reg_anim_* functions in combat (including vanilla functions) if set to 0. It is automatically reset at the end of each frame, so you need to call it before reg_anim_begin - reg_anim_end block.
reg_anim_destroy
void reg_anim_destroy(ObjectPtr)
Given object is destroyed at the end of current animation set.
reg_anim_light
void reg_anim_light(ObjectPtr, int light, int delay)
Change light of any object. Light argument is a light radius (0-8), but you can use highest 2 bytes to pass light intensity as well (example: 0xFFFF0008 - intensity 65535 and radius 8). If highest 2 bytes are 0, intensity will not be changed. Intensity range is from 0 to 65535 (0xFFFF)
reg_anim_take_out
void reg_anim_take_out(ObjectPtr, holdFrameID, delay)
-
Plays “take out weapon” animation for given holdFrameID. It is not required to have such weapon in critter’s inventory.
reg_anim_turn_towards
void reg_anim_turn_towards(ObjectPtr, int tile/target, delay)
+
Plays “take out weapon” animation for given holdFrameID. It is not required to have such weapon in critter’s inventory.
reg_anim_turn_towards
void reg_anim_turn_towards(ObjectPtr, int tile/target, delay)
Makes object change its direction to face given tile num or target object.
diff --git a/array-functions/index.html b/array-functions/index.html
index 7b12560d..378fb45f 100644
--- a/array-functions/index.html
+++ b/array-functions/index.html
@@ -1,4 +1,4 @@
- Array functions - sfall Array functions | sfall Array functions
Functions
- array_key
- arrayexpr
- create_array
- fix_array
- free_array
- get_array
- len_array
- load_array
- resize_array
- save_array
- scan_array
- set_array
- temp_array
array_key
mixed array_key(int arrayID, int index)
+ Array functions - sfall Array functions | sfall Array functions
Functions
- array_key
- arrayexpr
- create_array
- fix_array
- free_array
- get_array
- len_array
- load_array
- resize_array
- save_array
- scan_array
- set_array
- temp_array
array_key
mixed array_key(int arrayID, int index)
Don’t use it directly; it is generated by the compiler in foreach loops.
arrayexpr
int arrayexpr(mixed key, mixed value)
Don’t use it directly; it is used by compiler to create array expressions.
create_array
int create_array(int size, int nothing)
Creates permanent array (but not “saved”).
fix_array
void fix_array(int arrayID)
diff --git a/arrays/index.html b/arrays/index.html
index 3c7302c5..2255ed7a 100644
--- a/arrays/index.html
+++ b/arrays/index.html
@@ -1,17 +1,17 @@
- Arrays - sfall Arrays | sfall Arrays
sfall introduces new method of storing variables - arrays.
Array is basically a container which can store variable number of values (elements). Each element in array can be of any type. Arrays can be extremely useful for some more advanced scripting, in conjunction with loops. See array function reference here.
- Arrays concept
- Arrays syntax
- Storing arrays
- Practical examples
- Array operators reference
- Backward compatibility notes
Arrays concept
Array elements are accessed by index or key. For example:
// this code puts some string in array "list" at index 5:
-list[5] := "Value";
-
There are 2 different types of arrays currently available:
-
Lists - a set of values with specific size (number of elements), where all elements have numeric indexes starting from zero (0) up to array length minus one.
For example:
// this creates list with 3 elements. Element "A" has index 0, element "B" has index 1, element "C" - 2
-list := ["A", "B", "C"];
+ Arrays - sfall Arrays | sfall Arrays
sfall introduces new method of storing variables - arrays.
Array is basically a container which can store variable number of values (elements). Each element in array can be of any type. Arrays can be extremely useful for some more advanced scripting, in conjunction with loops. See array function reference here.
- Arrays concept
- Arrays syntax
- Storing arrays
- Practical examples
- Array operators reference
- Backward compatibility notes
Arrays concept
Array elements are accessed by index or key. For example:
// this code puts some string in array "list" at index 5:
+list[5] := "Value";
+
There are 2 different types of arrays currently available:
-
Lists - a set of values with specific size (number of elements), where all elements have numeric indexes starting from zero (0) up to array length minus one.
For example:
// this creates list with 3 elements. Element "A" has index 0, element "B" has index 1, element "C" - 2
+list := ["A", "B", "C"];
Limitations:
- all indexes are numeric, starting from 0;
- to assign value to a specific index, you must first resize array to contain this index (for example, if list is of size 3 (indexes from 0 to 2), you can’t assign value to index 4 unless you change list size to 5 first).
-
Maps (or associative arrays) - a set of key=>value pairs, where all elements (values) are accessed by corresponding keys.
Differences from list:
- maps don’t have specific size (to assign values, you don’t need to resize array first);
- keys, just like values, can be of any type (but avoid using -1 as array keys or you won’t be able to use some functions reliably).
Both array types have their pros and cons and are suited for different tasks.
Arrays syntax
Basically arrays are implemented using number of new operators (script functions). But for ease of use, there are some new syntax elements:
- Accessing elements. Use square brackets:
display_msg(arr[5]);
-mymap["price"] := 515.23;
+mymap["price"] := 515.23;
- Alternative accessing for maps. Use dot:
display_msg(mymap.name);
mymap.price := 232.23;
-
- Array expressions. Create and fill arrays with just one expression:
// create list with 5 values
-[5, 777, 0, 3.14, "Cool Value"]
+
- Array expressions. Create and fill arrays with just one expression:
// create list with 5 values
+[5, 777, 0, 3.14, "Cool Value"]
-// create map:
-{5: "Five", "health": 50, "speed": 0.252}
-
NOTE: Make sure to call fix_array if you want the new array to be available in the next frame or save_array if you want to use it for a longer period (see next section for details).
- Iterating in loop. Use
foreach key word like this: foreach (item in myarray) begin
+// create map:
+{5: "Five", "health": 50, "speed": 0.252}
+
NOTE: Make sure to call fix_array if you want the new array to be available in the next frame or save_array if you want to use it for a longer period (see next section for details).
- Iterating in loop. Use
foreach key word like this: foreach (item in myarray) begin
// this block is executed for each array element, where "item" contains current value on each step
end
@@ -19,10 +19,10 @@
foreach (key: item in myarray) begin
// "key" will contain current key (or numeric index, for lists)
end
-
See “scripting_docs\compiler\sslc_readme.html” file for full information on new SSL syntax features.
Storing arrays
Apart from lists/maps arrays are divided by how they are stored. There a 3 types of arrays:
-
Temporary. They are created using temp_array function or when using array expressions. Arrays of this type are auto-deleted at the end of the frame. So, for example, if you have a global script which runs at regular intervals, where you create temp_array, it will not be available next time your global script is executed.
-
Permanent. They are created using create_array function or fix_array (from pre-existing temporary array). This type of arrays are always available (by their ID) until you start a new game or load a saved game (at which point they are deleted).
-
Saved. If you want your array to really stay for a while, use function save_array to make any array “saved”. However, they are, like permanent arrays, “deleted” from memory when loading game. In order to use them properly, you must load them from the savegame using load_array whenever you want to use them.
Example:
variable savedArray;
+
See “scripting_docs\compiler\sslc_readme.html” file for full information on new SSL syntax features.
Storing arrays
Apart from lists/maps arrays are divided by how they are stored. There a 3 types of arrays:
-
Temporary. They are created using temp_array function or when using array expressions. Arrays of this type are auto-deleted at the end of the frame. So, for example, if you have a global script which runs at regular intervals, where you create temp_array, it will not be available next time your global script is executed.
-
Permanent. They are created using create_array function or fix_array (from pre-existing temporary array). This type of arrays are always available (by their ID) until you start a new game or load a saved game (at which point they are deleted).
-
Saved. If you want your array to really stay for a while, use function save_array to make any array “saved”. However, they are, like permanent arrays, “deleted” from memory when loading game. In order to use them properly, you must load them from the savegame using load_array whenever you want to use them.
Example:
variable savedArray;
procedure start begin
if game_loaded then begin
- savedArray := load_array("traps");
+ savedArray := load_array("traps");
end else begin
foreach trap in traps begin
....
@@ -41,27 +41,27 @@
Create arrays of objects (maps) for advanced scripting
variable traps;
procedure init_traps begin
// just a quick example, there is a better way of doing it...
- traps := load_array("traps");
+ traps := load_array("traps");
if (traps == 0) then begin
traps := [];
- save_array("traps", traps);
+ save_array("traps", traps);
end
foreach k: v in traps begin
- traps[k] := load_array("trap_"+k); // each object is stored separately
+ traps[k] := load_array("trap_"+k); // each object is stored separately
end
end
procedure add_trap(variable trapArray) begin
variable index;
index := len_array(traps);
- save_array("trap_"+k, trapArray);
+ save_array("trap_"+k, trapArray);
array_push(traps, trapArray);
end
// use them:
foreach trap in traps begin
- if (self_elevation == trap["elev"] and tile_distance(self_tile, trap["tile"]) < trap["radius"]) then
+ if (self_elevation == trap["elev"] and tile_distance(self_tile, trap["tile"]) < trap["radius"]) then
// kaboom!!!
end
end
-
Array operators reference
*mixed means any type
int create_array(int size, int flags): - creates permanent array (but not “saved”)
- if
size >= 0, creates list with given size - if
size == -1, creates map (associative array) - if
size == -1 and flags == 2, creates a “lookup” map (associative array) in which the values of existing keys are read-only and can’t be updated. This type of array allows you to store a zero (0) key value - NOTE: in earlier versions (up to 4.1.3/3.8.13) the second argument is not used, just use 0
- returns arrayID (valid until array is deleted)
int temp_array(int size, int flags): - works exactly like
create_array, only created array becomes “temporary”
void fix_array(int arrayID): - changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames)
void set_array(int arrayID, mixed key, mixed value): - sets array value
- if used on list, “key” must be numeric and within valid index range (0..size-1)
- if used on map, key can be of any type
- to “unset” a value from map, just set it to zero (0)
- NOTE: to add a value of 0 for the key, use the float value of 0.0
- this works exactly like statement:
arrayID[key] := value;
mixed get_array(int arrayID, mixed key): - returns array value by key or index
- if key doesn’t exist or index is not in valid range, returns 0
- works exactly like expression:
(arrayID[key])
void resize_array(int arrayID, int size): - changes array size
- applicable to maps too, but only to reduce elements
- there are number of special negative values of “size” which perform various operations on the array, use macros
sort_array, sort_array_reverse, reverse_array, shuffle_array from sfall.h header
void free_array(int arrayID): - deletes any array
- if array was “saved”, it will be removed from a savegame
mixed scan_array(int arrayID, mixed value): - searches for a first occurence of given value inside given array
- if value is found, returns it’s index (for lists) or key (for maps)
- if value is not found, returns -1 (be careful, as -1 can be a valid key for a map)
int len_array(int arrayID): - returns number of elements or key=>value pairs in a given array
- if array is not found, returns -1 (can be used to check if given array exist)
mixed array_key(int arrayID, int index): - don’t use it directly; it is generated by the compiler in foreach loops
- for lists, returns index back (no change)
- for maps, returns a key at the specified numeric index (don’t rely on the order in which keys are stored though)
- can be checked if given array is associative or not, by using index (-1): 0 - array is list, 1 - array is map
int arrayexpr(mixed key, mixed value): - don’t use it directly; it is used by compiler to create array expressions
- assigns value to a given key in an array, created by last
create_array or temp_array call - always returns 0
void save_array(mixed key, int arrayID): - makes the array saveable; it will be saved in sfallgv.sav file when saving the game
- arrayID is associated with given “key”
- array becomes permanent (if it was temporary) and “saved”
- key can be of any type (int, float or string)
- if you specify 0 as the key for the array ID, it will make the array “unsaved”
int load_array(mixed key): - loads array from savegame data by the same key provided in
save_array - returns array ID or zero (0) if none found
Backward compatibility notes
For those who used arrays in their mods before sfall 3.4:
-
There is an INI parameter ArraysBehavior in Misc section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that create_array will create permanent arrays which are “saved” by default and their IDs are also permanent. It is 1 by default.
-
NOTE: Starting from sfall 4.3.3/3.8.33, the ArraysBehavior option is removed, and arrays always work in ArraysBehavior=1 mode. Make sure to review your scripts if you need to save arrays into savegames.
-
How savegame compatibility is handled?\ Saved arrays are stored in sfallgv.sav file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), the game shouldn’t crash, but all arrays will be lost.
-
Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays.
Table of contents
+
Array operators reference
*mixed means any type
int create_array(int size, int flags): - creates permanent array (but not “saved”)
- if
size >= 0, creates list with given size - if
size == -1, creates map (associative array) - if
size == -1 and flags == 2, creates a “lookup” map (associative array) in which the values of existing keys are read-only and can’t be updated. This type of array allows you to store a zero (0) key value - NOTE: in earlier versions (up to 4.1.3/3.8.13) the second argument is not used, just use 0
- returns arrayID (valid until array is deleted)
int temp_array(int size, int flags): - works exactly like
create_array, only created array becomes “temporary”
void fix_array(int arrayID): - changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames)
void set_array(int arrayID, mixed key, mixed value): - sets array value
- if used on list, “key” must be numeric and within valid index range (0..size-1)
- if used on map, key can be of any type
- to “unset” a value from map, just set it to zero (0)
- NOTE: to add a value of 0 for the key, use the float value of 0.0
- this works exactly like statement:
arrayID[key] := value;
mixed get_array(int arrayID, mixed key): - returns array value by key or index
- if key doesn’t exist or index is not in valid range, returns 0
- works exactly like expression:
(arrayID[key])
void resize_array(int arrayID, int size): - changes array size
- applicable to maps too, but only to reduce elements
- there are number of special negative values of “size” which perform various operations on the array, use macros
sort_array, sort_array_reverse, reverse_array, shuffle_array from sfall.h header
void free_array(int arrayID): - deletes any array
- if array was “saved”, it will be removed from a savegame
mixed scan_array(int arrayID, mixed value): - searches for a first occurence of given value inside given array
- if value is found, returns it’s index (for lists) or key (for maps)
- if value is not found, returns -1 (be careful, as -1 can be a valid key for a map)
int len_array(int arrayID): - returns number of elements or key=>value pairs in a given array
- if array is not found, returns -1 (can be used to check if given array exist)
mixed array_key(int arrayID, int index): - don’t use it directly; it is generated by the compiler in foreach loops
- for lists, returns index back (no change)
- for maps, returns a key at the specified numeric index (don’t rely on the order in which keys are stored though)
- can be checked if given array is associative or not, by using index (-1): 0 - array is list, 1 - array is map
int arrayexpr(mixed key, mixed value): - don’t use it directly; it is used by compiler to create array expressions
- assigns value to a given key in an array, created by last
create_array or temp_array call - always returns 0
void save_array(mixed key, int arrayID): - makes the array saveable; it will be saved in sfallgv.sav file when saving the game
- arrayID is associated with given “key”
- array becomes permanent (if it was temporary) and “saved”
- key can be of any type (int, float or string)
- if you specify 0 as the key for the array ID, it will make the array “unsaved”
int load_array(mixed key): - loads array from savegame data by the same key provided in
save_array - returns array ID or zero (0) if none found
Backward compatibility notes
For those who used arrays in their mods before sfall 3.4:
-
There is an INI parameter ArraysBehavior in Misc section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that create_array will create permanent arrays which are “saved” by default and their IDs are also permanent. It is 1 by default.
-
NOTE: Starting from sfall 4.3.3/3.8.33, the ArraysBehavior option is removed, and arrays always work in ArraysBehavior=1 mode. Make sure to review your scripts if you need to save arrays into savegames.
-
How savegame compatibility is handled?
Saved arrays are stored in sfallgv.sav file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), the game shouldn’t crash, but all arrays will be lost.
-
Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays.
Table of contents
diff --git a/art-and-appearance/index.html b/art-and-appearance/index.html
index 20f3c5bd..12209422 100644
--- a/art-and-appearance/index.html
+++ b/art-and-appearance/index.html
@@ -1,6 +1,6 @@
- Art and appearance - sfall Art and appearance | sfall Art and appearance
Functions
art_cache_clear
sfall.h
void art_cache_clear()
+ Art and appearance - sfall Art and appearance | sfall Art and appearance
Functions
art_cache_clear
sfall.h
void art_cache_clear()
Clears the cache of FRM image files loaded into memory.
art_exists
int art_exists(int artFID)
-
checks if given artFID exists in the game. Useful when you want to check if critter can use specific weapon: art_exists((artFid bwand 0xffff0fff) bwor (weaponAnim * 0x1000)).
refresh_pc_art
void refresh_pc_art
+
checks if given artFID exists in the game. Useful when you want to check if critter can use specific weapon: art_exists((artFid bwand 0xffff0fff) bwor (weaponAnim * 0x1000)).
refresh_pc_art
void refresh_pc_art
set_hero_race
void set_hero_race(int style)
set_hero_style
void set_hero_style(int style)
diff --git a/assets/images/large-image.jpg b/assets/images/large-image.jpg
new file mode 100644
index 00000000..c007781c
Binary files /dev/null and b/assets/images/large-image.jpg differ
diff --git a/assets/images/small-image.jpg b/assets/images/small-image.jpg
new file mode 100644
index 00000000..5bf58a94
Binary files /dev/null and b/assets/images/small-image.jpg differ
diff --git a/assets/js/search-data.json b/assets/js/search-data.json
index 467fd0aa..35c2e652 100644
--- a/assets/js/search-data.json
+++ b/assets/js/search-data.json
@@ -73,7 +73,7 @@
},"12": {
"doc": "Arrays",
"title": "Backward compatibility notes",
- "content": "For those who used arrays in their mods before sfall 3.4: . | There is an INI parameter ArraysBehavior in Misc section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that create_array will create permanent arrays which are “saved” by default and their IDs are also permanent. It is 1 by default. | NOTE: Starting from sfall 4.3.3/3.8.33, the ArraysBehavior option is removed, and arrays always work in ArraysBehavior=1 mode. Make sure to review your scripts if you need to save arrays into savegames. | How savegame compatibility is handled?\\ Saved arrays are stored in sfallgv.sav file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), the game shouldn’t crash, but all arrays will be lost. | Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays. | . ",
+ "content": "For those who used arrays in their mods before sfall 3.4: . | There is an INI parameter ArraysBehavior in Misc section of ddraw.ini. If set to 0, all scripts which used sfall arrays before should work. This basically changes that create_array will create permanent arrays which are “saved” by default and their IDs are also permanent. It is 1 by default. | NOTE: Starting from sfall 4.3.3/3.8.33, the ArraysBehavior option is removed, and arrays always work in ArraysBehavior=1 mode. Make sure to review your scripts if you need to save arrays into savegames. | How savegame compatibility is handled? Saved arrays are stored in sfallgv.sav file (in savegame) in new (more flexible) format, just after the old arrays. So basically, when you load older savegame, sfall will load arrays from old format and save them to new format on next game save. If you load savegame made with sfall 3.4 using sfall 3.3 (for example), the game shouldn’t crash, but all arrays will be lost. | Previously you had to specify size in bytes for array elements. This parameter is now ignored and you can store strings of arbitrary length in arrays. | . ",
"url": "/sfall/arrays/#backward-compatibility-notes",
"relUrl": "/arrays/#backward-compatibility-notes"
},"13": {
@@ -529,13 +529,13 @@
},"88": {
"doc": "Hook types",
"title": "UseObjOn",
- "content": "HOOK_USEOBJON (hs_useobjon.int) . Runs when: . | a critter uses an object on another critter. (Or themselves) | a critter uses an object from inventory screen AND this object does not have “Use” action flag set and it’s not active flare or explosive. | player or AI uses any drug | . This is fired before the object is used, and the relevant use_obj_on script procedures are run. You can disable default item behavior. NOTE: you can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1. Critter arg0 - The target Critter arg1 - The user int arg2 - The object used int ret0 - overrides hard-coded handler and selects what should happen with the item (0 - place it back, 1 - remove it, -1 - use engine handler) . ",
+ "content": "HOOK_USEOBJON (hs_useobjon.int) . Runs when: . | a critter uses an object on another critter. (Or themselves) | a critter uses an object from inventory screen AND this object does not have “Use” action flag set and it’s not active flare or explosive. | player or AI uses any drug | . This is fired before the object is used, and the relevant use_obj_on script procedures are run. You can disable default item behavior. NOTE: You can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1. Critter arg0 - The target Critter arg1 - The user int arg2 - The object used int ret0 - overrides hard-coded handler and selects what should happen with the item (0 - place it back, 1 - remove it, -1 - use engine handler) . ",
"url": "/sfall/hook-types/#useobjon",
"relUrl": "/hook-types/#useobjon"
},"89": {
"doc": "Hook types",
"title": "UseSkill",
- "content": "HOOK_USESKILL (hs_useskill.int) . Runs when using any skill on any object. This is fired before the default handlers are called, which you can override. In this case you should write your own skill use handler entirely, or otherwise nothing will happen (this includes fade in/fade out, time lapsing and messages - all of this can be scripted; to get vanilla text messages - use message_str_game along with sprintf). Suggested use - override first aid/doctor skills to buff/nerf them, override steal skill to disallow observing NPCs inventories in some cases. Doesn’t seem to run when lock picking. Critter arg0 - The user critter Obj arg1 - The target object int arg2 - skill being used int arg3 - skill bonus from items such as first aid kits int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override) . ",
+ "content": "HOOK_USESKILL (hs_useskill.int) . Runs when using any skill on any object. This is fired before the default handlers are called, which you can override. In this case you should write your own skill use handler entirely, or otherwise nothing will happen (this includes fade in/fade out, time lapsing and messages - all of this can be scripted; to get vanilla text messages - use message_str_game along with sprintf). Suggested use - override First Aid/Doctor skills to buff/nerf them, override Steal skill to disallow observing NPCs inventories in some cases. Does not run if the script of the object calls script_overrides for using the skill. Critter arg0 - The user critter Obj arg1 - The target object int arg2 - skill being used int arg3 - skill bonus from items such as first aid kits int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override; if it is 0, there will be a 10% chance of removing the used medical item) . ",
"url": "/sfall/hook-types/#useskill",
"relUrl": "/hook-types/#useskill"
},"90": {
@@ -565,7 +565,7 @@
},"94": {
"doc": "Home",
"title": "sfall",
- "content": ". | Getting started | Questions and problems | . Sfall is a set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself. Engine modifications include: . | Better support for modern operating systems | Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc. | Bug fixes | Many additional features for users, such as item highlight button, party member control, etc. | Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions) | . Note that this is documentation for sfall specifically, not Fallout scripting in general. For vanilla function reference, refer to the wiki. ",
+ "content": ". | Getting started | Questions and problems | . sfall is a set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself. Engine modifications include: . | Better support for modern operating systems | Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc. | Bug fixes | Many additional features for users, such as item highlight button, party member control, etc. | Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions) | . Note that this is documentation for sfall specifically, not Fallout scripting in general. For vanilla function reference, refer to the wiki. ",
"url": "/sfall/#sfall",
"relUrl": "/#sfall"
},"95": {
diff --git a/audio/index.html b/audio/index.html
index 5a3e5449..b86e1d8b 100644
--- a/audio/index.html
+++ b/audio/index.html
@@ -1,5 +1,5 @@
- Audio - sfall Audio | sfall Audio
Functions
eax_available
int eax_available
+ Audio - sfall Audio | sfall Audio
Functions
eax_available
int eax_available
play_sfall_sound
int play_sfall_sound(string file, int mode)
-
Used to play mp3/wav/wma files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don’t wish to loop, play_sfall_sound returns 0. If you do loop, it returns an id which can be passed back to stop_sfall_sound when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. Does not require AllowDShowSound to be set to 1 in ddraw.ini.
Starting from sfall 4.2.8/3.8.28, you can pass a value in the mode argument for a reduced sound volume. To set the volume, You need to convert the number to hexadecimal and use the argument format 0xZZZZ000Y, where ZZZZ is the volume reduction value in range from 0 to 32767 (the value 32767 is mute), and Y is the playback mode.
set_eax_environment
void set_eax_environment(int environment)
+
Used to play mp3/wav/wma files. The path given is relative to the Fallout folder. Specify mode as 1 to loop the file continuously, 2 to replace the current background game music with playing the specified file in loop mode, or 0 to play the file once. If you don’t wish to loop, play_sfall_sound returns 0. If you do loop, it returns an id which can be passed back to stop_sfall_sound when you want to stop the effect. All sounds effects will be stopped on game reload, looping or not. Does not require AllowDShowSound to be set to 1 in ddraw.ini.
Starting from sfall 4.2.8/3.8.28, you can pass a value in the mode argument for a reduced sound volume. To set the volume, You need to convert the number to hexadecimal and use the argument format 0xZZZZ000Y, where ZZZZ is the volume reduction value in range from 0 to 32767 (the value 32767 is mute), and Y is the playback mode.
set_eax_environment
void set_eax_environment(int environment)
stop_sfall_sound
void stop_sfall_sound(int soundID)
-
Stops looping mp3/wav/wma files previously launched by play_sfall_sound. All sounds effects will be stopped on game reload, looping or not. Does not require AllowDShowSound to be set to 1 in ddraw.ini.
+
Stops looping mp3/wav/wma files previously launched by play_sfall_sound. All sounds effects will be stopped on game reload, looping or not. Does not require AllowDShowSound to be set to 1 in ddraw.ini.
diff --git a/best-practices/index.html b/best-practices/index.html
index 9af169bb..57bf84f8 100644
--- a/best-practices/index.html
+++ b/best-practices/index.html
@@ -1,11 +1,11 @@
- Best practices - sfall Best practices | sfall Best practices
Mod compatibility
- If it can be done in a global script, do it in a global script. Combined with hooks, they are extremely powerful, possibilities ranging from creating new perks to UI scripting to prototype altering on-the-fly. While scripting does take a bit longer to get started, and hacking prototypes directly with GUI programs might look easier at first, consider that:
- Scripts from different mods modifying the same thing can actually be compatible with each other. Binary files can’t.
- Scripts can be version controlled and thus are much more easier to maintain.
-
If you’re using set_sfall_return, always couple it with set_sfall_arg for the corresponding arg(s), unless you have a specific reason not to. Detailed explanation is available here.
- Pick yourself a 2-3 character modding prefix. Use it for:
- global script names
- global variable names and saved array names
- debug messages
This will ensure (to some degree), that another mod doesn’t overwrite your scripts, doesn’t mess with your global variables, and that debug messages coming from your scripts can be distinguished easily.
For example, if you pick prefix “a_”, your script could be named gl_a_myscript.int, and might look like this:
#define NAME "gl_a_myscript"
- #define ndebug(message) debug_msg(NAME + ": " + message + "\n")
+ Best practices - sfall Best practices | sfall Best practices
Mod compatibility
- If it can be done in a global script, do it in a global script. Combined with hooks, they are extremely powerful, possibilities ranging from creating new perks to UI scripting to prototype altering on-the-fly. While scripting does take a bit longer to get started, and hacking prototypes directly with GUI programs might look easier at first, consider that:
- Scripts from different mods modifying the same thing can actually be compatible with each other. Binary files can’t.
- Scripts can be version controlled and thus are much more easier to maintain.
-
If you’re using set_sfall_return, always couple it with set_sfall_arg for the corresponding arg(s), unless you have a specific reason not to. Detailed explanation is available here.
- Pick yourself a 2-3 character modding prefix. Use it for:
- global script names
- global variable names and saved array names
- debug messages
This will ensure (to some degree), that another mod doesn’t overwrite your scripts, doesn’t mess with your global variables, and that debug messages coming from your scripts can be distinguished easily.
For example, if you pick prefix “a_”, your script could be named gl_a_myscript.int, and might look like this:
#define NAME "gl_a_myscript"
+ #define ndebug(message) debug_msg(NAME + ": " + message + "\n")
procedure start begin
if game_loaded then begin
- set_sfall_global("a_myvar", 1000);
- ndebug("initialized");
+ set_sfall_global("a_myvar", 1000);
+ ndebug("initialized");
end
end
...
-
Performance
- Do not abuse set_global_script_repeat. Whenever possible, register your script as a hook instead. You can register the same procedure at multiple hook points, if necessary.
- If you have
set_global_script_repeat(300) in your script, you’re probably doing something wrong. That’s an invocation every 3-5 seconds, approximately. - If you have
set_global_script_repeat(30), you are definitely doing something wrong. Look for suitable hooks harder, think of another way for implementing it, ask fellow modders for help.
+
Performance
- Do not abuse set_global_script_repeat. Whenever possible, register your script as a hook instead. You can register the same procedure at multiple hook points, if necessary.
- If you have
set_global_script_repeat(300) in your script, you’re probably doing something wrong. That’s an invocation every 3-5 seconds, approximately. - If you have
set_global_script_repeat(30), you are definitely doing something wrong. Look for suitable hooks harder, think of another way for implementing it, ask fellow modders for help.
diff --git a/call_offset_vx/index.html b/call_offset_vx/index.html
index d9ca41c2..3c7a6355 100644
--- a/call_offset_vx/index.html
+++ b/call_offset_vx/index.html
@@ -1,4 +1,4 @@
- call_offset_vX - sfall call_offset_vX | sfall call_offset_vX
Can be used to call arbitrary functions inside Fallout. Different versions are used to call functions with different numbers of arguments. None of these functions will work unless AllowUnsafeScripting is enabled in ddraw.ini.
Functions
- call_offset_r0
- call_offset_r1
- call_offset_r2
- call_offset_r3
- call_offset_r4
- call_offset_v0
- call_offset_v1
- call_offset_v2
- call_offset_v3
- call_offset_v4
call_offset_r0
UNSAFE
int call_offset_r0(int address)
+ call_offset_vX - sfall call_offset_vX | sfall call_offset_vX
Can be used to call arbitrary functions inside Fallout. Different versions are used to call functions with different numbers of arguments. None of these functions will work unless AllowUnsafeScripting is enabled in ddraw.ini.
Functions
- call_offset_r0
- call_offset_r1
- call_offset_r2
- call_offset_r3
- call_offset_r4
- call_offset_v0
- call_offset_v1
- call_offset_v2
- call_offset_v3
- call_offset_v4
call_offset_r0
UNSAFE
int call_offset_r0(int address)
call_offset_r1
UNSAFE
int call_offset_r1(int address, int arg1)
call_offset_r2
UNSAFE
int call_offset_r2(int address, int arg1, int arg2)
call_offset_r3
UNSAFE
int call_offset_r3(int address, int arg1, int arg2, int arg3)
diff --git a/car/index.html b/car/index.html
index 8869f936..7f8aa6e6 100644
--- a/car/index.html
+++ b/car/index.html
@@ -1,4 +1,4 @@
- Car - sfall Car | sfall Car
Functions
car_gas_amount
sfall.h
int car_gas_amount()
-
Returns the current amount of fuel in player’s car (between 0 and 80000). To change fuel amount, use vanilla function: metarule(METARULE_GIVE_CAR_GAS, amount) - amount can be positive or negative.
set_car_current_town
void set_car_current_town(int town)
+ Car - sfall Car | sfall Car
Functions
car_gas_amount
sfall.h
int car_gas_amount()
+
Returns the current amount of fuel in player’s car (between 0 and 80000). To change fuel amount, use vanilla function: metarule(METARULE_GIVE_CAR_GAS, amount) - amount can be positive or negative.
set_car_current_town
void set_car_current_town(int town)
Changes the current town index for the player’s car.
set_car_intface_art
sfall.h
void set_car_intface_art(int artIndex)
-
- Changes the interface art (index in
intrface.lst) for the car image on the world map interface - Should be called before going to the world map
- Vanilla art index is 433
+
- Changes the interface art (index in
intrface.lst) for the car image on the world map interface - Should be called before going to the world map
- Vanilla art index is 433
diff --git a/combat/index.html b/combat/index.html
index 8ba90dbd..6f2511b4 100644
--- a/combat/index.html
+++ b/combat/index.html
@@ -1,17 +1,17 @@
- Combat - sfall Combat | sfall Combat
Subcategories
Functions
- attack_is_aimed
- block_combat
- combat_data
- disable_aimed_shots
- force_aimed_shots
- get_attack_type
- get_bodypart_hit_modifier
- get_critical_table
- get_critter_current_ap
- get_last_attacker
- get_last_target
- reset_critical_table
- set_bodypart_hit_modifier
- set_critical_table
- set_critter_burst_disable
- set_critter_current_ap
attack_is_aimed
sfall.h
bool attack_is_aimed()
+ Combat - sfall Combat | sfall Combat
Subcategories
Functions
- attack_is_aimed
- block_combat
- combat_data
- disable_aimed_shots
- force_aimed_shots
- get_attack_type
- get_bodypart_hit_modifier
- get_critical_table
- get_critter_current_ap
- get_last_attacker
- get_last_target
- reset_critical_table
- set_bodypart_hit_modifier
- set_critical_table
- set_critter_burst_disable
- set_critter_current_ap
attack_is_aimed
sfall.h
bool attack_is_aimed()
Returns 1 if the aimed attack mode is selected, 0 otherwise.
block_combat
void block_combat(bool value)
Deny the player to enter combat mode.
combat_data
mixed combat_data
-
- returns a pointer to the
C_ATTACK_* data for the current combat attack process (see defined constants in define_extra.h) - can be used in conjunction with the
get_object_data and set_object_data functions example: sfall_func3("set_object_data", sfall_func0("combat_data"), C_ATTACK_UNUSED, 255);
disable_aimed_shots
void disable_aimed_shots(int pid)
+
- returns a pointer to the
C_ATTACK_* data for the current combat attack process (see defined constants in define_extra.h) - can be used in conjunction with the
get_object_data and set_object_data functions example: sfall_func3("set_object_data", sfall_func0("combat_data"), C_ATTACK_UNUSED, 255);
disable_aimed_shots
void disable_aimed_shots(int pid)
Allows overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) stops a weapon from making aimed shots even if it normally coulld. Affects player and NPCs alike. The list of edited weapons is not saved over game loads, so you need to call the function once at each reload. Use a pid of 0 to represent unarmed.
force_aimed_shots
void force_aimed_shots(int pid)
Allows overriding the normal rules regarding which weapons are allowed to make aimed attacks. (e.g. weapons that cause explosive damage normally cannot normally make aimed shots.) Will allow a weapon to make aimed shots even if it normally couldn’t. Affects player and NPCs alike. Does not override the effects of the fast shot trait. The list of edited weapons is not saved over game loads, so you need to call the function once at each reload. Use a pid of 0 to represent unarmed.
get_attack_type
int get_attack_type
get_bodypart_hit_modifier
int get_bodypart_hit_modifier(int bodypart)
Gets the hit percentage modifiers for aiming at specific bodyparts. Valid bodypart id’s are from 0 to 8.
get_critical_table
int get_critical_table(int crittertype, int bodypart, int level, int valuetype)
-
Gets current critical table. For details see critical hit tables. Requires OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
get_critter_current_ap
int get_critter_current_ap(CritterPtr)
+
Gets current critical table. For details see critical hit tables. Requires OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
get_critter_current_ap
int get_critter_current_ap(CritterPtr)
Should only be used during the target critters turn while in combat. Calling it outside of combat typically returns the critters max ap, but don’t rely on that behaviour. (Specifically, if the critter has never before entered combat, it will probably return the critters base ap ignoring any extra bonuses from perks etc.)
get_last_attacker
ObjectPtr get_last_attacker(ObjectPtr critter)
Will return the last critter to deliberately launch an attack against the argument critter. If a critter has not launched/received an attack, it will return 0. Outside of combat always returns 0.
get_last_target
ObjectPtr get_last_target(ObjectPtr critter)
Will return the last critter to be deliberately attacked. Outside of combat always returns 0.
reset_critical_table
void reset_critical_table(int crittertype, int bodypart, int level, int valuetype)
-
Resets the critical table to default (or to the contents of CriticalOverrides.ini, if it exists). For details see ‘http://falloutmods.wikia.com/wiki/Critical_hit_tables’. Requires OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
set_bodypart_hit_modifier
void set_bodypart_hit_modifier(int bodypart, int value)
+
Resets the critical table to default (or to the contents of CriticalOverrides.ini, if it exists). For details see ‘http://falloutmods.wikia.com/wiki/Critical_hit_tables’. Requires OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
set_bodypart_hit_modifier
void set_bodypart_hit_modifier(int bodypart, int value)
Alters the hit percentage modifiers for aiming at specific bodyparts. Valid bodypart id’s are from 0 to 8. Changes are not saved, and will reset to the defaults (or to the values specified in ddraw.ini if they exist) at each reload.
set_critical_table
void set_critical_table(int crittertype, int bodypart, int level, int valuetype, int value)
-
Used for modifying the critical table. For details see critical hit tables. Changes are not saved, and will reset to the defaults, (or to the contents of CriticalOverrides.ini, if it exists) at each game reload. Requires OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
set_critter_burst_disable
void set_critter_burst_disable(int critter, int disable)
+
Used for modifying the critical table. For details see critical hit tables. Changes are not saved, and will reset to the defaults, (or to the contents of CriticalOverrides.ini, if it exists) at each game reload. Requires OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
set_critter_burst_disable
void set_critter_burst_disable(int critter, int disable)
set_critter_current_ap
void set_critter_current_ap(CritterPtr, int ap)
Should only be used during the target critters turn while in combat.
diff --git a/cursor/index.html b/cursor/index.html
index e19f2965..5f390390 100644
--- a/cursor/index.html
+++ b/cursor/index.html
@@ -1,3 +1,3 @@
- Cursor - sfall Cursor | sfall Cursor
Functions
get_cursor_mode
sfall.h
int get_cursor_mode()
+ Cursor - sfall Cursor | sfall Cursor
Functions
get_cursor_mode
sfall.h
int get_cursor_mode()
Returns the current cursor mode. Values: 0 - movement cursor, 1 - command cursor, 2 - targeting cursor, 4 to 10 are Skilldex skills (yellow targeting cursor).
set_cursor_mode
sfall.h
void set_cursor_mode(int mode)
Sets the current cursor mode.
diff --git a/data-types/index.html b/data-types/index.html
index 60976db3..c051bf37 100644
--- a/data-types/index.html
+++ b/data-types/index.html
@@ -1 +1 @@
- Data types - sfall Data types | sfall Data types
Data types mentioned in this document
array - array ID to be used with array-related functions (actually an integer) any - any type bool - boolean (in fact, int: True is 1 and False is 0) int - integer number mixed - type depends on exact use case float - floating point number ObjectPtr - pointer to a game object (actually an integer) proc - procedure name (used in register_hook_proc) string - string (text) value void - means opcode does not return any value
+ Data types - sfall Data types | sfall Data types
Data types mentioned in this document
array - array ID to be used with array-related functions (actually an integer) any - any type bool - boolean (in fact, int: True is 1 and False is 0) int - integer number mixed - type depends on exact use case float - floating point number ObjectPtr - pointer to a game object (actually an integer) proc - procedure name (used in register_hook_proc) string - string (text) value void - means opcode does not return any value
diff --git a/direct-memory-access/index.html b/direct-memory-access/index.html
index fbb6d8ef..ea7c448c 100644
--- a/direct-memory-access/index.html
+++ b/direct-memory-access/index.html
@@ -1 +1 @@
- Direct memory access - sfall Direct memory access | sfall
+ Direct memory access - sfall Direct memory access | sfall
diff --git a/explosions/index.html b/explosions/index.html
index 8b202079..a0b2966f 100644
--- a/explosions/index.html
+++ b/explosions/index.html
@@ -1,11 +1,11 @@
- Explosions - sfall Explosions | sfall Explosions
Functions
- get_explosion_damage
- item_make_explosive
- metarule2_explosions
- set_attack_explosion_art
- set_attack_explosion_pattern
- set_attack_explosion_radius
- set_attack_is_explosion_fire
- set_dynamite_damage
- set_explosion_max_targets
- set_explosion_radius
- set_plastic_damage
get_explosion_damage
sfall.h
array get_explosion_damage(itemPid)
+ Explosions - sfall Explosions | sfall Explosions
Functions
- get_explosion_damage
- item_make_explosive
- metarule2_explosions
- set_attack_explosion_art
- set_attack_explosion_pattern
- set_attack_explosion_radius
- set_attack_is_explosion_fire
- set_dynamite_damage
- set_explosion_max_targets
- set_explosion_radius
- set_plastic_damage
get_explosion_damage
sfall.h
array get_explosion_damage(itemPid)
Returns an array of the minimum and maximum damage of the explosive item.
item_make_explosive
sfall.h
void item_make_explosive(int pid, int activePid, int minDamage, int maxDamage)
-
- makes the specified item (pid) an explosive item like Dynamite or Plastic Explosives
maxDamage is optional activePid is for an item with an active timer, can be the same as the pid argument - the item proto must be “Misc Item” type and have “Use” action flag
- minDamage/maxDamage are the minimum and maximum explosion damage
- using the function on an item that is already set as an explosive will override its previous settings
- NOTE: this function does not work for pids of Dynamite and Plastic Explosives
metarule2_explosions
int metarule2_explosions(int arg1, int arg2)
+
- makes the specified item (pid) an explosive item like Dynamite or Plastic Explosives
maxDamage is optional activePid is for an item with an active timer, can be the same as the pid argument - the item proto must be “Misc Item” type and have “Use” action flag
- minDamage/maxDamage are the minimum and maximum explosion damage
- using the function on an item that is already set as an explosive will override its previous settings
- NOTE: this function does not work for pids of Dynamite and Plastic Explosives
metarule2_explosions
int metarule2_explosions(int arg1, int arg2)
Was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action.
set_attack_explosion_art
sfall.h
void set_attack_explosion_art(x, y)
Y not used and X is a misc frame ID (last 3 bytes, without object type) to use for the next explosion.
set_attack_explosion_pattern
sfall.h
void set_attack_explosion_pattern(x, y)
Currently Y is not used and X means: 1 - reduced explosion pattern (3 effects are spawned instead of 7), 0 - full pattern.
set_attack_explosion_radius
sfall.h
void set_attack_explosion_radius(x)
Changes radius at which explosion will hit secondary targets for the next attack (from the experiments it is limited to something around 8 by the engine).
set_attack_is_explosion_fire
sfall.h
void set_attack_is_explosion_fire
-
If you call this right before using a weapon with fire damage type (e.g. in HOOK_AFTERHITROLL), it will produce explosion effects (and radius damage) just like “explosion” type, but all targets will still receive fire damage.
set_dynamite_damage
sfall.h
void set_dynamite_damage(minDmg, maxDmg)
+
If you call this right before using a weapon with fire damage type (e.g. in HOOK_AFTERHITROLL), it will produce explosion effects (and radius damage) just like “explosion” type, but all targets will still receive fire damage.
set_dynamite_damage
sfall.h
void set_dynamite_damage(minDmg, maxDmg)
Sets the minimum and maximum damage for Dynamite. Changed damage will be reset each time the player reloads the game.
set_explosion_max_targets
sfall.h
void set_explosion_max_targets(x)
Sets the maximum number of additional targets for an explosion, valid range: 1..6 (default is 6).
set_explosion_radius
sfall.h
void set_explosion_radius(grenade, rocket)
Sets a permanent radius of the explosion for grenades and/or rockets. Passing 0 means not changing the corresponding radius. Changed radius will be reset each time the player reloads the game.
set_plastic_damage
sfall.h
void set_plastic_damage(minDmg, maxDmg)
diff --git a/feed.xml b/feed.xml
index 197b16b3..052a3f6a 100644
--- a/feed.xml
+++ b/feed.xml
@@ -1 +1 @@
-Jekyll 2022-02-26T11:45:52+00:00 /sfall/ sfall Sfall documentation
\ No newline at end of file
+Jekyll 2022-04-07T13:19:47+00:00 /sfall/feed.xml sfall Sfall documentation
\ No newline at end of file
diff --git a/funcx/index.html b/funcx/index.html
index 1684203b..bdc05fdb 100644
--- a/funcx/index.html
+++ b/funcx/index.html
@@ -1,4 +1,4 @@
- funcX - sfall funcX | sfall funcX
Functions
- sfall_func0
- sfall_func1
- sfall_func2
- sfall_func3
- sfall_func4
- sfall_func5
- sfall_func6
- sfall_func7
- sfall_func8
sfall_func0
any sfall_func0(char* funcName)
+ funcX - sfall funcX | sfall funcX
Functions
- sfall_func0
- sfall_func1
- sfall_func2
- sfall_func3
- sfall_func4
- sfall_func5
- sfall_func6
- sfall_func7
- sfall_func8
sfall_func0
any sfall_func0(char* funcName)
Calls script function with given name and no arguments.
sfall_func1
any sfall_func1(char* funcName, arg1)
Calls script function with given name and 1 argument.
sfall_func2
any sfall_func2(char* funcName, arg1, arg2)
Calls script function with given name and 2 arguments.
sfall_func3
any sfall_func3(char* funcName, arg1, arg2, arg3)
diff --git a/global-script-functions/index.html b/global-script-functions/index.html
index f708dcce..a8aeff90 100644
--- a/global-script-functions/index.html
+++ b/global-script-functions/index.html
@@ -1,4 +1,4 @@
- Global script functions - sfall Global script functions | sfall Global script functions
Functions
available_global_script_types
int available_global_script_types
+ Global script functions - sfall Global script functions | sfall Global script functions
Functions
available_global_script_types
int available_global_script_types
set_global_script_repeat
void set_global_script_repeat(int frames)
-
Only has an effect on the script it is called from. Every global script needs its own game_loaded block to correctly set up repeat rate. Will have no effect if called on a non-global script.
set_global_script_type
void set_global_script_type(int type)
-
Only has an effect on the script it is called from. Every global script needs its own game_loaded block to correctly set up the script type.
+
Only has an effect on the script it is called from. Every global script needs its own game_loaded block to correctly set up repeat rate. Will have no effect if called on a non-global script.
set_global_script_type
void set_global_script_type(int type)
+
Only has an effect on the script it is called from. Every global script needs its own game_loaded block to correctly set up the script type.
diff --git a/global-scripts/index.html b/global-scripts/index.html
index 2cc34371..b93b62a7 100644
--- a/global-scripts/index.html
+++ b/global-scripts/index.html
@@ -1 +1 @@
- Global scripts - sfall Global scripts | sfall Global scripts
As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj without using set_self first will crash the script.) To use a global script, the script must have a name which begins with gl and contains a procedure called start, map_enter_p_proc, map_exit_p_proc, or map_update_p_proc. The start procedure will be executed once when the player loads a saved game or starts a new game. The map_*_p_proc procedures will be executed once when a map is being entered/left/updated. If you wish the script to be executed repeatedly, call set_global_script_repeat on the first run of the start procedure using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.)
Global scripts have multiple modes, which can be set using the set_global_script_type function.
- In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map. [Using mode 1 requires the input wrapper to be enabled. Use
available_global_script_types to check what is available.] - Obsolete. - In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc.
- In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows.
- Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows.
+ Global scripts - sfall Global scripts | sfall Global scripts
As well as the new functions, sfall also adds global scripts. These run independent of any loaded maps, but do not have an attached object. (i.e. using self_obj without using set_self first will crash the script.) To use a global script, the script must have a name which begins with gl and contains a procedure called start, map_enter_p_proc, map_exit_p_proc, or map_update_p_proc. The start procedure will be executed once when the player loads a saved game or starts a new game. The map_*_p_proc procedures will be executed once when a map is being entered/left/updated. If you wish the script to be executed repeatedly, call set_global_script_repeat on the first run of the start procedure using the number of frames between each run as the argument. (0 disables the script, 1 runs it every frame, 2 runs it every other frame etc.)
Global scripts have multiple modes, which can be set using the set_global_script_type function.
- In the default mode (i.e. mode 0) their execution is linked to the local map game loop, so the script will not run in dialogs or on the world map. [Using mode 1 requires the input wrapper to be enabled. Use
available_global_script_types to check what is available.] - Obsolete. - In mode 1 their execution is linked to the player input, and so they will run whenever the mouse cursor is visible on screen, including the world map, character dialogs etc.
- In mode 2, execution is linked to the world map loop, so the script will only be executed on the world map and not on the local map or in any dialog windows.
- Mode 3 is a combination of modes 0 and 2, so scripts will be executed on both local maps and the world map, but not in dialog windows.
diff --git a/global-variables/index.html b/global-variables/index.html
index 244cc9cf..8abaee4c 100644
--- a/global-variables/index.html
+++ b/global-variables/index.html
@@ -1,4 +1,4 @@
- Global variables - sfall Global variables | sfall Global variables
These functions require an EXACTLY 8 characters long, case sensitive string for the variable name. The variables behave the same as normal Fallout globals, except that they don’t have to be declared beforehand in vault13.gam. Trying to get a variable which hasn’t been set will always return 0. The functions are intended for use when a patch to a mod requires the addition of a new global variable, a case which would otherwise require the player to start a new game.
Functions
get_sfall_global_float
float get_sfall_global_float(string/int varname)
+ Global variables - sfall Global variables | sfall Global variables
These functions require an EXACTLY 8 characters long, case sensitive string for the variable name. The variables behave the same as normal Fallout globals, except that they don’t have to be declared beforehand in vault13.gam. Trying to get a variable which hasn’t been set will always return 0. The functions are intended for use when a patch to a mod requires the addition of a new global variable, a case which would otherwise require the player to start a new game.
Functions
get_sfall_global_float
float get_sfall_global_float(string/int varname)
get_sfall_global_int
int get_sfall_global_int(string/int varname)
set_sfall_global
void set_sfall_global(string/int varname, int/float value)
diff --git a/graphics/index.html b/graphics/index.html
index 77f0aee8..0fda99c9 100644
--- a/graphics/index.html
+++ b/graphics/index.html
@@ -1,4 +1,4 @@
- Graphics - sfall Graphics | sfall Graphics
The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can’t. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.
Functions
- activate_shader
- deactivate_shader
- force_graphics_refresh
- free_shader
- get_screen_height
- get_screen_width
- get_shader_texture
- get_shader_version
- graphics_funcs_available
- load_shader
- set_palette
- set_shader_float
- set_shader_int
- set_shader_mode
- set_shader_texture
- set_shader_vector
activate_shader
void activate_shader(int ID)
+ Graphics - sfall Graphics | sfall Graphics
The graphics functions are only available if the user is using graphics mode 4 or 5. Use graphics_funcs_available to check; it returns 1 if you can use them or 0 if you can’t. Calling graphics functions when graphics_funcs_available returns 0 will do nothing.
Functions
- activate_shader
- deactivate_shader
- force_graphics_refresh
- free_shader
- get_screen_height
- get_screen_width
- get_shader_texture
- get_shader_version
- graphics_funcs_available
- load_shader
- set_palette
- set_shader_float
- set_shader_int
- set_shader_mode
- set_shader_texture
- set_shader_vector
activate_shader
void activate_shader(int ID)
deactivate_shader
void deactivate_shader(int ID)
force_graphics_refresh
void force_graphics_refresh(bool enabled)
Forces the screen to redraw at times when it normally wouldn’t. If you’re using animated shader, turning this option on is recommended.
free_shader
void free_shader(int ID)
@@ -8,10 +8,10 @@
get_shader_version
int get_shader_version
Gives you the highest shader version supported by the player’s graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30.
graphics_funcs_available
bool graphics_funcs_available
load_shader
int load_shader(string path)
-
Takes a path relative to the <GameRoot>\<master_patches>\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.
set_palette
void set_palette(string path)
+
Takes a path relative to the <GameRoot>\<master_patches>\shaders\ directory as an argument and returns a shader ID. That ID should be passed as the first argument to all other shader functions, and is valid until free_shader is called on the ID, the player loads a saved game or the player quits to the main menu.
set_palette
void set_palette(string path)
set_shader_float
void set_shader_float(int ID, string param, float value)
set_shader_int
void set_shader_int(int ID, string param, int value)
set_shader_mode
void set_shader_mode(int mode)
-
Tells sfall when to use a shader. The parameter is a set of 32 flags which specify the screens on which the shader will be disabled, unless bit 32 is set, in which case the shader will only be active on those screens. Remember that screens are displayed on top of each other; if the player opens the character menu which in combat, the game still considers the player to be in combat. See sfall.h for a list of defines.
set_shader_texture
void set_shader_texture(int ID, string param, int texID)
+
Tells sfall when to use a shader. The parameter is a set of 32 flags which specify the screens on which the shader will be disabled, unless bit 32 is set, in which case the shader will only be active on those screens. Remember that screens are displayed on top of each other; if the player opens the character menu which in combat, the game still considers the player to be in combat. See sfall.h for a list of defines.
set_shader_texture
void set_shader_texture(int ID, string param, int texID)
set_shader_vector
void set_shader_vector(int ID, string param, float f1, float f2, float f3, float f4)
diff --git a/hook-functions/index.html b/hook-functions/index.html
index 50f48b57..85350ef3 100644
--- a/hook-functions/index.html
+++ b/hook-functions/index.html
@@ -1,16 +1,16 @@
- Hook functions - sfall Hook functions | sfall Hook functions
Functions
- get_sfall_arg
- get_sfall_arg_at
- get_sfall_args
- init_hook
- register_hook
- register_hook_proc
- register_hook_proc_spec
- set_sfall_arg
- set_sfall_return
get_sfall_arg
mixed get_sfall_arg()
-
Gets the next argument from sfall. Each time it’s called it returns the next argument, or otherwise it returns 0 if there are no more arguments left. You can arbitrarily get the value of any argument using the sfall_func1("get_sfall_arg_at", argNum) function.
get_sfall_arg_at
sfall.h
mixed get_sfall_arg_at(int argNum)
+ Hook functions - sfall Hook functions | sfall Hook functions
Functions
- get_sfall_arg
- get_sfall_arg_at
- get_sfall_args
- init_hook
- register_hook
- register_hook_proc
- register_hook_proc_spec
- set_sfall_arg
- set_sfall_return
get_sfall_arg
mixed get_sfall_arg()
+
Gets the next argument from sfall. Each time it’s called it returns the next argument, or otherwise it returns 0 if there are no more arguments left. You can arbitrarily get the value of any argument using the sfall_func1("get_sfall_arg_at", argNum) function.
get_sfall_arg_at
sfall.h
mixed get_sfall_arg_at(int argNum)
Gets the value of hook argument with the specified argument number (first argument of hook starts from 0)
get_sfall_args
int get_sfall_args()
Returns all hook arguments as a new temp array.
init_hook
int init_hook()
-
The hook script equivalent of game_loaded; it returns 1 when the script is loaded for the first time or when the player reloads the game, and 0 otherwise.
register_hook
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 current global script. You can use all above functions like normal.
register_hook_proc
void register_hook_proc(int hookID, proc procedure)
-
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!).
Use zero (0) as second argument to unregister hook script from current global script.
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.
Example: let’s say we have a Mod A which reduces all “to hit” chances by 50%. The code might look like this:
original_chance = get_sfall_arg;
+
The hook script equivalent of game_loaded; it returns 1 when the script is loaded for the first time or when the player reloads the game, and 0 otherwise.
register_hook
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 current global script. You can use all above functions like normal.
register_hook_proc
void register_hook_proc(int hookID, proc procedure)
+
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!).
Use zero (0) as second argument to unregister hook script from current global script.
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.
Example: let’s say we have a Mod A which reduces all “to hit” chances by 50%. The code might look like this:
original_chance = get_sfall_arg;
set_sfall_return(original_chance / 2);
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(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(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).
The defines to use for the hookID are in sfall.h.
register_hook_proc_spec
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.
set_sfall_arg
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 register_hook_proc).
set_sfall_return
void set_sfall_return(int value)
+
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 hookID are in sfall.h.
register_hook_proc_spec
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.
set_sfall_arg
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 register_hook_proc).
set_sfall_return
void set_sfall_return(int value)
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.
diff --git a/hook-types/index.html b/hook-types/index.html
index 16be293d..3e7116a0 100644
--- a/hook-types/index.html
+++ b/hook-types/index.html
@@ -1,19 +1,19 @@
- Hook types - sfall Hook types | sfall Hook types
- AdjustFID
- AdjustPoison
- AdjustRads
- AfterHitRoll
- AmmoCost
- BarterPrice
- BestWeapon
- CalcAPCost
- CanUseWeapon
- CarTravel
- CombatDamage
- CombatTurn
- DeathAnim1
- DeathAnim2
- Deprecated hooks
- DescriptionObj
- Encounter
- ExplosiveTimer
- FindTarget
- GameModeChange
- InvenWield
- InventoryMove
- ItemDamage
- KeyPress
- MouseClick
- MoveCost
- OnDeath
- OnExplosion
- RemoveInvenObj
- RestTimer
- RollCheck
- SetGlobalVar
- SetLighting
- Sneak
- StdProcedure
- StdProcedureEnd
- Steal
- SubCombatDamage
- TargetObject
- ToHit
- UseAnimObj
- UseObj
- UseObjOn
- UseSkill
- UseSkillOn
- WithinPerception
AdjustFID
HOOK_ADJUSTFID (hs_adjustfid.int)
Runs after calculating character figure FID on the inventory screen, whenever the game decides that character appearance might change. Also happens on other screens, like barter.
NOTE: FID has following format: 0x0ABBCDDD, where: A - object type, BB - animation code (always 0 in this case), C - weapon code, DDD - FRM index in LST file.
int arg0 - the vanilla FID calculated by the engine according to critter base FID and armor/weapon being used
+ Hook types - sfall Hook types | sfall Hook types
- AdjustFID
- AdjustPoison
- AdjustRads
- AfterHitRoll
- AmmoCost
- BarterPrice
- BestWeapon
- CalcAPCost
- CanUseWeapon
- CarTravel
- CombatDamage
- CombatTurn
- DeathAnim1
- DeathAnim2
- Deprecated hooks
- DescriptionObj
- Encounter
- ExplosiveTimer
- FindTarget
- GameModeChange
- InvenWield
- InventoryMove
- ItemDamage
- KeyPress
- MouseClick
- MoveCost
- OnDeath
- OnExplosion
- RemoveInvenObj
- RestTimer
- RollCheck
- SetGlobalVar
- SetLighting
- Sneak
- StdProcedure
- StdProcedureEnd
- Steal
- SubCombatDamage
- TargetObject
- ToHit
- UseAnimObj
- UseObj
- UseObjOn
- UseSkill
- UseSkillOn
- WithinPerception
AdjustFID
HOOK_ADJUSTFID (hs_adjustfid.int)
Runs after calculating character figure FID on the inventory screen, whenever the game decides that character appearance might change. Also happens on other screens, like barter.
NOTE: FID has following format: 0x0ABBCDDD, where: A - object type, BB - animation code (always 0 in this case), C - weapon code, DDD - FRM index in LST file.
int arg0 - the vanilla FID calculated by the engine according to critter base FID and armor/weapon being used
int arg1 - the modified FID calculated by the internal sfall code (like Hero Appearance Mod)
int ret0 - overrides the calculated FID with provided value
-
AdjustPoison
HOOK_ADJUSTPOISON (hs_adjustpoison.int)
Runs when a critter’s poison level is changed, or when the player takes damage from the poison.
Critter arg0 - the critter
+
AdjustPoison
HOOK_ADJUSTPOISON (hs_adjustpoison.int)
Runs when a critter’s poison level is changed, or when the player takes damage from the poison.
Critter arg0 - the critter
int arg1 - the amount of poison being added/removed
int arg2 - the damage value at the time of applying the poison effect
(damage from the poison effect is implemented only for the player character; for other critters, this value will always be 0)
int ret0 - the new amount of poison being added/removed
int ret1 - the new damage value, only negative values are allowed (will only be valid at the time of taking damage from the poison)
-
AdjustRads
HOOK_ADJUSTRADS (hs_adjustrads.int)
Runs when a critter’s radiation level is changed.
Critter arg0 - the critter (usually dude_obj)
+
AdjustRads
HOOK_ADJUSTRADS (hs_adjustrads.int)
Runs when a critter’s radiation level is changed.
Critter arg0 - the critter (usually dude_obj)
int arg1 - the amount of radiation being added/removed
int ret0 - the new amount of radiation being added/removed
-
AfterHitRoll
HOOK_AFTERHITROLL (hs_afterhitroll.int)
Runs after Fallout has decided if an attack will hit or miss.
int arg0 - If the attack will hit: 0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit
+
AfterHitRoll
HOOK_AFTERHITROLL (hs_afterhitroll.int)
Runs after Fallout has decided if an attack will hit or miss.
int arg0 - If the attack will hit: 0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit
Critter arg1 - The attacker
Critter arg2 - The target of the attack
int arg3 - The bodypart
@@ -22,7 +22,7 @@ int arg4 - The hit chance
int ret0 - Override the hit/miss
int ret1 - Override the targeted bodypart
Critter ret2 - Override the target of the attack
-
AmmoCost
HOOK_AMMOCOST (hs_ammocost.int)
Runs when calculating ammo cost for a weapon. Doesn’t affect damage, only how much ammo is spent. By default, weapons can make attacks when at least 1 ammo is left, regardless of ammo cost calculations. To add proper check for ammo before attacking and proper calculation of the number of burst rounds (hook type 1 and 2 in arg3), set CheckWeaponAmmoCost=1 in Misc section of ddraw.ini.
Item arg0 - The weapon
+
AmmoCost
HOOK_AMMOCOST (hs_ammocost.int)
Runs when calculating ammo cost for a weapon. Doesn’t affect damage, only how much ammo is spent.
By default, weapons can make attacks when at least 1 ammo is left, regardless of ammo cost calculations.
To add proper check for ammo before attacking and proper calculation of the number of burst rounds (hook type 1 and 2 in arg3), set CheckWeaponAmmoCost=1 in Misc section of ddraw.ini.
Item arg0 - The weapon
int arg1 - Number of bullets in burst or 1 for single shots
int arg2 - The amount of ammo that will be consumed, calculated by the original ammo cost function (this is basically 2 for Super Cattle Prod and Mega Power Fist)
NOTE: for hook type 2, this value is the ammo cost per round (default is always 1)
@@ -33,7 +33,7 @@ int arg3 - Type of hook:
3 - when subtracting ammo after burst attack
int ret0 - The new amount of ammo to be consumed, or ammo cost per round for hook type 2 (set to 0 for unlimited ammo)
-
BarterPrice
HOOK_BARTERPRICE (hs_barterprice.int)
Runs whenever the value of goods being purchased is calculated.
NOTE: the hook is executed twice when entering the barter screen or after transaction: the first time is for the player and the second time is for NPC.
Critter arg0 - the critter doing the bartering (either dude_obj or inven_dude)
+
BarterPrice
HOOK_BARTERPRICE (hs_barterprice.int)
Runs whenever the value of goods being purchased is calculated.
NOTE: the hook is executed twice when entering the barter screen or after transaction: the first time is for the player and the second time is for NPC.
Critter arg0 - the critter doing the bartering (either dude_obj or inven_dude)
Critter arg1 - the critter being bartered with
int arg2 - the default value of the goods
Critter arg3 - table of requested goods (being bought from NPC)
@@ -46,32 +46,32 @@ int arg9 - 1 if trading with a party member, 0 otherwise
int ret0 - the modified value of all of the goods (pass -1 if you just want to modify offered goods)
int ret1 - the modified value of all offered goods
-
BestWeapon
HOOK_BESTWEAPON (hs_bestweapon.int)
Runs when the AI decides which weapon is the best while searching the inventory for a weapon to equip in combat. This also runs when the player presses the “Use Best Weapon” button on the party member control panel.
Critter arg0 - the critter searching for a weapon
+
BestWeapon
HOOK_BESTWEAPON (hs_bestweapon.int)
Runs when the AI decides which weapon is the best while searching the inventory for a weapon to equip in combat. This also runs when the player presses the “Use Best Weapon” button on the party member control panel.
Critter arg0 - the critter searching for a weapon
Item arg1 - the best weapon chosen from two items
Item arg2 - the first choice of weapon
Item arg3 - the second choice of weapon
Critter arg4 - the target of the critter (can be 0)
Item ret0 - overrides the chosen best weapon
-
CalcAPCost
HOOK_CALCAPCOST (hs_calcapcost.int)
Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn’t run for using other item types or moving. Note that the first time a game is loaded, this script doesn’t run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player’s hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn. You can get the weapon object by checking item slot based on attack type (ATKTYPE_LWEP1, ATKTYPE_LWEP2, etc) and then calling critter_inven_obj.
Critter arg0 - The critter performing the action
+
CalcAPCost
HOOK_CALCAPCOST (hs_calcapcost.int)
Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn’t run for using other item types or moving.
Note that the first time a game is loaded, this script doesn’t run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the player’s hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.
You can get the weapon object by checking item slot based on attack type (ATKTYPE_LWEP1, ATKTYPE_LWEP2, etc) and then calling critter_inven_obj.
Critter arg0 - The critter performing the action
int arg1 - Attack Type (see ATKTYPE_* constants)
int arg2 - Is aimed attack (1 or 0)
int arg3 - The default AP cost
Item arg4 - The weapon for which the cost is calculated. If it is 0, the pointer to the weapon can still be obtained by the aforementioned method
int ret0 - The new AP cost
-
CanUseWeapon
HOOK_CANUSEWEAPON (hs_canuseweapon.int)
Run when the AI checks whether it can use a weapon. This mostly happens when NPCs try to find weapons in their inventory or on the map.
Critter arg0 - the critter doing the check
+
CanUseWeapon
HOOK_CANUSEWEAPON (hs_canuseweapon.int)
Run when the AI checks whether it can use a weapon. This mostly happens when NPCs try to find weapons in their inventory or on the map.
Critter arg0 - the critter doing the check
Item arg1 - the weapon being checked
int arg2 - attack type (see ATKTYPE_* constants)
int arg3 - original result of engine function: 1 - can use, 0 - can't use
int ret0 - overrides the result of engine function. Any non-zero value allows using the weapon
-
CarTravel
HOOK_CARTRAVEL (hs_cartravel.int)
Runs continuously during worldmap travel on car.
int arg0 - vanilla car speed (between 3 and 8 "steps")
+
CarTravel
HOOK_CARTRAVEL (hs_cartravel.int)
Runs continuously during worldmap travel on car.
int arg0 - vanilla car speed (between 3 and 8 "steps")
int arg1 - vanilla fuel consumption (100 and below)
int ret0 - car speed override (pass -1 if you just want to override fuel consumption)
int ret1 - fuel consumption override
-
CombatDamage
HOOK_COMBATDAMAGE (hs_subcombatdmg.int)
Runs when:
- Game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts). This happens BEFORE the actual attack animation.
- AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.
Does not run for misses, or non-combat damage like dynamite explosions.
Critter arg0 - The target
+
CombatDamage
HOOK_COMBATDAMAGE (hs_subcombatdmg.int)
Runs when:
- Game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts). This happens BEFORE the actual attack animation.
- AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.
Does not run for misses, or non-combat damage like dynamite explosions.
Critter arg0 - The target
Critter arg1 - The attacker
int arg2 - The amount of damage to the target
int arg3 - The amount of damage to the attacker
@@ -90,7 +90,7 @@ int ret1 - The damage to the attacker
int ret2 - The special effect flags for the target
int ret3 - The special effect flags for the attacker
int ret4 - The amount of knockback to the target
-
CombatTurn
HOOK_COMBATURN (hs_combatturn.int)
Runs before and after each turn in combat (for both PC and NPC).
int arg0 - event type:
+
CombatTurn
HOOK_COMBATURN (hs_combatturn.int)
Runs before and after each turn in combat (for both PC and NPC).
int arg0 - event type:
1 - start of turn
0 - normal end of turn
-1 - combat ends abruptly (by script or by pressing Enter during PC turn)
@@ -99,42 +99,42 @@ Critter arg1 - critter doing the turn
bool arg2 - 1 at the start/end of the player's turn after loading a game saved in combat mode, 0 otherwise
int ret0 - pass 1 at the start of turn to skip the turn, pass -1 at the end of turn to force end of combat
-
DeathAnim1
HOOK_DEATHANIM1 (hs_deathanim1.int)
Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees. Does not run for critters in the knockdown/out state.
int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
+
DeathAnim1
HOOK_DEATHANIM1 (hs_deathanim1.int)
Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees.
Does not run for critters in the knockdown/out state.
int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
Critter arg1 - The attacker
Critter arg2 - The target
int arg3 - The amount of damage
int arg4 - Unused, always -1. Use this if you are using the same procedure for HOOK_DEATHANIM1 and HOOK_DEATHANIM2 (since sfall 4.1/3.8.24)
int ret0 - The pid of an object to override the attacking weapon with
-
DeathAnim2
HOOK_DEATHANIM2 (hs_deathanim2.int)
Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than HOOK_DEATHANIM1, but performs no validation. When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and attacker will point to an object with obj_art_fid == 0x20001F5. Does not run for critters in the knockdown/out state.
int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
+
DeathAnim2
HOOK_DEATHANIM2 (hs_deathanim2.int)
Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than HOOK_DEATHANIM1, but performs no validation.
When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and attacker will point to an object with obj_art_fid == 0x20001F5.
Does not run for critters in the knockdown/out state.
int arg0 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
Critter arg1 - The attacker
Critter arg2 - The target
int arg3 - The amount of damage
int arg4 - The death anim id calculated by Fallout
int ret0 - The death anim id to override with
-
Deprecated hooks
hs_hexmoveblocking.int hs_hexaiblocking.int hs_hexshootblocking.int hs_hexsightblocking.int
Run when checking to see if a hex blocks movement or shooting. (or ai-ing, presumably…)
NOTE: These hook scripts can become very CPU-intensive and you should avoid using them. For this reason, these hooks are not thoroughly supported in sfall, and may be removed in future versions.
If you want to check if some tile or path is blocked, use functions: obj_blocking_tile, obj_blocking_line, path_find_to.
If you want script to be called every time NPC moves by hex in combat, use HOOK_MOVECOST hook.
Critter arg0 - the critter doing the moving
+
Deprecated hooks
hs_hexmoveblocking.int hs_hexaiblocking.int hs_hexshootblocking.int hs_hexsightblocking.int
Run when checking to see if a hex blocks movement or shooting. (or ai-ing, presumably…)
NOTE: These hook scripts can become very CPU-intensive and you should avoid using them. For this reason, these hooks are not thoroughly supported in sfall, and may be removed in future versions.
If you want to check if some tile or path is blocked, use functions: obj_blocking_tile, obj_blocking_line, path_find_to.
If you want script to be called every time NPC moves by hex in combat, use HOOK_MOVECOST hook.
Critter arg0 - the critter doing the moving
int arg1 - the tile number being checked
int arg2 - the elevation being checked
int arg3 - 1 if the hex would normally be blocking
Obj ret0 - 0 if the hex doesn't block, or any sort of object pointer if it does
-
DescriptionObj
HOOK_DESCRIPTIONOBJ (hs_descriptionobj.int)
Runs when using the examine action icon to display the description of an object. You can override the description text. An example usage would be to add an additional description to the item based on player’s stats/skills. Does not run if the script of the object overrides the description.
Obj arg0 - the object
+
DescriptionObj
HOOK_DESCRIPTIONOBJ (hs_descriptionobj.int)
Runs when using the examine action icon to display the description of an object. You can override the description text. An example usage would be to add an additional description to the item based on player’s stats/skills.
Does not run if the script of the object overrides the description.
Obj arg0 - the object
int ret0 - a pointer to the new text received by using "get_string_pointer" function
-
Encounter
HOOK_ENCOUNTER (hs_encounter.int)
Runs whenever a random encounter occurs (except the Horrigan meeting and scripted encounters), or when the player enters a local map from the world map. You can override the map for loading or the encounter.
int arg0 - event type: 0 - when a random encounter occurs, 1 - when the player enters from the world map
+
Encounter
HOOK_ENCOUNTER (hs_encounter.int)
Runs whenever a random encounter occurs (except the Horrigan meeting and scripted encounters), or when the player enters a local map from the world map. You can override the map for loading or the encounter.
int arg0 - event type: 0 - when a random encounter occurs, 1 - when the player enters from the world map
int arg1 - the map ID that the encounter will load (see MAPS.h or Maps.txt)
int arg2 - 1 when the encounter occurs is a special encounter, 0 otherwise
int ret0 - overrides the map ID, or pass -1 for event type 0 to cancel the encounter and continue traveling
int ret1 - pass 1 to cancel the encounter and load the specified map from the ret0 (only for event type 0)
-
ExplosiveTimer
HOOK_EXPLOSIVETIMER (hs_explosivetimer.int)
Runs after setting the explosive timer. You can override the result.
int arg0 - the time in ticks set in the timer
+
ExplosiveTimer
HOOK_EXPLOSIVETIMER (hs_explosivetimer.int)
Runs after setting the explosive timer. You can override the result.
int arg0 - the time in ticks set in the timer
Obj arg1 - the explosive object
int arg2 - the result of engine calculation of whether the timer was set successfully: 1 - failure, 2 - success (similar to ROLL_* in Condtion.h)
int ret0 - overrides the time of the timer (maximum 18000 ticks)
int ret1 - overrides the result of engine calculation: 0/1 - failure, 2/3 - success (similar to ROLL_*), any other value - use engine handler
-
FindTarget
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.
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, but this is fixed in sfall 4.2.3/3.8.23. Use set_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.
NOTE: The engine can choose targets by the following criteria: 1) The nearest enemy to the attacker. 2) The enemy that attacked the attacker. 3) The enemy that attacked an NPC from the same team as the attacker. 4) The enemy that is attacked by an NPC from the same team as the attacker.
Critter arg0 - The attacker
+
FindTarget
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.
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, but this is fixed in sfall 4.2.3/3.8.23. Use set_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.
NOTE: The engine can choose targets by the following criteria: 1) The nearest enemy to the attacker. 2) The enemy that attacked the attacker. 3) The enemy that attacked an NPC from the same team as the attacker. 4) The enemy that is attacked by an NPC from the same team as the attacker.
Critter arg0 - The attacker
Critter arg1 - A possible target
Critter arg2 - A possible target
Critter arg3 - A possible target
@@ -144,16 +144,16 @@ Critter ret0 - The first choice of target
Critter ret1 - The second choice of target
Critter ret2 - The third choice of target
Critter ret3 - The fourth choice of target
-
GameModeChange
HOOK_GAMEMODECHANGE (hs_gamemodechange.int)
Runs once every time when the game mode was changed, like opening/closing the inventory, character screen, pipboy, etc.
int arg0 - event type: 1 - when the player exits the game, 0 - otherwise
+
GameModeChange
HOOK_GAMEMODECHANGE (hs_gamemodechange.int)
Runs once every time when the game mode was changed, like opening/closing the inventory, character screen, pipboy, etc.
int arg0 - event type: 1 - when the player exits the game, 0 - otherwise
int arg1 - the previous game mode
-
InvenWield
HOOK_INVENWIELD (hs_invenwield.int)
Runs before causing a critter or the player to wield/unwield an armor or a weapon (except when using the inventory by PC). An example usage would be to change critter art depending on armor being used or to dynamically customize weapon animations.
NOTE: When replacing a previously wielded armor or weapon, the unwielding hook will not be executed. If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.
Critter arg0 - critter
+
InvenWield
HOOK_INVENWIELD (hs_invenwield.int)
Runs before causing a critter or the player to wield/unwield an armor or a weapon (except when using the inventory by PC). An example usage would be to change critter art depending on armor being used or to dynamically customize weapon animations.
NOTE: When replacing a previously wielded armor or weapon, the unwielding hook will not be executed. If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.
Critter arg0 - critter
Item arg1 - item being wielded or unwielded (weapon/armor)
int arg2 - slot (INVEN_TYPE_*)
int arg3 - 1 when wielding, 0 when unwielding
int arg4 - 1 when removing an equipped item from inventory, 0 otherwise
int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override) - NOT RECOMMENDED
-
InventoryMove
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) 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 arg0 - Target slot:
+
InventoryMove
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) 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 arg0 - Target slot:
0 - main backpack
1 - left hand
2 - right hand
@@ -167,7 +167,7 @@ Item arg1 - Item being moved
Item arg2 - Item being replaced, weapon being reloaded, or container being filled (can be 0)
int ret0 - Override setting (-1 - use engine handler, any other value - prevent relocation of item/reloading weapon/picking up item)
-
ItemDamage
HOOK_ITEMDAMAGE (hs_itemdamage.int)
Runs when retrieving the damage rating of the player’s used weapon. (Which may be their fists.)
int arg0 - The default min damage
+
ItemDamage
HOOK_ITEMDAMAGE (hs_itemdamage.int)
Runs when retrieving the damage rating of the player’s used weapon. (Which may be their fists.)
int arg0 - The default min damage
int arg1 - The default max damage
Item arg2 - The weapon used (0 if unarmed)
Critter arg3 - The critter doing the attacking
@@ -176,20 +176,20 @@ int arg5 - non-zero if this is an attack using a melee weapon
int ret0 - Either the damage to be used, if ret1 isn't given, or the new minimum damage if it is
int ret1 - The new maximum damage
-
KeyPress
HOOK_KEYPRESS (hs_keypress.int)
Runs once every time when any key was pressed or released.
- DX codes: see dik.h header or https://kippykip.com/b3ddocs/commands/scancodes.htm
- VK codes
NOTE: If you want to override a key, the new key DX scancode should be the same for both pressed and released events.
int arg0 - event type: 1 - pressed, 0 - released
+
KeyPress
HOOK_KEYPRESS (hs_keypress.int)
Runs once every time when any key was pressed or released.
- DX codes: see dik.h header or https://kippykip.com/b3ddocs/commands/scancodes.htm
- VK codes
NOTE: If you want to override a key, the new key DX scancode should be the same for both pressed and released events.
int arg0 - event type: 1 - pressed, 0 - released
int arg1 - key DX scancode
int arg2 - key VK code (very similar to ASCII codes)
int ret0 - overrides the pressed key (a new key DX scancode or 0 for no override)
-
MouseClick
HOOK_MOUSECLICK (hs_mouseclick.int)
Runs once every time when a mouse button was pressed or released.
int arg0 - event type: 1 - pressed, 0 - released
+
MouseClick
HOOK_MOUSECLICK (hs_mouseclick.int)
Runs once every time when a mouse button was pressed or released.
int arg0 - event type: 1 - pressed, 0 - released
int arg1 - button number (0 - left, 1 - right, up to 7)
-
MoveCost
HOOK_MOVECOST (hs_movecost.int)
Runs when calculating the AP cost of movement.
Critter arg0 - the critter doing the moving
+
MoveCost
HOOK_MOVECOST (hs_movecost.int)
Runs when calculating the AP cost of movement.
Critter arg0 - the critter doing the moving
int arg1 - the number of hexes being moved
int arg2 - the original AP cost
int ret0 - the new AP cost
-
OnDeath
HOOK_ONDEATH (hs_ondeath.int)
Runs immediately after a critter dies for any reason. No return values; this is just a convenience for when you need to do something after death for a large number of different critters and don’t want to have to script each and every one of them.
Critter arg0 - The critter that just died
-
OnExplosion
HOOK_ONEXPLOSION (hs_onexplosion.int)
Runs when Fallout is checking all the tiles within the explosion radius for targets before an explosion occurs. The tile checking will be interrupted when 6 additional targets (critters) are received.
int arg0 - event type: 1 - when checking objects within the explosion radius without causing damage (e.g. the player drops an active explosive), 0 - otherwise
+
OnDeath
HOOK_ONDEATH (hs_ondeath.int)
Runs immediately after a critter dies for any reason. No return values; this is just a convenience for when you need to do something after death for a large number of different critters and don’t want to have to script each and every one of them.
Critter arg0 - The critter that just died
+
OnExplosion
HOOK_ONEXPLOSION (hs_onexplosion.int)
Runs when Fallout is checking all the tiles within the explosion radius for targets before an explosion occurs. The tile checking will be interrupted when 6 additional targets (critters) are received.
int arg0 - event type: 1 - when checking objects within the explosion radius without causing damage (e.g. the player drops an active explosive), 0 - otherwise
Critter arg1 - the attacker
int arg2 - the tile on which the explosion occurs
int arg3 - checked tile within the explosion radius
@@ -198,18 +198,18 @@ Critter arg5 - the target critter, may be 0 or equal to the attacker
int arg6 - 1 when using throwing weapons (e.g. grenades), 0 otherwise
int ret0 - overrides the found object on the checked tile, pass 0 to skip the object
-
RemoveInvenObj
HOOK_REMOVEINVENOBJ (hs_removeinvenobj.int)
Runs when an object is removed from a container or critter’s inventory for any reason.
Obj arg0 - the owner that the object is being removed from
+
RemoveInvenObj
HOOK_REMOVEINVENOBJ (hs_removeinvenobj.int)
Runs when an object is removed from a container or critter’s inventory for any reason.
Obj arg0 - the owner that the object is being removed from
Item arg1 - the item that is being removed
int arg2 - the number of items to remove
int arg3 - The reason the object is being removed (see RMOBJ_* constants)
Obj arg4 - The destination object when the item is moved to another object, 0 otherwise
-
RestTimer
HOOK_RESTTIMER (hs_resttimer.int)
Runs continuously while the player is resting (using pipboy alarm clock).
int arg0 - the game time in ticks
+
RestTimer
HOOK_RESTTIMER (hs_resttimer.int)
Runs continuously while the player is resting (using pipboy alarm clock).
int arg0 - the game time in ticks
int arg1 - event type: 1 - when the resting ends normally, -1 - when pressing ESC to cancel the timer, 0 - otherwise
int arg2 - the hour part of the length of resting time
int arg3 - the minute part of the length of resting time
int ret0 - pass 1 to interrupt the resting, pass 0 to continue the rest if it was interrupted by pressing ESC key
-
RollCheck
HOOK_ROLLCHECK (hs_rollcheck.int)
Runs when a game event performs a random roll to check the chance of success or failure.
int arg0 - event type:
+
RollCheck
HOOK_ROLLCHECK (hs_rollcheck.int)
Runs when a game event performs a random roll to check the chance of success or failure.
int arg0 - event type:
1 - checks the chance of an attack hitting the target
2 - checks the chance of a bullet from a burst hitting the target (for burst attacks)
3 - checks the chance when using skills (not listed below)
@@ -225,38 +225,38 @@ int arg3 - the bonus value, used when checking critical success
int arg4 - random chance (calculated as: chance - random(1, 100)), where a negative value is a failure check (ROLL_FAILURE)
int ret0 - overrides the roll result
-
SetGlobalVar
HOOK_SETGLOBALVAR (hs_setglobalvar.int)
Runs when setting the value of a global variable.
int arg0 - the index number of the global variable being set
+
SetGlobalVar
HOOK_SETGLOBALVAR (hs_setglobalvar.int)
Runs when setting the value of a global variable.
int arg0 - the index number of the global variable being set
int arg1 - the set value of the global variable
int ret0 - overrides the value of the global variable
-
SetLighting
HOOK_SETLIGHTING (hs_setlighting.int)
Runs before setting the light level for an object or a map. You can override the result.
Obj arg0 - the object being set, or -1 when setting the light level for a map
+
SetLighting
HOOK_SETLIGHTING (hs_setlighting.int)
Runs before setting the light level for an object or a map. You can override the result.
Obj arg0 - the object being set, or -1 when setting the light level for a map
int arg1 - the light intensity
int arg2 - the light radius, or -1 when setting the light level for a map
int ret0 - overrides the light intensity. Intensity range is from 0 to 65536
int ret1 - overrides the light radius. Radius range is from 0 to 8 (works only for the object)
-
Sneak
HOOK_SNEAK (hs_sneak.int)
Runs when the Sneak skill is activated, or when the game rolls another Sneak check after the duration for the current one is over. You can override the result of a random Sneak check or the duration time for the current result.
int arg0 - Sneak check result: 1 - success, 0 - failure
+
Sneak
HOOK_SNEAK (hs_sneak.int)
Runs when the Sneak skill is activated, or when the game rolls another Sneak check after the duration for the current one is over. You can override the result of a random Sneak check or the duration time for the current result.
int arg0 - Sneak check result: 1 - success, 0 - failure
int arg1 - the duration in ticks for the current Sneak check (time depends on Sneak skill level)
Critter arg2 - the critter (usually dude_obj)
int ret0 - overrides the result of the Sneak check
int ret1 - overrides the duration time for the current result
-
StdProcedure
HOOK_STDPROCEDURE (hs_stdprocedure.int)
Runs before Fallout executes a standard procedure (handler) in any script of any object. NOTE: this hook will not be executed for start, critter_p_proc, timed_event_p_proc, and map_update_p_proc procedures.
int arg0 - the number of the standard script handler (see define.h)
+
StdProcedure
HOOK_STDPROCEDURE (hs_stdprocedure.int)
Runs before Fallout executes a standard procedure (handler) in any script of any object. NOTE: this hook will not be executed for start, critter_p_proc, timed_event_p_proc, and map_update_p_proc procedures.
int arg0 - the number of the standard script handler (see define.h)
Obj arg1 - the object that owns this handler (self_obj)
Obj arg2 - the object that called this handler (source_obj, can be 0)
int ret0 - pass -1 to cancel the execution of the handler
-
StdProcedureEnd
HOOK_STDPROCEDURE_END (hs_stdprocedure.int)
Runs after Fallout executes a standard procedure (handler) in any script of any object. NOTE: this hook will not be executed for start, critter_p_proc, timed_event_p_proc, and map_update_p_proc procedures.
int arg0 - the number of the standard script handler (see define.h)
+
StdProcedureEnd
HOOK_STDPROCEDURE_END (hs_stdprocedure.int)
Runs after Fallout executes a standard procedure (handler) in any script of any object. NOTE: this hook will not be executed for start, critter_p_proc, timed_event_p_proc, and map_update_p_proc procedures.
int arg0 - the number of the standard script handler (see define.h)
Obj arg1 - the object that owns this handler (self_obj)
Obj arg2 - the object that called this handler (source_obj, can be 0)
int arg3 - 1 after procedure execution
-
Steal
HOOK_STEAL (hs_steal.int)
Runs when checking an attempt to steal or plant an item in other inventory using Steal skill.
This is fired before the default handlers are called, which you can override. In this case you MUST provide message of the result to player (“You steal the %s”, “You are caught planting the %s”, etc.). Example message (vanilla behavior):
display_msg(sprintf(mstr_skill(570 + (isSuccess != false) + arg3 * 2), obj_name(arg2)));
Critter arg0 - Thief
+
Steal
HOOK_STEAL (hs_steal.int)
Runs when checking an attempt to steal or plant an item in other inventory using Steal skill.
This is fired before the default handlers are called, which you can override. In this case you MUST provide message of the result to player (“You steal the %s”, “You are caught planting the %s”, etc.). Example message (vanilla behavior):
display_msg(sprintf(mstr_skill(570 + (isSuccess != false) + arg3 * 2), obj_name(arg2)));
Critter arg0 - Thief
Obj arg1 - The target
Item arg2 - Item being stolen/planted
int arg3 - 0 when stealing, 1 when planting
int ret0 - overrides hard-coded handler (1 - force success, 0 - force fail, -1 - use engine handler)
-
SubCombatDamage
HOOK_SUBCOMBATDAMAGE (hs_subcombatdamage.int)
This hook overrides the vanilla damage calculation formula. Runs when:
- Before the game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts).
- AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.
Does not run for misses, non-combat damage like dynamite explosions, or if one of the damage formulas is selected in ddraw.ini.
Critter arg0 - the attacker
+
SubCombatDamage
HOOK_SUBCOMBATDAMAGE (hs_subcombatdamage.int)
This hook overrides the vanilla damage calculation formula. Runs when:
- Before the game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts).
- AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.
Does not run for misses, non-combat damage like dynamite explosions, or if one of the damage formulas is selected in ddraw.ini.
Critter arg0 - the attacker
Critter arg1 - the target
Item arg2 - the weapon used in the attack
int arg3 - attack type (see ATKTYPE_* constants)
@@ -270,12 +270,12 @@ int arg10 - the calculated amount of damage (usually 0, required when using
mixed arg11 - computed attack data (see C_ATTACK_* for offsets and use get/set_object_data functions to get/set the data)
int ret0 - the returned amount of damage
-
TargetObject
HOOK_TARGETOBJECT (hs_targetobject.int)
Runs when the targeting cursor hovers over an object, or when the player tries to attack the target object. You can override the target object or prevent the player from attacking the chosen target.
int arg0 - event type: 0 - when the targeting cursor hovers over the object, 1 - when trying to attack the target object
+
TargetObject
HOOK_TARGETOBJECT (hs_targetobject.int)
Runs when the targeting cursor hovers over an object, or when the player tries to attack the target object. You can override the target object or prevent the player from attacking the chosen target.
int arg0 - event type: 0 - when the targeting cursor hovers over the object, 1 - when trying to attack the target object
int arg1 - 1 when the target object is valid to attack, 0 otherwise
Obj arg2 - the target object
mixed ret0 - overrides the target object, or pass -1 to prevent the player from attacking the object
-
ToHit
HOOK_TOHIT (hs_tohit.int)
Runs when Fallout is calculating the chances of an attack striking a target. Runs after the hit chance is fully calculated normally, including applying the 95% cap.
int arg0 - The hit chance (capped)
+
ToHit
HOOK_TOHIT (hs_tohit.int)
Runs when Fallout is calculating the chances of an attack striking a target.
Runs after the hit chance is fully calculated normally, including applying the 95% cap.
int arg0 - The hit chance (capped)
Critter arg1 - The attacker
Critter arg2 - The target of the attack
int arg3 - The targeted bodypart
@@ -285,33 +285,33 @@ int arg6 - Ranged flag. 1 if the hit chance calculation takes into account t
int arg7 - The raw hit chance before applying the cap
int ret0 - the new hit chance
-
UseAnimObj
HOOK_USEANIMOBJ (hs_useanimobj.int)
Runs before playing the “use” (usually “magic hands”) animation when a critter uses a scenery/container object on the map, or before walking/running animation if the player is at a distance from the object.
Critter arg0 - the critter that uses an object (usually dude_obj)
+
UseAnimObj
HOOK_USEANIMOBJ (hs_useanimobj.int)
Runs before playing the “use” (usually “magic hands”) animation when a critter uses a scenery/container object on the map, or before walking/running animation if the player is at a distance from the object.
Critter arg0 - the critter that uses an object (usually dude_obj)
Obj arg1 - the object being used
int arg2 - the animation code being used (see ANIM_* in Animcomd.h)
int ret0 - overrides the animation code (pass -1 if you want to skip the animation)
-
UseObj
HOOK_USEOBJ (hs_useobj.int)
Runs when:
- a critter uses an object from inventory which have “Use” action flag set or it’s an active flare or dynamite.
- player uses an object from main interface
This is fired before the object is used, and the relevant use_obj script procedures are run. You can disable default item behavior.
NOTE: You can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.
Critter arg0 - The user
+
UseObj
HOOK_USEOBJ (hs_useobj.int)
Runs when:
- a critter uses an object from inventory which have “Use” action flag set or it’s an active flare or dynamite.
- player uses an object from main interface
This is fired before the object is used, and the relevant use_obj script procedures are run. You can disable default item behavior.
NOTE: You can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.
Critter arg0 - The user
Obj arg1 - The object used
int ret0 - overrides hard-coded handler and selects what should happen with the item (0 - place it back, 1 - remove it, -1 - use engine handler)
-
UseObjOn
HOOK_USEOBJON (hs_useobjon.int)
Runs when:
- a critter uses an object on another critter. (Or themselves)
- a critter uses an object from inventory screen AND this object does not have “Use” action flag set and it’s not active flare or explosive.
- player or AI uses any drug
This is fired before the object is used, and the relevant use_obj_on script procedures are run. You can disable default item behavior. NOTE: you can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.
Critter arg0 - The target
+
UseObjOn
HOOK_USEOBJON (hs_useobjon.int)
Runs when:
- a critter uses an object on another critter. (Or themselves)
- a critter uses an object from inventory screen AND this object does not have “Use” action flag set and it’s not active flare or explosive.
- player or AI uses any drug
This is fired before the object is used, and the relevant use_obj_on script procedures are run. You can disable default item behavior.
NOTE: You can’t remove and/or destroy this object during the hookscript (game will crash otherwise). To remove it, return 1.
Critter arg0 - The target
Critter arg1 - The user
int arg2 - The object used
int ret0 - overrides hard-coded handler and selects what should happen with the item (0 - place it back, 1 - remove it, -1 - use engine handler)
-
UseSkill
HOOK_USESKILL (hs_useskill.int)
Runs when using any skill on any object.
This is fired before the default handlers are called, which you can override. In this case you should write your own skill use handler entirely, or otherwise nothing will happen (this includes fade in/fade out, time lapsing and messages - all of this can be scripted; to get vanilla text messages - use message_str_game along with sprintf). Suggested use - override first aid/doctor skills to buff/nerf them, override steal skill to disallow observing NPCs inventories in some cases. Doesn’t seem to run when lock picking.
Critter arg0 - The user critter
+
UseSkill
HOOK_USESKILL (hs_useskill.int)
Runs when using any skill on any object.
This is fired before the default handlers are called, which you can override. In this case you should write your own skill use handler entirely, or otherwise nothing will happen (this includes fade in/fade out, time lapsing and messages - all of this can be scripted; to get vanilla text messages - use message_str_game along with sprintf). Suggested use - override First Aid/Doctor skills to buff/nerf them, override Steal skill to disallow observing NPCs inventories in some cases.
Does not run if the script of the object calls script_overrides for using the skill.
Critter arg0 - The user critter
Obj arg1 - The target object
int arg2 - skill being used
int arg3 - skill bonus from items such as first aid kits
-int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override)
-
UseSkillOn
HOOK_USESKILLON (hs_useskillon.int)
Runs before using any skill on any object. Lets you override the critter that uses the skill.
NOTE: The user critter can’t be overridden when using Steal skill.
Critter arg0 - the user critter (usually dude_obj)
+int ret0 - overrides hard-coded handler (-1 - use engine handler, any other value - override; if it is 0, there will be a 10% chance of removing the used medical item)
+
UseSkillOn
HOOK_USESKILLON (hs_useskillon.int)
Runs before using any skill on any object. Lets you override the critter that uses the skill.
NOTE: The user critter can’t be overridden when using Steal skill.
Critter arg0 - the user critter (usually dude_obj)
Obj arg1 - the target object/critter
int arg2 - skill being used
int ret0 - a new critter to override the user critter. Pass -1 to cancel the skill use, pass 0 to skip this return value
int ret1 - pass 1 to allow the skill being used in combat (only for dude_obj or critter being controlled by the player)
-
WithinPerception
HOOK_WITHINPRECEPTION (hs_withinperception.int)
Runs when checking if one critter sees another critter. This is used in different situations like combat AI. You can override the result.
NOTE: obj_can_see_obj calls this first when deciding if critter can possibly see another critter with regard to perception, lighting, sneak factors.
If check fails, the end result is false. If check succeeds (e.g. critter is within perception range), another check is made if there is any blocking tile between two critters (which includes stuff like windows, large bushes, barrels, etc.) and if there is - check still fails.
You can override “within perception” check by returning 0 or 1, OR, as a convenience, you can also override blocking check after the perception check by returning 2 instead. In this case you should add “line of sight” check inside your hook script, otherwise critters will detect you through walls.
This is fired after the default calculation is made.
Critter arg0 - Watcher object
+
WithinPerception
HOOK_WITHINPRECEPTION (hs_withinperception.int)
Runs when checking if one critter sees another critter. This is used in different situations like combat AI. You can override the result.
NOTE: obj_can_see_obj calls this first when deciding if critter can possibly see another critter with regard to perception, lighting, sneak factors.
If check fails, the end result is false. If check succeeds (e.g. critter is within perception range), another check is made if there is any blocking tile between two critters (which includes stuff like windows, large bushes, barrels, etc.) and if there is - check still fails.
You can override “within perception” check by returning 0 or 1, OR, as a convenience, you can also override blocking check after the perception check by returning 2 instead. In this case you should add “line of sight” check inside your hook script, otherwise critters will detect you through walls.
This is fired after the default calculation is made.
Critter arg0 - Watcher object
Obj arg1 - Target object
int arg2 - Result of vanilla function: 1 - within perception range, 0 - otherwise
int arg3 - Type of hook:
diff --git a/hooks/index.html b/hooks/index.html
index eaa7fc42..e3801f03 100644
--- a/hooks/index.html
+++ b/hooks/index.html
@@ -1,5 +1,5 @@
- Hooks - sfall Hooks | sfall Hooks
Hook scripts are specially named scripts that are run by sfall at specific points to allow mods to override normally hardcoded behaviour in a more flexible way than sfall’s normal ini configuration.
In addition to the bit of code it overrides, the script will be run once when first loaded and again at each player reload to allow for setup. Hook scripts have access to a set of arguments supplied to sfall, but aren’t required to use them all. They also return one or more values, but again they’re optional, and you only need to return a value if you want to override the default.
See hook types and hook functions reference for details.
Hooks compatibility
To aid in mods compatibility, avoid using hs_xxx .int scripts. Instead it is recommended to use a normal global script combined with register_hook_proc or register_hook.
Example setup for a hook-script based mod:
procedure tohit_hook_handler begin
- display_msg("Modifying hit_hook " + get_sfall_arg);
+ Hooks - sfall Hooks | sfall Hooks
Hook scripts are specially named scripts that are run by sfall at specific points to allow mods to override normally hardcoded behaviour in a more flexible way than sfall’s normal ini configuration.
In addition to the bit of code it overrides, the script will be run once when first loaded and again at each player reload to allow for setup. Hook scripts have access to a set of arguments supplied to sfall, but aren’t required to use them all. They also return one or more values, but again they’re optional, and you only need to return a value if you want to override the default.
See hook types and hook functions reference for details.
Hooks compatibility
To aid in mods compatibility, avoid using hs_xxx .int scripts. Instead it is recommended to use a normal global script combined with register_hook_proc or register_hook.
Example setup for a hook-script based mod:
procedure tohit_hook_handler begin
+ display_msg("Modifying hit_hook " + get_sfall_arg);
set_hit_chance_max(100);
set_sfall_return(100);
end
@@ -9,4 +9,4 @@
register_hook_proc(HOOK_TOHIT, tohit_hook_handler);
end
end
-
Table of contents
+
Table of contents
diff --git a/index.html b/index.html
index e991a9f5..01f8729f 100644
--- a/index.html
+++ b/index.html
@@ -1 +1 @@
- Home - sfall Home | sfall sfall
Sfall is a set of engine modifications for the classic game Fallout 2 in form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
Engine modifications include:
- Better support for modern operating systems
- Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc.
- Bug fixes
- Many additional features for users, such as item highlight button, party member control, etc.
- Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)
Note that this is documentation for sfall specifically, not Fallout scripting in general. For vanilla function reference, refer to the wiki.
Getting started
To get started with sfall, first familiarize yourself with new concepts:
- Global scripts and variables.
- Arrays and lists.
- Hooks.
- Data types.
- Object and script manipulation.
Pay special attention to the best practices page. Also, take a look at SSLC features and optimization guide.
Next, proceed to discover new functions. They are categorized, use the menu to find the one you need. If you can’t, check uncategorized functions list and sfall macros. Also, there’s search at the top of the page.
Questions and problems
+ Home - sfall Home | sfall sfall
sfall is a set of engine modifications for the classic game Fallout 2 in the form of a DLL, which modifies executable in memory without changing anything in EXE file itself.
Engine modifications include:
- Better support for modern operating systems
- Externalizing many settings like starting map and game time, skills, perks, critical hit tables, books, etc.
- Bug fixes
- Many additional features for users, such as item highlight button, party member control, etc.
- Extended scripting capabilities for modders (many new opcodes to control sfall features as well as previously unavailable vanilla engine functions)
Note that this is documentation for sfall specifically, not Fallout scripting in general. For vanilla function reference, refer to the wiki.
Getting started
To get started with sfall, first familiarize yourself with new concepts:
- Global scripts and variables.
- Arrays and lists.
- Hooks.
- Data types.
- Object and script manipulation.
Pay special attention to the best practices page. Also, take a look at SSLC features and optimization guide.
Next, proceed to discover new functions. They are categorized, use the menu to find the one you need. If you can’t, check uncategorized functions list and sfall macros. Also, there’s search at the top of the page.
Questions and problems
diff --git a/ini-settings/index.html b/ini-settings/index.html
index bd2a83cd..8786b8e5 100644
--- a/ini-settings/index.html
+++ b/ini-settings/index.html
@@ -1,7 +1,7 @@
- INI settings - sfall INI settings | sfall INI settings
Functions
get_ini_section
sfall.h
array get_ini_section(string file, string sect)
+ INI settings - sfall INI settings | sfall INI settings
Functions
get_ini_section
sfall.h
array get_ini_section(string file, string sect)
Returns an associative array of keys and values for a given INI file and section. NOTE: all keys and their values will be of String type.
get_ini_sections
sfall.h
array get_ini_sections(string file)
Returns an array of names of all sections in a given INI file.
get_ini_setting
int get_ini_setting(string setting)
-
- Reads an integer value from an ini file in the fallout directory.
- It only takes a single argument; seperate the file name, section and key with a “|” character; e.g.
myvar:=get_ini_setting("myini.ini|mysec|var1") If the file or key cannot be found, -1 is returned. - The file name is limited to 63 chars, including the extension.
- The section name is limited to 32 characters.
- It can also be used to get sfall’s settings, by using
ddraw.ini as the file name.
get_ini_string
string get_ini_string(string setting)
+
- Reads an integer value from an ini file in the fallout directory.
- It only takes a single argument; seperate the file name, section and key with a “|” character; e.g.
myvar:=get_ini_setting("myini.ini|mysec|var1") If the file or key cannot be found, -1 is returned. - The file name is limited to 63 chars, including the extension.
- The section name is limited to 32 characters.
- It can also be used to get sfall’s settings, by using
ddraw.ini as the file name.
get_ini_string
string get_ini_string(string setting)
Reads a string value from an ini file in the fallout directory.
modified_ini
int modified_ini
Returns the value of ModifiedIni setting in [Main] section of the INI.
set_ini_setting
sfall.h
void set_ini_setting(string setting, int/string value)
-
Writes an integer or a string value to an ini file in the Fallout directory. If the ini file does not exist, it will be created The setting argument works in the same way as in get_ini_setting, seperate the file name, section and key with a “|” character. Note: the file name is limited to 63 chars (including the extension), the section name is limited to 32 characters.
+
Writes an integer or a string value to an ini file in the Fallout directory. If the ini file does not exist, it will be created The setting argument works in the same way as in get_ini_setting, seperate the file name, section and key with a “|” character. Note: the file name is limited to 63 chars (including the extension), the section name is limited to 32 characters.
diff --git a/interface/index.html b/interface/index.html
index 6e267819..f5993c0d 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -1 +1 @@
- Interface - sfall Interface | sfall
+ Interface - sfall Interface | sfall
diff --git a/inventory/index.html b/inventory/index.html
index 22d6eabf..ae3d2830 100644
--- a/inventory/index.html
+++ b/inventory/index.html
@@ -1,3 +1,3 @@
- Inventory - sfall Inventory | sfall Inventory
Functions
display_stats
sfall.h
void display_stats()
+ Inventory - sfall Inventory | sfall Inventory
Functions
display_stats
sfall.h
void display_stats()
- Updates player’s stats in the inventory display window or on the character screen.
- NOTE: works only when the interface window is opened
inventory_redraw
sfall.h
void inventory_redraw(invSide)
Redraws inventory items list in the inventory/loot/barter screens. Argument invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens), -1 - both sides (same as without argument).
diff --git a/keyboard-and-mouse/index.html b/keyboard-and-mouse/index.html
index 36c92177..cd865301 100644
--- a/keyboard-and-mouse/index.html
+++ b/keyboard-and-mouse/index.html
@@ -1,4 +1,4 @@
- Keyboard and mouse - sfall Keyboard and mouse | sfall Keyboard and mouse
Functions
get_mouse_buttons
int get_mouse_buttons()
+ Keyboard and mouse - sfall Keyboard and mouse | sfall Keyboard and mouse
Functions
get_mouse_buttons
int get_mouse_buttons()
Returns the number of the mouse button that is currently pressed (1 - left, 2 - right, 3 - left+right, 4 - middle, 0 otherwise).
get_mouse_x
int get_mouse_x()
get_mouse_y
int get_mouse_y()
key_pressed
int key_pressed(int dxScancode)
diff --git a/knockback/index.html b/knockback/index.html
index 2f011f8a..a49f9929 100644
--- a/knockback/index.html
+++ b/knockback/index.html
@@ -1,4 +1,4 @@
- Knockback - sfall Knockback | sfall Knockback
The type value in the weapon knockback functions can be 0 or 1. If 0, the value becomes an absolute distance that targets will be knocked back. If 1, the value is multiplied by the distance they would normally have been knocked back. Weapon knockback modifiers are applied in the order weapon -> attacker -> target, so a x2 weapon wielded by an abs 6 attacker hitting a /2 target will knock the target back 3 squares. The knockback functions will not override the stonewall perk or knockdowns resulting from criticals. knockback values set on weapons or critters are not saved, and must be reset each time the player reloads.
Functions
- remove_attacker_knockback
- remove_target_knockback
- remove_weapon_knockback
- set_attacker_knockback
- set_target_knockback
- set_weapon_knockback
remove_attacker_knockback
void remove_attacker_knockback(CritterPtr)
+ Knockback - sfall Knockback | sfall Knockback
The type value in the weapon knockback functions can be 0 or 1. If 0, the value becomes an absolute distance that targets will be knocked back. If 1, the value is multiplied by the distance they would normally have been knocked back. Weapon knockback modifiers are applied in the order weapon -> attacker -> target, so a x2 weapon wielded by an abs 6 attacker hitting a /2 target will knock the target back 3 squares. The knockback functions will not override the stonewall perk or knockdowns resulting from criticals. knockback values set on weapons or critters are not saved, and must be reset each time the player reloads.
Functions
- remove_attacker_knockback
- remove_target_knockback
- remove_weapon_knockback
- set_attacker_knockback
- set_target_knockback
- set_weapon_knockback
remove_attacker_knockback
void remove_attacker_knockback(CritterPtr)
remove_target_knockback
void remove_target_knockback(CritterPtr)
remove_weapon_knockback
void remove_weapon_knockback(WeaponPtr)
set_attacker_knockback
void set_attacker_knockback(CritterPtr, int type, float value)
diff --git a/lists/index.html b/lists/index.html
index 06aae8d0..135d2e7f 100644
--- a/lists/index.html
+++ b/lists/index.html
@@ -1,4 +1,4 @@
- Lists - sfall Lists | sfall Lists
The list_xxx functions can be used to loop over all items on a map. list_begin takes an argument telling sfall what you want to list. (Defined in sfall.h) It returns a list pointer, which you iterate through with list_next. Finally, when you’ve finished with the list use list_end on it. Not calling list_end will result in a memory leak. Alternatively, use list_as_array to get the whole list at once as a temp array variable, which can be looped over using len_array and which you don’t need to remember to free afterwards.
Functions
list_as_array
array list_as_array(int type)
+ Lists - sfall Lists | sfall Lists
The list_xxx functions can be used to loop over all items on a map. list_begin takes an argument telling sfall what you want to list. (Defined in sfall.h) It returns a list pointer, which you iterate through with list_next. Finally, when you’ve finished with the list use list_end on it. Not calling list_end will result in a memory leak. Alternatively, use list_as_array to get the whole list at once as a temp array variable, which can be looped over using len_array and which you don’t need to remember to free afterwards.
Functions
list_as_array
array list_as_array(int type)
list_begin
int list_begin(int type)
list_end
void list_end(int listid)
list_next
int list_next(int listid)
diff --git a/locks/index.html b/locks/index.html
index fd5db10e..436dd0ed 100644
--- a/locks/index.html
+++ b/locks/index.html
@@ -1,4 +1,4 @@
- Locks - sfall Locks | sfall Locks
Functions
lock_is_jammed
sfall.h
bool lock_is_jammed(ObjectPtr obj)
+ Locks - sfall Locks | sfall Locks
Functions
lock_is_jammed
sfall.h
bool lock_is_jammed(ObjectPtr obj)
Returns 1 if the lock (container or scenery) is currently jammed, 0 otherwise.
set_unjam_locks_time
sfall.h
void set_unjam_locks_time(int time)
Sets after how many hours (up to 127 hours) jammed locks will be unjammed if the player leaves the map. Also disables the auto unjam that occurs at midnight when the player is on the map. Passing 0 will disable the auto unjam mechanism completely. The auto unjam mechanism will be reset each time the player reloads the game.
unjam_lock
sfall.h
void unjam_lock(ObjectPtr obj)
-
Unjams a lock immediately without having to wait until the next day, or leave the map and then return after 24 hours. Does not work in use_skill_on_p_proc procedure.
+
Unjams a lock immediately without having to wait until the next day, or leave the map and then return after 24 hours. Does not work in use_skill_on_p_proc procedure.
diff --git a/main-interface/index.html b/main-interface/index.html
index f34bb6af..69dbc2b6 100644
--- a/main-interface/index.html
+++ b/main-interface/index.html
@@ -1,5 +1,5 @@
- Main interface - sfall Main interface | sfall Main interface
Functions
intface_hide
sfall.h
void intface_hide()
+ Main interface - sfall Main interface | sfall Main interface
Functions
intface_hide
sfall.h
void intface_hide()
Hides main interface.
intface_is_hidden
sfall.h
bool intface_is_hidden()
Returns 1 if interface is currently hidden, 0 otherwise.
intface_redraw
sfall.h
void intface_redraw(bool winType)
-
Redraws main game interface. Useful after direct changes to current player weapons or stats to reflect changes.
- redraws main game interface, useful to reflect changes after directly changing current player weapons or stats
winType: the type number of the interface window (see WINTYPE_* constants in sfall.h). Pass -1 to redraw all interface windows.
intface_show
sfall.h
void intface_show()
+
Redraws main game interface. Useful after direct changes to current player weapons or stats to reflect changes.
- redraws main game interface, useful to reflect changes after directly changing current player weapons or stats
winType: the type number of the interface window (see WINTYPE_* constants in sfall.h). Pass -1 to redraw all interface windows.
intface_show
sfall.h
void intface_show()
Shows main interface.
diff --git a/maps-and-encounters/index.html b/maps-and-encounters/index.html
index 67f90653..e09a1f38 100644
--- a/maps-and-encounters/index.html
+++ b/maps-and-encounters/index.html
@@ -1,11 +1,11 @@
- Maps and encounters - sfall Maps and encounters | sfall Maps and encounters
Subcategories
Functions
- exec_map_update_scripts
- force_encounter
- force_encounter_with_flags
- get_map_enter_position
- in_world_map
- set_map_enter_position
- set_map_time_multi
- set_terrain_name
- set_town_title
exec_map_update_scripts
sfall.h
void exec_map_update_scripts()
-
Executes map_update_p_proc for all objects on map and global/hook scripts as well.
force_encounter
void force_encounter(int map)
+ Maps and encounters - sfall Maps and encounters | sfall Maps and encounters
Subcategories
Functions
- exec_map_update_scripts
- force_encounter
- force_encounter_with_flags
- get_map_enter_position
- in_world_map
- set_map_enter_position
- set_map_time_multi
- set_terrain_name
- set_town_title
exec_map_update_scripts
sfall.h
void exec_map_update_scripts()
+
Executes map_update_p_proc for all objects on map and global/hook scripts as well.
force_encounter
void force_encounter(int map)
Can be called either from a global script while traveling on the world map, or from a normal script while on a local map. In either case the encounter occurs shortly after the next time the player moves on the world map. The player will not get an outdoorsman skill check.
force_encounter_with_flags
void force_encounter_with_flags(int map, int flags)
-
Does the same thing as force_encounter, but allows the specification of some extra options (see sfall.h for available flags). Forcing a random encounter on a map that is not normally used for random encounters may cause the player to lose the car, if they have it. In this case use force_encounter_with_flags with the ENCOUNTER_FLAG_NO_CAR flag set.
get_map_enter_position
array get_map_enter_position()
-
Returns an array of the player’s position data (index: 0 - tile, 1 - elevation, 2 - rotation) when entering the map through exit grids. If entering from the world map, the tile value will be -1. Should be called in map_enter_p_proc procedure to get the correct position data.
in_world_map
bool in_world_map
+
Does the same thing as force_encounter, but allows the specification of some extra options (see sfall.h for available flags). Forcing a random encounter on a map that is not normally used for random encounters may cause the player to lose the car, if they have it. In this case use force_encounter_with_flags with the ENCOUNTER_FLAG_NO_CAR flag set.
get_map_enter_position
array get_map_enter_position()
+
Returns an array of the player’s position data (index: 0 - tile, 1 - elevation, 2 - rotation) when entering the map through exit grids. If entering from the world map, the tile value will be -1. Should be called in map_enter_p_proc procedure to get the correct position data.
in_world_map
bool in_world_map
Returns 1 if the player is looking at the world map, or 0 at any other time. Obviously this is only useful in global scripts, since normal scripts will never get the chance to run on the world map.
set_map_enter_position
void set_map_enter_position(int tile, int elevation, int rotation)
-
Overrides the players entry position when entering the map through exit grids. Setting the tile to 0 will put the player on the start hex (default tile and elevation) of the map. Works only in map_enter_p_proc procedure.
set_map_time_multi
void set_map_time_multi(float multi)
-
Adjusts how fast time passes while you’re on the world map. It takes a single float as an argument, where 1 is the normal speed. This function works in addition to the WorldMapTimeMod setting in ddraw.ini and the Pathfinder perk, rather than overriding it, so calling set_map_time_multi(0.5) when the player has 2 levels of Pathfinder would result in time passing at 25% the normal speed on the world map.
set_terrain_name
void sfall_func3("set_terrain_name", int x, int y, string name)
+
Overrides the players entry position when entering the map through exit grids. Setting the tile to 0 will put the player on the start hex (default tile and elevation) of the map. Works only in map_enter_p_proc procedure.
set_map_time_multi
void set_map_time_multi(float multi)
+
Adjusts how fast time passes while you’re on the world map. It takes a single float as an argument, where 1 is the normal speed. This function works in addition to the WorldMapTimeMod setting in ddraw.ini and the Pathfinder perk, rather than overriding it, so calling set_map_time_multi(0.5) when the player has 2 levels of Pathfinder would result in time passing at 25% the normal speed on the world map.
set_terrain_name
void sfall_func3("set_terrain_name", int x, int y, string name)
Overrides the terrain type name for the sub-tile on the world map by the specified coordinates.
set_town_title
void sfall_func2("set_town_title", int areaID, string title)
-
Sets a floating text for a town on the world map when hovering the cursor over the player’s marker.
- areaID: the ID number of the town from city.txt
+
Sets a floating text for a town on the world map when hovering the cursor over the player’s marker.
- areaID: the ID number of the town from city.txt
diff --git a/math/index.html b/math/index.html
index f3474f12..4db344f3 100644
--- a/math/index.html
+++ b/math/index.html
@@ -1,12 +1,12 @@
- Math - sfall Math | sfall Math
Functions
^
x^y
-
Exponentiation. Use as any other arithmetic operator, like 5^(1/3). If exponent is an integer, you can use a negative base, otherwise you will get “NaN” with a negative base. If both arguments are integers, the result will be an integer.
abs
int/float abs(int/float x)
+ Math - sfall Math | sfall Math
Functions
^
x^y
+
Exponentiation. Use as any other arithmetic operator, like 5^(1/3). If exponent is an integer, you can use a negative base, otherwise you will get “NaN” with a negative base. If both arguments are integers, the result will be an integer.
abs
int/float abs(int/float x)
Absolute (positive) value of x.
arctan
float arctan(float x, float y)
Arctangent of x. Pass 1 as y (don’t ask…).
ceil
int ceil(float)
Round x to the nearest integer that is not less than x.
cos
float cos(float x)
Cosine of x
div
div(x, y)
-
Unsigned integer division. Use as a division operator, like 3 + (20 div 5). If both dividend and divisor are integers, they will be treated as unsigned integers. If one of them is a float, div will perform the signed division just like vanilla division operator.
exponent
float exponent(float x)
+
Unsigned integer division. Use as a division operator, like 3 + (20 div 5). If both dividend and divisor are integers, they will be treated as unsigned integers. If one of them is a float, div will perform the signed division just like vanilla division operator.
exponent
float exponent(float x)
E^X
floor2
sfall.h
int floor2(int/float value)
-
Works just like vanilla floor function, but returns correct integers for negative values (vanilla floor function works exactly the same as ceil for negative values, much like trunc in C/C++).
log
float log(float x)
+
Works just like vanilla floor function, but returns correct integers for negative values (vanilla floor function works exactly the same as ceil for negative values, much like trunc in C/C++).
log
float log(float x)
Natural logarithm of x.
round
int round(float x)
Round x to the nearest integer.
sin
float sin(float x)
Sine of x
sqrt
float sqrt(float x)
diff --git a/npc-perks/index.html b/npc-perks/index.html
index 812a89d8..4c352b42 100644
--- a/npc-perks/index.html
+++ b/npc-perks/index.html
@@ -1,4 +1,4 @@
- NPC perks - sfall NPC perks | sfall NPC perks
These functions are similar to has_fake_*/set_fake_*/set_selectable_perk functions, but apply to the specified party member NPC (including dude_obj)
Functions
has_fake_perk_npc
sfall.h
int has_fake_perk_npc(object npc, string namePerk)
+ NPC perks - sfall NPC perks | sfall NPC perks
These functions are similar to has_fake_*/set_fake_*/set_selectable_perk functions, but apply to the specified party member NPC (including dude_obj)
Functions
has_fake_perk_npc
sfall.h
int has_fake_perk_npc(object npc, string namePerk)
has_fake_trait_npc
sfall.h
int has_fake_trait_npc(object npc, string nameTrait)
set_fake_perk_npc
sfall.h
void set_fake_perk_npc(object npc, string namePerk, int level, int image, string desc)
set_fake_trait_npc
sfall.h
void set_fake_trait_npc(object npc, string nameTrait, int active, int image, string desc)
diff --git a/objects-and-scripts/index.html b/objects-and-scripts/index.html
index 36b3207e..f3dd3877 100644
--- a/objects-and-scripts/index.html
+++ b/objects-and-scripts/index.html
@@ -1,18 +1,18 @@
- Objects and scripts - sfall Objects and scripts | sfall Objects and scripts
Functions
- dialog_obj
- get_flags
- get_object_data
- get_script
- loot_obj
- obj_is_carrying_obj
- obj_is_openable
- obj_under_cursor
- real_dude_obj
- remove_script
- set_dude_obj
- set_flags
- set_object_data
- set_scr_name
- set_script
- set_self
- set_unique_id
dialog_obj
sfall.h
ObjectPtr dialog_obj()
+ Objects and scripts - sfall Objects and scripts | sfall Objects and scripts
Functions
- dialog_obj
- get_flags
- get_object_data
- get_script
- loot_obj
- obj_is_carrying_obj
- obj_is_openable
- obj_under_cursor
- real_dude_obj
- remove_script
- set_dude_obj
- set_flags
- set_object_data
- set_scr_name
- set_script
- set_self
- set_unique_id
dialog_obj
sfall.h
ObjectPtr dialog_obj()
Returns a pointer to the object (critter) the player is having a conversation or bartering with.
get_flags
sfall.h
int get_flags(ObjectPtr obj)
-
Gets the current value of object flags (see define_extra.h for available flags).
get_object_data
sfall.h
get_object_data(ObjectPtr object, int offset)
-
Returns the data at the specified offset of an object (see OBJ_DATA_* constants in define_extra.h for offsets).
get_script
int get_script(ObjectPtr)
-
- accepts a pointer to an object and returns its scriptID (line number in
scripts.lst), or 0 if the object is unscripted. - returns -1 on argument error.
loot_obj
sfall.h
ObjectPtr loot_obj()
+
Gets the current value of object flags (see define_extra.h for available flags).
get_object_data
sfall.h
get_object_data(ObjectPtr object, int offset)
+
Returns the data at the specified offset of an object (see OBJ_DATA_* constants in define_extra.h for offsets).
get_script
int get_script(ObjectPtr)
+
- accepts a pointer to an object and returns its scriptID (line number in
scripts.lst), or 0 if the object is unscripted. - returns -1 on argument error.
loot_obj
sfall.h
ObjectPtr loot_obj()
Returns a pointer to the target object (container or critter) of the loot screen.
obj_is_carrying_obj
int (ObjectPtr invenObj, ObjectPtr itemObj)
-
Returns number of itemObj inside invenObj’s inventory, note that both arguments are object pointers. useful when dealing with different stacks of same item (obj_is_carrying_obj_pid just returns total for all stacks of the same PID.)
obj_is_openable
sfall.h
bool obj_is_openable(object obj)
+
Returns number of itemObj inside invenObj’s inventory, note that both arguments are object pointers. useful when dealing with different stacks of same item (obj_is_carrying_obj_pid just returns total for all stacks of the same PID.)
obj_is_openable
sfall.h
bool obj_is_openable(object obj)
Returns True if the object is openable (i.e. has an opening/closing animation)
obj_under_cursor
sfall.h
ObjectPtr obj_under_cursor(bool onlyCritter, bool includeDude)
-
Returns the object under the cursor on the main game screen.
- onlyCritter:
- True - only checks critters and ignores their cover (roof tiles, walls, scenery, etc.)
- False - checks all objects (can’t check critters under objects)
- passing False to the includeDude argument will ignore dude_obj
- NOTE: to get an object located on a tile when the cursor is in movement mode (hexagon cursor), use the
tile_under_cursor function
real_dude_obj
sfall.h
ObjectPtr real_dude_obj()
-
Returns the initial dude_obj after set_dude_obj was used.
remove_script
void remove_script(ObjectPtr)
+
Returns the object under the cursor on the main game screen.
- onlyCritter:
- True - only checks critters and ignores their cover (roof tiles, walls, scenery, etc.)
- False - checks all objects (can’t check critters under objects)
- passing False to the includeDude argument will ignore dude_obj
- NOTE: to get an object located on a tile when the cursor is in movement mode (hexagon cursor), use the
tile_under_cursor function
real_dude_obj
sfall.h
ObjectPtr real_dude_obj()
+
Returns the initial dude_obj after set_dude_obj was used.
remove_script
void remove_script(ObjectPtr)
Accepts a pointer to an object and will remove the script from that object.
set_dude_obj
sfall.h
void set_dude_obj(ObjectPtr critter)
Take control of a given critter. Passing value 0 will reset control back to “real” dude.
set_flags
sfall.h
void set_flags(ObjectPtr obj, int flags)
-
Sets the current flags of an object. All flags are rewritten with given integer, so first get current flags with get_flags and use bwor/bwand to set/remove specific flag.
set_object_data
sfall.h
set_object_data(ObjectPtr object, int offset, int data)
+
Sets the current flags of an object. All flags are rewritten with given integer, so first get current flags with get_flags and use bwor/bwand to set/remove specific flag.
set_object_data
sfall.h
set_object_data(ObjectPtr object, int offset, int data)
Sets the data at the specified offset of an object.
set_scr_name
sfall.h
void set_scr_name(string name)
-
Overrides the name of the script object that was set from scrname.msg.
- The changed name will be reset each time the player leaves the map or reloads the game
- Passing an empty string (“”) to the
name argument or omitting it will allow the game to get the name for the object from pro_*.msg files - NOTE: this function is intended for use in normal game scripts and overrides the name only once for the same object until reset
set_script
void set_script(ObjectPtr, int scriptid)
-
Accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6). If used on an object that is already scripted, it will remove the existing script first; you cannot have multiple scripts attached to a single object. Calling set_script on self_obj will have all sorts of wacky side effects, and should be avoided. If you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run.
set_self
void set_self(ObjectPtr)
-
Overrides the script’s self_obj for the next function call.
- It is primarily used to allow the calling of functions which take an implicit
self_obj parameter (e.g. drop_obj) from global scripts, but it can also be used from normal scripts. - Will revert back to its original value after the next function call.
- Calling
self_obj(0) will also revert self_obj to original value. It is recommended to call this after each use of set_self in normal scripts in order to avoid unforeseen side effects. source_obj, target_obj, and similar functions will not work if preceded by set_self. - NOTE: for
use_obj, use_obj_on_obj vanilla functions to work correctly, it is required to call set_self twice.
set_unique_id
sfall.h
int set_unique_id(ObjectPtr object, int flag)
-
Assigns a unique ID number to the object and returns it. If a unique ID number has already been assigned to an object, then ID number is returned without reassignment. flag is optional.
- items with unique IDs will not stack with other items of the same type in the inventory
- to just get the current ID number of an object, use
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 a unique ID number range for the player and party members from 18000 to 83535
- to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument
+
Overrides the name of the script object that was set from scrname.msg.
- The changed name will be reset each time the player leaves the map or reloads the game
- Passing an empty string (“”) to the
name argument or omitting it will allow the game to get the name for the object from pro_*.msg files - NOTE: this function is intended for use in normal game scripts and overrides the name only once for the same object until reset
set_script
void set_script(ObjectPtr, int scriptid)
+
Accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6). If used on an object that is already scripted, it will remove the existing script first; you cannot have multiple scripts attached to a single object. Calling set_script on self_obj will have all sorts of wacky side effects, and should be avoided. If you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run.
set_self
void set_self(ObjectPtr)
+
Overrides the script’s self_obj for the next function call.
- It is primarily used to allow the calling of functions which take an implicit
self_obj parameter (e.g. drop_obj) from global scripts, but it can also be used from normal scripts. - Will revert back to its original value after the next function call.
- Calling
self_obj(0) will also revert self_obj to original value. It is recommended to call this after each use of set_self in normal scripts in order to avoid unforeseen side effects. source_obj, target_obj, and similar functions will not work if preceded by set_self. - NOTE: for
use_obj, use_obj_on_obj vanilla functions to work correctly, it is required to call set_self twice.
set_unique_id
sfall.h
int set_unique_id(ObjectPtr object, int flag)
+
Assigns a unique ID number to the object and returns it. If a unique ID number has already been assigned to an object, then ID number is returned without reassignment. flag is optional.
- items with unique IDs will not stack with other items of the same type in the inventory
- to just get the current ID number of an object, use
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 a unique ID number range for the player and party members from 18000 to 83535
- to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument
diff --git a/optimization/index.html b/optimization/index.html
index 292fb5f3..f7ae9180 100644
--- a/optimization/index.html
+++ b/optimization/index.html
@@ -1,37 +1,37 @@
- Optimization - sfall Optimization | sfall Optimization
The executation speed of scripts is not typically important in an unmodded game, given the difference in performance between a modern computer and what Fallout was designed for. When you start adding mods to the mix there’s the potential for problems again, since sfall’s global script system means that you can have a large amount of scripts being run every single frame.
sslc -O option
The sfall build of sslc supports a -O command line option to perform an optimization pass over the generated code. This isn’t a magic make-my-code-go-faster bullet; most of what it does is very limited in scope. It’s primary purpose was to strip out the procedures and variables which get automatically pulled into every script that includes define.h, whether you use them or not, and to do something about the additional variables that get created by foreach loops.
There are several levels of optimization available:
-O1 - Basic, only removes unreferenced globals variables and procedures, code itself remains untouched. -O2 - Full, most code optimizations are on, but only those that were tested on complex scripts. -O3 - Experimental, provides most efficiency, but tend to break some complex code due to bugs.
The following optimizations are performed:
- constant expression folding: if an expression depends only on values which are known at compile time, then the expression is replaced by its result.
a:=2+2; -> a:=4; - constant variable initialization: All variables are initialised to some value, (‘0’, if you don’t specify anything else,) so sslc attempts to make use of that fact to remove the first assignment to a variable if the first assignment is a constant expression.
variable a; -> variable a:=4;
+ Optimization - sfall Optimization | sfall Optimization
The executation speed of scripts is not typically important in an unmodded game, given the difference in performance between a modern computer and what Fallout was designed for. When you start adding mods to the mix there’s the potential for problems again, since sfall’s global script system means that you can have a large amount of scripts being run every single frame.
sslc -O option
The sfall build of sslc supports a -O command line option to perform an optimization pass over the generated code. This isn’t a magic make-my-code-go-faster bullet; most of what it does is very limited in scope. It’s primary purpose was to strip out the procedures and variables which get automatically pulled into every script that includes define.h, whether you use them or not, and to do something about the additional variables that get created by foreach loops.
There are several levels of optimization available:
-O1 - Basic, only removes unreferenced globals variables and procedures, code itself remains untouched. -O2 - Full, most code optimizations are on, but only those that were tested on complex scripts. -O3 - Experimental, provides most efficiency, but tend to break some complex code due to bugs.
The following optimizations are performed:
- constant expression folding: if an expression depends only on values which are known at compile time, then the expression is replaced by its result.
a:=2+2; -> a:=4; - constant variable initialization: All variables are initialised to some value, (‘0’, if you don’t specify anything else,) so sslc attempts to make use of that fact to remove the first assignment to a variable if the first assignment is a constant expression.
variable a; -> variable a:=4;
a:=4; ->
-
- constant propagation: checks for values assigned to variables which can be computed at compile time, and replaces relevent references to the symbol by the constant. The original store is not removed by this optimization. Global variables are considered for this optimization only if they are not marked import or export, and are not assigned to anywhere in the script.
a:=4 -> a:=4
+
- constant propagation: checks for values assigned to variables which can be computed at compile time, and replaces relevent references to the symbol by the constant. The original store is not removed by this optimization. Global variables are considered for this optimization only if they are not marked import or export, and are not assigned to anywhere in the script.
a:=4 -> a:=4
foo(a); -> foo(4);
-
- dead code removal: Checks for and removes code which cannot be reached, either because it is hidden behind a return or because the argument to an if statement can be computed at compile time.
if 1 then begin -> display_msg("foo");
+
- dead code removal: Checks for and removes code which cannot be reached, either because it is hidden behind a return or because the argument to an if statement can be computed at compile time.
if 1 then begin -> display_msg("foo");
display_msg("foo"); ->
end else begin ->
display_msg("bar"); ->
end ->
-
- unreferenced variable elimination: Checks for variables which are never referenced, and removes them. Also applies to global variables, as long as they are not marked for export.
variable i, j, k; -> variable i;
+
- unreferenced variable elimination: Checks for variables which are never referenced, and removes them. Also applies to global variables, as long as they are not marked for export.
variable i, j, k; -> variable i;
i:=1; -> i:=1;
return; -> return;
-
- unreferenced procedure elimination: Checks for any procedures which are never called, and removes them.
procedure foo begin return "foo"; end -> procedure foo begin return "foo"; end
+
- unreferenced procedure elimination: Checks for any procedures which are never called, and removes them.
procedure foo begin return "foo"; end -> procedure foo begin return "foo"; end
procedure bar begin return "bar"; end -> procedure start begin
procedure start begin -> display_msg(foo);
display_msg(foo); -> end
end ->
-
- dead store removal: Removes variable assignments if the result of the variable is unused, and if the expression used to compute the value of the variable is provably free of side effects. (See ‘pure’ keyword)
a:="moo"; -> a:="foo";
+
- dead store removal: Removes variable assignments if the result of the variable is unused, and if the expression used to compute the value of the variable is provably free of side effects. (See ‘pure’ keyword)
a:="moo"; -> a:="foo";
a:="foo"; -> display_msg(a);
display_msg(a); ->
a:="bar"; ->
-
- store combination: Where there are two stores in a row to the same variable, the two expressions are combined.
var1 := var2; -> var1 := var2 + var3;
+
- store combination: Where there are two stores in a row to the same variable, the two expressions are combined.
var1 := var2; -> var1 := var2 + var3;
var1 += var3; ->
-
- variable combination: Where usage regions of variables do not overlap, combine the variables to provide additional candidates for unreferenced variable elimination. Very useful for scripts containing multiple foreach loops, which generate 2 or 3 hidden variables each.
a:="foo"; -> a:="foo";
+
- variable combination: Where usage regions of variables do not overlap, combine the variables to provide additional candidates for unreferenced variable elimination. Very useful for scripts containing multiple foreach loops, which generate 2 or 3 hidden variables each.
a:="foo"; -> a:="foo";
display_msg(a); -> display_msg(a);
b:="bar"; -> a:="bar";
display_msg(b); -> display_msg(a);
-
- namelist compression: Fallout stores the names of all file scope variables and procedures in a namelist which is saved into the .int. Any of these that are unreferenced can be removed, and the names of global variables can be modified to make them shorter.
Writing your own code
- Don’t have global scripts running any more often that you need them to. Not everything needs to be run every single frame.
- Never concat constant strings with the ‘+’ operator, as it forces the operation to be done at runtime. The compiler can cope with constant strings being placed next to each other without the need for a +, which results in far more efficient code as the combination is done at lex time.
#define GLOB_PREFIX "ts__" -> #define GLOB_PREFIX "ts__"
+
- namelist compression: Fallout stores the names of all file scope variables and procedures in a namelist which is saved into the .int. Any of these that are unreferenced can be removed, and the names of global variables can be modified to make them shorter.
Writing your own code
- Don’t have global scripts running any more often that you need them to. Not everything needs to be run every single frame.
- Never concat constant strings with the ‘+’ operator, as it forces the operation to be done at runtime. The compiler can cope with constant strings being placed next to each other without the need for a +, which results in far more efficient code as the combination is done at lex time.
#define GLOB_PREFIX "ts__" -> #define GLOB_PREFIX "ts__"
procedure start begin -> procedure start begin
set_sfall_global(GLOB_PREFIX + "foo1", 0); -> set_sfall_global(GLOB_PREFIX "foo1", 0);
end -> end
-
- Avoid function calls in while loops. function calls are expensive in comparison to variable lookups, so it’s more efficient to move the function call out of the loop and store the result in a variable
while i < len_array(array) do begin -> tmp:= len_array(array);
+
- Avoid function calls in while loops. function calls are expensive in comparison to variable lookups, so it’s more efficient to move the function call out of the loop and store the result in a variable
while i < len_array(array) do begin -> tmp:= len_array(array);
... -> while i < tmp do begin
end -> ...
-> end
-
-
Mark functions with pure or inline where relevent.
‘pure’ is a hint to the optimizer that a procedure has no side effects. (i.e. there’s no way to tell that it’s been called aside from its return value.) Pure procedures cannot modify global variables, or call any other procedure that isn’t itself pure. Functions marked with pure can only be used in expressions (i.e. you cannot use the call <procedure> syntax to call them.) If there are non-pure terms in an expression, it prevents that expression being considered for dead store removal. Where no such optimizations can be performed, or if optimization is disabled, marking a procedure with pure will have no effect on the compiled code.
‘inline’ is an instruction to the compiler to replace calls to the marked procedure with a copy of the procedures code instead of having a seperate call. inlined procedures cannot use the ‘return’ command, cannot be predefined, and cannot be used as part of an expression. inlining if a procedure is only going to be called once is always a win, but if there are multiple calls to a procedure you will end up bloating the size of the generated code.
+
-
Mark functions with pure or inline where relevent.
‘pure’ is a hint to the optimizer that a procedure has no side effects. (i.e. there’s no way to tell that it’s been called aside from its return value.) Pure procedures cannot modify global variables, or call any other procedure that isn’t itself pure. Functions marked with pure can only be used in expressions (i.e. you cannot use the call <procedure> syntax to call them.) If there are non-pure terms in an expression, it prevents that expression being considered for dead store removal. Where no such optimizations can be performed, or if optimization is disabled, marking a procedure with pure will have no effect on the compiled code.
‘inline’ is an instruction to the compiler to replace calls to the marked procedure with a copy of the procedures code instead of having a seperate call. inlined procedures cannot use the ‘return’ command, cannot be predefined, and cannot be used as part of an expression. inlining if a procedure is only going to be called once is always a win, but if there are multiple calls to a procedure you will end up bloating the size of the generated code.
diff --git a/other/index.html b/other/index.html
index e0013c86..e7c1fb6c 100644
--- a/other/index.html
+++ b/other/index.html
@@ -1,35 +1,35 @@
- Other - sfall Other | sfall Other
Functions
- active_hand
- add_g_timer_event
- add_trait
- create_message_window
- create_spatial
- game_loaded
- gdialog_get_barter_mod
- get_game_mode
- get_inven_ap_cost
- get_kill_counter
- get_light_level
- get_npc_level
- get_proto_data
- get_unspent_ap_bonus
- get_unspent_ap_perk_bonus
- get_uptime
- get_viewport_x
- get_viewport_y
- get_year
- hero_select_win
- inc_npc_level
- input_funcs_available
- mark_movie_played
- message_str_game
- mod_kill_counter
- nb_create_char
- resume_game
- set_base_hit_chance_mod
- set_base_pickpocket_mod
- set_critter_hit_chance_mod
- set_critter_pickpocket_mod
- set_df_model
- set_dm_model
- set_hit_chance_max
- set_hp_per_level_mod
- set_inven_ap_cost
- set_movie_path
- set_pickpocket_max
- set_pipboy_available
- set_proto_data
- set_unspent_ap_bonus
- set_unspent_ap_perk_bonus
- set_viewport_x
- set_viewport_y
- set_xp_mod
- sneak_success
- stop_game
- toggle_active_hand
- unwield_slot
active_hand
int active_hand
+ Other - sfall Other | sfall Other
Functions
- active_hand
- add_g_timer_event
- add_trait
- create_message_window
- create_spatial
- game_loaded
- gdialog_get_barter_mod
- get_game_mode
- get_inven_ap_cost
- get_kill_counter
- get_light_level
- get_npc_level
- get_proto_data
- get_unspent_ap_bonus
- get_unspent_ap_perk_bonus
- get_uptime
- get_viewport_x
- get_viewport_y
- get_year
- hero_select_win
- inc_npc_level
- input_funcs_available
- mark_movie_played
- message_str_game
- mod_kill_counter
- nb_create_char
- resume_game
- set_base_hit_chance_mod
- set_base_pickpocket_mod
- set_critter_hit_chance_mod
- set_critter_pickpocket_mod
- set_df_model
- set_dm_model
- set_hit_chance_max
- set_hp_per_level_mod
- set_inven_ap_cost
- set_movie_path
- set_pickpocket_max
- set_pipboy_available
- set_proto_data
- set_unspent_ap_bonus
- set_unspent_ap_perk_bonus
- set_viewport_x
- set_viewport_y
- set_xp_mod
- sneak_success
- stop_game
- toggle_active_hand
- unwield_slot
active_hand
int active_hand
add_g_timer_event
sfall.h
void add_g_timer_event(int time, int fixedParam)
-
Adds a timer event that calls the timed_event_p_proc procedure in the current global script time: the number of ticks after which the event timer is triggered fixedParam: the value that is passed to the timed_event_p_proc procedure for the fixed_param function
add_trait
sfall.h
void add_trait(int traitID)
+
Adds a timer event that calls the timed_event_p_proc procedure in the current global script time: the number of ticks after which the event timer is triggered fixedParam: the value that is passed to the timed_event_p_proc procedure for the fixed_param function
add_trait
sfall.h
void add_trait(int traitID)
adds the specified trait to the player
create_message_window
void create_message_window(string message)
create_spatial
ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius)
Creates new spatial script with given SID, at given tile, and radius.
game_loaded
int game_loaded()
-
Returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. Its primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too.
gdialog_get_barter_mod
int gdialog_get_barter_mod
+
Returns 1 the first time it is called after a new game or game load, and 0 any time after. It works on an individual basis for each script, so one script wont interfere with others. Its primary use is for global scripts, so that they know when to call set_global_script_repeat, but it can be called from normal scripts too.
gdialog_get_barter_mod
int gdialog_get_barter_mod
get_game_mode
int get_game_mode()
-
A more flexible version of in_world_map. It will return a set of flags indicating which mode the game is currently in. These flags are the same as those used in the set_shader_mode function.
get_inven_ap_cost
int get_inven_ap_cost
+
A more flexible version of in_world_map. It will return a set of flags indicating which mode the game is currently in. These flags are the same as those used in the set_shader_mode function.
get_inven_ap_cost
int get_inven_ap_cost
Returns the current AP cost to access the inventory in combat
get_kill_counter
int get_kill_counter(int critterType)
get_light_level
int get_light_level()
-
Returns ambient light level in range 0..65536. The value returned by get_light_level may not exactly match that set by set_light_level, as set_light_level applies modifiers from the Night Vision perk.
get_npc_level
int get_npc_level(string npc)
+
Returns ambient light level in range 0..65536. The value returned by get_light_level may not exactly match that set by set_light_level, as set_light_level applies modifiers from the Night Vision perk.
get_npc_level
int get_npc_level(string npc)
get_proto_data
int get_proto_data(int pid, int offset)
Used to read the in-memory copies of the .pro files Fallout makes when they are loaded. The offset refers to the offset in memory from the start of the proto to the element you are reading.
get_unspent_ap_bonus
int get_unspent_ap_bonus()
Gets the AC bonus you receive per unused action point at the end of your turn in combat. To allow for fractional values, the value given if divided by 4. (Hence the default value is 4 and not 1.)
get_unspent_ap_perk_bonus
int get_unspent_ap_perk_bonus()
-
Similar to get_unspent_ap_bonus, but accounts for the extra AC granted by the H2H Evade perk. (The default value of this is also 4, equivalent to doubling the original bonus.
get_uptime
int get_uptime()
+
Similar to get_unspent_ap_bonus, but accounts for the extra AC granted by the H2H Evade perk. (The default value of this is also 4, equivalent to doubling the original bonus.
get_uptime
int get_uptime()
Just a wrapper around the windows GetTickCount() function. It’s useful for making time fade effects in shaders, since they already have access to the current tick count.
get_viewport_x
int get_viewport_x()
get_viewport_y
int get_viewport_y()
get_year
int get_year
hero_select_win
void hero_select_win(int)
inc_npc_level
void inc_npc_level(int party_member_pid)
-
Takes a party member PID or an NPC name (deprecated, for compatibility with sfall 4.1.5/3.8.15 or earlier) as an argument. The NPC must be in your party. This function ignores player level requirements and the minimum 3 player level delay between NPC level gains. It also ignores the random element, regardless of sfall’s NPCAutoLevel setting.
input_funcs_available
int input_funcs_available()
-
The input functions are only available if the user has the input hook turned on in ddraw.ini. Use input_funcs_available to check.
mark_movie_played
void mark_movie_played(int id)
+
Takes a party member PID or an NPC name (deprecated, for compatibility with sfall 4.1.5/3.8.15 or earlier) as an argument. The NPC must be in your party. This function ignores player level requirements and the minimum 3 player level delay between NPC level gains. It also ignores the random element, regardless of sfall’s NPCAutoLevel setting.
input_funcs_available
int input_funcs_available()
+
The input functions are only available if the user has the input hook turned on in ddraw.ini. Use input_funcs_available to check.
mark_movie_played
void mark_movie_played(int id)
message_str_game
string message_str_game(int fileId, int messageId)
-
Works exactly the same as message_str, except you get messages from files in text/english/game folder. Use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file
- Additional game msg files added by
ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000 to 0x2FFF. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.). - If a file has a specific number assigned in
ExtraGameMsgFileList, its fileId will be (0x2000 + assigned number). (e.g. with ExtraGameMsgFileList=foo,bar:2,foobar in ddraw.ini, bar.msg will be associated with 0x2002 and foobar.msg with 0x2003.)
mod_kill_counter
void mod_kill_counter(int critterType, int amount)
+
Works exactly the same as message_str, except you get messages from files in text/english/game folder. Use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file
- Additional game msg files added by
ExtraGameMsgFileList setting will have consecutive fileIds assigned beginning from 0x2000 to 0x2FFF. (e.g. if you set ExtraGameMsgFileList=foo,bar in ddraw.ini, foo.msg will be associated with 0x2000 and bar.msg with 0x2001.). - If a file has a specific number assigned in
ExtraGameMsgFileList, its fileId will be (0x2000 + assigned number). (e.g. with ExtraGameMsgFileList=foo,bar:2,foobar in ddraw.ini, bar.msg will be associated with 0x2002 and foobar.msg with 0x2003.)
mod_kill_counter
void mod_kill_counter(int critterType, int amount)
nb_create_char
int nb_create_char()
-
nb_* functions are reserved for the brotherhood tactical training mod, and should be avoided.
resume_game
void resume_game()
+
nb_* functions are reserved for the brotherhood tactical training mod, and should be avoided.
resume_game
void resume_game()
set_base_hit_chance_mod
void set_base_hit_chance_mod(int max, int mod)
set_base_pickpocket_mod
void set_base_pickpocket_mod(int max, int mod)
-
Changes maximum chance of success and chance mod for each steal attempt. max will replace 95% success chance cap (so you can set 100% maximum chance, for instance). mod will add this much percent to each success chance. for example if your chance is 50% and mod is 20, you will get 70% actual success rate
set_critter_hit_chance_mod
void set_critter_hit_chance_mod(CritterPtr, int max, int mod)
+
Changes maximum chance of success and chance mod for each steal attempt. max will replace 95% success chance cap (so you can set 100% maximum chance, for instance). mod will add this much percent to each success chance. for example if your chance is 50% and mod is 20, you will get 70% actual success rate
set_critter_hit_chance_mod
void set_critter_hit_chance_mod(CritterPtr, int max, int mod)
set_critter_pickpocket_mod
void set_critter_pickpocket_mod(CritterPtr, int max, int mod)
-
The same as set_base_pickpocket, but applies only to specific critter.
set_df_model
void set_df_model(string name)
+
The same as set_base_pickpocket, but applies only to specific critter.
set_df_model
void set_df_model(string name)
set_dm_model
void set_dm_model(string name)
set_hit_chance_max
void set_hit_chance_max(int percentage)
Effects all critters rather than just the player and can set the maximum in range from 0 to 999.
set_hp_per_level_mod
void set_hp_per_level_mod(int mod)
@@ -40,11 +40,11 @@
Will only accept 0 or 1 as an argument. Using any other value will cause the function to have no effect. Use 0 to disable the pipboy, and 1 to enable it.
set_proto_data
void set_proto_data(int pid, int offset, int value)
Used to alter the in-memory copies of the .pro files Fallout makes when they are loaded. The offset refers to the offset in memory from the start of the proto to the element you are reading. Changes are not stored on disc, and are not permanent. If you modify the protos, and then Fallout subsequently reloads the file your changes will be lost.
set_unspent_ap_bonus
void set_unspent_ap_bonus(int multiplier)
Alters the AC bonus you receive per unused action point at the end of your turn in combat. To allow for fractional values, the value given if divided by 4. (Hence the default value is 4 and not 1.)
set_unspent_ap_perk_bonus
void set_unspent_ap_perk_bonus(int multiplier)
-
Similar to set_unspent_ap_bonus, but effects the extra AC granted by the H2H Evade perk. (The default value of this is also 4, equivalent to doubling the original bonus.
set_viewport_x
void set_viewport_x(int view_x)
+
Similar to set_unspent_ap_bonus, but effects the extra AC granted by the H2H Evade perk. (The default value of this is also 4, equivalent to doubling the original bonus.
set_viewport_x
void set_viewport_x(int view_x)
set_viewport_y
void set_viewport_y(int view_y)
set_xp_mod
void set_xp_mod(int percentage)
sneak_success
int sneak_success
-
Returns 1 if last sneak attempt (roll against skill) was successful, 0 otherwise. This calls an internal engine function which is used to determine the perception range of critters (which you can override using HOOK_WITHINPERCEPTION).
stop_game
void stop_game()
+
Returns 1 if last sneak attempt (roll against skill) was successful, 0 otherwise. This calls an internal engine function which is used to determine the perception range of critters (which you can override using HOOK_WITHINPERCEPTION).
stop_game
void stop_game()
toggle_active_hand
void toggle_active_hand
unwield_slot
void sfall_func2("unwield_slot", object critter, int slot)
-
unequips an item from the specified slot for a critter or the player can take off player’s equipped item when the inventory is opened, or the player is in the barter screen slot: 0 - armor slot, 1 - right slot, 2 - left slot (see INVEN_TYPE_* in define.h)
+
unequips an item from the specified slot for a critter or the player can take off player’s equipped item when the inventory is opened, or the player is in the barter screen slot: 0 - armor slot, 1 - right slot, 2 - left slot (see INVEN_TYPE_* in define.h)
diff --git a/outline/index.html b/outline/index.html
index aae287d4..f3e3f873 100644
--- a/outline/index.html
+++ b/outline/index.html
@@ -1,4 +1,4 @@
- Outline - sfall Outline | sfall Outline
Functions
get_outline
sfall.h
int get_outline(ObjectPtr obj)
+ Outline - sfall Outline | sfall Outline
Functions
get_outline
sfall.h
int get_outline(ObjectPtr obj)
Gets the current outline color for an object.
outlined_object
sfall.h
ObjectPtr outlined_object()
Returns an object that is currently highlighted by hovering the mouse above it.
set_outline
sfall.h
void set_outline(ObjectPtr obj, int color)
-
- sets the outline color of an object (see
OUTLINE_* constants in sfall.h) - can also set a custom color from the game palette by shifting the color index value left by 8 bits:
0xCC00 where CC is the palette index (available since sfall 4.2.7/3.8.27) - passing 0 will disable the outline
+
- sets the outline color of an object (see
OUTLINE_* constants in sfall.h) - can also set a custom color from the game palette by shifting the color index value left by 8 bits:
0xCC00 where CC is the palette index (available since sfall 4.2.7/3.8.27) - passing 0 will disable the outline
diff --git a/perks-and-traits/index.html b/perks-and-traits/index.html
index 339adeac..0f8771aa 100644
--- a/perks-and-traits/index.html
+++ b/perks-and-traits/index.html
@@ -1,4 +1,4 @@
- Perks and traits - sfall Perks and traits | sfall Perks and traits
Subcategories
Functions
- apply_heaveho_fix
- clear_selectable_perks
- get_perk_available
- get_perk_owed
- has_fake_perk
- has_fake_trait
- hide_real_perks
- perk_add_mode
- remove_trait
- seq_perk_freq
- set_fake_perk
- set_fake_trait
- set_perk_agl
- set_perk_chr
- set_perk_desc
- set_perk_end
- set_perk_freq
- set_perk_image
- set_perk_int
- set_perk_lck
- set_perk_level
- set_perk_level_mod
- set_perk_name
- set_perk_owed
- set_perk_per
- set_perk_ranks
- set_perk_skill1
- set_perk_skill1_mag
- set_perk_skill2
- set_perk_skill2_mag
- set_perk_stat
- set_perk_stat_mag
- set_perk_str
- set_perk_type
- set_perkbox_title
- set_pyromaniac_mod
- set_selectable_perk
- set_swiftlearner_mod
- show_real_perks
apply_heaveho_fix
void apply_heaveho_fix
+ Perks and traits - sfall Perks and traits | sfall Perks and traits
Subcategories
Functions
- apply_heaveho_fix
- clear_selectable_perks
- get_perk_available
- get_perk_owed
- has_fake_perk
- has_fake_trait
- hide_real_perks
- perk_add_mode
- remove_trait
- seq_perk_freq
- set_fake_perk
- set_fake_trait
- set_perk_agl
- set_perk_chr
- set_perk_desc
- set_perk_end
- set_perk_freq
- set_perk_image
- set_perk_int
- set_perk_lck
- set_perk_level
- set_perk_level_mod
- set_perk_name
- set_perk_owed
- set_perk_per
- set_perk_ranks
- set_perk_skill1
- set_perk_skill1_mag
- set_perk_skill2
- set_perk_skill2_mag
- set_perk_stat
- set_perk_stat_mag
- set_perk_str
- set_perk_type
- set_perkbox_title
- set_pyromaniac_mod
- set_selectable_perk
- set_swiftlearner_mod
- show_real_perks
apply_heaveho_fix
void apply_heaveho_fix
clear_selectable_perks
void clear_selectable_perks()
Restores the “select a perk” box to its default state.
get_perk_available
int get_perk_available(int perk)
get_perk_owed
int get_perk_owed
@@ -9,8 +9,8 @@
Modifies what happens when a fake perk is selected from the perks dialog. It is treated as a set of flags - if bit 1 is set then it is added to the player’s traits, if bit 2 is set it is added to the player’s perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2.
remove_trait
void remove_trait(int traitID)
seq_perk_freq
void seq_perk_freq(int value)
Sets the number of levels between each perk.
set_fake_perk
void set_fake_perk(string name, int level, int image, string desc)
-
Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in skilldex.lst. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
set_fake_trait
void set_fake_trait(string name, int active, int image, string desc)
-
Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in skilldex.lst. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
set_perk_agl
void set_perk_agl(int perkID, int value)
+
Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in skilldex.lst. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
set_fake_trait
void set_fake_trait(string name, int active, int image, string desc)
+
Used to add additional traits and perks to the character screen. They will be saved correctly when the player saves and reloads games, but by themselves they will have no further effect on the character. For perks, the allowed range for levels is between 0 and 100; setting the level to 0 removes that perk. For traits, the level must be 0 or 1. The image is a numeric id that corresponds to an entry in skilldex.lst. The name is limited to 63 characters and the description to 255 characters by sfall, but internal Fallout limits may be lower.
set_perk_agl
void set_perk_agl(int perkID, int value)
set_perk_chr
void set_perk_chr(int perkID, int value)
set_perk_desc
void set_perk_desc(int perkID, string value)
set_perk_end
void set_perk_end(int perkID, int value)
@@ -37,4 +37,4 @@
set_selectable_perk
void set_selectable_perk(string name, int active, int image, string desc)
Used to add additional items to “select a perk” box by setting the ‘active’ parameter to 1, and to remove them again by setting it to 0.
set_swiftlearner_mod
void set_swiftlearner_mod(int bonus)
show_real_perks
void show_real_perks()
-
Reverts the effect os hide_real_perks.
+
Reverts the effect os hide_real_perks.
diff --git a/pip-boy/index.html b/pip-boy/index.html
index f6cacd93..d048fc51 100644
--- a/pip-boy/index.html
+++ b/pip-boy/index.html
@@ -1,2 +1,2 @@
- Pip-Boy - sfall Pip-Boy | sfall Pip-Boy
Functions
set_quest_failure_value
void sfall_func2("set_quest_failure_value", int gvarNumber, int thresholdValue)
-
- sets the threshold value (failure_threshold) for the quest at which the quest will be considered failed (its description in the pipboy will be crossed out and colored red)
gvarNumber: the number of the global variable controlling the quest thresholdValue: the value of the global variable at which the quest is counted as a failure
+ Pip-Boy - sfall Pip-Boy | sfall Pip-Boy
Functions
set_quest_failure_value
void sfall_func2("set_quest_failure_value", int gvarNumber, int thresholdValue)
+
- sets the threshold value (failure_threshold) for the quest at which the quest will be considered failed (its description in the pipboy will be crossed out and colored red)
gvarNumber: the number of the global variable controlling the quest thresholdValue: the value of the global variable at which the quest is counted as a failure
diff --git a/read_xxx/index.html b/read_xxx/index.html
index f1241702..23f864d0 100644
--- a/read_xxx/index.html
+++ b/read_xxx/index.html
@@ -1,4 +1,4 @@
- read_xxx - sfall read_xxx | sfall read_xxx
These functions take a memory address as the parameter and can read arbitrary pieces of Fallout’s address space.
Functions
read_byte
int read_byte(int address)
+ read_xxx - sfall read_xxx | sfall read_xxx
These functions take a memory address as the parameter and can read arbitrary pieces of Fallout’s address space.
Functions
read_byte
int read_byte(int address)
read_int
int read_int(int address)
read_short
int read_short(int address)
read_string
int read_string(int address)
diff --git a/rest/index.html b/rest/index.html
index b6e3e0fa..c9f0d9c8 100644
--- a/rest/index.html
+++ b/rest/index.html
@@ -1,3 +1,3 @@
- Rest - sfall Rest | sfall Rest
Functions
get_can_rest_on_map
sfall.h
get_can_rest_on_map(int mapNum, int elev)
-
- returns the set rest value of the map after using the
set_can_rest_on_map function - Returns -1 if the rest value of the map was not previously set (i.e. no data for the map in
sfalldb.sav) - the
can_rest_here values from maps.txt are ignored.
set_can_rest_on_map
sfall.h
void set_can_rest_on_map(int mapNum, int elev, bool value)
-
Allows/disallows to rest on the map for the specified level, overrides the can_rest_here values in maps.txt.
mapNum is the map index from maps.txt - passing -1 to the elev argument will set the rest value for all map elevations
- the set rest value will be stored in
sfalldb.sav file (in savegame)
+ Rest - sfall Rest | sfall Rest
Functions
get_can_rest_on_map
sfall.h
get_can_rest_on_map(int mapNum, int elev)
+
- returns the set rest value of the map after using the
set_can_rest_on_map function - Returns -1 if the rest value of the map was not previously set (i.e. no data for the map in
sfalldb.sav) - the
can_rest_here values from maps.txt are ignored.
set_can_rest_on_map
sfall.h
void set_can_rest_on_map(int mapNum, int elev, bool value)
+
Allows/disallows to rest on the map for the specified level, overrides the can_rest_here values in maps.txt.
mapNum is the map index from maps.txt - passing -1 to the elev argument will set the rest value for all map elevations
- the set rest value will be stored in
sfalldb.sav file (in savegame)
diff --git a/sfall-funcx-macros/index.html b/sfall-funcx-macros/index.html
index d760dfef..45873f90 100644
--- a/sfall-funcx-macros/index.html
+++ b/sfall-funcx-macros/index.html
@@ -1,24 +1,24 @@
- Sfall funcX macros - sfall Sfall funcX macros | sfall Sfall funcX macros
Functions
- add_extra_msg_file
- critter_inven_obj2
- dialog_message
- get_current_inven_size
- get_metarule_table
- get_object_ai_data
- get_text_width
- item_weight
- metarule_exist
- npc_engine_level_up
- objects_in_radius
- set_drugs_data
- set_rest_heal_time
- set_rest_mode
- sfall_func0(“hide_window”)
- sfall_func0(“show_window”)
- sfall_func1(“hide_window”, string winName)
- sfall_func1(“remove_timer_event”, int fixedParam)
- sfall_func1(“show_window”, string winName)
- sfall_func2(“string_compare”, string str1, string str2)
- sfall_func3(“string_compare”, string str1, string str2, int codePage)
- spatial_radius
- void sfall_func0(“remove_timer_event”)
add_extra_msg_file
sfall.h
int add_extra_msg_file(string fileName)
-
Loads the custom message file, and returns the file ID number assigned to it in range from 0x3000 to 0x3FFF for the message_str_game function to get messages from the file.
fileName: the name of the custom message file (including the .msg extension) in text\<language>\game\ directory.
Alternative form: int add_extra_msg_file(string fileName, int fileNumber)
fileNumber: the file ID number for the message_str_game function. The available range is from 0x2000 to 0x2FFF (see ExtraGameMsgFileList setting in ddraw.ini) Use fileNumber only if you want to add a message file without editing ddraw.ini or existing scripts to support the old way.
critter_inven_obj2
sfall.h
ObjectPtr critter_inven_obj2(ObjectPtr obj, int type)
-
Works just like vanilla critter_inven_obj, but correctly reports item in player’s inactive hand slot.
dialog_message
sfall.h
void dialog_message(string text)
+ Sfall funcX macros - sfall Sfall funcX macros | sfall Sfall funcX macros
Functions
- add_extra_msg_file
- critter_inven_obj2
- dialog_message
- get_current_inven_size
- get_metarule_table
- get_object_ai_data
- get_text_width
- item_weight
- metarule_exist
- npc_engine_level_up
- objects_in_radius
- set_drugs_data
- set_rest_heal_time
- set_rest_mode
- sfall_func0(“hide_window”)
- sfall_func0(“show_window”)
- sfall_func1(“hide_window”, string winName)
- sfall_func1(“remove_timer_event”, int fixedParam)
- sfall_func1(“show_window”, string winName)
- sfall_func2(“string_compare”, string str1, string str2)
- sfall_func3(“string_compare”, string str1, string str2, int codePage)
- spatial_radius
- void sfall_func0(“remove_timer_event”)
add_extra_msg_file
sfall.h
int add_extra_msg_file(string fileName)
+
Loads the custom message file, and returns the file ID number assigned to it in range from 0x3000 to 0x3FFF for the message_str_game function to get messages from the file.
fileName: the name of the custom message file (including the .msg extension) in text\<language>\game\ directory.
Alternative form: int add_extra_msg_file(string fileName, int fileNumber)
fileNumber: the file ID number for the message_str_game function. The available range is from 0x2000 to 0x2FFF (see ExtraGameMsgFileList setting in ddraw.ini) Use fileNumber only if you want to add a message file without editing ddraw.ini or existing scripts to support the old way.
critter_inven_obj2
sfall.h
ObjectPtr critter_inven_obj2(ObjectPtr obj, int type)
+
Works just like vanilla critter_inven_obj, but correctly reports item in player’s inactive hand slot.
dialog_message
sfall.h
void dialog_message(string text)
Displays a message in the NPC response window in dialog or barter screen.
get_current_inven_size
sfall.h
get_current_inven_size(ObjectPtr object)
Returns the current inventory size of the container or the critter.
get_metarule_table
sfall.h
array get_metarule_table
Returns names of all currently available script functions.
get_object_ai_data
sfall.h
int get_object_ai_data(ObjectPtr object, int aiParam)
-
Returns the setting value from the AI packet of an object (critter). Use AI_CAP_* constants from define_extra.h for the aiParam argument to get AI value.
get_text_width
sfall.h
int get_text_width(string text)
+
Returns the setting value from the AI packet of an object (critter). Use AI_CAP_* constants from define_extra.h for the aiParam argument to get AI value.
get_text_width
sfall.h
int get_text_width(string text)
Returns the text width in pixels for the currently set font.
item_weight
sfall.h
int item_weight(ObjectPtr obj)
Gets the current weight of an object.
metarule_exist
sfall.h
bool metarule_exist(string metaruleName)
Returns True if the specified name of metarule (sfall_funcX) function exists in the current version of sfall.
npc_engine_level_up
sfall.h
void npc_engine_level_up(bool toggle)
Enables/disables the engine function that increases the level of party members in the player leveling process. If the engine function is disabled, the process of leveling up party members should be performed by script functions.
objects_in_radius
sfall.h
objects_in_radius", int tile, int radius, int elevation, int type)
-
- returns an array of objects of a type (see
OBJ_TYPE_* constants in define_extra.h) within the specified radius from the given tile - passing -1 to the
type argument or not specifying it will return all objects within the radius - the radius is limited to 50 hexes
set_drugs_data
sfall.h
void set_drugs_data(int type, int pid, int value)
-
Overrides the parameters of drugs set in the configuration file (DrugsFile setting in ddraw.ini). 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).
set_rest_heal_time
sfall.h
void set_rest_heal_time(int time)
+
- returns an array of objects of a type (see
OBJ_TYPE_* constants in define_extra.h) within the specified radius from the given tile - passing -1 to the
type argument or not specifying it will return all objects within the radius - the radius is limited to 50 hexes
set_drugs_data
sfall.h
void set_drugs_data(int type, int pid, int value)
+
Overrides the parameters of drugs set in the configuration file (DrugsFile setting in ddraw.ini). 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).
set_rest_heal_time
sfall.h
void set_rest_heal_time(int time)
Sets the time interval in minutes for healing during resting. The default is 180. Note: The interval will be reset each time the player reloads the game.
set_rest_mode
sfall.h
void set_rest_mode(int flags)
-
Sets the bit flags for the rest mode (see RESTMODE_* constants in sfall.h). Passing 0 will reset the rest mode. It will also be reset each time the player reloads the game.
sfall_func0(“hide_window”)
sfall.h
void sfall_func0("hide_window")
+
Sets the bit flags for the rest mode (see RESTMODE_* constants in sfall.h). Passing 0 will reset the rest mode. It will also be reset each time the player reloads the game.
sfall_func0(“hide_window”)
sfall.h
void sfall_func0("hide_window")
Hides currently active (selected) script window.
sfall_func0(“show_window”)
sfall.h
void sfall_func0("show_window")
-
Displays the script window previously hidden with the sfall_func0("hide_window") function.
sfall_func1(“hide_window”, string winName)
sfall.h
void sfall_func0("hide_window")
-
Hides the specified script window.
- winName: the window name, assigned to the window by the
CreateWin/create_win function
sfall_func1(“remove_timer_event”, int fixedParam)
sfall.h
void sfall_func1("remove_timer_event", int fixedParam)
-
Removes all timer events with the specified fixedParam value for the current global script.
sfall_func1(“show_window”, string winName)
sfall.h
void sfall_func1("show_window", string winName)
-
Displays the specified hidden script window. winName: the window name, assigned to the window by the CreateWin/create_win function
sfall_func2(“string_compare”, string str1, string str2)
sfall.h
bool sfall_func2("string_compare", string str1, string str2)
-
Compares two strings case-insensitive, and returns True if the two strings are matched.
sfall_func3(“string_compare”, string str1, string str2, int codePage)
sfall.h
bool sfall_func3("string_compare", string str1, string str2, int codePage)
-
Compares two strings case-insensitive, and returns True if the two strings are matched
codePage: code page number to properly compare national characters in the range 128-255 of the ASCII code table available encodings: 1250-1252, 866
spatial_radius
sfall.h
int spatial_radius(ObjectPtr obj)
-
Returns radius of spatial script, associated with given dummy-object (returned by create_spatial).
void sfall_func0(“remove_timer_event”)
sfall.h
void sfall_func0("remove_timer_event")
+
Displays the script window previously hidden with the sfall_func0("hide_window") function.
sfall_func1(“hide_window”, string winName)
sfall.h
void sfall_func0("hide_window")
+
Hides the specified script window.
- winName: the window name, assigned to the window by the
CreateWin/create_win function
sfall_func1(“remove_timer_event”, int fixedParam)
sfall.h
void sfall_func1("remove_timer_event", int fixedParam)
+
Removes all timer events with the specified fixedParam value for the current global script.
sfall_func1(“show_window”, string winName)
sfall.h
void sfall_func1("show_window", string winName)
+
Displays the specified hidden script window. winName: the window name, assigned to the window by the CreateWin/create_win function
sfall_func2(“string_compare”, string str1, string str2)
sfall.h
bool sfall_func2("string_compare", string str1, string str2)
+
Compares two strings case-insensitive, and returns True if the two strings are matched.
sfall_func3(“string_compare”, string str1, string str2, int codePage)
sfall.h
bool sfall_func3("string_compare", string str1, string str2, int codePage)
+
Compares two strings case-insensitive, and returns True if the two strings are matched
codePage: code page number to properly compare national characters in the range 128-255 of the ASCII code table available encodings: 1250-1252, 866
spatial_radius
sfall.h
int spatial_radius(ObjectPtr obj)
+
Returns radius of spatial script, associated with given dummy-object (returned by create_spatial).
void sfall_func0(“remove_timer_event”)
sfall.h
void sfall_func0("remove_timer_event")
Clears all set timer events for the current global script.
diff --git a/sfall/index.html b/sfall/index.html
index 9c9dd169..886e4b1d 100644
--- a/sfall/index.html
+++ b/sfall/index.html
@@ -1 +1 @@
- Sfall - sfall Sfall | sfall
+ Sfall - sfall Sfall | sfall
diff --git a/skills/index.html b/skills/index.html
index e164b230..855c47e4 100644
--- a/skills/index.html
+++ b/skills/index.html
@@ -1,7 +1,7 @@
- Skills - sfall Skills | sfall Skills
Functions
- get_available_skill_points
- get_critter_skill_points
- mod_skill_points_per_level
- set_available_skill_points
- set_base_skill_mod
- set_critter_skill_mod
- set_critter_skill_points
- set_skill_max
get_available_skill_points
int get_available_skill_points()
+ Skills - sfall Skills | sfall