You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/Development/ModLoader/BlueprintHooks.adoc
+28-4Lines changed: 28 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,14 +104,16 @@ The "Hook Implementation" option on hook nodes determines what function is invok
104
104
105
105
=== Hook Function Parameters
106
106
107
-
Hook functions parameters are populated by the hooking system based on
107
+
Hook functions parameters are populated by the hooking system based on
108
+
the target function's parameters, target class, and type of hook.
108
109
109
-
The first parameter should be the type of Blueprint you are hooking.
110
-
Subsequent parameters can be any variable that is available in the hooked function's context that the hook might want to read/write. If set to be By Ref, the type must exactly match, but otherwise a wider type can be used.
110
+
The first parameter should be named `Target` and be of the type of Blueprint you are hooking.
111
+
Subsequent parameters can be any variable that is available in the hooked function's context that the hook might want to read/write.
112
+
If set to be By Ref, the type must exactly match, but otherwise a wider type can be used.
111
113
112
114
Parameters will be mapped using their name to:
113
115
114
-
* `Target` - special hooking argument that resolves to the object instance the hooked function was running
116
+
* `Target` - special hooking argument that resolves to the object instance the hooked function was running on
115
117
* Global Variables - on the object instance
116
118
* Local Variables - function inputs, function locals, and function temps (which you can check for in a BP code dump, either via the link:#ViewingBlueprintFunctionImplementations[`-DumpBlueprintPatchingResults` launch argument] which generates pseudocode, or in xref:Development/ExtractGameFiles.adoc#FModel[FModel] which generates a json very similar to the asset dump)
117
119
* `TargetReturnValue` - special hooking argument that resolves to the hooked function's ReturnValue
@@ -136,6 +138,28 @@ If your hooks aren't triggering as expected,
136
138
check your logs for messages in the `LogBlueprintHookingCodeGen` and `LogBlueprintHookManager` categories.
137
139
A failure to attach a hook will produce a message and usually also the blueprint bytecode.
138
140
141
+
== Advanced Functionality
142
+
143
+
=== Modify Function Arguments
144
+
145
+
You can modify the arguments the hooked function receives by using a Before Hook targeting Function Entry Statement.
146
+
Add the parameter you want to modify as a By-Ref parameter on your hook function.
147
+
The initial value can be accessed via the parameter and modified by a Set By Ref node.
148
+
149
+
// === Cancel Hooked Function Execution
150
+
151
+
// TODO, see https://discord.com/channels/555424930502541343/562722670974599227/1451402917624942612
152
+
153
+
// You can (conditionally) cancel the execution of a function using a Replace hook.
154
+
// By default, Replace hooks do not execute their original target, .
155
+
// When relevant, Replace hooks will still execute their original target if the Hook Implementation returns `True` for a boolean output parameter named `ReturnValue`.
156
+
157
+
=== More!
158
+
159
+
The Blueprint Hooking system is very powerful and flexible.
160
+
The examples on this page and ExampleMod only scratch the surface of what is possible.
161
+
Please use the "Edit this Page" button in the top right to add more examples
0 commit comments