Compare commits

...
132 Commits
Author SHA1 Message Date
NovaRain 8af87a5252 Merge branch 'develop' 2018-10-01 21:14:00 +08:00
NovaRain 96cb6c51ea Updated version number. 2018-10-01 21:10:21 +08:00
NovaRain 5874450f60 AllowDShowSound improvements from Mr.Stalin:
* Added volume control support for alternative sound files.
* Added mode 2 to play alternative music files even if original acm files are not present in the music folder.
* Added AllowDShowMovies option to separate avi files playback from enabling DX9 mode.
* Fixed initialization bug when DX9 mode is disabled.
* Small refactoring on ASM code.

Added missing FadeMultiplier option to ddraw.ini.
2018-09-30 21:34:35 +08:00
NovaRain f088c9bb70 Fixed the mood argument of start_gdialog function being ignored for talking heads. (from Crafty)
Simplified the code of disabling losing unused perks.
2018-09-30 16:24:15 +08:00
NovaRain 7f8481d03a Added "get/set_rest_on_map" script functions (from Mr.Stalin) 2018-09-28 13:59:09 +08:00
NovaRain f162a5ab0c Moved item_count function fix from Inventory.cpp to BugFixes.cpp.
Minor edit to document.
2018-09-25 14:12:06 +08:00
NovaRain ce69e8123e Fixed the max text width of player name in inventory.
Added an 8 lines limit to the underline position fix.
Removed obsoleted WorldMapEncPatch* functions from Worldmap.cpp (forgot to remove during commit 0f1072c302)
Some minor ASM code edits.
2018-09-25 12:19:30 +08:00
NovaRain b5e85f2f89 Changed the implementation of fs_* opcodes from ASM blocks to handler functions. 2018-09-24 12:20:42 +08:00
NovaRain f7fe463f42 Added "create_win" script function and InterfaceDontMoveOnTop option (from Mr.Stalin) 2018-09-23 16:13:20 +08:00
NovaRain 27f2d57ebd Fixed ai_retrieve_object_ engine function not returning the requested object when there are different objects with the same ID (from Mr.Stalin)
Added info about map_*_p_proc procedures to the global script section in notes.txt (#197)
2018-09-23 08:13:35 +08:00
NovaRain bbe789d013 Added "get_current_inven_size" script function. 2018-09-21 19:23:35 +08:00
NovaRain 76ea3ed383 Added inventory size check to "Take All" button (from Mr.Stalin)
Added additional note to CritterInvSizeLimitMode in ddraw.ini, and changed CritterInvSizeLimit to its default value.
2018-09-20 09:41:49 +08:00
NovaRain c6f3dbfcf6 Changed item_total_weight/item_c_curr_size engine functions to return the weight and size of equipped(hidden) items on NPCs when exchanging/bartering items (from Mr.Stalin)
Fixed CritterInvSizeLimitMode not properly checking the weight of equipped items when mode is set to 4+.
2018-09-19 22:49:05 +08:00
NovaRain 49ce654d72 Excluded inventory size features for NPCs when CritterInvSizeLimitMode is set to PC only. 2018-09-16 10:24:49 +08:00
NovaRain b2a1160492 Removed UTF-8 BOM in Inventory.cpp. 2018-09-15 10:13:25 +08:00
NovaRain 5da2ec76de Refactored CritterInvSizeLimitMode option and fixed some bugs (from Mr.Stalin)
Added party member's current/max inventory size info to the combat control panel.
2018-09-15 09:49:07 +08:00
NovaRain 123f69268d Fixed the underline position in the inventory display window when the item name is longer than one line (from Mr.Stalin)
Simplified the code of SuperStimExploitFix and corrected the return value for the change.
2018-09-12 22:39:18 +08:00
NovaRain 6d0c84e783 Fixed broken get/reset_critical_table functions (from Mr.Stalin) 2018-09-11 09:55:38 +08:00
NovaRain c652fae849 Fixed the encounter description being displayed in two lines instead of one (from Crafty) 2018-09-09 23:09:26 +08:00
NovaRain 3399e07958 Removed the duplicated sf_inventory_redraw code in Interface.cpp. 2018-09-06 23:01:15 +08:00
NovaRain 044af677d9 Merge branch 'develop' 2018-09-06 21:18:59 +08:00
NovaRain 752ad8ae01 Added notes to AutoQuickSavePage description. 2018-09-06 13:01:57 +08:00
NovaRain 9d9d8ada49 Added options to use more than one save slot for quick saving (from Mr.Stalin) (#186) 2018-09-06 07:01:14 +08:00
NovaRain 6bd7d3ebca Added the description of the new FemaleDialogMsgs setting value to ddraw.ini. 2018-09-03 09:58:27 +08:00
NovaRainandGitHub 9bc71a5d2a Merge pull request #193 from FakelsHub/dev/CutsFemale
Added FemaleDialogMsgs=2 for loading subtitle files from text/language/cuts_female/ for female PC.
2018-09-03 09:51:46 +08:00
Mr.Stalin 6d66232162 Added functional to the option FemaleDialogMsgs for possibility using the 'cuts_female' directory for female phrases. 2018-09-02 22:51:39 +03:00
NovaRain fe5f4bb2aa Changed the fix for multihex critter moving in combat to a more proper one (from Mr.Stalin)
Added AIBestWeaponFix option to ddraw.ini.
2018-09-02 18:08:37 +08:00
NovaRain 8a7d22dd03 Added additional checks to the fix of multihex critters moving in combat (from Mr.Stalin)
Added AIBestWeaponFix option to ddraw.ini.
2018-09-02 10:55:14 +08:00
NovaRain fac0b73d9e Changed the fix for multihex critter moving in combat to a more proper one. 2018-08-29 09:37:55 +08:00
NovaRain 2974210ad3 Minor edit to the description of QuestsScrollButtonsX/Y. 2018-08-26 14:53:47 +08:00
NovaRain bb0f2bb8db Changed the two example hook scripts to global scripts. 2018-08-24 08:10:38 +08:00
NovaRain 715b55dda8 Fixed multihex critters moving too close and overlapping their targets in combat (from Crafty)
Fixed critters not checking weapon perks properly when searching for the best weapon (from Mr.Stalin)
Changed BugFixes module to be initialized at the beginning.
2018-08-21 07:19:51 +08:00
NovaRain 999d818c86 Fixed multihex critters moving too close and overlapping their targets in combat (from Crafty)
Fixed critters not checking weapon perks properly when searching for the best weapon (from Mr.Stalin)
Changed BugFixes module to be initialized at the beginning.
2018-08-21 06:14:16 +08:00
NovaRain 1d7fd442b0 Minor edits to sfall-mods.ini. 2018-08-19 00:41:50 +08:00
NovaRain 3062533492 Added ObjCanHearObjFix to ddraw.ini.
Added extra comment for CarChargingFix to ddraw.ini.
Edited the description of DisplayName in sfall-mods.ini because of the new BoxBarCount option.
Minor edits to hookscripts.txt.
2018-08-19 00:33:10 +08:00
Mr.StalinandNovaRain 032e1d13f3 Fixed the functions of the engine op_obj_can_see_obj_/op_obj_can_hear_obj_ (#189)
Added one additional argument for the hook HOOK_WITHINPERCEPTION.
2018-08-18 23:56:03 +08:00
NovaRain 9f0797f8ad Added extra comment for CarChargingFix to ddraw.ini. 2018-08-14 23:58:09 +08:00
NovaRain a7c66685b9 Added QuestsScrollButtonsX/Y, DisplaySwiftLearnerExp, and additional note for the new mode of UseScrollingQuestsList to ddraw.ini.
Changed a log message in BugFixes.cpp to be a bit more specific.
Edited some comments in QuestList.cpp.
2018-08-12 19:07:52 +08:00
Mr.StalinandNovaRain 118b186d4d Quest list: Added options to specify the location of the buttons and a choice of the buttons type. (#187)
Fixed the clickability issue of holodisk list in the pipboy.

Fixed the display issue in the pipboy when a quest list is too long with UseScrollingQuestsList diabled.

Added an option to display experience points with the bonus from Swift Learner perk when gained from non-scripted situations (from Crafty)
2018-08-12 18:57:21 +08:00
Mr.StalinandNovaRain a8718dab2f Fixed the divided by 0 bug in CheckWeaponAmmoCost option. (#190) 2018-08-12 09:14:28 +08:00
NovaRain ccd897281f Fixed obj_can_see_obj not checking if source and target objects are on the same elevation before calling is_within_perception_ (from Mr.Stalin) 2018-08-10 22:54:07 +08:00
NovaRain d200262a2b Added a fix for the display issue in the pipboy when a quest list is too long with UseScrollingQuestsList diabled (from Mr.Stalin)
Added a fix for the clickability issue of holodisk list in the pipboy (from Mr.Stalin)
2018-08-06 22:04:21 +08:00
Mr.StalinandNovaRain 0ebe3ef1a4 Added new game mode DIALOGVIEW. (#182) 2018-07-29 17:48:33 +08:00
NovaRain d0c97f7118 Fixed an issue with file IDs of additional game msg files being shifted when a file in ExtraGameMsgFileList is missing.
Minor edit to the description of CityRepsList in ddraw.ini, to avoid misunderstanding.
Updated version number.
2018-07-28 22:46:59 +08:00
NovaRain 0bda53e109 Rename the option from previous commit to FullItemDescInBarter and added it to ddraw.ini.
Edited info about HOOK_DESCRIPTIONOBJ and the new return value of HOOK_BARTERPRICE to documents.
Minor edits to ddraw.ini to avoid misunderstanding.
2018-07-28 22:27:32 +08:00
Mr.StalinandNovaRain 93cd7a08ad Added new HOOK_DESCRIPTIONOBJ and dialog_message/get_string_pointer functions (#181)
Added the second return value to HOOK_BARTERPRICE to modify the cost of the player's goods.
Fixed missing AC/DR mod stats when examining ammo in barter screen.
Added an option to display full item description for weapon/ammo in barter screen.
2018-07-28 22:14:38 +08:00
NovaRain 44d668f50b Renamed DialogFemaleMsgFile to FemaleDialogMsgs, and added its description to ddraw.ini.
Added additional notes for the new functionality of ExtraGameMsgFileList to documents.
2018-07-24 12:07:02 +08:00
NovaRainandGitHub f368973299 Merge pull request #185 from FakelsHub/devFeature/MessageDialog
Added option for loading alternative dialogue message files.
2018-07-24 11:50:41 +08:00
Mr.Stalin 96802c9642 Added option for loading alternative dialogue message files. (#183)
Fix error of the ExtraGameMsgFileList option, when the absence of a file, the number order was shifted.
To the ExtraGameMsgFileList option, added ability to directly specify the number for the message file.
2018-07-22 20:47:32 +03:00
NovaRain 39221065af Added BoxBarCount to ddraw.ini.
Edited documents for the change of is_iface_tag_active and added BoxBarCount.
Edited the phrasing of debugging message in SafeWrite.cpp.
2018-07-21 08:54:25 +08:00
Mr.StalinandNovaRain 95f95e7b38 BarBoxes: Set used count (#180)
* Added BarBoxesCount option to set the number of additional notification boxes to the interface.
* Expanded is_iface_tag_active function to check tag value of 0/1/2 (sneak/poisoned/radiated)
2018-07-21 08:47:05 +08:00
NovaRain 41c8722179 Merged a couple of fixes and minor improvements for 4.0.x from the develop branch:
* Fixed the game thinking you dropped an active explosive when the dropping is prevented with hs_inventorymove.
* Added "inventory_redraw" script function (from Mr.Stalin)
* NPC combat control mod now centers the screen on the controlled critter and has new options to display critter's name.
* Removed obsoleted WIN2K preprocessor defines.
Updated version number.
2018-07-16 09:14:01 +08:00
NovaRainandGitHub 3b780110ea Merge pull request #177 from FakelsHub/dev/RefHooks
Refactoring hooks.
2018-07-15 21:07:51 +08:00
Mr.Stalin 448dbdb31e Fixed injecting bug for HOOK_DEATHANIM2. 2018-07-14 20:39:15 +03:00
NovaRain 033376000c Fixed the screen flickering during switching critters in NPC combat control.
Now the mod does not center the screen on PC and display name box for the first turn of a player-initiated combat or when there's no other controllable critter in combat.
2018-07-13 11:25:42 +08:00
NovaRain bc2dabc461 Removed redundant function from NPC combat control and tidied up a bit. 2018-07-11 10:03:03 +08:00
NovaRain 08b5e3a769 Improved the functionality of NPC combat control mod (#179)
* centers the screen on controlled critter.

* removes roof tiles to show controlled critter properly.

* additional options to display the name of controller critter.
2018-07-10 12:05:15 +08:00
NovaRain 09c9c5cce0 Added the description of HOOK_EXPLOSIVETIMER to hookscripts.txt.
Edited the example script.
Updated version number.
2018-07-10 06:09:23 +08:00
Mr.StalinandNovaRain b4b1698345 Added new HOOK_EXPLOSIVETIMER (#175) 2018-07-10 06:00:04 +08:00
NovaRain 2a20209bb8 Added "inventory_redraw" script function (from Mr.Stalin) 2018-07-08 00:30:26 +08:00
NovaRain 84c7ac0536 Added InjectAllGameHooks to [Debugging] section in ddraw.ini. 2018-07-05 21:52:53 +08:00
Mr.Stalin 46f8820ecf Refactoring some hooks. 2018-07-04 21:55:52 +03:00
NovaRain 5d4b8fdd7b Added info for new HOOK_AMMOCOST arguments to hookscripts.txt. 2018-07-03 09:38:07 +08:00
Mr.StalinandNovaRain 44603174dd Refactoring combat hooks (#174)
* Fixed and improved the functionality of HOOK_AMMOCOST when CheckWeaponAmmoCost is enabled.

* Fixed the instant death critical fix not working if there's no script using HOOK_COMBATDAMAGE, due to the new hooks injection implementation.
2018-07-03 09:34:47 +08:00
Mr.Stalin d37fbd8390 Implementation detect conflict address for debug mode (#10). 2018-07-02 20:19:21 +03:00
NovaRain 2f22a1e982 Edited the description of HOOK_USEANIMOBJ in hookscripts.txt.
Removed obsoleted WIN2K preprocessor define.
Updated version number.
2018-06-25 22:12:42 +08:00
NovaRainandGitHub 3f03cf3c18 Merge pull request #171 from FakelsHub/devHook/UseObjectMap
* Added new HOOK_USEANIMOBJ.

* Moved some hooks code from MiscHs.cpp to ObjectHs.cpp.
2018-06-25 22:04:18 +08:00
NovaRain 1b3b5dc523 Fixed premature assignment of arguments before the beginning of the hooks in InventoryHs.cpp. (#173)
(cherry picked from commit fff48407c3)
Updated version number.
2018-06-24 12:36:01 +08:00
Mr.StalinandNovaRain fff48407c3 Fix of premature assignment of arguments before the beginning of the hook. (#173) 2018-06-24 09:56:29 +08:00
Mr.Stalin 841e741e91 Fixed calls BeginHook() procedures. 2018-06-24 00:24:27 +03:00
Mr.Stalin d4a501d813 Hook is renamed to HOOK_USEANIMOBJ. 2018-06-20 21:21:46 +03:00
Mr.StalinandNovaRain 5e056f1743 Fixed the drop event for Hook_InventoryMove when dropping an active explosive item on the ground. (#170)
When an armed explosive is dropped from the inventory, the dropped_explosive engine variable is set. If the drop is canceled by scripting, the variable will still be set to 1 without the fix.
2018-06-20 22:26:05 +08:00
Mr.Stalin 35a94b5418 Refactoring: Moving some hooks code from MiscHs.cpp to ObjectHs.cpp 2018-06-19 21:48:18 +03:00
Mr.Stalin 7eaef76f6f Added new script hook HOOK_USEOBJECTMAP. 2018-06-19 21:40:27 +03:00
Mr.StalinandNovaRain 30002664ef Implemented an injection system for hook scripts. (#168)
* Before the code of hooks was always executed even if there's no corresponding hook script, just passing through and doing nothing. Now the code of a hook only gets injected into the game when the corresponding hook script exists.
2018-06-19 14:31:35 +08:00
NovaRain c2f7e38a43 Added KeepWeaponSelectMode option to ddraw.ini. 2018-06-19 06:03:36 +08:00
Mr.StalinandNovaRain 8a5674f2d9 Added the option to keep the selected attack mode for the weapon when the weapon moves to another slot of the hand. (#166) 2018-06-19 06:01:43 +08:00
NovaRain 8c2483a289 Merge branch 'develop' 2018-06-12 21:01:12 +08:00
NovaRain e14ac89463 Added more info to the comments of various keys in [Input] section of ddraw.ini. 2018-06-12 20:52:03 +08:00
Mr.StalinandNovaRain d5a38eb3aa Fix for inventory moving hook - an item drop into container when it is in the slot of the hands. (#167) 2018-06-12 12:13:42 +08:00
NovaRain 177137f2ee Edited the description in hookscripts.txt for changes to HOOK_INVENTORYMOVE and HOKK_INVENWIELD.
Fixed a bug in DisplaySecondWeaponRange that didn't display correct weapon range when the secondary mode is aimed (e.g. spear and throwing knife)
Removed trilling spaces in previous commit.
2018-06-11 13:40:09 +08:00
Mr.StalinandNovaRain 76f88eae18 Added new events to HOOK_INVENTORYMOVE. Added possible to get a pointer to an weapon item in HOOK_INVENWIELD before unweld it. (#163)
Refactoring the hooks code of the inventory.
2018-06-11 13:14:52 +08:00
NovaRain 28962f428f Added ItemFastMoveKey and ItemCounterDefaultMax options to ddraw.ini.
Set ReloadReserve to be disabled by default.
2018-06-06 06:33:46 +08:00
Mr.StalinandNovaRain aaa76cb3d1 Quickly moving items in inventory. (#162)
* Added an option for quickly moving items (w/o dialog box) in inventory.

* An separate option is added to set the counter of maximum number of items when moving items.
2018-06-06 06:23:07 +08:00
NovaRain ea1c00ec91 Added the ability to define allowed weapon animations for NPCs to NPC armor appearance mod (#159) 2018-06-05 22:08:39 +08:00
NovaRain 410c7ab417 Minor edits to documents. 2018-06-04 21:21:32 +08:00
VladandNovaRain ab3ddc68b6 Retarget project to use VS2017 build tools, fix deprecation warnings (#161) 2018-06-03 16:35:08 +08:00
NovaRain 1652072391 Fixed a bug that critters killed in combat by scripting still being able to move in their combat turn if the distance parameter in their AI packages is set to stay_close/charge, or NPCsTryToSpendExtraAP is enabled (from Mr.Stalin) 2018-06-02 18:15:53 +08:00
NovaRain 051b1c98aa Edited the added comments in AnimationsAtOnceLimit.cpp.
Renamed obj_move_hack to object_move_hack because it hooks on object_move_ engine function.
2018-06-01 23:36:56 +08:00
Mr.StalinandNovaRain 56945c7437 Fixed crash game when playing animation when the critter/pc goes through the door. Refactoring code. (#158) 2018-06-01 23:30:37 +08:00
NovaRain 2f6f0d8b28 Added the description of new metarule2_explosions mode to function notes.txt.
Fixed a typo in metarule2_explosions error message.
2018-05-30 21:07:51 +08:00
Mr.StalinandNovaRain 0e715236bf Added an additional mode to the function 'metarule2_explosions', sets a constant radius of the explosion grenades and rockets. (#146) 2018-05-30 21:02:35 +08:00
NovaRain b24a860d40 Renamed WorldMapFont to WorldMapFontPatch and changed its description in ddraw.ini. 2018-05-30 09:27:58 +08:00
NovaRain 120a8cd964 Added WorldMapFont option to use Fallout font on the world map instead of system font. (#48) 2018-05-29 16:22:58 +08:00
Mr.StalinandNovaRain 62d4577152 Adding to the function get_mouse_buttons the return of pressing the middle mouse button (#114). (#157)
Change the type of argument checking for the len_array function to remove an unwanted error message (# 128).
2018-05-29 09:29:11 +08:00
NovaRain 2d8ea2b44c Added description of HOOK_GAMEMODECHANGE to hookscripts.txt.
Fixed the line break for debug.log message of GameReset.
Minor edits to Tiles.cpp code format.
2018-05-28 23:37:45 +08:00
Mr.StalinandNovaRain 4ef20c3526 Added new hook for function get_game_mode, when the game mode changes. (#86) (#153) 2018-05-28 23:32:14 +08:00
NovaRain 5e0e8dd2f1 Added MoreTiles option to ddraw.ini.
Changed MoreTiles to work independently of HRP 4.1.8 and removed the redundant define.
Added sfall log messages to both options in Tiles.cpp.
Implemented HookCalls in TimeLimitPatch().
Fixed a minor typo in function notes.txt.
2018-05-28 09:27:53 +08:00
Mr.StalinandNovaRain 04bd88cdc2 Added MoreTiles option to increase the limit of FRM images for tiles from 4096 to 16383 (from Crafty) (#156) 2018-05-28 09:18:55 +08:00
NovaRain 839e86ed26 Added the description and setting for the previous commit to ddraw.ini.
Improved DisablePipboyAlarm so that when the player press Z key they won't see a blank Pipboy screen.
2018-05-27 15:08:46 +08:00
Mr.StalinandNovaRain eeef8759d3 Display statistics of the weapon's range for the second attack mode in player inventory. (#154) 2018-05-27 14:48:09 +08:00
NovaRain c4903abd4c Added the description of set_iface_tag_text to notes.txt.
Fixed compilation error in BarBoxes.cpp.
Updated version number.
2018-05-21 10:51:12 +08:00
Mr.StalinandNovaRain e0c0b9ba19 Added function 'set_iface_tag_text' - sets custom text and color to bar boxes. (#152) 2018-05-21 10:41:59 +08:00
NovaRain b9c7f5ea82 Fixed commit 470a0b3386. 2018-05-15 20:20:07 +08:00
NovaRain 56fdec8b37 Reverted the previous changes of ASM code due to the bug that AppChCrt.frm overwrites AppChEdt.frm. 2018-05-14 21:14:50 +08:00
NovaRain 470a0b3386 Simplified the code from previous commit. 2018-05-14 20:52:26 +08:00
NovaRain 279c524da9 Added support for adding custom background image to the character creation/screen of the hero appearance mod (From Mr.Stalin)
AppChCrt.frm (for the character creation) and AppChEdt.frm (for the character screen) should be in art/intrface, and the image size must be 640x480.
2018-05-14 10:05:49 +08:00
NovaRain 57c4c0bd5d Merge branch 'develop' 2018-05-11 20:01:53 +08:00
NovaRain 3ff0e77c26 Added the description of attack_is_aimed to notes.txt.
Removed unnecessary function declaration in Misc.h.
2018-05-09 10:07:11 +08:00
mr.StalinandNovaRain 15909dbb5b Fixed function "get_attack_type" and new function "attack_is_aimed". (#145)
* Fixed broken function 'get_attack_type'. Adding a new function 'attack_is_aimed'.
2018-05-09 10:03:07 +08:00
NovaRain ee9010217e Added description of HOOK_RESTTIMER, set_rest_heal_time, and set_rest_mode to documents.
Renamed the bit flags for set_rest_mode.
Fixed compilation error in Worldmap.cpp.
2018-05-08 12:30:53 +08:00
mr.StalinandNovaRain 9fa59a0d75 Rest hook and functions (#144)
* Added new HOOK_RESTTIMER (#89)

* Added "set_rest_mode" and "set_rest_heal_time" script functions.
2018-05-08 12:18:44 +08:00
NovaRain 371a299640 Added new HOOK_SETGLOBALVAR (#34) (from Mr.Stalin) 2018-05-02 11:14:02 +08:00
NovaRain 31f42128e1 Added "floor2" script function to work with ceil (#109)
Added the missing description of ceil to notes.txt.
Disabled ceil marco in lib.math.h.
Removed duplications in Utils.h.
2018-04-28 11:07:37 +08:00
NovaRain 57225bbd38 Fixed max tile number for set_map_enter_position and compilation error in Worldmap.cpp.
Added the description of get/set_map_enter_position to function notes.
2018-04-27 19:40:23 +08:00
mr.StalinandNovaRain 310d029801 New *_map_enter_position functions. (#141)
Added "get/set_map_enter_position" script functions (#101)
2018-04-27 19:35:29 +08:00
NovaRain b52f4544c0 Fixed the last additional notification boxes to the interface being missing (#140) 2018-04-26 10:01:15 +08:00
NovaRain 0950efec8c Changed the upper limit of set_unjam_locks_time to 127.
Added set_unjam_locks_time to documents.
2018-04-25 20:00:49 +08:00
NovaRain d86794be3a Added "set_unjam_locks_time" script function (from Mr.Stalin) 2018-04-24 09:20:16 +08:00
NovaRain d6aff61607 Added "lock_is_jammed" and "unjam_lock" script functions. 2018-04-24 08:13:26 +08:00
NovaRain 0eeab768bd Fixed a bug in item highlighting that caused items to be kept highlighted when entering combat while holding the highlight key. 2018-04-22 11:06:36 +08:00
NovaRain e474ba1660 Updated README.txt for info about additional headers/libraries. 2018-04-21 09:18:51 +08:00
NovaRain 3abebb8486 Added a new script function: set_ini_setting (from Mr.Stalin) (#85)
Added set_ini_setting to documents, and updated info for get_ini_setting.
Updated credits.
Replacing a couple of strcpy usages with strcpy_s.
2018-04-21 09:01:27 +08:00
NovaRain 29910e98bf Revert "Fixed a bug when using HOOK_ITEMDAMAGE and calling item_w_damage_ engine function at the same time. It would result in player self-damaging when attacking targets."
This reverts commit 4194feafdf.
2018-04-13 20:42:09 +08:00
NovaRain 4194feafdf Fixed a bug when using HOOK_ITEMDAMAGE and calling item_w_damage_ engine function at the same time. It would result in player self-damaging when attacking targets.
Set DataLoadOrderPatch to be enabled by default, for preventing partial of a game crash issue due to unusual game folder setup. #136
2018-04-13 11:06:21 +08:00
NovaRain 1c6729a25f Added a fix for being at incorrect hex after map change when the exit hex in source map is at the same position as some exit hex in destination map (from Crafty) #134 2018-04-02 23:19:07 +08:00
NovaRain 39388fd927 Rewrote the fix for player's base EMP DR as an engine-level fix (from Crafty) 2018-04-01 12:45:30 +08:00
NovaRain 72093079c5 Fixed a bug in NPC combat control that caused Gecko Skinning to appear in the perk selection window. 2018-03-28 21:29:22 +08:00
NovaRain 5141ca4ebb Fixed typos in hookscripts.txt. 2018-03-23 23:08:42 +08:00
NovaRain 78e9f08682 Fixed typos in sfall function notes.txt. 2018-03-23 22:01:22 +08:00
NovaRain ce779b4764 Fixed the long existing slotdat.ini function in ExtraSaveSlots.
Reduced duplication in ExtraSaveSlots code using MakeCalls.
Unified the indent style in ExtraSaveSlots.cpp.
2018-03-16 12:25:12 +08:00
NovaRain 1a108cade5 Implemented MakeCalls function to reduce code duplication.
Updated version number.
2018-03-16 11:32:23 +08:00
101 changed files with 5979 additions and 3223 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
[sfall]
SaveInCombat=Cannot save at this time
SaveInCombat=Cannot save at this time.
KarmaGain=You gained %d karma.
KarmaLoss=You lost %d karma.
HighlightFail1=You aren't carrying a motion sensor.
+6
View File
@@ -19,6 +19,7 @@ Robe=16777218
; Sulik
[1]
PID=16777313
WeaponAnims=1,3,4,6
Default=16777280
Leather=16777325
Power=16777324
@@ -29,6 +30,7 @@ Combat=16777322
; Vic
[2]
PID=16777278
WeaponAnims=1,5,7
Default=16777307
Jacket=16777329
Combat=16777330
@@ -39,6 +41,7 @@ Leather=16777333
; Cassidy
[3]
PID=16777305
WeaponAnims=4,5,7
Default=16777354
Leather=16777260
Power=16777328
@@ -49,6 +52,7 @@ Combat=16777326
; Myron
[4]
PID=16777376
WeaponAnims=1,5
Default=16777304
Leather=
Power=16777349
@@ -57,6 +61,7 @@ Combat=16777350
; Cat Jules
[5]
PID=16777734
WeaponAnims=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Default=16777353
Leather=16777347
Metal=16777348
@@ -66,6 +71,7 @@ Combat=16777226
; Kitsune
[6]
PID=16777724
WeaponAnims=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
Default=16777222
Leather=16777221
Metal=16777223
+16 -1
View File
@@ -1,6 +1,6 @@
[Highlighting]
; DX scandode of a key to press to highlight items on the ground
; DX scancode of a key to press to highlight items on the ground
; 42 - SHIFT key
Key=42
@@ -38,3 +38,18 @@ MotionScanner=0
;If you want to control only specific critters, uncomment the PIDList line and set a comma delimited list of PIDs
Mode=0
;PIDList=62,89,97,107,160,161
;Choose a notification box to display the name of the controlled critter above the interface bar
;Must be between 5 and (4 + the value of BoxBarCount in ddraw.ini)
;Set to 0 to disable
DisplayName=0
;Set the color of display name, available colors:
;0 - green
;1 - red
;2 - white
;3 - yellow
;4 - dark yellow
;5 - blue
;6 - purple
DisplayNameColor=0
+93 -15
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.0.3
;v4.1.1
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -17,7 +17,8 @@ NumSoundBuffers=0
;Set to 1 to allow attaching sound files to combat float messages
AllowSoundForFloats=1
;Set to 1 to automatically search for alternative formats when Fallout tries to play an acm
;Set to 1 to automatically search for alternative formats (mp3/wma/wav) when Fallout tries to play an acm
;Set to 2 to play alternative music files even if original acm files are not present in the music folder
;This does not effect the play_sfall_sound and stop_sfall_sound script functions
AllowDShowSound=0
@@ -70,6 +71,14 @@ GPUBlt=0
;Requires graphics mode 4 or 5, and GPUBlt set to 1
Use32BitHeadGraphics=0
;Set to 1 to automatically search for alternative avi video files when Fallout tries to play the game movies
;Requires graphics mode 4 or 5
AllowDShowMovies=0
;Fade effect time length percentage modifier
;Default is 100. Larger values make it slower, smaller values make it faster
FadeMultiplier=100
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Input]
;Set to 1 to enable the mouse scroll wheel to scroll through inventory, barter, and loot screens
@@ -107,7 +116,7 @@ SpeedModKey=-1
;A key to press to toggle the speed tweak on or off
;Specify 0 if you don't want a toggle key, or a DX scancode otherwise
SpeedToggleKey=0x00
SpeedToggleKey=0
;The keys corresponding to the 10 speed slots
;Set to 0 to disable a slot, otherwise specify the DX scancode of the key you want to use
@@ -128,9 +137,15 @@ SpeedKey9=0x00
WindowScrollKey=0
;A key to press to reload your currently equipped weapon
;Set to 0 if you don't want a reload key, or a DX scancode otherwise
ReloadWeaponKey=0
;A key to press to open a debug game editor
;A key to hold down to let you move/drop a whole stack of items at once without the 'Move Items' window
;Set to 0 if you don't want to use a modifier key, or a DX scancode otherwise
ItemFastMoveKey=0x1d
;A key to press to open a debug game editor (requires FalloutClient.exe from the modders pack)
;Set to 0 to disable, or a DX scancode otherwise
DebugEditorKey=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@@ -164,7 +179,7 @@ WorldMapEncounterRate=5
;The number of slots available in the locations list panel of the world map
;Set to 0 to leave unchanged. 17 is default.
;Setting this greater than 17 requires a replacement background frm, or you'll get glitched graphics
;Setting this greater than 17 requires a replacement background FRM, or you'll get glitched graphics
WorldMapSlots=0
;To start a new game somewhere other than artemple.map, uncomment the next line and set it to the map you want to load
@@ -184,11 +199,15 @@ WorldMapSlots=0
;PatchFile=patch%03d.dat
;MultiPatches=0
;Set to 1 to enable the modified data load order for the engine to find game data
;Set to 1 to use the modified data load order for the engine to find game data
;Original: patchXXX.dat > critter_patches > critter_dat > f2_res_patches > f2_res_dat > master_patches > master_dat
;Modified: master_patches > critter_patches > patchXXX.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
DataLoadOrderPatch=0
;Set to 1 to enable loading alternative dialog msg files from text/language/dialog_female/ for female PC
;Set to 2 to also load subtitle files from text/language/cuts_female/ for female PC
FemaleDialogMsgs=0
;To change the default and starting player models, uncomment the next four lines.
;The default models can also be changed ingame via script
;MaleStartModel=hmwarr
@@ -288,7 +307,7 @@ SaveInCombatFix=1
;Player's level is capped once the highest specified level is reached
;XPTable=50,100,200
;Set to 1 to enable additional weapon animations codes from o-t
;Set to 1 to enable additional weapon animation codes from o-t
;The 4 byte value at 0x39 of weapon protos may range from 0 to 15 rather than 0 to 10
;Since the letters 'n' and 'r' are in use for other animations, an animation code of 11 corrisponds to 's' and 15 to 't'
AdditionalWeaponAnims=1
@@ -339,12 +358,19 @@ SkipOpeningMovies=0
;Set to 0 to disable
NPCsTryToSpendExtraAP=0
;Set to 1 to fix NPCs not checking weapon perks properly when searching for the best weapon
;Note that enabling this option can significantly affect the weapon choice of some NPCs in combat
AIBestWeaponFix=0
;Allows the use of tiles over 80*36 in size. sfall will just split and resave them at startup
;Set to 1 to check all tiles on started (slow)
;Set to 2 if you provide a XLtiles.lst file in art/tiles/ containing a list of the tile ids that need checking
AllowLargeTiles=0
;Change the Skilldex cursor frm numbers
;Set to 1 to boost the maximum number of tile FRMs from 4096 to 16383
MoreTiles=0
;Change the Skilldex cursor FRM numbers
;Default is 293 for all skills
Lockpick=293
Steal=293
@@ -357,16 +383,22 @@ Repair=293
;Remove window position rounding
RemoveWindowRounding=0
;Set to 1 to add scroll buttons to the pip boy quest list, and remove the quests per area limit
;Set to 1 to add scroll buttons to the pipboy quest list, and remove the quests per area limit
;Set to 2 to use a different set of scroll buttons
UseScrollingQuestsList=1
;To change the location of quest list scroll buttons, uncomment the next two lines
;Defaults are 140 for the X-axis and 334 for the Y-axis
;QuestsScrollButtonsX=140
;QuestsScrollButtonsY=334
;Uncomment these lines to control the premade characters offered when starting a new game
;Multiple options should be separated by commas, and there must be the same number of entries in both lines
;PremadePaths=combat,diplomat,stealth
;PremadeFIDs=201,203,202
;Use this line to modify the list of cities and their associated global variables used for city reputations
;Syntax is 'city id : global id', with each city/global pair separated by a comma.
;Syntax is 'city id:global id', with each city/global pair separated by a comma.
;CityRepsList=0:47,2:48,1:49,4:50,5:51,3:52,8:53,6:54,7:55,13:56,10:57,11:59,14:61,17:63,19:64,18:65,25:66,9:294,20:308
;Set this to a valid path to save a copy of the console contents
@@ -375,11 +407,19 @@ UseScrollingQuestsList=1
;Set to 1 to add additional pages of save slots
ExtraSaveSlots=0
;To use more than one save slot for quick saving (F6 key) without picking a slot beforehand, set the next two lines
;AutoQuickSave sets how many save slots on a page you want to use for quick saving (valid range: 1..10)
;AutoQuickSavePage is the page number to use (valid range: 1..1000) if ExtraSaveSlots is enabled
;The quick saves will be rotated from the first slot on the page to the n-th slot
;Set to 0 to disable. AutoQuickSave will use page 1 if AutoQuickSavePage is disabled
AutoQuickSave=0
AutoQuickSavePage=0
;Set to 1 to speed up the HP/AC counter animations
;Set to 2 to update the HP/AC counters instantly
SpeedInterfaceCounterAnims=0
;These lines allow you to control the karma frm's displayed on the character screen
;These lines allow you to control the karma FRMs displayed on the character screen
;Number of KarmaPoints should be 1 less than number of KarmaFRMs
;KarmaFRMs=47,48,49
;KarmaPoints=-100,100
@@ -391,8 +431,11 @@ ScienceOnCritters=0
;Default is 166
SpeedInventoryPCRotation=166
;Uncomment to set the text colour of the extra 5 interface boxes
;The line must contain a 5 digits, each either a 0 for green or 1 for red
;Modify the number of the extra interface boxes available to modders. (Default is 5, and the maximum is 95)
BoxBarCount=5
;Uncomment to set the text colour of the extra interface boxes
;The line must contain the same number of digits as the value of BoxBarCount, each either a 0 for green or 1 for red
;BoxBarColours=00000
;Set to 1 to fix the bug that caused bonus HtH damage to not be applied correctly.
@@ -401,6 +444,9 @@ BonusHtHDamageFix=1
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
DisplayBonusDamage=0
;Set to 1 to display the range of the second attack mode in the inventory when you switch weapon modes in active item slots
DisplaySecondWeaponRange=1
;Modify the maximum number of animations allowed to run on a map. (Default is 32, and the maximum is 127)
AnimationsAtOnceLimit=120
@@ -433,10 +479,10 @@ BoostScriptDialogLimit=0
;These options modify the checks to see if a critter can carry an additional item, changing which items are counted towards the weight limit and adding an additional size check
;Set the mode to 0 to disable the size check, 1 to apply to the PC only, 2 to apply to the PC and party members, or 3 to apply to all critters
;Only the PC uses CritterInvSizeLimit. Other critters will use the extra unused stat (STAT_unused = 10)
;Only the PC uses CritterInvSizeLimit. Other critters will use the unused stat (STAT_unused = 10) or have the size limit of 100 if the stat is not set
;Add 4 to the mode to limit the weight check to used items only
CritterInvSizeLimitMode=0
CritterInvSizeLimit=200
CritterInvSizeLimit=100
;Some bit flags to alter behaviour of the motion sensor
;1 - Allow sensor use on automap when motion sensor is in pack rather than hands
@@ -466,6 +512,13 @@ QuickPocketsApCostReduction=2
;Set to 1 to allow objects seeing through other objects with their ShootThru flag set
ObjCanSeeObj_ShootThru_Fix=0
;Set to 1 to fix the broken obj_can_hear_obj script function
ObjCanHearObjFix=0
;Set to 1 to fix the mood argument of start_gdialog script function to be available for talking heads
;If the argument value is -1, the mood will be determined by the local variable 0 of the script (vanilla behavior)
StartGDialogFix=0
;Set to 1 to enable the balanced bullet distribution formula for burst attacks
ComputeSprayMod=0
@@ -523,6 +576,9 @@ StackEmptyWeapons=0
;If the amount of ammo boxes in the inventory is less than or equal to the reserve, only one box will be used
ReloadReserve=-1
;Set to 1 to change the counter in the 'Move Items' window to start at the maximum number of items
ItemCounterDefaultMax=0
;Allows 9 options (lines of text) to be displayed correctly in a dialog window
DialogOptions9Lines=1
@@ -536,18 +592,37 @@ DontTurnOffSneakIfYouRun=0
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 0 if another mod you're using has custom vehicles
CarChargingFix=1
;Set to 1 to skip weapon equip/unequip animations when performing various actions
InstantWeaponEquip=0
;To add additional game msg files, uncomment the next line and set a comma delimited list of filenames without .msg extension
;By default, the files will have consecutive numbers assigned beginning with 0
;You can use the syntax 'filename:number' to manually assign numbers to specific msg files, with each pair separated by a comma
;If a file after the specified pair does not have a number assigned, it will have the next consecutive number from the last pair
;You need to use the message_str_game script function to get messages from the files
;ExtraGameMsgFileList=
;Set to 1 to display numbered dialogue options
NumbersInDialogue=0
;Set to 1 to use Fallout's normal text font instead of DOS-like font on the world map
WorldMapFontPatch=0
;Set to 1 to keep the selected attack mode when moving the weapon between active item slots
KeepWeaponSelectMode=1
;Set to 1 to display full item description for weapon/ammo in barter screen
FullItemDescInBarter=0
;Set to 1 to display experience points with the bonus from Swift Learner perk when gained from non-scripted situations
DisplaySwiftLearnerExp=1
;Set to 1 to allow windows created by vanilla script function to be placed on top of inventory/loot/automap interfaces
InterfaceDontMoveOnTop=0
;Set to 1 to display sfall built-in credits at the bottom of credits.txt contents instead of at the top
CreditsAtBottom=0
@@ -601,6 +676,9 @@ DontDeleteProtos=0
;Set to 1 to give scripts direct access to Fallout's address space, and to make arbitrary calls into Fallout's code
AllowUnsafeScripting=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
;These options control what output is saved in the debug log (sfall-log.txt)
;Prints messages duing sfall initialization
@@ -0,0 +1,44 @@
/*
Example implementation of the algorithm of how the game engine sets the explosive timer.
*/
#include "..\..\scripting_docs\headers\sfall.h"
#include "..\..\scripting_docs\headers\define_lite.h"
// from CONDTION.H
#define ROLL_CRITICAL_FAILURE (0)
#define ROLL_FAILURE (1)
#define ROLL_SUCCESS (2)
#define ROLL_CRITICAL_SUCCESS (3)
procedure start;
procedure start begin
if game_loaded then begin
register_hook(HOOK_EXPLOSIVETIMER);
end else begin
variable
time := get_sfall_arg,
result := ROLL_CRITICAL_FAILURE;
if has_trait(TRAIT_PERK, dude_obj, PERK_demolition_expert_perk) then
result := ROLL_SUCCESS;
else begin
result := roll_vs_skill(dude_obj, SKILL_TRAPS, 0);
end
if (result) then begin
if (result == ROLL_FAILURE) then
time /= 2;
else begin // success or critical success
result := ROLL_SUCCESS;
end
end else begin // critical failure
time := 0;
result := ROLL_FAILURE;
end
set_sfall_return(time);
set_sfall_return(result); // failure/success
end
end
@@ -0,0 +1,60 @@
/*
Example implementation of the algorithm of how the game engine checks if one critter sees another critter.
NOTE: the AllowUnsafeScripting option must be enabled.
*/
#include "..\headers\define.h"
#include "..\headers\command.h"
#include "..\headers\sfall\sfall.h"
#include "..\headers\sfall\define_extra.h"
#define can_see_(source, target) call_offset_r2(0x412BEC, source, target)
#define obj_dist_(target, source) call_offset_r2(0x48BBD4, target, source)
procedure start;
procedure start begin
if game_loaded then begin
register_hook(HOOK_WITHINPERCEPTION);
end else begin
variable
source := get_sfall_arg,
target := get_sfall_arg,
original := get_sfall_arg,
hookType := get_sfall_arg, /* new arg */
result := 0,
distance;
if target then begin
distance := get_critter_stat(source, STAT_pe);
if can_see_(source, target) then begin
distance *= 5;
if (get_flags(target) bwand FLAG_TRANSGLASS) then distance /= 2;
end else if combat_is_initialized then begin
distance *= 2;
end
if (target == dude_obj) then begin
if sneak_success then begin
distance /= 4;
if has_skill(target, SKILL_SNEAK) > 120 then distance -= 1;
end else if dude_is_sneaking then begin
distance := distance * 2 / 3;
end
end
if obj_dist_(target, source) <= distance then result := 1;
// example
if (result) then begin
display_msg("hs_withinperception: " + obj_name(source) + " sees " + obj_name(target) + " [original: " + original + " script: " + result + "]");
end else begin
display_msg("hs_withinperception: " + obj_name(source) + " does not see " + obj_name(target) + " [original: " + original + " script: " + result + "]");
end
end
//set_sfall_return(result);
end
end
Binary file not shown.
+11
View File
@@ -27,6 +27,7 @@
variable configSection := "Highlighting";
variable highlightKey;
variable isHighlight;
variable alsoContainer;
variable alsoCorpse;
variable checkLOS;
@@ -68,6 +69,7 @@ procedure KeyPressHandler begin
if scanCode == highlightKey then begin
if pressed then begin
isHighlight := true;
if motionScanner then begin
scanner := obj_carrying_pid_obj(dude_obj, PID_MOTION_SENSOR);
if scanner then begin
@@ -90,11 +92,19 @@ procedure KeyPressHandler begin
call ToggleHighlight(true);
end
end else begin
isHighlight := false;
call ToggleHighlight(false);
end
end
end
procedure CombatTurnHandler begin
if isHighlight then begin
isHighlight := false;
call ToggleHighlight(false);
end
end
procedure start begin
if game_loaded and (sfall_ver_major >= 4) then begin
call InitConfigs;
@@ -111,5 +121,6 @@ procedure start begin
highlightFailMsg2 := Translate("HighlightFail2", "Your motion sensor is out of charge.");
register_hook_proc(HOOK_KEYPRESS, KeyPressHandler);
register_hook_proc(HOOK_COMBATTURN, CombatTurnHandler);
end
end
Binary file not shown.
+44 -4
View File
@@ -4,18 +4,19 @@
Used to replace the scripted part of B-Team mod.
Appropriate graphics are required for this mod to work.
Can be adopted to any mod by adjusting armor PIDs, NPC PIDs and NPC FIDs in INI file.
Can be adopted to any mod by adjusting armor PIDs, allowed weapon anim codes, NPC PIDs and NPC FIDs in INI file.
NOTE: this script requires compiler from sfall modderspack with -s option
(short circuit evaluation)
version 1.0
version 1.1
*/
#include "main.h"
#define IS_ARMOR(item) (obj_type(item) == OBJ_TYPE_ITEM and obj_item_subtype(item) == item_type_armor)
#define IS_WEAPON(item) (obj_type(item) == OBJ_TYPE_ITEM and obj_item_subtype(item) == item_type_weapon)
variable
modIni := "npcarmor.ini",
@@ -41,9 +42,28 @@ procedure check_armor_change(variable critter, variable item, variable isWorn) b
return -1;
end
// for NPCs when they change armor themselves
procedure check_weapon_change(variable critter, variable item, variable isWield) begin
variable npc, newWeaponAnim, weaponAnimList, i;
if (npcMap[obj_pid(critter)]) then begin
npc := npcMap[obj_pid(critter)];
if isWield then begin
newWeaponAnim := get_proto_data(obj_pid(item), PROTO_WP_ANIM);
weaponAnimList := string_split(npc["WeaponAnims"], ",");
if newWeaponAnim then begin
foreach (i in weaponAnimList) begin
if (newWeaponAnim == atoi(i)) then return -1;
end
end else begin // anim code 0 - none/unarmed
return -1;
end
end
end
return 0;
end
// for NPCs when they change armor/weapon themselves
procedure invenwield_handler begin
variable critter, item, fid, slot, isWorn;
variable critter, item, fid, slot, isWorn, canWield;
critter := get_sfall_arg;
item := get_sfall_arg;
slot := get_sfall_arg;
@@ -55,6 +75,11 @@ procedure invenwield_handler begin
art_change_fid_num(critter, fid);
end
end
if (critter and item and (slot == INVEN_TYPE_RIGHT_HAND or slot == INVEN_TYPE_LEFT_HAND)) then begin
canWield := check_weapon_change(critter, item, isWorn);
set_sfall_return(canWield);
end
end
// when changing armor from inventory while controlling other NPCs
@@ -69,12 +94,26 @@ procedure adjustfid_handler begin
end
end
// when changing weapon from inventory while controlling other NPCs
procedure inventorymove_handler begin
variable slot, item, canWield;
slot := get_sfall_arg;
item := get_sfall_arg;
if (dude_obj != real_dude_obj) then begin
if (IS_WEAPON(item) and (slot == INVEN_TYPE_RIGHT_HAND or slot == INVEN_TYPE_LEFT_HAND)) then begin
canWield := check_weapon_change(dude_obj, item, item != 0);
set_sfall_return(canWield);
end
end
end
procedure start begin
variable sect, sects, armorTypes, armorType, npc, pid, pids, i;
if game_loaded and (sfall_ver_major >= 4) then begin
register_hook_proc(HOOK_INVENWIELD, invenwield_handler);
register_hook_proc(HOOK_ADJUSTFID, adjustfid_handler);
register_hook_proc(HOOK_INVENTORYMOVE, inventorymove_handler);
defaultFids := get_ini_section(modIni, "Default");
fix_array(defaultFids);
@@ -97,6 +136,7 @@ procedure start begin
sect := get_ini_section(modIni, ""+i);
while (sect.PID) do begin
npc := create_array_map;
npc["WeaponAnims"] := sect["WeaponAnims"];
npc["Default"] := atoi(sect["Default"]);
foreach (armorType: pids in armorTypes) begin
if (sect[armorType]) then begin
Binary file not shown.
+28 -3
View File
@@ -12,12 +12,16 @@
*/
#include "..\headers\define.h"
#include "..\headers\command.h"
#include "main.h"
variable
configSection := "CombatControl",
controlMode,
pidList,
displayName,
displayNameColor,
inControl := false,
hasGeckoSkinning := false;
@@ -33,24 +37,45 @@ procedure combatturn_handler begin
if (status == 1
and (len_array(pidList) == 0 or scan_array(pidList, pid bwand 0xFFFFFF) != -1)
and (controlMode == 1 or party_member_obj(pid))) then begin
set_dude_obj(critter);
if hasGeckoSkinning then critter_add_trait(critter, TRAIT_PERK, PERK_gecko_skinning_perk, 1);
end else begin
if not(critter == real_dude_obj) then begin
set_dude_obj(critter);
if hasGeckoSkinning then critter_add_trait(critter, TRAIT_PERK, PERK_gecko_skinning_perk, 1);
inControl := true;
end
if inControl then begin
// center the screen on the controlled critter and remove roof tiles
move_to(dude_obj, dude_tile, dude_elevation);
if displayName then begin
set_iface_tag_text(displayName, obj_name(critter), displayNameColor);
show_iface_tag(displayName);
end
end
end else if inControl then begin
set_dude_obj(real_dude_obj);
if displayName then hide_iface_tag(displayName);
end
end
procedure gamemodechange_handler begin
if not(get_game_mode BWAND COMBAT) then inControl := false;
end
procedure start begin
if game_loaded and (sfall_ver_major >= 4) then begin
set_perk_ranks(PERK_gecko_skinning_perk, 1);
set_perk_level(PERK_gecko_skinning_perk, 999); // prevent it from appearing in the perk selection window
controlMode := GetConfig("CombatControl", "Mode", 0);
displayName := GetConfig("CombatControl", "DisplayName", 0);
displayNameColor := GetConfig("CombatControl", "DisplayNameColor", 0);
if (controlMode > 2) then controlMode := 0;
if (displayName < 5 or displayName > 9) then displayName := 0;
if (controlMode > 0) then begin
pidList := GetConfigListInt("CombatControl", "PIDList");
fix_array(pidList);
if has_trait(TRAIT_PERK, dude_obj, PERK_gecko_skinning_perk) then hasGeckoSkinning := true;
register_hook_proc(HOOK_COMBATTURN, combatturn_handler);
register_hook_proc(HOOK_GAMEMODECHANGE, gamemodechange_handler);
end
end
end
+15 -5
View File
@@ -3,13 +3,23 @@ This folder contains documentation about sfall scripting extensions.
headers\ - folder contains sfall headers that you should #include in your scripts
sfall.h - main sfall header, always include it
define_extra.h - some additional preprocessor constants for vanilla engine stuff (proto offsets, etc.)
dik.h - DX scancodes constants for use with key_pressed function and HOOK_KEYPRESS
define_lite.h - a lite version of official define.h
dik.h - DX scancodes constants for use with key_pressed function and HOOK_KEYPRESS
lib.arrays.h - procedures that will help you use arrays in their full:
- use them as stacks, sets
- easily compare, copy, slice, cut, add arrays
- display array contents (for debugging)
- save/load two-dimensional arrays to savegame in one command (e.g. arrays of objects)
lib.inven.h - fallout items manipulation functions
lib.math.h - a few simple functions for calculations
lib.strings.h - search in strings, join, repeat, etc.
lib.misc.h - misc stuff
sfall function notes.txt - incomplete reference for new opcodes
sfall opcode list.txt - list of all sfall opcodes (w/o descriptions)
hookscripts.txt - detailed manual for using hook scripts to modify engine behavior
arrays.txt - manual for sfall arrays
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in ScriptEditor\docs\sslc_readme.txt,
If you are/will be using sfall Script Editor, don't forget to check out new compiler documentation in ScriptEditor\docs\sslc_readme.txt,
there are numerious new syntax features and extensions to SSL (Star-Trek Scripting language).
+2 -3
View File
@@ -26,15 +26,14 @@ end
return intp;
end*/
procedure ceil(variable val) begin
/*procedure ceil(variable val) begin
variable intp;
intp := floor(val);
if (abs(val-intp) > 0.0) then begin
intp++;
end
return intp;
end
end*/
procedure cap_number(variable num, variable min, variable max) begin
if (num > max) then num := max;
+31
View File
@@ -18,6 +18,7 @@
#define INTFACELOOT (0x10000)
#define BARTER (0x20000)
#define HEROWIN (0x40000)
#define DIALOGVIEW (0x80000)
//Valid arguments to register_hook
#define HOOK_TOHIT (0)
@@ -49,6 +50,11 @@
#define HOOK_ADJUSTFID (26)
#define HOOK_COMBATTURN (27)
#define HOOK_CARTRAVEL (28)
#define HOOK_SETGLOBALVAR (29)
#define HOOK_RESTTIMER (30)
#define HOOK_GAMEMODECHANGE (31)
#define HOOK_USEANIMOBJ (32)
#define HOOK_EXPLOSIVETIMER (33)
//Valid arguments to list_begin
#define LIST_CRITTERS (0)
@@ -136,6 +142,7 @@
#define set_attack_explosion_radius(x) metarule2_explosions(3, x, 0)
#define set_attack_is_explosion(x) metarule2_explosions(4, x, 0)
#define set_attack_is_explosion_fire set_attack_is_explosion(DMG_fire)
#define set_explosion_radius(grenade, rocket) metarule2_explosions(5, grenade, rocket)
#define GAME_MSG_COMBAT (0)
@@ -178,6 +185,11 @@
#define CURSOR_COMMAND (1)
#define CURSOR_TARGETING (2)
//Valid flags for set_rest_mode
#define RESTMODE_DISABLED (1) // disable resting on all maps
#define RESTMODE_STRICT (2) // disable resting on maps with "can_rest_here=No" in Maps.txt, even if there are no other critters
#define RESTMODE_NO_HEALING (4) // disable healing during resting
#define mstr_combat(x) (message_str_game(GAME_MSG_COMBAT, x))
#define mstr_ai(x) (message_str_game(GAME_MSG_AI, x))
#define mstr_scrname(x) (message_str_game(GAME_MSG_SCRNAME, x))
@@ -209,26 +221,45 @@
#define party_member_list_all party_member_list(1)
#define attack_is_aimed sfall_func0("attack_is_aimed")
#define car_gas_amount sfall_func0("car_gas_amount")
#define create_win(winName, x, y, w, h) sfall_func5("create_win", winName, x, y, w, h)
#define create_win_flag(winName, x, y, w, h, flag) sfall_func6("create_win", winName, x, y, w, h, flag)
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
#define dialog_message(text) sfall_func1("dialog_message", text)
#define display_stats sfall_func0("display_stats")
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
#define floor2(value) sfall_func1("floor2", value)
#define get_can_rest_on_map(map, elev) sfall_func2("get_can_rest_on_map", map, elev)
#define get_current_inven_size(obj) sfall_func1("get_current_inven_size", obj)
#define get_cursor_mode sfall_func0("get_cursor_mode")
#define get_flags(obj) sfall_func1("get_flags", obj)
#define get_ini_section(file, sect) sfall_func2("get_ini_section", file, sect)
#define get_ini_sections(file) sfall_func1("get_ini_sections", file)
#define get_map_enter_position sfall_func0("get_map_enter_position")
#define get_outline(obj) sfall_func1("get_outline", obj)
#define get_string_pointer(text) sfall_func1("get_string_pointer", text)
#define intface_hide sfall_func0("intface_hide")
#define intface_is_hidden sfall_func0("intface_is_hidden")
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define inventory_redraw(invSide) sfall_func1("inventory_redraw", invSide)
#define item_weight(obj) sfall_func1("item_weight", obj)
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
#define outlined_object sfall_func0("outlined_object")
#define real_dude_obj sfall_func0("real_dude_obj")
#define set_can_rest_on_map(map, elev, value) sfall_func3("set_can_rest_on_map", map, elev, value)
#define set_car_intface_art(artIndex) sfall_func1("set_car_intface_art", artIndex)
#define set_cursor_mode(mode) sfall_func1("set_cursor_mode", mode)
#define set_dude_obj(critter) sfall_func1("set_dude_obj", critter)
#define set_flags(obj, flags) sfall_func2("set_flags", obj, flags)
#define set_iface_tag_text(tag, text, color) sfall_func3("set_iface_tag_text", tag, text, color)
#define set_ini_setting(setting, value) sfall_func2("set_ini_setting", setting, value)
#define set_map_enter_position(tile, elev, rot) sfall_func3("set_map_enter_position", tile, elev, rot)
#define set_outline(obj, color) sfall_func2("set_outline", obj, color)
#define set_rest_heal_time(time) sfall_func1("set_rest_heal_time", time)
#define set_rest_mode(mode) sfall_func1("set_rest_mode", mode)
#define set_unjam_locks_time(time) sfall_func1("set_unjam_locks_time", time)
#define spatial_radius(obj) sfall_func1("spatial_radius", obj)
#define tile_refresh_display sfall_func0("tile_refresh_display")
#define unjam_lock(obj) sfall_func1("unjam_lock", obj)
+102 -32
View File
@@ -30,7 +30,7 @@ end
There are script functions available, specific to hook scripts:
> int init_hook()
The hook script equivilent of game_loaded; it returns 2 when the script is first loaded, 1 when the player reloads and 0 otherwise.
The hook script equivalent of game_loaded; it returns 2 when the script is first loaded, 1 when the player reloads and 0 otherwise.
> 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.
@@ -42,10 +42,10 @@ Returns all hook arguments as a new temp array.
Used to return the new values from the script. Each time it's called it sets the next value, or if you've already set all return values it does nothing.
> void set_sfall_arg(int argnum, int value)
Changes argument value. The argument number (argnum) is 0-indexed. This is usefull if you have several hook scripts attached to one hook point (see below).
Changes argument value. The argument number (argnum) is 0-indexed. This is useful if you have several hook scripts attached to one hook point (see below).
> void register_hook(int hooktype)
Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, "start" proc will be execuded in a current global script. You can use all above functions like normal.
Used from a normal global script if you want to run it at the same point a full hook script would normally run. In case of this function, "start" proc will be 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!).
@@ -77,7 +77,7 @@ The defines to use for the hooktype are in sfall.h.
HOOK_TOHIT (hs_tohit.int)
Runs when fallout is calculating the chances of an attack striking a target
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 arg1 - The unmodified hit chance
@@ -94,7 +94,7 @@ int ret1 - the new hit chance
HOOK_AFTERHITROLL (hs_afterhitroll.int)
Runs after fallout has decided if an attack will hit or miss
Runs after Fallout has decided if an attack will hit or miss
int arg1 - If the attack will hit. (0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit)
critter arg2 - The attacker
@@ -110,22 +110,22 @@ critter ret3 - Override the target of the attack
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 players hands at the time the wrong ap cost will be shown. It will be fixed the next time the interface is redrawn.
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 players 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 arg1 - The critter performing the action
int arg2 - Attack Type (see ATKTYPE_* constants)
int arg3 - Is aimed attack (1 or 0)
int arg4 - The normal ap cost
int arg4 - The normal AP cost
int ret1 - The new ap cost
int ret1 - The new AP cost
-------------------------------------------
HOOK_DEATHANIM1 (hs_deathanim1.int)
Runs before fallout tries to calculate the death animation. Lets you switch out which weapon fallout sees
Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees
int arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
critter arg2 - The attacker
@@ -138,14 +138,14 @@ int ret1 - The pid of an object to override the attacking weapon with
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 hs_deathanim1, but performs no validation.
Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than hs_deathanim1, but performs no validation.
When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and target will point to an object with obj_art_fid == 0x20001F5.
item arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
critter arg2 - The attacker
critter arg3 - The target
int arg4 - The amount of damage
int arg5 - The death anim id calculated by fallout
int arg5 - The death anim id calculated by Fallout
int ret1 - The death anim id to override with
@@ -166,7 +166,7 @@ int arg5 - The special effect flags for the target
int arg6 - The special effect flags for the attacker
int arg7 - The weapon used in the attack
int arg8 - The bodypart that was struck
int arg9 - Damage Multipiler (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2, but with Silent Death perk and the corresponding attack conditions, it's 4; for critical hits, the value is taken from the critical table)
int arg9 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2, but with Silent Death perk and the corresponding attack conditions, it's 4; for critical hits, the value is taken from the critical table)
int arg10 - Number of bullets actually hit the target (1 for melee attacks)
int arg11 - The amount of knockback to the target
int arg12 - Attack Type (see ATKTYPE_* constants)
@@ -181,7 +181,7 @@ int ret5 - The amount of knockback to the target
HOOK_ONDEATH (hs_ondeath.int)
Runs immediately after a critter dies for any reason. No return values; this is just a convinence 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.
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 arg1 - The critter that just died
@@ -189,7 +189,7 @@ Critter arg1 - The critter that just died
HOOK_FINDTARGET (hs_findtarget.int)
Runs when the ai is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the ai caps of the attacker. This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way. Use sfall_return to give the 4 targets, in order of preference. All 4 must be given if you want to override normal sorting; if you want to specify less than 4 targets fill in the extra spaces with 0's. If you do not give 4 targets, the npcs normal sorting mechanism will be used.
Runs when the ai is trying to pick a target in combat. Fallout first chooses a list of 4 likely suspects, then normally sorts them in order of weakness/distance/etc depending on the ai caps of the attacker. This hook replaces that sorting function, allowing you to sort the targets in some arbitrary way. Use sfall_return to give the 4 targets, in order of preference. All 4 must be given if you want to override normal sorting; if you want to specify less than 4 targets fill in the extra spaces with 0's. If you do not give 4 targets, the NPCs normal sorting mechanism will be used.
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.
@@ -213,7 +213,7 @@ Runs when:
2) 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.
3) player or AI uses any drug
This is fired before the object is used, and the relevent use_obj_on script procedures are run. You can disable default item behavior.
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 arg1 - The target
@@ -230,7 +230,7 @@ Runs when:
1) a critter uses an object from inventory which have "Use" action flag set or it's an active flare or dynamite.
2) player uses an object from main interface
This is fired before the object is used, and the relevent use_obj script procedures are run. You can disable default item behavior.
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 arg1 - The user
@@ -265,19 +265,20 @@ 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 ret1 - the modified value of all of the goods
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
-------------------------------------------
HOOK_MOVECOST (hs_movecost.int)
Runs when calculating the ap cost of movement
Runs when calculating the AP cost of movement
Critter arg1 - the critter doing the moving
int arg2 - the number of hexes being moved
int arg3 - the original ap cost
int arg3 - the original AP cost
int ret1 - the new ap cost
int ret1 - the new AP cost
-------------------------------------------
@@ -305,14 +306,14 @@ object* ret1 - 0 if the hex doesn't block, or any sort of object pointer if it d
HOOK_ITEMDAMAGE (hs_itemdamage.int)
Runs when retriving the damage rating of the players used weapon. (Which may be their fists.)
Runs when retrieving the damage rating of the players used weapon. (Which may be their fists.)
int arg1 - The default min damage
int arg2 - The default max damage
Item arg3 - The weapon used. (0 if unarmed)
Critter arg4 - The critter doing the attacking
int arg5 - The type of attack
int arg6 - non zero if this is an attack using a melee weapon
int arg6 - non-zero if this is an attack using a melee weapon
int ret1 - Either the damage to be used, if ret2 isn't given, or the new minimum damage if it is
int ret2 - The new maximum damage
@@ -323,12 +324,12 @@ 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, weapon will shoot when at least 1 round is left, regardless of ammo cost calculations.
To add proper check for ammo before shooting and proper calculation of number of burst rounds, set Misc.CheckWeaponAmmoCost=1 in ddraw.ini
To add proper check for ammo before shooting and proper calculation of number of burst rounds (hook type 1 and 2 in arg4), set Misc.CheckWeaponAmmoCost=1 in ddraw.ini
Item arg1 - weapon
int arg2 - Number of bullets in burst (1 for single shots)
int arg3 - Ammo cost calculated by original function (this is basically 2 for Super Cattle Prod and Mega Power Fist)
int arg4 - Type of hook (0 - when substracting ammo after attack, 1 - when checking for "out of ammo" before attack)
int arg4 - Type of hook (0 - when subtracting ammo after single shot attack, 1 - when checking for "out of ammo" before attack, 2 - when calculating number of burst rounds, 3 - when subtracting ammo after burst attack)
int ret1 - new ammo cost value (set to 0 for unlimited ammo)
@@ -393,13 +394,14 @@ HOOK_WITHINPERCEPTION (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 (eg. 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.
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 arg1 - Watcher object
Obj arg2 - Target objet
Obj arg2 - Target object
int arg3 - Result of vanilla function: 1 - within perception range, 0 - otherwise
int arg4 - Type of hook: 1 - when being called from obj_can_see_obj script function, 2 when being called from obj_can_hear_obj script function (need to set ObjCanHearObjFix=1 in ddraw.ini), 0 for all other cases
int ret1 - overrides the returned result of the function: 0 - not in range (can't see), 1 - in range (will see if not blocked), 2 - forced detection (will see regardless, only used in obj_can_see_obj scripting function which is called by every critter in the game)
@@ -409,16 +411,16 @@ 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 inapropriate slots (like gun in armor slot)
- force moving items to inappropriate slots (like gun in armor slot)
- block picking up items
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 arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo)
int arg1 - Target slot (0 - main backpack, 1 - left hand, 2 - right hand, 3 - armor slot, 4 - weapon, when reloading it by dropping ammo, 5 - container, like bag/backpack, 6 - dropping on the ground)
Item arg2 - Item being moved
Item arg3 - Item being replaced or weapon being reloaded (can be 0)
Item arg3 - Item being replaced, weapon being reloaded, or container being filled (can be 0)
int ret1 - Override setting (-1 - use engine handler, any other value - prevent relocation of item/reloading weapon)
@@ -432,7 +434,7 @@ NOTE: when replacing a previously wielded armor or weapon, the unwielding hook w
If you need to rely on this, try checking if armor/weapon already equipped when wielding hook is executed.
Critter arg1 - critter
Obj arg2 - item being wielded or unwielded (weapon/armor), may be 0 when unwielding
Obj arg2 - item being wielded or unwielded (weapon/armor)
int arg3 - slot (INVEN_TYPE_*)
int arg4 - 1 when wielding, 0 when unwielding
@@ -467,10 +469,78 @@ int ret1 - pass 1 at the start of turn to skip the turn, pass -1 at the end
HOOK_CARTRAVEL (hs_cartravel.int)
Runs continously during worldmap travel on car.
Runs continuously during worldmap travel on car.
int arg1 - vanilla car speed (between 3 and 8 "steps")
int arg2 - vanilla fuel consumption (100 and below)
int ret1 - car speed override (pass -1 if you just want to override fuel consumption)
int ret2 - fuel consumption override
-------------------------------------------
HOOK_SETGLOBALVAR (hs_setglobalvar.int)
Runs when setting the value of a global variable.
int arg1 - the index number of the global variable being set
int arg2 - the set value of the global variable
int ret1 - overrides the value of the global variable
-------------------------------------------
HOOK_RESTTIMER (hs_resttimer.int)
Runs continuously while the player is resting (using pipboy alarm clock).
int arg1 - the game time in ticks
int arg2 - event type: 1 - when the resting ends normally, -1 - when pressing ESC to cancel the timer, 0 - otherwise
int arg3 - the hour part of the length of resting time
int arg4 - the minute part of the length of resting time
int ret1 - pass 1 to interrupt the resting, pass 0 to continue the rest if it was interrupted by pressing ESC key
-------------------------------------------
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 arg1 - event type: 1 - when the player exits the game, 0 - otherwise
-------------------------------------------
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 arg1 - the critter that uses an object (usually dude_obj)
Obj arg2 - the object being used
int arg3 - the animation code being used (see ANIM_* in Animcomd.h)
int ret1 - overrides the animation code (pass -1 if you want to skip the animation)
-------------------------------------------
HOOK_EXPLOSIVETIMER (hs_explosivetimer.int)
Runs after setting the explosive timer. You can override the result.
int arg1 - the time in ticks set in the timer
Obj arg2 - the explosive object
int arg3 - the result of engine calculation of whether the timer was set successfully: 1 - failure, 2 - success (similar to ROLL_* in Condtion.h)
int ret1 - overrides the time of the timer (maximum 18000 ticks)
int ret2 - overrides the result of engine calculation: 0/1 - failure, 2/3 - success (similar to ROLL_*), any other value - use engine handler
-------------------------------------------
HOOK_DESCRIPTIONOBJ (hs_descriptionobj.int)
Runs when using the examine action icon to display item description. You can override the description of the item.
An example usage would be to add an additional description to the item based on player's stats/skills.
Obj arg1 - the item
int ret1 - a pointer to the new text received by using "get_string_pointer" function
+118 -31
View File
@@ -2,7 +2,7 @@
---------- 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'. This procedure will be executed once when the player loads a saved game or starts a new game. If you wish the script to be executed repeatedly, call set_global_script_repeat on this first run 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.)
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. 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. Using mode 1 requires the input wrapper to be enabled. Use available_global_script_types to check what is available.
@@ -14,9 +14,9 @@ Global scripts have multiple modes, which can be set using the set_global_script
Both set_global_script_repeat and set_global_script_type only have an effect on the script they were called from. Every global script needs its own game_loaded block to correctly set up the script type and repeat rate. set_global_script_repeat will have no effect if called on a non-global script.
The read_xxx functions take a memory address as the parameter and can read arbitrary pieces of fallouts address space. The write functions are equivilent except that they write to arbitrary memory addresses. The call_offset_xx functions 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
The read_xxx functions take a memory address as the parameter and can read arbitrary pieces of Fallout's address space. The write functions are equivalent except that they write to arbitrary memory addresses. The call_offset_xx functions 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
The get/set_pc_base/extra_stat functions are equivelent to calling get/set_critter_base/extra_stat with dude_obj as the critter pointer. None of these stat functions take perks into account, and neither do they do range clamping to make sure the stats are valid. Use the normal get_critter_stat function to get a correctly perk adjusted and range clamped value for a stat.
The get/set_pc_base/extra_stat functions are equivalent to calling get/set_critter_base/extra_stat with dude_obj as the critter pointer. None of these stat functions take perks into account, and neither do they do range clamping to make sure the stats are valid. Use the normal get_critter_stat function to get a correctly perk adjusted and range clamped value for a stat.
The set_stat_max/min functions can be used to set the valid ranges on on stats. Values returned by get_current_stat will be clamped to this range. The set_pc_ function only effect the player, the set_npc_ functions only effect other critters, and the set_ functions effect both.
@@ -26,7 +26,7 @@ The graphics functions are only available if the user is using graphics mode 4 o
load_shader takes a path relative to the data\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.
get_shader_version gives you the higest shader version supported by the players graphics cards. Possible return values are 11, 12, 13, 14, 20, 21 and 30.
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.
set_shader_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.
@@ -38,41 +38,41 @@ set_pipboy_available will only accept 0 or 1 as an argument. Using any other val
get/set_critter_current_ap functions should only be used during the target critters turn while in combat. Calling them 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.) Using set_critter_current_ap on the player will not automatically redraw the screen, so the ap bar will be incorrect until the player next clicks.
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 weilded 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.
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.
The get/set_sfall_global functions require an 8 character 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. These 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 get/set_sfall_global functions require an 8 character 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. These 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.
set_pickpocket_max and set_hit_chance_max effect all critters rather than just the player. set_skill_max can't be used to increase the skill cap above 300. set_perk_level_mod sets a modifier between +25 and -25 that is added/subtracted from the players level for the purposes of deciding which perks can be chosen.
set_fake_trait and set_fake_perk can be 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 corrisponds to an entry in skilldex.lst. The name is limited to 64 characters and the description to 1024 characters by sfall, but internal fallout limits may be lower.
set_fake_trait and set_fake_perk can be 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 64 characters and the description to 1024 characters by sfall, but internal Fallout limits may be lower.
has_fake_trait and has_fake_perk return the number of levels the player has of the perks/traits with the given name.
perk_add_mode, set_selectable_perk, set_perkbox_title, hide_real_perks, show_real_perks and clear_selectable_perks control the behaviour of the select a perk box. set_selectable_perk can be used to add additional items by setting the 'active' parameter to 1, and to remove them again by setting it to 0. set_perkbox_title can be used to change the title of the box, or by using "" it will be set back to the default. hide and show_real_perks can be used to prevent the dialog from displaying any of the original 119 perks. perk_add_mode 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 players traits, if bit 2 is set it is added to the players perks, and if bit 3 is set it is removed from the list of selectable perks. The default is 0x2. clear_selectable_perks restores the dialog to it's default state.
show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 3 for LEVEL and 4 for ADDICT, or the range from 5 to 9 for custom boxes. Remember to add your messages to intrface.msg and setup the font colours in ddraw.ini if you're going to use custom boxes.
show_iface_tag, hide_iface_tag and is_iface_tag_active relate to the boxes that appear above the interface such as SNEAK and LEVEL. You can use 3 for LEVEL and 4 for ADDICT, or the range from 5 to (4 + the value of BoxBarCount in ddraw.ini) for custom boxes. Remember to add your messages to intrface.msg and set up the font colours in ddraw.ini if you're going to use custom boxes. Starting from sfall 4.1, is_iface_tag_active can also be used to check 0 for SNEAK, 1 for POISONED, and 2 for RADIATED.
get/set_bodypart_hit_modifier alter 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.
(re)set/get_critical_table are used for modifing the critical table. For details see 'http://falloutmods.wikia.com/wiki/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. These function also require OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
(re)set/get_critical_table are used for modifying the critical table. For details see 'http://falloutmods.wikia.com/wiki/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. These function also require OverrideCriticalTable to be set to 1 in ddraw.ini. (Disabled by default, because it noticably increases loading times.)
get/set_unspent_ap_bonus alter the AC bonus you recieve 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/set_unspent_ap_perk_bonus are similar, but effect the extra AC granted by the h2h evade perk. (The default value of this is also 4, equivilent to doubling the original bonus.)
get/set_unspent_ap_bonus alter 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/set_unspent_ap_perk_bonus are similar, but effect the extra AC granted by the h2h evade perk. (The default value of this is also 4, equivalent to doubling the original bonus.)
nb_* functions are reserved for the brotherhood tactical training mod, and should be avoided.
The fs_* functions are used to manipulate a virtual file system. Files saved here should have paths relative to the data folder, and use backslashes as the directory seperator. They will take precedence over files stored in the normal data folder. They will also be saved into save games, so be avoid creating large files. Using fs_copy followed by fs_read_xxx, you can read the contents of existing files.
The fs_* functions are used to manipulate a virtual file system. Files saved here should have paths relative to the data folder, and use backslashes as the directory separator. They will take precedence over files stored in the normal data folder. They will also be saved into save games, so be avoid creating large files. Using fs_copy followed by fs_read_xxx, you can read the contents of existing files.
get/set_proto_data are used to manipulate 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 permenent. If you modify the protos, and then fallout subsequently reloads the file your changes will be lost.
get/set_proto_data are used to manipulate 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.
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.
play_sfall_sound and stop_sfall_sound are used to play mp3/wav/wma files. The path given is relative to the fallout folder. Specify loop as 1 to loop the file continuously, or 0 otherwise. 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. These functions do not require 'AllowDShowSound' to be set to 1 in ddraw.ini.
play_sfall_sound and stop_sfall_sound are used to play mp3/wav/wma files. The path given is relative to the Fallout folder. Specify loop as 1 to loop the file continuously, or 0 otherwise. 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. These functions do not require 'AllowDShowSound' to be set to 1 in ddraw.ini.
arrays are created and manipulated with the xxx_array functions. An array must first be created with create_array or temp_array, specifying how many data elements the array can hold. You can store any of ints, floats and strings in an array, and can mix all 3 in a single array. The id returned by create/temp_array can then be used with the other array functions. Arrays are shared between all scripts. (i.e. you can call create_array from one script, and then use the returned id from another script.) They are also saved across savegames. You must remember to free any arrays you create with create_array when you are done with them, or you will leak memory. arrays created with temp_array will be automatically freed at the end of the frame. These functions are safe, in that supplying a bad id or trying to access out of range elements will not crash the script. create_array is the only function that returns a permenent array, all other functions which return arrays (string_split, list_as_array etc,) all return temp arrays. You can use fix_array to make a temp array permenent.
arrays are created and manipulated with the xxx_array functions. An array must first be created with create_array or temp_array, specifying how many data elements the array can hold. You can store any of ints, floats and strings in an array, and can mix all 3 in a single array. The id returned by create/temp_array can then be used with the other array functions. Arrays are shared between all scripts. (i.e. you can call create_array from one script, and then use the returned id from another script.) They are also saved across savegames. You must remember to free any arrays you create with create_array when you are done with them, or you will leak memory. arrays created with temp_array will be automatically freed at the end of the frame. These functions are safe, in that supplying a bad id or trying to access out of range elements will not crash the script. create_array is the only function that returns a permanent array, all other functions which return arrays (string_split, list_as_array etc,) all return temp arrays. You can use fix_array to make a temp array permanent.
NOTE: the above description only applies when "arraysBehavior" is set to 0 in ddraw.ini. Refer to "arrays.txt" for detailed description of new arrays behavior.
force_aimed_shots and disable_aimed_shots allow 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.) force_aimed_shots will allow a weapon to make aimed shots even if it normally couldn't, and disable_aimed_shots stops a weapon from making aimed shots even if it normally could. Both of these functions affect player and npcs alike. force_aimed_shots 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 functions once at each reload. Use a pid of 0 to represent unarmed.
force_aimed_shots and disable_aimed_shots allow 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.) force_aimed_shots will allow a weapon to make aimed shots even if it normally couldn't, and disable_aimed_shots stops a weapon from making aimed shots even if it normally could. Both of these functions affect player and NPCs alike. force_aimed_shots 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 functions once at each reload. Use a pid of 0 to represent unarmed.
get/set_critter_skill_points will get/set the number of additional points a critter has in a skill, on top of whatever they have from their stats and other bonuses. Note that skill points are part of the proto, so calling set_skill_points on a critter will affect all critters that share the same proto.
@@ -101,23 +101,23 @@ array - array ID to be used with array-related functions (actually an integer)
- 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. It's 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.
> void inc_npc_level(string npc)
- takes an npc name 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.
- takes an NPC name 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.
> int get_npc_level(string npc)
- also takes the npc name as an argument, and returns the npc's current level. Again, the npc needs to be in your party.
- also takes the NPC name as an argument, and returns the NPC's current level. Again, the NPC needs to be in your party.
> void set_car_current_town(int town)
- changes the current town index for the player's car
> int get_ini_setting(string setting)
- reads an integer value from an ini file in the fallout directory.
- 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 16 chars, including the extension.
- The section name is limited to 8 characters.
- 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 sfalls settings, by using ddraw.ini as the file name.
> string get_ini_string(string setting)
- reads a string value from an ini file in the fallout directory.
- reads a string value from an ini file in the Fallout directory.
> int get_game_mode()
- is a more flexible version of in_world_map. It will return a set of flags indicating which mode the game is currently in.
@@ -157,21 +157,21 @@ array - array ID to be used with array-related functions (actually an integer)
- 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.
> int get_script(object)
- accepts a pointer to an object and returns it's scriptID (line number in scripts.lst), or -1 if the object is unscripted.
- accepts a pointer to an object and returns its scriptID (line number in scripts.lst), or -1 if the object is unscripted.
> void set_self(int obj)
- overrides the scripts 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;
- self_obj will revert back to its original value after the next function call.
- calling self_obj(0) will also revert self_obj to original value
- source_obj, target_obj, and similar functions will not work if preceeded by "set_self"
- source_obj, target_obj, and similar functions will not work if preceded by "set_self"
> void mod_skill_points_per_level(int x)
- accepts a value of between -100 and 100, and modifies the number of skill points the player recieves when they level up.
- accepts a value of between -100 and 100, and modifies the number of skill points the player receives when they level up.
- This is a modification of what would otherwise happen, rather than a replacement.
- The value is not saved into the save game, so should be reset in the game_loaded section of a script.
> void seq_perk_freq(int x)
> void set_perk_freq(int x)
- sets the number of levels between each perk.
- Setting 0 will reset it back to the default.
- This overrides the effects of the skilled trait.
@@ -182,7 +182,7 @@ array - array ID to be used with array-related functions (actually an integer)
- will return the last critter to be deliberately attacked
> object get_last_attacker(object)
- will return the last critter to deliberately launch an attack against the argument critter.
- If a critter has not launched/recieved an attack, it will return 0. This is only stored for the duration of combat, and outside of combat both functions will always return 0.
- If a critter has not launched/received an attack, it will return 0. This is only stored for the duration of combat, and outside of combat both functions will always return 0.
> void set_base_pickpocket_mod(int max, int mod)
- changes maximum chance of success and chance mod for each steal attempt
@@ -214,7 +214,7 @@ Some additional reg_anim_* functions were introduced. They all work in the same
- plays "take out weapon" animation for given holdFrameID. It is not required to have such weapon in critter's inventory.
> void reg_anim_turn_towards(object, tile/target, delay)
- makes object change it's direction to face given tile num or target object.
- makes object change its direction to face given tile num or target object.
> 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. Following macros are available in sfall.h:
@@ -229,13 +229,17 @@ was made as a dirty easy hack to allow dynamically change some explosion paramet
- 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)
> void set_attack_is_explosion_fire
- if you call this right before using a weapon with fire damage type, it will produce explosion effects (and radius damage) just like "explosion" type, but all targets will still recieve fire damage.
- if you call this right before using a weapon with fire damage type, it will produce explosion effects (and radius damage) just like "explosion" type, but all targets will still receive fire damage.
> 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.
Some utility/math functions are available:
> array string_split(string, split)
- takes a string and a seperator, searches the string for all instances of the seperator, and returns a temp array filled with the pieces of the string split at each instance. If you give an empty string as the seperator, the string is split into individual characters.
- takes a string and a separator, searches the string for all instances of the separator, and returns a temp array filled with the pieces of the string split at each instance. If you give an empty string as the separator, the string is split into individual characters.
- you can use this to search for a substring in a string like this: strlen(get_array(string_split(haystack, needle), 0))
> string substr(string, start, length)
@@ -245,7 +249,7 @@ Some utility/math functions are available:
- returns string length
> string sprintf(string format, any value)
- formats given value using standart syntax of C printf function (google "printf" for format details). However it is limited to formatting only 1 value.
- formats given value using standard syntax of C printf function (google "printf" for format details). However it is limited to formatting only 1 value.
- can be used to get character by ASCII code ("%c")
> int typeof(any value)
@@ -265,6 +269,9 @@ Some utility/math functions are available:
> float exponent(float x)
- e^x
> int ceil(float x)
- round x to the nearest integer that is not less than x
> int round(float x)
- round x to the nearest integer
@@ -297,6 +304,7 @@ Some utility/math functions are available:
- 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. (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.)
> int sneak_success
- returns 1 if the player is currently sneaking, and last sneak attempt (roll against skill) was successful; 0 otherwise
@@ -340,7 +348,7 @@ Some utility/math functions are available:
- these opcodes allows to use additional scripting functions, that do not require new opcode
- first argument is always function name (string)
- there are 7 versions of this opcode for different number of additional arguments (for convenience)
- opcodes have return value, but it is not neccessary to use it
- opcodes have return value, but it is not necessary to use it
------------------------------------
@@ -372,6 +380,16 @@ Some utility/math functions are available:
> void sfall_func0("exec_map_update_scripts")
- executes map_update_p_proc for all objects on map and global/hook scripts as well
> void sfall_func2("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; e.g. 'set_ini_setting("myini.ini|mysec|var1", 42)'
- The file name is limited to 63 chars, including the extension
- The section name is limited to 32 characters
> int sfall_func1("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++
> int sfall_func1("item_weight", object)
- gets the current weight of an object
@@ -429,6 +447,75 @@ Some utility/math functions are available:
- displays player stats in the inventory screen display window
- works only in opened inventory
> int sfall_func1("lock_is_jammed", object)
- returns 1 if the lock (container or scenery) is currently jammed, 0 otherwise
> void sfall_func1("unjam_lock", object)
- 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
> void sfall_func1("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
> array sfall_func0("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
> void sfall_func3("set_map_enter_position", int tile, int elevation, int rotation)
- overrides the player's 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
> void sfall_func1("set_rest_heal_time", int minutes)
- sets the time interval in minutes for healing during resting. The default is 180
- The time interval will be reset each time the player reloads the game
> void sfall_func1("set_rest_mode", int mode)
- 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
> int sfall_func0("attack_is_aimed")
- returns 1 if the aimed attack mode is selected, 0 otherwise
> void sfall_func3("set_iface_tag_text", int tag, string text, int color)
- sets the text messages and colors for custom notification boxes to the interface without the need to add messages to intrface.msg and set up the font colors in ddraw.ini
- tag value is the same as used in show_iface_tag, hide_iface_tag, and is_iface_tag_active. The valid range is from 5 to (4 + the value of BoxBarCount in ddraw.ini)
- The text is limited to 19 characters
- available colors: 0 - green, 1 - red, 2 - white, 3 - yellow, 4 - dark yellow, 5 - blue, 6 - purple
> void sfall_func1("inventory_redraw", int invSide)
- redraws inventory list in the inventory/use inventory item on/loot/barter screens
- invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens)
> int sfall_func1("get_string_pointer", string text)
- returns a pointer to a string variable or to a text
> void sfall_func1("dialog_message", string text)
- displays a message in the NPC response window in dialog or barter screen
> int sfall_func1("get_current_inven_size", object)
- returns the current inventory size of the container or the critter
> void sfall_func5("create_win", string winName, int x, int y, int width, int height)
> void sfall_func6("create_win", string winName, int x, int y, int width, int height, int flags)
- works just like vanilla CreateWin function, but creates a window with MoveOnTop flag if flags argument is not specified, and allows to set additional flags for the created window
- MoveOnTop flag allows the created window to be placed on top of the game interface
> void sfall_func3("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)
> int sfall_func2("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 in maps.txt are ignored
------------------------
------ MORE INFO -------
------------------------
+31
View File
@@ -20,6 +20,7 @@
#include "Functions.h"
#include "Structs.h"
#include "Variables.h"
#include "VariableOffsets.h"
#include "EngineUtils.h"
@@ -74,7 +75,37 @@ void SkillSetTags(long* tags, long num) {
fo::func::skill_set_tags(tags, num);
}
int _fastcall GetItemType(GameObject* item) {
return fo::func::item_get_type(item);
}
_declspec(noinline) GameObject* GetItemPtrSlot(GameObject* critter, InvenType slot) {
GameObject* itemPtr = nullptr;
switch (slot) {
case fo::INVEN_TYPE_LEFT_HAND:
itemPtr = fo::func::inven_left_hand(critter);
break;
case fo::INVEN_TYPE_RIGHT_HAND:
itemPtr = fo::func::inven_right_hand(critter);
break;
case fo::INVEN_TYPE_WORN:
itemPtr = fo::func::inven_worn(critter);
break;
}
return itemPtr;
}
long& GetActiveItemMode() {
return fo::var::itemButtonItems[fo::var::itemCurrentItem].mode;
}
GameObject* GetActiveItem() {
return fo::var::itemButtonItems[fo::var::itemCurrentItem].item;
}
bool HeroIsFemale() {
return (fo::func::stat_level(fo::var::obj_dude, fo::Stat::STAT_gender) == fo::Gender::GENDER_FEMALE);
}
//---------------------------------------------------------
//print text to surface
+10
View File
@@ -50,6 +50,16 @@ void SkillGetTags(long* result, long num);
// wrapper for skill_set_tags with bounds checking
void SkillSetTags(long* tags, long num);
int _fastcall GetItemType(GameObject* item);
_declspec(noinline) GameObject* GetItemPtrSlot(GameObject* critter, InvenType slot);
long& GetActiveItemMode();
GameObject* GetActiveItem();
bool HeroIsFemale();
// Print text to surface
void PrintText(char *displayText, BYTE colorIndex, DWORD x, DWORD y, DWORD textWidth, DWORD destWidth, BYTE *surface);
// gets the height of the currently selected font
+107 -2
View File
@@ -213,6 +213,15 @@ enum ObjType : char
OBJ_TYPE_SPATIAL = 6
};
enum ArtType : char
{
OBJ_TYPE_INTRFACE = 6,
OBJ_TYPE_INVEN = 7,
OBJ_TYPE_HEAD = 8,
OBJ_TYPE_BACKGROUND = 9,
OBJ_TYPE_SKILLDEX = 10
};
// Some FO2 PIDs possibly used by engine
enum ProtoId : long
{
@@ -420,8 +429,8 @@ enum Trait : long
enum class ScenerySubType : long
{
DOOR = 0,
STAIRS = 1,
ELEVATOR = 2,
STAIRS = 1,
ELEVATOR = 2,
LADDER_BOTTOM = 3,
LADDER_TOP = 4,
GENERIC = 5
@@ -579,6 +588,38 @@ enum ItemType : long
item_type_key = 6,
};
// Inventory Equates
enum InvenType : long
{
INVEN_TYPE_WORN = 0,
INVEN_TYPE_RIGHT_HAND = 1,
INVEN_TYPE_LEFT_HAND = 2,
};
enum AttackType : long
{
ATKTYPE_LWEAPON_PRIMARY = 0,
ATKTYPE_LWEAPON_SECONDARY = 1,
ATKTYPE_RWEAPON_PRIMARY = 2,
ATKTYPE_RWEAPON_SECONDARY = 3,
ATKTYPE_PUNCH = 4,
ATKTYPE_KICK = 5,
ATKTYPE_LWEAPON_RELOAD = 6,
ATKTYPE_RWEAPON_RELOAD = 7,
ATKTYPE_STRONGPUNCH = 8,
ATKTYPE_HAMMERPUNCH = 9,
ATKTYPE_HAYMAKER = 10,
ATKTYPE_JAB = 11,
ATKTYPE_PALMSTRIKE = 12,
ATKTYPE_PIERCINGSTRIKE = 13,
ATKTYPE_STRONGKICK = 14,
ATKTYPE_SNAPKICK = 15,
ATKTYPE_POWERKICK = 16,
ATKTYPE_HIPKICK = 17,
ATKTYPE_HOOKKICK = 18,
ATKTYPE_PIERCINGKICK = 19
};
#define OBJFLAG_CAN_WEAR_ITEMS (0xf000000)
#define OBJFLAG_HELD_IN_RIGHT (0x10000)
@@ -600,4 +641,68 @@ enum RollResult
ROLL_CRITICAL_SUCCESS = 0x3,
};
namespace Fields {
enum CommonObj : long
{
id = 0x00,
tile = 0x04,
x = 0x08,
y = 0x0C,
sx = 0x10,
sy = 0x14,
frm = 0x18,
rotation = 0x1C,
artFid = 0x20,
flags = 0x24,
elevation = 0x28,
inventory = 0x2C,
protoId = 0x64,
cid = 0x68,
lightDistance = 0x6C,
lightIntensity = 0x70,
outline = 0x74,
scriptId = 0x78,
owner = 0x7C,
scriptIndex = 0x80,
};
enum CritterObj : long
{
reaction = 0x38,
combatState = 0x3C,
movePoints = 0x40,
damageFlags = 0x44,
damageLastTurn = 0x48,
aiPacket = 0x4C,
teamNum = 0x50,
whoHitMe = 0x54,
health = 0x58,
rads = 0x5C,
poison = 0x60,
};
enum ItemObj : long
{
updatedFlags = 0x38,
charges = 0x3C,
ammoPid = 0x40,
};
}
namespace WinFlags {
enum WinButtonFlags : long
{
OwnerFlag = 0x1,
UnknownFlag2 = 0x2,
MoveOnTop = 0x4,
Hidden = 0x8,
Exclusive = 0x10,
Transparent = 0x20,
UnknownFlag40 = 0x40,
UnknownFlag80 = 0x80,
scriptWindow = 0x100,
itsButton = 0x10000,
};
}
}

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