PREREQUISITES
1. Load the UnityEngine and DaggerfallWorkshop.Game namespaces in your mod, you can achieve this by adding the following lines at the top of your mod class file:
Code: Select all
using UnityEngine;
using DaggerfallWorkshop.Game;
3. Your mod class will need methods that handle the custom activation, they need to be set up as follows:
Code: Select all
private static void ExampleActivation(RaycastHit hit) {
//Your code here
}
Code: Select all
//For flats
PlayerActivate.RegisterCustomActivation(mod, 211, 20, ExampleActivation);
//For models
PlayerActivate.RegisterCustomActivation(mod, 41005, ExampleActivation);
LOAD PRIORITY
The RegisterCustomActivation method adheres to the load order priority for mods and will log any failed registration to the output_log so check there if you have trouble getting your activations registered.
Look for the following line: 'Denied custom activation registration from <Mod1> for <ObjectName> | <Mod2> has higher load priority'
This will tell you what mod is interfering with your registration.
I have put up a demo version that showcases the functionality through a mod: https://github.com/BadLuckBurt/dfu-cust ... o/releases. To try this showcase, go to the Daggerfall region and search for 'Custom' on the travel map, it's a tiny dungeon that consists of 1 room with various objects you can activate.
The source.zip on the release page contains the entire mod, the master branch on Github already contains code for the next stage: custom dialog buttons but until that is merged, it won't be compatible with the main DFU release.