Fallout 4
0 of 0

File information

Last updated

Original upload

Created by

TommInfinite

Uploaded by

TommInfinite

Virus scan

Safe to use

About this mod

F4SE plugin which adds new engine fixes, new permanent events and many functions for modders.

Requirements
Permissions and credits
Changelogs
Description:
F4SE plugin which adds new functions for modders.
Complete list of functions can be found in the SUP_F4SE.psc file in the plugin package.

Installation:

Install the package via mod manager.

Engine fixes:
Spoiler:  
Show


-ScrapCrashFix
Fixes bug widely known as "scrap crash". Will take care of removing object reference from it's powergrid in case reference was not scrapped via Workshop(using "Delete" console or papyrus function).

-WirelessPowerFix
Fixes and reworks wireless power connections:
When radiators  are powered off they will drop all wireless connections to it. When powered on they will restore them. This fixes bug when powergrid elements "connected" via powered off radiator will be in the same powergrid.
Properly restores wireless connections of a radiator which is also a generator if connections were severed while it was moved.

-TerminalLinkFix
Prevents power grid from losing all of previous terminal connections when you connect a new terminal to it. Also enables terminal connections for wireless objects
All engine patches are enabled by default and can be switched off in SUP F4SE INI file.



Events:
Spoiler:  
Show

Since V 11.00 those events can be permanent if you set the respective flag. Permanent events will be tied to the
savegame like vanilla or F4SE events. The only exception is "OnMainGameLoop" - it can't be made permanent.

Starting from V11.00 SUP F4SE adds following events for modders to use:(Please refer to .psc file for more detailed info)
-"OnMainGameLoop" - allows papyrus functions to be  independently called by the game with specified time between calls and other parameters(Call interval, Only Gamemode\Only menumode)
-"OnGameLoad" - invokes on savegame load or a new game.
-"OnGameSave" - invokes on savegame save.
-"OnCellChange" - invokes when player enters a Cell(also fires on savegame load).
-"OnCellFirstTimeVisit" - invokes when player enters an INTERIOR cell for the first time.
-"OnPowerConnection" - invokes when Player Adds\removes connection in the workshop.
-"OnQuestFinished" - invokes when Quest is finished(either completed or failed).
-"OnQuestActive" -invokes when quest is enabled\disabled in Pipboy..
-"OnConsoleCommand" - invokes when user successfully executes a console command.
-"OnPlayerMapMarkerStateChange" - invokes when player sets\removed Custom marker in the pipboy or via relevant SUP function.
-"OnActorRagdollStart" -invokes when Actor is knocked down(Ragdoll mode) by explosion or by PushActorAway command.
-"OnActorRagdollFinish" - invoked when Actor is no longer in Ragdoll mode.
-"OnPlayerRadioState"- invokes when player radio is switched on\off via pipboy or papyrus command.
-"OnCrosshairRefChange" - invoked when when the a new ref is found in the crosshair.
-"OnWorkshopPowerStateChange" - invoked when workshop capacity,load,power rating changes.
-"OnDismemberLimb" - invoked when actor loses a limb.
All of these events can be set up using papyrus functions or SUP Script Runner. More info can be found in .psc file which comes with the package.


If you try to set any event except "OnMainGameLoop" twice for the same function - it won't be set the second time.


SUP Script Runner:
Spoiler:  
Show

SUP Script Runner allows you to set up event callbacks by placing a JSON file in the game folder.
 Note:
-Info provided here is valid for SUP F4SE V 11.00 or later!
-All files must be placed in "Data\Scripts\SUPScriptRunner" folder.
-You can set up  all of abovementioned events.
-Functions can be either global or local.
-Function should have parameters which correspond with specified event(requires params correspond with those mentioned in .psc file)
-The function call is done via native CallGlobalFunctionNoWait(for global functions) or CallFunctionNoWait(for local functions) function.
More info and examples are under spoiler:
Example:
Papyrus script:
Scriptname MyScriptName

Function OnLoadFunction() global
    DebugPrintSUP("My global function runs!")
endFunction

or

Function MyLocalFunction()
    DebugPrintSUP("My local function runs!")
endFunction
Instruction:
You should create a JSON file(editable in notepad), give it a unique name and place it "Data\Scripts\SUPScriptRunner" folder.
JSON examples are avaiable at "file section".
{
    "Scripts": [
        {
            "FunctionName": "MyLocalFunction",
            "Event": "OnGameLoad",
            "Caller": "801|SUP_F4SE_Test_Plugin.esp",
            "ScriptName": "MyScriptName"
        }
    ]
}
For this file global "OnLoadFunction" from "MyScriptName" will be called.
{
    "Scripts": [
        {
            "FunctionName": "OnLoadFunction",
            "Event": "OnGameLoad",
     "Caller": "801|SUP_F4SE_Test_Plugin.esp",
            "ScriptName": "SUP_F4SE_QUEST_SCRIPT"
        }
    ]
}
For this file local "MyLocalFunction" from "MyScriptName" will be called.
Example file path - "Data\Scripts\SUPScriptRunner\Myfile.json"
If you want more than one function called on game load, use this template:
{
    "Scripts": [
        {
            "FunctionName": "MyLocalFunction",
            "Event": "OnGameLoad",
     "Caller": "801|SUP_F4SE_Test_Plugin.esp",
            "ScriptName": "SUP_F4SE_QUEST_SCRIPT"
        },
        {
            "FunctionName": "MyFunctionName2",
            "ScriptName": "MyScriptName2",
            "Caller": "801|SUP_F4SE_Test_Plugin.esp",
            "Event": "OnGameLoad"
        
        },
        {
            "FunctionName": "MyFunctionName3",
            "RunTimesCount": 3,
            "ScriptName": "MyScriptName3",
            "Event": "OnGameLoad"
        },
        {
            "FunctionName": "SUPTestLoop",
            "Event": "OnMainGameLoop",
            "CallInterval": 10,
            "CallMode": 0,
            "ScriptName": "SUP_F4SE_QUEST_SCRIPT"
        },
        {
            "FunctionName": "SUPOnCellChange",
            "ScriptName": "SUP_F4SE_QUEST_SCRIPT",
            "Caller": "801|SUP_F4SE_Test_Plugin.esp",
            "Event": "OnCellChange",
        },
        {
            "FunctionName": "SUPOnCellChangeSecond",
            "ScriptName": "SUP_F4SE_QUEST_SCRIPT",
            "Caller": "801|SUP_F4SE_Test_Plugin.esp",
            "Event": "OnCellChange",
        }
    ]
}

In the papyrus you should have:
Function SUPOnCellChange(Cell NewCell)
    DebugPrintSUP("NEW CELL FROM ESP IS " + NewCell)
endFunction

Function SUPOnCellChangeSecond(Cell NewCell)
    DebugPrintSUP("NEW CELL FROM ESP SECOND IS " + NewCell)
endFunction


Function SUPTestLoop() global
    ;DebugPrintSUP("Test loop works = CHECK")
endFunction

List of parameters you can add to all types of Events:
-"Event"(string) - Specify event for which this function will be called.You can see list of Events in the section above.
-"Caller"(string) - FormID of object to which script is attached in "formIDhex|PluginName" structure. Light mods are supported.
-"RunTimesCount"(0-infinite) - Specify for how much times this function will be called untill callback is automatically removed. Set it to 0 or don't specify at all for infinite calls.
List of parameters you can add to callbacks of "OnMainGameLoop" event:
-"CallInterval": (0-inf) - specify time between calls in seconds(it's not advisable to call the functions very frequently as papyrus can stack them).
-"CallMode": (0-2) - 0 - function will be called in both Gamemode and Menumode, 1 - function will be called only in Gamemode, 2 - function will be called only in Menunode



For modders:
Spoiler:  
Show

Your papyrus script should include this line to call the functions:

Import SUP_F4SE

You can check if plugin installed using GetPluginVersion from F4SE. Plugin name is "SUP_F4SE".
Plugin version is returned as a decimal value.
1.00 == 100
1.1 == 110
11.00 = 1100
etc..




Credits:
  • F4SE team for F4SE;
  • SKSE team for some source material;
  • CommonLibF4SE team for some source material.
  • Ian Patterson for helping me setting up F4SE;
  • Niston for his great expertise.
  • LL FourPlay community F4SE plugin developers for some source material;
  • Brofield for SimpleIni;
  • Volker Diels-Grabsch for sha1 library;
  • shaovoon for MP3 player example
  • xNVSE team for helping me get into coding;
  • i860 for a valuable tip;
  • shad0wshayd3 for a valuable tip;
  • msalaba for commenting papyrus source code;
  • nlohmann for JSON library.
  • JazzIsParis for the NAMES.
  • Everyone who was there to support me.

Source code is located here.