#How to detect and cancel the overcharge event?

1 messages · Page 1 of 1 (latest)

fresh temple
#

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).

copper cloak
fresh temple
#

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

fresh temple
#

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

copper cloak
#

Look in Scp079Recontainer, you likely need to patch

fresh temple
copper cloak
#

I think Jesus-QC has a tutorial on transpilers but for now, stick to a prefix

fresh temple
#

aight I will try making a patch then. thanks for pointing me to the right way

copper cloak
#

Np

fresh temple
#

Revolver spin event listener? ✅✅✅✅
Big red button listener? ❌❌❌❌

wild flint
#

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

fresh temple
#

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.

wild flint
wild flint
#

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

fresh temple
#

thanks! I will try to use this. Patching is a bit new to me

wild flint
# fresh temple thanks! I will try to use this. Patching is a bit new to me
  1. Add the Harmony reference to your plugin

  2. 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;   
    }
}
  1. Add this to your plugin entry:
private Harmony _harmony = new("SCP:SL Patching");
private NoRecontainment _noRecontainment = new();
  1. In the Enable function 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);