Fallout 4
0 of 0

File information

Last updated

Original upload

Created by

LarannKiar

Uploaded by

LarannKiar

Virus scan

Safe to use

About this mod

F4SE plugin that extends the capabilites of the game's scripting language with over 630 new native functions.

Requirements
Permissions and credits
About this mod:

F4SE plugin that adds over 630 new native Papyrus script functions for mod authors.

A complete list of the implemented functions is in these structured Google Drive documents, here and here.
(They open normally, not with Google Docs. I had to put the list in searchable and user-friendly documents because eventually it become too big for a mod description). Event callback and registration functions are here.

v2.0 update:
Spoiler:  
Show

introduces AI injection (to player and any NPC), dialogue manipulation (like start, stop, pause), physics (Havok) reset, lot of global game functions (like CharGen HUD mode, VATS data), actor functions (purge inventory, smooth "undress", collision boundaries, current animation archetype), inventory item cloning (with reapplied instance data such as attached mods), FormList functions (array passing, calculating script added forms), lot of quest data (such as priority, event ID, total ref count, scene data, quest aliases' editor-set names), terminal data (like NthMenuItemItem (as string), NthMenuItemSubMenu (as terminal), header text, etc.), outfit array and many many more....

v3.0 - v4.0 update: ~55 new functions.
Spoiler:  
Show

They open up the Quest Alias class (e.g., is optional, is quest object, ExternalLink, ExternalAliasID, is essential, etc.), also exposes Quest data (like Priority, QuestType) to Papyrus, adds many Package variables (such as real-time AI target reference), SetShortName for ActorBases and many more...

v5.0 update: 6 new functions (IntToHex, SubStr, etc.).
Spoiler:  
Show

 Requested ones (loaded ammo count, get magazine count, etc.) and Utility functions (like Substr ("cut text partially at somewhere and return"), IntToHex (for GetFormID() to "actual ingame" FormIDs), String length, String find, count occurrences).

v6.0 - v7.3 update: introduces inventory handlers.
Spoiler:  
Show

they open up the inventory system and contain some Weapon functions like GetEquippedWeaponLoadedAmmoCount(), SetEquippedWeaponLoadedAmmoCount() and ReloadWeaponSilent(), etc.. You can find all kinds of inventory items based on FormIDs (int) and HexFormIDs (with all formats like "0008925c", "0x8925c", "8925c" which makes it also possible get the index of any inventory item even through the console), get the actual FormID of any item based on index (which then can be processed with GetForm() however you like), see the special (unique or modded/renamed items') ("DisplayName") with GetInventoryItemDisplayName() and count how many of each inventory item an actor or object reference has with GetInventoryItemCount(). By knowing how many of each item the inventory owner has, the full inventory can be easily processed. However, this latter function can optionally be configured to act as a reversed GetItemCount() too, that sums up stacked items (e.g., ".38 Round (1000) = 1000 items). Using them with IntToHex() from v5.0, any inventory can essentially be printed to the log or to the screen. See the notes I wrote above the functions for the details, they are much simpler than they sound.

v8.0 - v8.1 update: over 20 new functions (notables: SetVATSCriticalCharge, GetSex for Actors, GetNearbyHostiles, GetSpells, HasKeywordInArray, highly configurable/filterable FindActors, ProcessActors)
Spoiler:  
Show

, set/get VATS data (like SetVATSCriticalCharge(float afValue)), GetSex() for Actors, GetNearbyHostiles() (radius based actor search with optional origo and distance), complex object (actor) processing functions with a lot of parameters (inactive/disjunctive/conjunctive setup with int modes, keyword arrays, living/dead, loaded/unloaded, friendly/hostile, female/male, level (min max), optional origo and distance). HasKeywordInArray() (also can be disjunctive/conjunctive) for Object References. v8.1.: added Spell[] GetSpells() for Actors and Bool HasEnableParent() for ObjectReferences.

v9.0 - v9.1 update: 13 new functions (notables: GetAspectRatio, GetINISetting, GetDetectionLevel, GetCombatTargeters, IsEnableParent, String editors).
Spoiler:  
Show

13 new functions; GetAspectRatio(), GetINISetting() (for bool, float, int, string; with error-check), IsWorkshop(), IsAshPile(), GetDetectionLevel(), Actors[] GetCombatTargeters(Actor akTarget), String editors (ReplaceStr(), ToLowerStr(), ToUpperStr(), CapitalizeStr(), EraseStr()), IsEnableParent(), GetVersionRelease(). New parameters for the "Actor processing functions": akMyCombatTarget, akMyCombatTargetMustHaveKeyword, aiReturnMode (all/random one/closest one), aiReturnOrderMode (randomly/ascending/descending order by distance from akOrigoRef). Added new parameter aiSelectiveProcessMode to FindActors() to select the actor data process from the .exe (can be useful for code optimization).

v10.0-v10.2 update: ~50 new: many inventory handlers, GetUniqueActors, MarkForForcedDeletion, SetKey (lockable refs), etc...
Spoiler:  
Show

About 50 new functions; many (individually indexable) inventory item handlers like GetNthItemEquipped() and GetNthItemLegendaryMod(), AddKeywordToNthItemInstanceData(), etc. Actor functions like IsFiringWeapon(), IsAiming(), IsWeaponBlocked(), IsUnderwater() and IsTakingHealthDamageFromActiveEffect(). New Location functions such as GetUniqueActors() (can find unloaded non-persistent Unique actors), GetSpecialRefs() (includes location center and Provisioner markers). Special Game and ObjectReference functions like RemoveLastUsedPowerArmorFromMap() and MarkForForcedDeletion() (deletes even persistent references... use with care).
v10.1: added PrintInventoryItems(), a fully filterable native "inventory to Papyrus" String[] function with equip, favorite, legendary and item count data (similarly to the Pip-Boy) and GetInventoryItemIndexByName() to find any inventory item easily by item name. v10.2: SetKey() for lockable object references and inventory item handlers GetNthInventoryItemName(), GetNthItemValue() and GetNthItemWeight().

v11.0 update: most notables: SetCurrentConsoleRef, GetReferenceName (always finds the "proper" name), GetRefsAliased (Quest Alias refs to Array), Ref Array sorting (e.g., by name)...
Spoiler:  
Show

Added SetCurrentConsoleRef(), GetReferenceName() (native functor to always find and return the proper reference name: DisplayName/FormName), GetHexFormID() (works with ingame created RefIDs too), GetRefsAliased() (pass all quest alias references to ObjectReference[]) and ObjectReference[] function SortRefsByName() (with optional abExactMatch, abReversedMode) to process any references by their actual name. Also includes sort by name parameter for the actor processors and some new utility functions (last digits and quoted text extracting).

v12.0 update: ~100 new. Many ActorBase (face, templates..) and MagicEffect data. New inventory handlers like EquipNthItem. MoveActorToFurniture, IsRefWithinBuildableArea, etc...
Spoiler:  
Show

About 100 new functions, mostly for ActorBase and MagicEffects like SetFaceTemplateActorBase() (native "face swapper"), IsChargenFacePreset(), SetHasBaseDataTemplate(), IsValueModifierEffect(), IsImmunityEffect(), IsSlowTimeEffect(). Also added GetAerialDistance() (worldmap based GetDistance() that ignores the "Ref1 in interior Ref2 in exterior" caused infinite distance).
v12.1 update: introduces EquipNthItem(), UnequipNthItem(), SetEquipStateLocked(), DropNthItem(), RemoveNthItem(), TransferNthItem(), DropNthItemEx(), CopyNthItem() and GetEquippedItemIndexesArray() for advanced inventory management. PrintInventoryItems() received two new parameters, abMarkEquipStateLocked and abMarkItemIndex.
v12.2 update: added MoveActorToFurniture() (with selectable furniture marker ID) and IsRefWithinBuildableArea() (also takes another reference to compare it with the build zone of the target reference). Introduces event callback functions OnPerkPointIncrease(), OnColorUpdateApply() and OnPipBoyLightChange().
v12.3 update: IsPipboyFlashlightOn().

v13-14 update: completely reworked inventory handlers, added crosshair target, Persistence Manager ([EP], [PP]), ExecuteConsoleCommand, Ini Parser (read, write, check), dev functions (e.g., memory address), GetHexFormID, HexFormIDToInt, HUD message suppressor, VATS data, combat AI target "better weapon" search ref flag set/unset (SetNoAIAcquire), LogPersistentRefs, Console log/history editor, GetAliasID, Get/SetProduceForm (Flora, harvestable item), GetFormByEditorID, GetFormEditorID, Record flag editor, etc....
Spoiler:  
Show

v13.0 update:
(search by name: inclusive/exclusive, many arrays, etc.). Added INI parser (check, write, read), some dev functions like GetFormByMemoryAddress() and GetMemoryAddress(), improved GetVATSTarget(), added HexFormIDToInt() for the already added GetHexFormID() to operate with "FE" and "FF" uint32-only FormIDs, return plugin name of forms, alias holder quest array, persistency check, persistent promoters (forms that cause another one to be persistent), activate ("crosshair") target ref and a few more...
v13.1 update:
global event "OnEquipUnequip" (it can receive callbacks without any specified akSource). EquipNthItem "deep scan" fix for stacked weapon instances. Added IsHUDMessagingSuppressed() and SuppressHUDMessages(bool abSuppress).
v13.2 update:
Alias[] GetAliases(ObjectReference akRef) and DoArmorSlotsOverlap(Armor akArmor1, Armor akArmor2) (equip slot comparator).
v13.3 update:
GetNthItemRefID() (editor-placed and persistent items have RefIDs), GetNthItemPersistentPromoters() (Forms that keep the item persistent), GetQuestItemIndexes(), GetNthItemIsQuestItem() and GetNthQuestItemOwnerQuest() (to find quest items in inventories). Two new parameters for PrintInventoryItems(), abMarkQuestItem and abMarkDisplayName.
v13.4 update:
Persistence Manager [EP], [PP]. ForcePersistent(), SetEditorPersistence() (both with True/False parameter; abIgnoreHierarchy), RemovePersistentPromoter(), RemoveAllPersistentPromoters(). Added SetTemporaryReference() ([T] flag to invoke the object reference cleanup by the engine), SetNoAIAcquire() (combat AI "better weaper search" behavior), SetNoRespawn(). Added GetAliasID(Alias akAlias) and corrected the lookup code of the existing Alias handlers.
v13.5 update:
GetVATSTargetPrecalculatedRemainingHealthPercent() and GetVATSTargetHealthPercent().
v13.6 update:
ExecuteConsoleCommand(String asCommand, ObjectReference akSelectRef = None), GetConsoleSelectableRefs(), GetCurrentConsoleRefIndex() and LogPersistentRefs()..
v14 update:
ForceEvaluatePersistence(), Get/SetConsoleHistory(), Clear/AddToConsoleHistory(), GetHexFormIDFromFile() (to bulk process much more refs a Papyrus array can hold), CountLinesOfFile(), IsTemporaryReference(). Optimization and some minor fixes for EquipNthItem, CopyNthItem, DropNthItem and TransferNthItem. Added GetFormListFullName(), GetFormByEditorID() and GetFormEditorID() (EditorIDs supported: Cell (interior-only), Quest, Keyword, Global, Voice Type, Idle, Image Space Modifier, Music Type), GetFormListsByFullName(), GetIsFormFlagSet(), SetFormFlag() and GetFormFlagsAsInt(). v14.5: 23 "Set" functions for Effect Shaders, GetProduceForm() and SetProduceForm() for Flora forms (produce form = harvestable item).

v15 update: added Game script functions: GetMenuTargetVendorActor(), GetMenuTargetVendorChestRef(), GetMenuTargetContainerRef(). Actor functions: GetAnimArchetypeKeyword(), GetAnimFaceArchetypeKeyword(), GetFactions(), GetPerks(). ObjectReference functions: GetKeywords(). v15.1 update: GetKeywordsByFullName(), GetHeadPartsByFullName(), GetQuestsByFullName(), GetActorBasesByFullName(), AttachModToNthItem() and RemoveModFromNthItem().

v16 update: rewrote the existing and added many new Terminal functions (some previous signatures changed) that grant full control over entries (for both the Pip-Boy and Terminals). (Create, remove, edit Menu Item entries at runtime like Item Text, Response Text, Entry ID and Index, etc.). Also, to change Header, Welcome, Body text, Submenu Terminals, TerminalMenu menu types (e.g, DisplayText, Force Redraw), etc. Added UI functions: SetMenuPriorityDepth() (changes native menu stack order, basically to "hijack" keyboard, mouse, controller input) and RefreshMenu(). Some BarterMenu specific ones: CompleteBarterMenuTrade(), ClearBarterMenuTradingData(), SetBarterMenuSuppressed(). v16.1: FindAllReferencesWithItem (find references by inventory content; with filters and built-in "aerial distance" to bypass exterior/interior Cell caused infinite distance), SetQuestPriority (to get around dialogue quest conflicts...), GetReferenceMods and GetNthItemMods (to return all ObjectMods a ref/inventory item has; with optional ModColl filter), and added a few functions to get real-time ActiveMagicEffect info on Actors like GetActiveMagicEffectSourceEffects to see the source Spell, Potion, Object Effect for example. Also, GetRenderedActors to see in an Actor[] which Actors are curently "fully rendered" (i.e., visible on screen, behavior graph is active, etc.). GetTerminalMenuItemCount and GetTerminalBodyTextCount for the Terminal API added in v16.0. Also, optional verbose logging for all menu events: EnableOnMenuOpenCloseEventLogging (it's in the "Development" section in GardenOfEden2.psc).

v17.0 update: Actor functions like GetCommandTypePerforming (aiCommandType) and GetHeadAngle (head rotation; with filter to body relative). Verbose (global, "catch-all") event loggers for all CombatStateChanged, OnCellAttachDetach, OnHitEvent (~40 parameters filled with practically all Hit and AttackData, damage offsets, etc. See Event callbacks to pass them to Papyrus). Set/Get LoadScreen texts. GetFormTypeAsString that returns "REFR", "FURN". Form[] GetAllFormsByType: "bulk Form processing". It returns all existing forms based on their type (with optional ModFile filter) so that all forms can be easily edited. GetLastOverridePluginFile for general purpose mod conflict resolving. Cell functions like GetCellEncounterZone and GetCellLocation. Minor bug fixes for ReplaceStr and ExecuteConsoleCommand.

v17.1 update: ability to evaluate Conditions (whole field + selected ones) on actor and object references with IsConditionTrueOn. This allows modders to call any Condition Functions from Papyrus to both greatly speed up execution speed and to make scripting much more convenient. See dev notes and examples in GardenOfEden2.psc. Also added many Combat Group data such as GetCombatGroupMembers and GetCurrentCombatThreatLevel, Actor functions like GetFactionMembers, Game script GetIsLockPickable and GetMessageText for Message forms and Utility GetRandomFloatFromArray and GetRandomIntFromArray.

v17.2 update: AreHostileActorsNear (one used by the "allowed to fast travel" code), GetIsCrosshairModeCrime, GetCrosshairMode (Command, Activate and so on), GetActorCause and ClearActorCause (can prevent projectiles from dealing damage), GetEquippedWeaponAccuracy/Range/RateOfFire/Damage, SortRefsByCondition (evaluate Conditions on any reference arrays to sort them by native IsConditionTrueOn), GetItemIndexesByMods (find inventory items based on their Object Modifications; with optional bMustHaveAll flag), fixes and performance improvements for AttachModToNthItem and RemoveModFromNthItem, IsScrapRecipe and GetRecipeFilterKeywords for Constructible Objects ("Craft Recipes"), CanPassThroughSmallTransparent for Projectiles, GetStaticCollectionForms for landscape modding, GetCurrentDateAndTimeAsString and OnActivateGlobal event (which can notify any script of all (but filterable) OnActivate events that may happen in the game world).

17.3 update: performance improvements and bug fixes for inventory functions EquipNthItem, UnequipNthItem, GetItemIndexesBy... and GetIsFormFlagSet. Added UsingGamepad boolean function to detect Gamepads and array functions AddToOutfitForms, RemoveOutfitForm, RemoveNthOutfitForm and RemoveAllOutfitForms for clothing and equipment modding.


OnHitEvent:
Spoiler:  
Show

[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13397] ---------------  OnHitEvent received  ----------------
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13403] akAggressor >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13409] akSource >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13415] akProjectile >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13421] akTarget >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13423] hasHitData >> 1
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13429]   akAmmo >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13435]   attackerByHandle >> 00000014
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13443]   baseDamage >> 12.600002
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13444]   blockedDamage >> 7.349367
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13445]   blockMult >> 0.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13446]   blockStaggerMult >> 0.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13447]   bodypartType >> 8
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13448]   calculatedBaseDamage >> 5.326025
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13449]   criticalDamageMult >> 1.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13466]   attackerMagicEffect >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13470]   hitDataFlags >> 393216
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13471]   reducedDamage >> 7.273977
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13472]   sneakAttackMult >> 1.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13482]   sourceByHandle >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13490]   sourceObjectInstanceBase >> 00004822
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13496]   spellItem >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13498]   materialType >> 0
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13500]   totalDamage >> 5.326025
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13506]   akTargetByHandle >> 0018e04f
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13508] hasAttackData >> 1
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13510]     actionPointsMult >> 0.250000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13512]     attackAngle >> 0.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13514]     attackChance >> 1.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13520]     attackSpell >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13526]     attackTypeKeyword >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13532]     weaponEquipSlot >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13538]     requiredEquipSlot >> None
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13545]     eventName >> meleeAttackGun
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13552]     damageMult >> 1.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13553]     attackDataFlags >> 4
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13554]     knockdown >> 0.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13555]     recoveryTime >> 1.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13556]     staggerOffset >> 0
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13557]     strikeAngle >> 35.000000
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13565] asMaterialName >> 
[2024-02-10 17:11:44.066] [ F4SE log ] [info] [Objects.h:13566] ------------------------------------------------------


LogPersistentRefs:
Spoiler:  
Show

Bool Function LogPersistentRefs(int aiEditorPersistent, int aiPromotedPersistent, String[] asSourcePlugins, \
Keyword[] akMustHaveKeywords, Keyword[] akMustNotHaveKeywords, \
bool abMustHaveKeywordsModeAll = false, bool abMustNotHaveKeywordsModeAll = false, Form akBaseForm = None, \
int aiDeletedState = -1, float afDistance = -1.0, ObjectReference akOrigoRef = None, bool abSuppressMessage = false) native global



Inventory Management:
Inventory item-level handlers to find, copy, transfer, remove, drop, equip/unequip indexable items (instances)
Simple randomized inventory loop with EquipNthItem


Player AI driven
Adding a simple Travel package to the Player's AI stack
(script callable packages with working weapon draw, mouse input and jumping)



Attaching Rowdy's Sandboxing AI
(First Person mode view)

Requirements:
F4SE
Address Library for F4SE Plugins
Microsoft Visual C++ Redistributable for Visual Studio 2019



Credits:
powerofthree (CommonLibF4)
Fudgyduff (CommonLibF4 and the Address Library)
GELUXRUM (for letting me reuse some part of their code)
This plugin wouldn't be possible without them.


Source code and MIT license.