// AlphaWolf: a custom mob. Every 20 minutes an Alpha Wolf (a black wolf half again as big, four times as tough, with // more leather and fat) appears somewhere on the island, and everyone is told the map square. One at a time. // It is made from the game's wolf: same model and animations, its own name, health, damage, size, color and loot. // Admins: /alpha spawns one where you look, /alpha clear removes it. // Install: copy this file into the server's data folder, plugins/AlphaWolf.cs. // Script engine rules: test objects with != null, no static fields that change, callbacks with one parameter at most. using RustLegacy; public class AlphaWolfConfig { public float EveryMinutes { get; set; } = 20f; public float Health { get; set; } = 500f; public float Damage { get; set; } = 35f; public float Scale { get; set; } = 1.5f; public string Tint { get; set; } = "#5a5a5a"; } public class AlphaWolf : RustPlugin { AlphaWolfConfig _config; Animal _alpha; public override void OnLoaded() { _config = LoadConfig(); var mob = new PluginMob { Name = "Alpha Wolf", Base = "Wolf", Health = _config.Health, Damage = _config.Damage, Scale = _config.Scale, Speed = 1.1f, Aggressive = "yes", Tint = _config.Tint }; mob.Loot.Add( new PluginMobLoot { Item = "Leather", Min = 15, Max = 20 } ); mob.Loot.Add( new PluginMobLoot { Item = "Animal Fat", Min = 10, Max = 15 } ); mob.Loot.Add( new PluginMobLoot { Item = "Raw Chicken Breast", Min = 8, Max = 10 } ); DefineMob( mob ); AddCommand( "alpha", OnCommand, "The Alpha Wolf", true, "[clear]" ); Every( _config.EveryMinutes * 60f, Appear ); } bool Alive => _alpha != null && _alpha.IsValid && !_alpha.IsDead; void Appear() { if ( Alive ) return; var at = RustGameManager.FindSpawnPosition( Scene ); _alpha = SpawnMob( "Alpha Wolf", at ); if ( _alpha != null ) Broadcast( $"An Alpha Wolf is hunting near {MapCell( at )}." ); } void OnCommand( ChatCommand cmd ) { var p = cmd.Player; if ( cmd.Arg( 0 ) == "clear" ) { if ( _alpha != null && _alpha.IsValid ) _alpha.GameObject.Destroy(); Reply( p, "Alpha Wolf removed." ); return; } var forward = p.Controller.EyeAngles.ToRotation().Forward.WithZ( 0f ).Normal; _alpha = SpawnMob( "Alpha Wolf", p.WorldPosition + forward * 400f + Vector3.Up * 20f ); Reply( p, _alpha != null ? "Alpha Wolf spawned in front of you." : "Could not spawn it (see the console)." ); } }