Skip to content
praydog edited this page Jan 18, 2022 · 38 revisions

This is the REFramework wiki. It will mostly serve as documentation for the upcoming scripting system.

VR Troubleshooting

Lua Scripting

REFramework comes with a scripting system using Lua.

Leveraging the RE Engine's IL2CPP implementation, REFramework gives developers powerful control over the game engine.

Lua scripting can be found here now:

Binaries: https://ci.appveyor.com/project/praydog/reframework-dev/build/artifacts

Loading a script

Manual Loading

Click on ScriptRunner from the main REFramework menu. From there, press Run Script and locate the corresponding *.lua file you wish to load.

Automatic Loading

Create an autorun folder in your game directory. REFramework will automatically load whatever *.lua scripts are in here during initialization.

Handling Lua errors

During script startup

When a Lua error occurs here, a MessageBox will pop up explaining what the error is.

During callback execution

When a Lua error occurs here, the reason will be written to a debug log. DebugView is required to view these.

We don't pop a MessageBox here so the user doesn't lock their game.

Finding game functions to call, and fields to grab

Use the ObjectExplorer that's in the developer builds. It can be found under DeveloperTools in the REFramework menu.

Poke around the singletons until you find something you're interested in.

Objects under Singletons can be obtained with sdk.get_managed_singleton("name")

Objects under Native Singletons can be obtained with sdk.get_native_singleton("name")

Do note that the Singletons (AKA Managed Singletons) are the usually the most exposed. They were originally written in C#.

Native Singletons have fields and methods exposed, but they are usually hand picked. These ones were written in C++, and have the least amount of data exposed about them.

Anything under TDB Methods or TDB Fields of something within the ObjectExplorer can be called or grabbed using the various call and field getter/setter methods found here in the wiki.

Good APIs to start on: sdk and re

Example Scripts

Side notes

Everything is subject to change and maybe refactored over time.

If there's something you find you can't do without native code, Lua can require native DLLs.

RE Engine's IL2CPP implementation is not the same as Unity's. While RE Engine and Unity have many similarities, they are not the same, and no existing tooling for Unity or IL2CPP will work on the RE Engine.

C# scripting maybe a possibility in the future for more natural interaction with the engine, but is not currently being looked at. REFramework is open source, so any developer wishing to do that can try.

While REFramework's scripting API can do all sorts of things, RE_RSZ is another powerful tool that may be more suitable in some scenarios. For example:

  • Inserting/cloning more game objects into a specific scene
  • Edits that don't require runtime awareness of the game's state
  • Time-sensitive edits to files (like something REFramework can't capture during startup)
  • Using it for base edits with an REFramework script on top for additional functionality
  • Changes that are impossible with REFramework's scripting system

Thanks

cursey for helping build the scripting system.

The Hitchhiker for testing/writing scripts/finding bugs/helpful suggestions.

alphaZomega for testing/writing scripts/finding bugs/helpful suggestions.

Discords

Modding Haven (General RE Engine modding)

Infernal Warks (DMC5 modding)

Monster Hunter Modding Discord

Clone this wiki locally