Merge branch 'develop'

This commit is contained in:
NovaRain
2019-09-15 07:19:08 +08:00
75 changed files with 1371 additions and 533 deletions
+21
View File
@@ -7,6 +7,26 @@
; have an additional NoHardcode option in this file which can
; be used to remove their hardcoded effects, and add new stat/skill effects
[PerksTweak]
;Change the penalty distance and distance bonus for 'Weapon Scope Range' weapon perk
;0 - no penalty, 8 - default penalty
WeaponScopeRangePenalty=8
;2 - no bonus, 5 - default bonus
WeaponScopeRangeBonus=5
;Changes the distance bonus for 'Weapon Long Range' weapon perk
;2 - no bonus, 4 - default bonus
WeaponLongRangeBonus=4
;Changes the hit chance bonus for 'Weapon Accurate' weapon perk
;0 - no bonus, 200 - maximum bonus, 20 - default bonus
WeaponAccurateBonus=20
;Changes the strength bonus for 'Weapon Handling' perk
;0 - no bonus, 10 - maximum bonus, 3 - default bonus
WeaponHandlingBonus=3
;##############################################################################
;Name=The name of the perk (max 63 characters)
;Desc=The description of the perk (max 255 characters)
;Image=The line number (0-indexed) of the corresponding FRM in skilldex.lst
@@ -43,6 +63,7 @@
;Skill3-Skill5 = The skill to be modified (or -1 for none)
;Skill3Mod-Skill5Mod = The increased/decreased value to the modified skill
;##############################################################################
;This is a modification to vanilla perk 0
[0]
Name=Example
+37 -15
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.1.9.1
;v4.2
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -191,6 +191,11 @@ DebugEditorKey=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Misc]
;Changes some of Fallout 2 engine functions to Fallout 1 behavior:
;- disables playing the final movie/credits after the endgame slideshow
;- disables halving the weight for power armor items
Fallout1Behavior=0
;Time limit in years. Must be between -3 and 13
;Set to 0 if you want to die the instant you leave arroyo
;Set to -1 to remove the time limit, and automatically reset the date back to 2241 each time you would have reached it
@@ -272,7 +277,7 @@ Movie16=artimer4.mve
Movie17=credits.mve
;To change the starting year, month or day, uncomment the next 3 lines
;Both StartMonth and StartDay are 0-indexed
;Both StartMonth and StartDay are 0-indexed (i.e. 0 is January or the first day of a month)
;StartYear=-1
;StartMonth=-1
;StartDay=-1
@@ -336,7 +341,7 @@ OverrideArtCacheSize=0
;Set to 2 to block all saving in combat
SaveInCombatFix=1
;Point at an ini file containing elevator data
;Point to an ini file containing elevator data
;ElevatorsFile=Elevators.ini
;Uncomment and set a comma delimited list of numbers to use a custom xp table.
@@ -349,14 +354,17 @@ SaveInCombatFix=1
AdditionalWeaponAnims=1
;Uncomment these lines to modify the default modifiers for aimed shots at specific bodyparts
;Modifiers affect both NPCs and the player
;BodyHit_Head=-40
;BodyHit_Left_Arm=-30
;BodyHit_Right_Arm=-30
;BodyHit_Torso_Uncalled=0
;BodyHit_Torso=0
;BodyHit_Right_Leg=-20
;BodyHit_Left_Leg=-20
;BodyHit_Eyes=-60
;BodyHit_Groin=-30
;The modifier for unaimed shots
;BodyHit_Torso_Uncalled=0
;Set to 1 to use a CriticalOverrides.ini file to override the default critical table
;Set to 2 to use the default critical with bug fixes (doesn't require an ini)
@@ -364,6 +372,8 @@ AdditionalWeaponAnims=1
;If the ExtraKillTypes option is enabled, this should be set to 3, with containing entries for any new types
;Must be non-zero to use the edit/get/reset_critical script functions
OverrideCriticalTable=2
;To change the path and filename of the critical table file, uncomment the next line
;OverrideCriticalFile=CriticalOverrides.ini
;Set to 1 to get notification of karma changes in the notification window
DisplayKarmaChanges=0
@@ -375,7 +385,7 @@ AlwaysReloadMsgs=0
PlayIdleAnimOnReload=0
;Set to 1 to prevent corpses from blocking line of fire
CorpseLineOfFireFix=0
CorpseLineOfFireFix=1
;Changes the timer (in days) for deleting corpses on a map after you leave (valid range: 0..13)
;The corpses of critters with 'Ages' flag or on maps with 'dead_bodies_age=No' set in maps.txt will not disappear
@@ -389,6 +399,7 @@ CorpseDeleteTime=6
ProcessorIdle=-1
;Set to 1 if using the hero appearance mod
;Set to 2 for backward compatibility with old scripts that manually fix obj_art_fid script function for dude_obj
;You can add AppChCrt.frm and AppChEdt.frm files to art\intrface\ to set a custom background for the character screen
EnableHeroAppearanceMod=0
@@ -500,9 +511,11 @@ RemoveCriticalTimelimits=0
;Set to 1 to enable party members with level 6 protos to reach level 6
NPCStage6Fix=0
;Change the colour of the font used on the main menu for the Fallout/sfall version number
;It's the last byte ('3c' by default) that picks the colour used. The first byte supplies additional flags
;MainMenuFontColour=0x0600003c
;Change the colour of the font used on the main menu for the Fallout/sfall version number and copyright text
;It's the last byte ('3C' by default) that picks the colour used. The first byte supplies additional flags for this option
;MainMenuFontColour=0x00003C
;Change the colour of the font used on the main menu for the button text
;MainMenuBigFontColour=0x3C
;Two alternate fixes to the interaction between HtH attacks and the fast shot trait
;0 - Fallout 2 original behaviour
@@ -514,7 +527,7 @@ FastShotFix=1
BoostScriptDialogLimit=0
;Allows you to edit the skill tables
;Point the next line at an ini file containing the replacement skill data
;Point the next line to an ini file containing the replacement skill data
;SkillsFile=Skills.ini
;To change the relationship between SPECIAL stats and derived stats, uncomment the next line
@@ -649,10 +662,14 @@ UseWalkDistance=3
;Set to 1 to fix the bug of being unable to sell used geiger counters or stealth boys
CanSellUsedGeiger=1
;Set to 1 to fix the issue with being able to charge the car by using cells on other scenary/critters
;Set to 1 to fix the issue with being able to charge the car by using cells on other scenery/critters
;Set to 0 if another mod you're using has custom vehicles
CarChargingFix=1
;Set to 1 to prevent the car from being lost when entering a location via the Town/World button and then leaving on foot
;Note that the global variable 633 (GVAR_CAR_PLACED_TILE) will be set to -1 when the player leaves a location
CarPlacedTileFix=1
;Set to 1 to skip weapon equip/unequip animations when performing various actions
InstantWeaponEquip=0
@@ -703,7 +720,7 @@ SpecialDeathGVAR=491
;Note that enabling this option can break the map changes in Modoc and Vault 15
DisableSpecialMapIDs=0
;Changes the base value of the duration of the knockout effect (valid range: 35..100)
;Changes the base value of the duration of the knockout effect (valid range: 35..100; default is 35)
;The formula for the duration in ticks is: 10 * (value - 3 * EN)
KnockoutTime=35
@@ -717,6 +734,11 @@ CreditsAtBottom=0
;Paths outside of scripts folder are supported
GlobalScriptPaths=scripts\gl*.int,scripts\sfall\gl*.int
;Uncomment the option to specify a common folder path for all ini files used by scripts
;You will have to put all the available ini files of the mods in this directory
;The maximum length of the specified path is 61 characters
;IniConfigFolder=IniConfig
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Debugging]
;Extra sfall configuration settings that can be used by modders
@@ -742,6 +764,10 @@ Enable=0
;-------
DebugMode=0
;Set to 1 to hide error messages in debug output when a null value is passed to the function as an object
;Requires DebugMode to be enabled
HideObjIsNullMsg=0
;Change to 1 to skip the compatibility mode check
SkipCompatModeCheck=0
@@ -767,10 +793,6 @@ AlwaysFindScripts=0
;Set to 1 to force sfall to inject all hooks code into the game, even if corresponding hook scripts don't exist
InjectAllGameHooks=0
;Set to 1 to hide error messages in debug output when a null value is passed to the function as an object
;Requires DebugMode to be enabled
HideObjIsNullMsg=0
;Set to 1 to force critters to display combat float messages
;Requires AllowSoundForFloats to be enabled
Test_ForceFloats=0
@@ -0,0 +1,206 @@
/*
Example algorithm of how the game engine calculates combat damage
*/
#include "..\headers\define.h"
#include "..\headers\command.h"
#include "..\headers\sfall\sfall.h"
#include "..\headers\sfall\define_extra.h"
procedure start;
procedure compute_damage_F2;
procedure item_w_damage_hook;
procedure item_w_subtype(variable weapon, variable hit_mode);
procedure get_ammo_value(variable weapon, variable param);
variable item_w_damage;
procedure start begin
if game_loaded then begin
register_hook_proc(HOOK_COMBATDAMAGE, compute_damage_F2);
register_hook_proc(HOOK_ITEMDAMAGE, item_w_damage_hook);
end
end
procedure compute_damage_F2 begin
variable dmg_type, weapon_perk, dmg_thresh, dmg_resist, weapon_subtype, bonus_ranged, difficulty, i, dmg_mult, dmg_div, damage;
variable target, flags, knockback, amount;
variable
ctdTarget := get_sfall_arg,
ctdSource := get_sfall_arg,
amountTarget := get_sfall_arg,
amountSource := get_sfall_arg,
flagsTarget := get_sfall_arg,
flagsSource := get_sfall_arg,
weapon := get_sfall_arg,
bodypart := get_sfall_arg,
damageMultiplier := get_sfall_arg,
rounds := get_sfall_arg,
amountKnockback := get_sfall_arg,
hit_mode := get_sfall_arg;
if (flagsSource bwand DAM_HIT) then begin
target := ctdTarget;
flags := flagsTarget;
knockback := 1;
end else begin
target := ctdSource;
flags := flagsSource;
knockback := 0;
end
//amount := 0;
if target and (obj_type(target) == OBJ_TYPE_CRITTER) then begin
if weapon then begin
dmg_type := weapon_dmg_type(weapon);
weapon_perk := get_proto_data(obj_pid(weapon), PROTO_WP_PERK);
end else begin
dmg_type := DMG_normal_dam;
weapon_perk := -1;
end
dmg_thresh := get_critter_stat(target, STAT_dmg_thresh + dmg_type);
dmg_resist := get_critter_stat(target, STAT_dmg_resist + dmg_type);
if (flags bwand DAM_BYPASS) and (dmg_type != DMG_emp) then begin
dmg_thresh := dmg_thresh * 20 / 100;
dmg_resist := dmg_resist * 20 / 100;
end else begin
if (weapon_perk == PERK_weapon_penetrate)
or (hit_mode == ATKTYPE_PALMSTRIKE or hit_mode == ATKTYPE_PIERCINGSTRIKE
or hit_mode == ATKTYPE_HOOKKICK or hit_mode == ATKTYPE_PIERCINGKICK) then
dmg_thresh := dmg_thresh * 20 / 100;
if ctdSource == dude_obj and has_trait(TRAIT_TRAIT, ctdSource, TRAIT_finesse) then
dmg_resist += 30;
end
weapon_subtype := item_w_subtype(weapon, hit_mode); // item_w_subtype_
if (ctdSource != dude_obj) or (weapon_subtype != WEAPON_TYPE_GUNS) then
bonus_ranged := 0;
else
bonus_ranged := has_trait(TRAIT_PERK, ctdSource, PERK_bonus_ranged_damage) * 2;
difficulty := 100;
if (has_trait(TRAIT_OBJECT, ctdSource, OBJECT_TEAM_NUM) != has_trait(TRAIT_OBJECT, dude_obj, OBJECT_TEAM_NUM)) then begin
if (combat_difficulty == 0) then
difficulty := 75;
else if (combat_difficulty == 2) then
difficulty := 125;
end
// F2 default start
// Damage = (1 - (DR_armor + DR_ammo_adjust) * (((raw_damage * (dmg_mult * damageMultiplier)) / dmg_div) - dmg_thresh)
dmg_resist += get_ammo_value(weapon, PROTO_AM_DR_MOD); // item_w_dr_adjust_ (DR Adjust %)
if (dmg_resist < 100) then begin
if (dmg_resist < 0) then dmg_resist := 0;
dmg_mult := damageMultiplier * get_ammo_value(weapon, PROTO_AM_DMG_MULT); // item_w_dam_mult_ (Dmg mod A)
dmg_div := get_ammo_value(weapon, PROTO_AM_DMG_DIV); // item_w_dam_div_ (Dmg mod B)
for (i := 1; i <= rounds; i++) begin
damage := (item_w_damage + bonus_ranged) * dmg_mult; // item_w_damage_ (raw_damage)
if dmg_div then damage /= dmg_div;
damage := (((damage / 2) * difficulty) / 100) - dmg_thresh;
if (damage > 0) then begin
damage := damage - ((damage * dmg_resist) / 100); // reduce damage by the percentage of DR_armor + DR_Ammo
if (damage > 0) then amount += damage;
end
end
end
// F2 default end
if (ctdSource == dude_obj) then begin
if has_trait(TRAIT_PERK, ctdSource, PERK_living_anatomy_perk) and (critter_kill_type(ctdTarget) != KILL_TYPE_robot_kills)
and (critter_kill_type(ctdTarget) != KILL_TYPE_alien_kills) then
amount += 5;
if has_trait(TRAIT_PERK, ctdSource, PERK_pyromaniac_perk) and (dmg_type == DMG_fire) then
amount += 5;
end
if knockback and ((get_flags(target) bwand FLAG_MULTIHEX) == 0)
and (dmg_type == DMG_explosion or weapon == 0 or weapon_subtype == WEAPON_TYPE_MELEE)
and ((get_proto_data(obj_pid(target), PROTO_CR_FLAGS) bwand CFLG_NOKNOCKDOWN) == 0) then begin // critter_flag_check_
damage := 0;
if (target == dude_obj) and has_trait(TRAIT_PERK, target, PERK_stonewall_perk) then begin
damage := 1;
if (random(0, 100) < 50) then knockback := 0;
end
if knockback then begin
if (weapon_perk == PERK_weapon_knockback) then
amountKnockback := amount / 5;
else
amountKnockback := amount / 10;
if damage then amountKnockback /= 2;
end
end
end
if (flagsSource bwand DAM_HIT) then begin
display_msg("amountTarget = " + amountTarget+ ", amount = " + amount);
amountTarget := amount;
flagsTarget := flags;
end else begin
display_msg("amountSource = " + amountSource+ ", amount = " + amount);
amountSource := amount;
flagsSource := flags;
end
set_sfall_return(amountTarget);
set_sfall_return(amountSource);
set_sfall_return(flagsTarget);
set_sfall_return(flagsSource);
set_sfall_return(amountKnockback);
end
procedure item_w_damage_hook begin
variable
item_w_damage_min := get_sfall_arg,
item_w_damage_max := get_sfall_arg;
//weapon := get_sfall_arg,
//source := get_sfall_arg,
//hit_mode := get_sfall_arg,
//isMelee := get_sfall_arg;
item_w_damage := (item_w_damage_min + (item_w_damage_max - item_w_damage_min) / 2);
display_msg("item_w_damage_ = " + item_w_damage);
set_sfall_return(item_w_damage);
end
procedure item_w_subtype(variable weapon, variable hit_mode) begin
variable attack_mode, type := WEAPON_TYPE_UNARMED;
if weapon and (hit_mode <= ATKTYPE_RWEP2) then begin
attack_mode := (get_proto_data(obj_pid(weapon), PROTO_IT_FLAGS));
if (hit_mode == ATKTYPE_LWEP2) or (hit_mode == ATKTYPE_RWEP2) then
attack_mode := (attack_mode bwand 0xF0) / 16; // shift 4 bits to the right
else
attack_mode := (attack_mode bwand 0x0F);
if (attack_mode > ATKMODE_PRI_THROW) then
type := WEAPON_TYPE_GUNS;
else if (attack_mode == ATKMODE_PRI_THROW) then
type := WEAPON_TYPE_THROWN;
else if (attack_mode > ATKMODE_PRI_KICK) then
type := WEAPON_TYPE_MELEE;
end
return type;
end
procedure get_ammo_value(variable weapon, variable param) begin
variable pid := -1, value := 0; // default DR value
if weapon then begin
pid := get_weapon_ammo_pid(weapon);
if (pid > -1) then value := get_proto_data(pid, param);
end
if (pid == -1 and param != PROTO_AM_DR_MOD) then value := 1; // default value for Mult/Div
return value;
end
+2 -2
View File
@@ -1,5 +1,5 @@
Master Theif cheat for fallout 2 by phobos2077
----------------------------------------
Master Thief cheat for fallout 2 by phobos2077
----------------------------------------------
- forces all steal attempts to succeed
@@ -1,20 +0,0 @@
procedure start;
// adjust include paths if needed
#include "..\..\scripting_docs\headers\sfall.h"
#include "..\..\scripting_docs\headers\dik.h"
procedure start begin
if game_loaded then begin
register_hook(HOOK_KEYPRESS);
end else begin
variable
event := get_sfall_arg,
keyDX := get_sfall_arg;
if (event == 1) and (keyDX == DIK_SEMICOLON) then begin
tap_key(DIK_CAPITAL);
tap_key(DIK_A);
tap_key(DIK_CAPITAL);
end
end
end
@@ -1,9 +0,0 @@
"Take All" Hotkey mod for Fallout 2 by NovaRain
----------------------------------------
- makes pressing the semicolon key send an uppercase A after a semicolon.
- Note: the uppercase A (shift + A if Caps Lock is off) is the built-in hotkey for the TAKE ALL button on the loot screen.
To use, copy *.int file to your scripts folder.
This mod is a simple example of how you can use HOOK_KEYPRESS hooks.
Binary file not shown.
@@ -0,0 +1,53 @@
/*
UI Hotkeys mod for Fallout 2 by NovaRain
----------------------------------------
- closes some game interfaces by pressing their hotkeys again:
* 'I' key for Inventory
* 'S' key for Skilldex
* 'Z' key for Pip-Boy
- extends the functionality of the 'Space' key (Caps Lock must be off):
* takes all items in the loot screen
* makes the offer in the barter screen
Requires sfall 3.5 or higher
*/
#include "..\headers\sfall\sfall.h"
#include "..\headers\sfall\dik.h"
procedure start;
procedure start begin
if game_loaded then begin
register_hook(HOOK_KEYPRESS);
end else begin
variable
event := get_sfall_arg,
keyDX := get_sfall_arg,
mode;
if (event) then begin
mode := get_game_mode;
if (mode bwand COUNTERWIN) then return; // new mode from sfall 4.2/3.8.20
if (keyDX == DIK_I and (mode bwand INVENTORY)) then begin
tap_key(DIK_ESCAPE);
end else if (keyDX == DIK_S and (mode bwand SKILLDEX)) then begin
tap_key(DIK_ESCAPE);
end else if (keyDX == DIK_Z and (mode bwand PIPBOY)) then begin
tap_key(DIK_ESCAPE);
end else if (keyDX == DIK_SPACE) then begin
if (mode bwand INTFACELOOT) then begin
tap_key(DIK_CAPITAL);
tap_key(DIK_A);
tap_key(DIK_CAPITAL);
end else if (mode bwand BARTER) then begin
tap_key(DIK_M);
end
end
end
end
end
@@ -0,0 +1,22 @@
UI Hotkeys mod for Fallout 2 by NovaRain
----------------------------------------
- closes some game interfaces by pressing their hotkeys again:
* 'I' key for Inventory
* 'S' key for Skilldex
* 'Z' key for Pip-Boy
- extends the functionality of the 'Space' key (Caps Lock must be off):
* takes all items in the loot screen
* makes the offer in the barter screen
- Note:
* the uppercase 'A' (shift + A if Caps Lock is off) is the built-in hotkey for the TAKE ALL button on the loot screen
* the lowercase 'm' is the built-in hotkey for the OFFER button on the barter screen
Requires sfall 3.5 or higher
To use, copy gl_uihotkeys.int to your scripts folder.
This mod is a simple example of how you can use HOOK_KEYPRESS hooks.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -125,6 +125,7 @@ procedure adjustfid_handler begin
variable weapAnim := get_sfall_arg bwand 0xF000;
variable newFid := fid bwand 0xFFFF0FFF bwor weapAnim;
if art_exists(newFid) then begin
set_sfall_arg(0, newFid);
set_sfall_return(newFid);
end else begin
debug_msg("Error: NPC Armor mod: missing FID.");
Binary file not shown.
+1
View File
@@ -58,6 +58,7 @@ procedure combatturn_handler begin
critter_add_trait(critter, TRAIT_PERK, perkID, level);
end
end
intface_redraw;
lightDist := get_object_data(critter, OBJ_DATA_LIGHT_DISTANCE);
lightInt := get_object_data(critter, OBJ_DATA_LIGHT_INTENSITY);
obj_set_light_level(critter, 100, 4);
+19 -5
View File
@@ -10,21 +10,35 @@
variable ini := "sfall-mods.ini";
variable translationIni;
// Gets the integer value from ini
// Gets the integer value from the specified ini
procedure GetIniConfig(variable section, variable key, variable def, variable inifile) begin
variable val := get_ini_setting(inifile + "|" + section + "|" + key);
if val == -1 then val := def;
return val;
end
// Gets the string value from the specified ini
procedure GetIniConfigStr(variable section, variable key, variable def, variable inifile) begin
variable val := get_ini_string(inifile + "|" + section + "|" + key);
if val == -1 or val == "" then val := def;
return val;
end
// Gets the integer value from sfall-mods.ini
procedure GetConfig(variable section, variable key, variable def) begin
variable val := get_ini_setting(ini + "|" + section + "|" + key);
if val == -1 then val := def;
return val;
end
// Gets the string value from ini
// Gets the string value from sfall-mods.ini
procedure GetConfigStr(variable section, variable key, variable def) begin
variable val := get_ini_string(ini + "|" + section + "|" + key);
if val == -1 or val == "" then val := def;
return val;
end
// Gets the value from ini as a temp array of strings
// Gets the value from sfall-mods.ini as a temp array of strings
procedure GetConfigList(variable section, variable key) begin
variable val := get_ini_string(ini + "|" + section + "|" + key);
if val == -1 or val == "" then return [];
@@ -32,7 +46,7 @@ procedure GetConfigList(variable section, variable key) begin
return string_split(val, ",");
end
// Gets the value from ini as a temp array of ints
// Gets the value from sfall-mods.ini as a temp array of ints
procedure GetConfigListInt(variable section, variable key) begin
variable arr, i, item;
@@ -53,5 +67,5 @@ procedure Translate(variable id, variable def) begin
end
procedure InitConfigs begin
translationIni := GetConfigStr("Main", "TranslationsINI", "./Translations.ini");
translationIni := GetIniConfigStr("Main", "TranslationsINI", "Translations.ini", "ddraw.ini");
end
@@ -2,6 +2,16 @@
#ifndef DEFINE_EXTRA_H
#define DEFINE_EXTRA_H
#define BODY_HIT_HEAD (0)
#define BODY_HIT_LEFT_ARM (1)
#define BODY_HIT_RIGHT_ARM (2)
#define BODY_HIT_TORSO (3)
#define BODY_HIT_RIGHT_LEG (4)
#define BODY_HIT_LEFT_LEG (5)
#define BODY_HIT_EYES (6)
#define BODY_HIT_GROIN (7)
#define BODY_UNCALLED (8)
#define OBJ_TYPE_ITEM (0)
#define OBJ_TYPE_CRITTER (1)
#define OBJ_TYPE_SCENERY (2)
@@ -31,6 +41,7 @@
#define WEAPON_BIGGUN 256 // 0x00000100 - Big Gun
#define WEAPON_2HAND 512 // 0x00000200 - 2Hnd (weapon is two-handed)
#define WEAPON_ENERGY 1024 // 0x00000400 - Energy Weapon (forces weapon to use Energy Weapons skill)
#define ATKMODE_PRI_NONE 0
#define ATKMODE_PRI_PUNCH 1 // 0001
+8 -4
View File
@@ -19,6 +19,7 @@
#define BARTER (0x20000)
#define HEROWIN (0x40000)
#define DIALOGVIEW (0x80000)
#define COUNTERWIN (0x100000) // counter window for moving multiple items or setting a timer
//Valid arguments to register_hook
#define HOOK_TOHIT (0)
@@ -61,6 +62,7 @@
#define HOOK_SUBCOMBATDAMAGE (37)
#define HOOK_SETLIGHTING (38)
#define HOOK_SNEAK (39)
#define HOOK_STDPROCEDURE (40)
//Valid arguments to list_begin
#define LIST_CRITTERS (0)
@@ -73,7 +75,8 @@
#define LIST_ALL (9)
//Valid flags for force_encounter_with_flags
#define ENCOUNTER_FLAG_NO_CAR (1)
#define ENCOUNTER_FLAG_NO_CAR (1)
#define ENCOUNTER_FLAG_LOCK (2) // block new forced encounter by the next function call until the current specified encounter occurs
//The attack types returned by get_attack_type
#define ATKTYPE_LWEP1 (0)
@@ -142,12 +145,13 @@
#define reverse_array(array) resize_array(array, -4)
// randomly shuffle elements in list/map
#define shuffle_array(array) resize_array(array, -5)
// sort map in ascending order by value
// sort map in ascending order by key value
#define sort_map_value(array) resize_array(array, -6)
// sort map in descending order by value
#define sort_map_value_desc(array) resize_array(array, -7)
// sort map in descending order by key value
#define sort_map_reverse(array) resize_array(array, -7)
// remove element from map or just replace value with 0 for list
#define unset_array(array, item) set_array(array, item, 0)
// same as "key_pressed" but checks VK codes instead of DX codes
#define key_pressed_vk(key) (key_pressed(key bwor 0x80000000))
+24 -10
View File
@@ -10,8 +10,6 @@ To aid in mods compatibility, avoid using hs_xxx .int scripts. Instead it is rec
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);
@@ -25,8 +23,6 @@ procedure start begin
end
There are script functions available, specific to hook scripts:
> int init_hook()
@@ -47,8 +43,11 @@ Changes argument value. The argument number (argnum) is 0-indexed. This is usefu
> void register_hook(int hooktype)
Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, "start" proc will be executed in a current global script. You can use all above functions like normal.
> void register_hook_proc(int hooktype, 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"). Pass procedure the same as how you use dialog option functions. This IS the recommended way to use hook scripts, as it gives both modularity (each mod logic in a separate global script, no conflicts if you don't use "hs_*.int" scripts) and flexibility (you can place all related hook scripts for specific mod in a single script!).
> void register_hook_proc(int hook, procedure proc)
The same as register_hook, except that you specifically define which procedure in the current script should be called as a hook (instead of "start" by default). Pass procedure the same as how you use dialog option functions. This IS the recommended way to use hook scripts, as it gives both modularity (each mod logic in a separate global script, no conflicts if you don't use "hs_*.int" scripts) and flexibility (you can place all related hook scripts for specific mod in a single script!).
> void register_hook_proc_spec(int hook, procedure proc)
Works very similar to register_hook_proc, except that it registers the current script at the end of the hook script execution chain (i.e. the script will be executed after all previously registered scripts for the same hook, including the hs_*.int script). All scripts hooked to a single hook point with this function are executed in exact order of how they were registered, as opposed to the description below, which refers to using register_hook/register_hook_proc functions.
NOTE: you can hook several scripts to a single hook point, for example if it's different mods from different authors or just some different aspects of one larger mod. In this case scripts are executed in reverse order of how they were registered. When one of the scripts in a chain returns value with "set_sfall_return", the next script may override this value if calls "set_sfall_return" again. Sometimes you need to multiply certain value in a chain of hook scripts.
Example: let's say we have a Mod A which reduces all "to hit" chances by 50%. The code might look like this:
@@ -248,13 +247,14 @@ Obj arg1 - the owner that the object is being removed from
item arg2 - the item that is being removed
int arg3 - the number of items to remove
int arg4 - The reason the object is being removed (see RMOBJ_* constants)
Obj arg5 - The destination object when the item is moved to another object, otherwise 0
Obj arg5 - The destination object when the item is moved to another object, 0 otherwise
-------------------------------------------
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 arg1 - the critter doing the bartering (either dude_obj or inven_dude)
critter arg2 - the critter being bartered with
@@ -264,7 +264,8 @@ int arg5 - the amount of actual caps in the barter stack (as opposed to good
int arg6 - the value of all goods being traded before skill modifications
critter arg7 - table of offered goods (being sold to NPC)
int arg8 - the total cost of the goods offered by the player
int arg9 - set 1 if the "offers" button was pressed (not for a party member), otherwise 0
int arg9 - 1 if the "offers" button was pressed (not for a party member), 0 otherwise
int arg10 - 1 if trading with a party member, 0 otherwise
int ret1 - the modified value of all of the goods (pass -1 if you just want to modify offered goods)
int ret2 - the modified value of all offered goods
@@ -334,7 +335,6 @@ int arg4 - Type of hook (0 - when subtracting ammo after single shot attack,
int ret1 - new ammo cost value (set to 0 for unlimited ammo)
-------------------------------------------
HOOK_KEYPRESS (hs_keypress.int)
@@ -452,7 +452,8 @@ Also happens on other screens, like barter.
NOTE: FID has following format: 0x0ABBCDDD, where A is object type, BB - animation code (always 0 in this case), C - weapon code, DDD - FRM index in LST file.
int arg1 - the vanilla fid calculated by the engine according to critter base FID and armor/weapon being used
int arg1 - the vanilla FID calculated by the engine according to critter base FID and armor/weapon being used
int arg2 - the modified FID calculated by the internal sfall code (like Hero Appearance Mod)
int ret1 - overrides the calculated FID with provided value
@@ -630,3 +631,16 @@ Critter arg3 - the critter (usually dude_obj)
int ret1 - overrides the result of the Sneak check
int ret2 - overrides the duration time for the current result
-------------------------------------------
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 arg1 - the number of the standard script handler (see define.h)
Obj arg2 - the object that owns this handler (self_obj)
Obj arg3 - the object that called this handler (source_obj, can be 0)
int ret1 - pass -1 to cancel the execution of the handler
@@ -316,6 +316,10 @@ Some utility/math functions are available:
- second argument should be passed just like you pass procedures to functions like gsay_option, giq_option, etc (name without quotes)
- see "hookscripts.txt" for more details
> void register_hook_proc_spec(int hook, procedure proc)
- works just like "register_hook_proc", but allows to register a 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)
- to unregister hook script from current global script, use the register_hook_proc function
> string message_str_game(int fileId, int messageId)
- works exactly the same as message_str, except you get messages from files in "text\<language>\game\" directory
- use GAME_MSG_* defines or mstr_* macros from sfall.h to use specific msg file
@@ -613,6 +617,7 @@ optional arguments:
> int sfall_func2("add_extra_msg_file", string fileName, int fileNumber)
- 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
- NOTE: if the msg file does not exist in the current language directory, the function will try to load it from "text\English\game\" directory
optional argument:
- 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

Some files were not shown because too many files have changed in this diff Show More