Skip to content
RustPluginGenerator

OnFrankensteinPetWake

OnFrankensteinPetWake is called when a FrankensteinTable is about to start waking the pet stored inside it, after the owner and table requirements have been checked but before the wake sequence begins.

Signature
object OnFrankensteinPetWake(FrankensteinTable frankensteinTable, BasePlayer owner)

Parameters

Hook parameters
ParameterTypeDescription
frankensteinTableFrankensteinTableThe FrankensteinTable entity that is waking its stored pet. Use it to read its position, owner, inventory or nearby entities; it is never null when the hook fires.
ownerBasePlayerThe BasePlayer who triggered the wake by using the table. Already validated as non-null by the game before the hook is called.

Return value

Return null (or nothing in a void method) to let the wake proceed normally. Return any non-null object to stop WakeFrankenstein before it sets the waking flag, locks the inventory or starts the wake coroutine, which prevents the pet from spawning.

How it works

This hook fires inside FrankensteinTable.WakeFrankenstein, which the game runs when a player interacts with a built Frankenstein Table that holds a complete pet. Before the hook is called, the game has already confirmed the interacting player is not null and that CanStartCreating(owner) returns true, so the pet is finished and the table is in a usable state. After your hook returns null, the game sets its waking flag, locks the table inventory, sends a network update and starts the DelayWakeFrankenstein coroutine that plays the animation and spawns the pet.

Use frankensteinTable for the table's position, owner ID or to inspect nearby entities, and owner for permission checks, cost deduction or chat feedback. Because the parameter types are already the concrete game classes, there is nothing to narrow by declaring a more specific type. Returning a non-null value aborts the wake entirely; this is the only injection point for this hook, so it cannot be used to modify an already-spawned pet.

Example plugin: Require a permission and a scrap fee before waking a Frankenstein pet

FrankensteinWakeFee.cs
using System.Linq;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("Frankenstein Wake Fee", "RustPluginGenerator", "1.0.0")]
    [Description("Requires a permission and a scrap fee before a Frankenstein pet can be woken from its table.")]
    public class FrankensteinWakeFee : RustPlugin
    {
        private const string PermUse = "frankensteinwakefee.use";

        private PluginConfig config;

        private class PluginConfig
        {
            [JsonProperty("Scrap cost per wake")]
            public int ScrapCost = 25;

            [JsonProperty("Require permission")]
            public bool RequirePermission = true;
        }

        protected override void LoadDefaultConfig() => config = new PluginConfig();

        protected override void LoadConfig()
        {
            base.LoadConfig();
            try
            {
                config = Config.ReadObject<PluginConfig>();
                if (config == null) throw new Exception();
            }
            catch
            {
                PrintWarning("Configuration file is invalid, using defaults");
                LoadDefaultConfig();
            }
            SaveConfig();
        }

        protected override void SaveConfig() => Config.WriteObject(config);

        protected override void LoadDefaultMessages()
        {
            lang.RegisterMessages(new Dictionary<string, string>
            {
                ["NoPermission"] = "You do not have permission to wake a Frankenstein pet.",
                ["NotEnoughScrap"] = "Waking this pet costs {0} scrap. You do not have enough.",
                ["Charged"] = "You paid {0} scrap to wake the pet."
            }, this);
        }

        private string Msg(string key, string userId = null, params object[] args) =>
            string.Format(lang.GetMessage(key, this, userId), args);

        private void Init()
        {
            permission.RegisterPermission(PermUse, this);
        }

        private object OnFrankensteinPetWake(FrankensteinTable frankensteinTable, BasePlayer owner)
        {
            if (frankensteinTable == null || owner == null) return null;

            if (config.RequirePermission && !permission.UserHasPermission(owner.UserIDString, PermUse))
            {
                owner.ChatMessage(Msg("NoPermission", owner.UserIDString));
                return true;
            }

            if (config.ScrapCost <= 0) return null;

            int held = owner.inventory.GetAmount(-932201673);
            if (held < config.ScrapCost)
            {
                owner.ChatMessage(Msg("NotEnoughScrap", owner.UserIDString, config.ScrapCost));
                return true;
            }

            var taken = new List<Item>();
            owner.inventory.Take(taken, -932201673, config.ScrapCost);
            owner.ChatMessage(Msg("Charged", owner.UserIDString, config.ScrapCost));
            return null;
        }
    }
}

The plugin charges the table owner a configurable scrap fee and requires the frankensteinwakefee.use permission before a Frankenstein pet can wake. In OnFrankensteinPetWake it reads the fee from config, checks the permission, then looks for the amount in the player's main inventory. If anything is missing, it sends a localized chat message and returns a non-null value to abort the wake; otherwise it takes the scrap and returns null so the game continues. The fee amount and message text are configurable, and messages are registered in the language file so other locales can be added later.

Common use cases

  • Gate pet waking behind a permission

    Check permission.UserHasPermission(owner.UserIDString, PermUse) and abort with a chat reply if the player lacks it. Useful on servers where only VIPs may use the Frankenstein Table.

  • Charge an item cost per wake

    Call owner.inventory.Take to remove scrap or another currency before returning null. If the player cannot pay, return a non-null value so the table stays dormant and the pet is not lost.

  • Notify nearby staff or log the event

    Use the table position to alert admins through a chat message or data file entry each time a pet is woken. Combine with OnFrankensteinPetSleep to track the full cycle.

Pitfalls

  • Returning true blocks the wake, not allows it

    The return value is only checked for being non-null; returning true, false or a string all cancel the wake. Always return null when you want the original behavior to continue.

  • The pet still exists inside the table after a cancel

    Aborting only stops this wake attempt; the complete pet remains in the table inventory. Players can retry once they meet your condition, so make the cancellation message explain what is missing.

  • Do not expect this to fire on spawned pets

    The hook runs before the animation and coroutine that create the pet entity. If you need to modify the spawned Frankenstein pet, work with it after the wake completes rather than inside this hook.

Build a plugin with OnFrankensteinPetWake

Describe what should happen and get a compiled plugin that uses this hook.

Prompt: Gate pet waking behind a permission using the OnFrankensteinPetWake hook, with a config file and a permission
Generate this plugin

Edit the prompt on the next screen. 2 free plugins a month, no card.

Last updated Oct 26, 2026. Found a mistake? Email support@rustplugingenerator.com.

Build a plugin with OnFrankensteinPetWake

Generate