Unreal
The unreal plugin makes Wraith’s tools work in Unreal Engine 4 and 5 games. It works out the engine’s names, objects and class layouts as the game starts, so it doesn’t need signatures or offsets for each version.
Wraith loads it in every Unreal game.
What it does
Section titled “What it does”- Camera. The free camera moves the player’s camera, cutscenes included.
- Look. Photo mode’s Look changes the game’s exposure, colour, effects and depth of field. Other under it sets any of the game’s post-process settings, for games that go by their own.
- Posing. Posing poses the 32 animated characters nearest the camera.
- Game speed. Game speed goes through the world’s time dilation, so the UI carries on and 0 pauses the world. A plugin for a game with its own speed can take it over.
- Ticks. Plugins’ ticks run on Unreal’s game thread.
- Console. Games that ship without a console get one back, on the game’s console key, usually
`or~. - Scene and Classes. The Workbench gets an Unreal tab with Scene in it, the world’s actors, their components and properties, and Classes, every class, struct and enum.
The Unreal service
Section titled “The Unreal service”The plugin’s Unreal.Unreal service finds objects and uses them by name, the way the Scene panel does. Its schema is schemas/unreal.sal in the plugin.
findObjects(class)andfindObject(class)find live objects of a class or one that comes from it, like"Character"or"BP_P001_C".get(object, property)andset(object, property, value)read and change a property.address(object, property)gives where it is, for thememoryarea, for the ones they can’t do.call(object, function, args)calls one of its functions, with args in order, and gives back what it returns.location,setLocation,rotationandsetRotationmove actors.nameOf,classOf,pathOf,isA,propertiesandisObjectsay what an object is.setLook(setting, field)points one of Look’s settings, like"exposure", at another post-process field, or hides it with"", for games that render from their own.lookNeeds(setting, field, value)sets another field along with it, like an intensity that turns the effect on.
Values are like { kind: "number", number: 0.5 }, with flag, integer, number, text, object or floats as the kind.
The game thread
Section titled “The game thread”Unreal frees its objects on its game thread, so the service only works there. Anywhere else it fails with WrongThread. threads.onTick runs on the game thread, and so do tweaks and Workbench scripts unless they’re moved.
An object is its address, and it’s good till Unreal’s garbage collector takes it. Find it again on a later tick rather than keeping it, or check it with isObject.
In scripts and tweaks
Section titled “In scripts and tweaks”A Workbench script or a tweak has it without depending on anything, as Unreal.unreal(). Those are JavaScript or Lua.
const ue = Unreal.unreal();
const player = ue.findObject("BP_P001_C");ue.set(player, "CustomTimeDilation", { kind: "number", number: 2 });log.info(`${ue.location(player).z}`);local ue = Unreal.unreal()
local player = ue:findObject("BP_P001_C")ue:set(player, "CustomTimeDilation", { kind = "number", number = 2 })print(ue:location(player).z)Scripts and tweaks are JavaScript or Lua, so there’s no Zig here. A Zig plugin uses it as below.
Scripts and tweaks are JavaScript or Lua, so there’s no C# here. A C# plugin uses it as below.
In plugins
Section titled “In plugins”Add "unreal" to your depends, and use it from threads.onTick. Its types are in the Unreal namespace, like Unreal.UnrealValue, and the service is Unreal.unreal(), with Unreal imported from wraith. See Sharing between plugins.
import { Wraith, Unreal } from "wraith";
const ue = Unreal.unreal();
Wraith.threads().onTick(() => { for (const light of ue.findObjects("PointLightComponent")) { ue.call(light, "SetIntensity", [{ kind: "number", number: 0 }]); }});local wraith = require("wraith")local Wraith, Unreal = wraith.Wraith, wraith.Unreal
local ue = Unreal.unreal()
Wraith.threads():onTick(function() for _, light in ipairs(ue:findObjects("PointLightComponent")) do ue:call(light, "SetIntensity", { { kind = "number", number = 0 } }) endend)const schema = @import("schema");
fn tick(self: *Plugin) void { _ = self; const ue = sdk.salamander.service(schema.Unreal.Unreal, "unreal") orelse return; const player = ue.findObject("BP_P001_C") catch return; const at = ue.location(player) catch return; _ = at;}var ue = Unreal.Unreal.Instance;
Threads.Instance.OnTick(() =>{ foreach (var light in ue.FindObjects("PointLightComponent")) { ue.Call(light, "SetIntensity", [new Unreal.UnrealValue { Kind = Unreal.UnrealValueKind.Number, Number = 0 }]); }});Its errors are thrown as UnrealErrorException.
findObjects looks through every object the game has, so find things now and then, not every tick.
wraith.io · Mods on the Hub · Get Wraith
Made with ♥ by Asgard
