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.
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.
voidreg_anim_animate_and_hide(ObjectPtr,intanimID,intdelay)
+ Animations | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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.
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.
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" - 2list:=["A","B","C"];
diff --git a/art-and-appearance/index.html b/art-and-appearance/index.html
index 3141c088..50e86280 100644
--- a/art-and-appearance/index.html
+++ b/art-and-appearance/index.html
@@ -1,4 +1,4 @@
- Art and appearance | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
Clears the cache of FRM image files loaded into memory.
art_exists
intart_exists(intartFID)
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)).
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
voidset_eax_environment(intenvironment)
Obsolete since sfall 2.1a. Has no effect.
stop_sfall_sound
voidstop_sfall_sound(intsoundID)
diff --git a/best-practices/index.html b/best-practices/index.html
index 976b7c7b..2e96100a 100644
--- a/best-practices/index.html
+++ b/best-practices/index.html
@@ -1,4 +1,4 @@
- Best practices | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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:
#defineNAME"gl_a_myscript"
+ Best practices | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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:
#defineNAME"gl_a_myscript"#definendebug(message)debug_msg(NAME+": "+message+"\n")procedurestartbegin
diff --git a/call_offset_vx/index.html b/call_offset_vx/index.html
index c241d3ed..afcb1814 100644
--- a/call_offset_vx/index.html
+++ b/call_offset_vx/index.html
@@ -1,4 +1,4 @@
- call_offset_vX | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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 unlessAllowUnsafeScriptingis enabled inddraw.ini.
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 unlessAllowUnsafeScriptingis enabled inddraw.ini.
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
voidset_car_current_town(inttown)
Changes the current town index for the player’s car.
set_car_intface_art
sfall.h
voidset_car_intface_art(intartIndex)
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 cda84aee..d1a83f48 100644
--- a/combat/index.html
+++ b/combat/index.html
@@ -1,4 +1,4 @@
- Combat | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
Returns 1 if the aimed attack mode is selected, 0 otherwise.
block_combat
voidblock_combat(boolvalue)
Deny the player to enter combat mode.
combat_data
mixedcombat_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
voiddisable_aimed_shots(intpid)
diff --git a/cursor/index.html b/cursor/index.html
index 38c59be4..a9caa40d 100644
--- a/cursor/index.html
+++ b/cursor/index.html
@@ -1,3 +1,3 @@
- Cursor | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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 the Misc Item type and have the 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
intmetarule2_explosions(intarg1,intarg2)
Was made as a quick-and-dirty hack to enable dynamic changes to some explosion parameters for ranged attacks. All changed parameters are automatically reset to vanilla state after each attack action.
set_attack_explosion_art
sfall.h
voidset_attack_explosion_art(x,y)
diff --git a/feed.xml b/feed.xml
index 42a5f988..e8824254 100644
--- a/feed.xml
+++ b/feed.xml
@@ -1 +1 @@
-Jekyll2023-09-30T09:20:09+00:00/sfall/feed.xmlsfallSfall documentation
\ No newline at end of file
+Jekyll2023-10-02T00:50:20+00:00/sfall/feed.xmlsfallSfall documentation
\ No newline at end of file
diff --git a/funcx/index.html b/funcx/index.html
index 5c3da149..7c8a717c 100644
--- a/funcx/index.html
+++ b/funcx/index.html
@@ -1,4 +1,4 @@
- funcX | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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
voidset_global_script_type(inttype)
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 d667ae41..a01ca9e3 100644
--- a/global-scripts/index.html
+++ b/global-scripts/index.html
@@ -1 +1 @@
- Global scripts | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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 | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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 9ddef32d..c8bd5a65 100644
--- a/global-variables/index.html
+++ b/global-variables/index.html
@@ -1,4 +1,4 @@
- Global variables | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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.
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.
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.
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.
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
mixedget_sfall_arg_at(intargNum)
Gets the value of hook argument with the specified argument number (first argument of hook starts from 0)
get_sfall_args
intget_sfall_args()
Returns all hook arguments as a new temp array.
init_hook
intinit_hook()
diff --git a/hook-types/index.html b/hook-types/index.html
index 09c0b761..b0eb258a 100644
--- a/hook-types/index.html
+++ b/hook-types/index.html
@@ -1,4 +1,4 @@
- Hook types | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied
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 | sfallSkip to main contentLinkMenuExpand(external link)DocumentSearchCopyCopied