Introduction
So what are Logic Mods? It's a modding system originally invented for Unreal Mod Loader (UML), where the mod loader would look for any .pak mods in Paks/LogicMods
directory, assuming the following conditions were met:
- The .pak file name must match the mod folder name you had in Unreal Editor before packaging the mod.
- The .pak mod needed to contain a
ModActor
asset.
Development for UML eventually ceased and UE4SS became the new popular tool for modding Unreal Engine games and UE4SS adopted the Logic Mods system from Unreal Mod Loader (with permission of course).
You might've seen some .pak mods that end with a _P
. These are not the same thing as Logic Mods and are referred to as patch paks which you can read more about in this article.
If you're creating Logic Mods for UE4SS, never include _P
at the end. The _P
suffix should be reserved for patch paks only. The reason for this is that they're both installed in different folders and will make troubleshooting mod issues very difficult later due to not knowing what's actually a Logic Mod and which is a patch pak.
Requirements
-
Basic Understanding of Unreal Editor - This is important, because otherwise you will be very confused. This knowledge is valuable and extends to any Unreal Engine game. Just because you're modding doesn't mean it's not relevant. There are a ton of free videos available on YouTube for getting started with using Unreal Editor.
Setup
- Assuming you've finished setting up your Palworld Modding Kit (PMK), open up the
Pal.uproject
. Once the Editor is open, you should see something like the image below.
- In the
Content Browser
, create a new folder calledMods
in which all of our Logic Mods will go.
- Navigate inside the
Mods
folder and create another folder calledMyFirstMod
. This will be our mod that we'll be working on. You can also opt to use a name other thanMyFirstMod
.
- Next, we want to create a new
Blueprint Class
with a Parent Class ofActor
, which we'll callModActor
. This makes UE4SS see our mod as a LogicMod.
- Open the
ModActor
we just created and navigate to theEvent Graph
tab.
If you don't see an Event Graph
tab and instead you see the text "NOTE: This is a data only blueprint, so only the default values are shown...", Click on the blue Open Full Blueprint Editor
text at the end.
UE4SS Events
Before we continue, we'll look into a variety of different events that UE4SS provides for our Logic Mods. To use these, simply create a new custom event in your Event Graph. Below is a list of all UE4SS events.
PrintToModLoader
PrintToModLoader
is useful for printing various messages to the UE4SS Console window which you can enable in the UE4SS-Settings.ini
file by setting ConsoleEnabled = 1
under [Debug]
section.
To use PrintToModLoader
, add a new Custom Event in your Event Graph and call it PrintToModLoader
with a String parameter called Message
.
PreBeginPlay
PreBeginPlay
is called when the ModActor is spawned. You'll typically never want to use this since it's called way too early for you to be able to make use of it.
PostBeginPlay
PostBeginPlay
is called when the PlayerController's BeginPlay is called. You're generally better off just using the standard BeginPlay
.