I'm trying to make a custom gamemode event and I want to detect when the overcharge event (when the players turn on all 3 generators and press the red button) happens. I couldn't find anything similar to public override OnOvercharge(OverchargeArgs ev) in my CustomEventsHandler. Is there a way to detect when it happens and cancel it somehow? (I'm aware that Generator event listeners exist, but I would like to know when the players press the big red button).
#How to detect and cancel the overcharge event?
1 messages · Page 1 of 1 (latest)
I was under the impression that it wont trigger without an SCP-079 being present in the round. but I'm gonna test now if it works or not
yeah I just tested and it seems this event only triggers if it actually recontaining a SCP079 that is alive when the overcharge happens. It doesn't trigger when there is no SCP079 tho.
I guess I could spawn a dummy and turn him into 079, but I'm not aware of how to do that either.
It also seems like ev.IsAllowed = false doesn't prevent the overcharge from happening, only prevents the dummy scp079 from dying. The lights out and door lockdown still happens unfortunatly, which is exactly what I'm trying to prevent
Look in Scp079Recontainer, you likely need to patch
I've never done patching before, is there any documentation available for me to look at on how to start?
aight I will try making a patch then. thanks for pointing me to the right way
Np
Revolver spin event listener? ✅✅✅✅
Big red button listener? ❌❌❌❌
The answer depends on what you need to check to disable the overcharge
Under what conditions do you want to prevent it from happening?
What is your reasoning?
Here's the problem @fresh temple, if you disable the overcharge from initiating or even just prevent 079 from dying to recontainment, he becomes immortal
I'm working on a custom event that completely changes the gameplay. It's basically zombie hide and seek and if you die you become a zombie.
One of the main game mechanics is that every door is open and locked to prevent closing to reinforce fights and hiding rather than chasing and allow the survivors to loot. Unfortunatly if I have all doors open like the 079 gates, it gives them access to press the red button to close all the doors and the plugin doesnt know when it happens so I cant reopen doors or cancel the overcharge sequence completely.
I decided that it was just less effort to make sure that the 079 gates were closed for the duration of the event. Unfortunate cause it cuts of a place to hide and loot, but I will make a patch later.
private static BreakableWindow Scp079Glass = null!;
[HarmonyPrefix]
[HarmonyPatch(typeof(Scp079Recontainer), nameof(Scp079Recontainer.Start))]
public static void Start(Scp079Recontainer __instance) => Scp079Glass = __instance._activatorGlass;
public override void OnPlayerDamagingWindow(PlayerDamagingWindowEventArgs ev)
{
if (ev.Window == Scp079Glass)
ev.IsAllowed = false;
}
I should probably elaborate
That is the solution to your problem
Recontainment only triggers when that activator glass shatters
Make it so it can't be damaged => prevents recontainment
thanks! I will try to use this. Patching is a bit new to me
-
Add the Harmony reference to your plugin
-
Make a new class like this in your plugin:
[HarmonyPatch(typeof(Scp079Recontainer), nameof(Scp079Recontainer.Start))]
public class NoRecontainment : CustomEventsHandler
{
private static BreakableWindow Scp079Glass = null!;
public static void Prefix(Scp079Recontainer __instance) => Scp079Glass = __instance._activatorGlass;
public override void OnPlayerDamagingWindow(PlayerDamagingWindowEventArgs ev)
{
if (ev.Window == Scp079Glass)
ev.IsAllowed = false;
}
}
- Add this to your plugin entry:
private Harmony _harmony = new("SCP:SL Patching");
private NoRecontainment _noRecontainment = new();
- In the
Enablefunction in your plugin entry:
_harmony.PatchAll();
CustomHandlersManager.RegisterEventsHandler(_noRecontainment);
5 (Optional, but recommended). In the Disable function in your plugin entry:
_harmony.UnpatchAll(_harmony.Id);
CustomHandlersManager.UnregisterEventsHandler(_noRecontainment);