TurretSpottedPlayer
Skip to content
mnscript
TurretSpottedPlayer(Turret, Player) 

Description ​

Invoked when a turret aquires a new target

Arguments ​

Turret - The Turret
Player - The player who was spotted

Example ​

msc
using Console;
using Event;
using Peripheral;

// NOTE: Hostile players are NOT KOS!
// Making a player hostile means the turret will track them when they are close,
// and prioritize hostile players for shooting at.

// This registers an event listener for when a turret spots a new player.
// We can use this event to tell the turret whether this player is hostile or neutral.
// If we return true, the Turret will make the player neutral.
// If we return false, the Turret will make the player hostile.

function<bool> OnTurretSpottedPlayer(Turret trt, Player ply){
    Console.WriteLine(ply.GetName().." has been spotted by a turret.");

    if(ply.GetSteamID() == "STEAM_0:1:34409736"){
        // Returning false to make Ventz hostile!
        return false;
    }

    // If you return false for everyone the turret will become confused, so avoid this.

    // If it's not Ventz, return true to make the player neutral.
    return true;
}

Event.AddListener("TurretSpottedPlayer", "turret_hostile", "OnTurretSpottedPlayer");