Skip to content
RustPluginGenerator

OnNpcRadioChatter

OnNpcRadioChatter is called on a ScientistNPC right before it plays a radio voice effect and schedules the next one. Returning a non-null value suppresses the chatter for that cycle.

Signature
object OnNpcRadioChatter(ScientistNPC scientistNPC)

Parameters

Hook parameters
ParameterTypeDescription
scientistNPCScientistNPCThe ScientistNPC whose radio chatter is about to play. Use it to check position, owner, health or identity, and null-check before reading any member.

Return value

Returning null lets the original code run: the random radio effect plays and the next chatter is queued. Returning any non-null value skips both the effect and the QueueRadioChatter() reschedule for that cycle, so the NPC is silent this time.

How it works

The hook fires inside ScientistNPC.PlayRadioChatter, the method that emits the radio voice line scientists use to signal each other. When it runs, the NPC has already checked that it is not destroyed and not stuck with a null transform; if either is true the scheduled invoke is cancelled instead. Otherwise Oxide calls the hook, and only if nothing is returned does the game run a random effect from RadioChatterEffects at the NPC's head bone and then call QueueRadioChatter() to schedule the next line.

The single argument is the ScientistNPC instance. Read-only inspection (position, OwnerID, IsNpc, nearby players) is all you need for most features. There is no narrower type to declare here: the parameter is already the concrete scientist class, and Oxide will simply not call your method if the argument is not a ScientistNPC, which in practice is never.

Because the hook fires on a repeating per-NPC schedule, keep the body cheap. Cache any global toggle is a const or plugin field instead of recomputing it per call, and never print to console from inside it. Suppression is per call, so skipping one cycle only delays the next chatter until the NPC's queue runs again.

Example plugin: Silence scientist radio chatter with a console toggle

NpcRadioMute.cs
using UnityEngine;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Core;

namespace Oxide.Plugins
{
    [Info("NpcRadioMute", "RustPluginGenerator", "1.0.0")]
    [Description("Allows admins to silence scientist NPC radio chatter at runtime.")]
    public class NpcRadioMute : RustPlugin
    {
        private const string PermAdmin = "npcradiomute.admin";

        private PluginConfig config;
        private bool muted;

        private class PluginConfig
        {
            [JsonProperty("Muted on load")]
            public bool MutedOnLoad { get; set; } = 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>
            {
                ["Muted"] = "NPC radio chatter is now muted.",
                ["Unmuted"] = "NPC radio chatter is now audible.",
                ["NoPerm"] = "You do not have permission to use this command."
            }, this);
        }

        private string Msg(string key, string userId = null) => lang.GetMessage(key, this, userId);

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

        private void OnServerInitialized()
        {
            muted = config.MutedOnLoad;
        }

        private object OnNpcRadioChatter(ScientistNPC scientistNPC)
        {
            if (scientistNPC == null) return null;
            if (!muted) return null;

            // Non-null return stops the effect and the reschedule.
            return true;
        }

        [ConsoleCommand("npcradio.toggle")]
        private void CmdToggle(ConsoleSystem.Arg arg)
        {
            var player = arg.Player();
            if (player != null && !player.IsAdmin && !permission.UserHasPermission(player.UserIDString, PermAdmin))
            {
                SendReply(player, Msg("NoPerm", player.UserIDString));
                return;
            }

            muted = !muted;
            string key = muted ? "Muted" : "Unmuted";
            if (player != null) SendReply(player, Msg(key, player.UserIDString));
            else arg.ReplyWith(Msg(key));
        }
    }
}

The plugin suppresses all NPC radio chatter while a runtime flag is enabled. OnNpcRadioChatter returns a non-null value whenever Muted is true, which stops the effect and the reschedule of the next line, so scientists go quiet. A console command npcradio.toggle flips the flag and reports the new state to the caller; it stays safe when run from RCON because it replies through arg.ReplyWith. The initial state comes from the config file, and the flag persists in memory only, so a reload restores the configured default. Message text is registered through the language API so admins can localize the toggle response.

Common use cases

  • Global mute switch

    Give admins a command to silence scientist radio chatter on quiet or roleplay-focused servers without removing NPCs.

  • Zoning rules

    Return a value when the scientist is inside a radius around a monument or base where radio effects should not play, keeping the area silent.

  • Event control

    Suppress chatter while a custom PvE event is running so that the audio cues do not give away scientist positions to players.

Pitfalls

  • Returning a value cancels the reschedule

    The original method also queues the next chatter. A non-null return skips that step, so a permanently muted NPC may stop scheduling radio chatter until it is re-queued by other game logic.

  • Fires repeatedly per NPC

    Each scientist cycles through this method on its own timer. Keep the body cheap and never log or print from it, or you will flood the server output.

  • Null-check the argument

    Although the game guards against destroyed NPCs before the hook fires, defensive null checks on scientistNPC avoid errors if other plugins call the method directly.

Build a plugin with OnNpcRadioChatter

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

Prompt: Global mute switch using the OnNpcRadioChatter 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 OnNpcRadioChatter

Generate