1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  1. billingn06

    billingn06 Scavenger

    Hi i'm working on a server project which requires at least 50 or more Plague Villager spawns, where I can choose the X and Z position of where they spawn. (Think Day Z) but when I try to add more spawns in the mods folder (crownland.spawnpoints cfg) they don't work. I think the maximum is the set 8 spawns near plague village.

    Now I know I can spawn them manually in game using /giveall and placing down the villagers but when they die they don't respawn, and it means I'd have to be online 24/7 to spawn them in for players.

    If anybody could help it'd be appreciated or even better if they can write a plugin for this I'd be willing to be pay $20.
     
  2. billingn06

    billingn06 Scavenger

    Update on this: what would also work would be having the Gates of Hell plugin fixed(currently broken), except it spawns only plague villagers near the people and it automatically spawns them every 2-5 minutes. But I think you could just use the TimeExecute plugin to type in the command that spawns them every 2-5 minutes. Just an idea.
     
  3. billingn06

    billingn06 Scavenger

    I tried editing gates of hell plugin to get it to work but it didnt work
    Code (Text):
    #region using-directives
    using System.Collections.Generic;
    using CodeHatch.Common;
    using CodeHatch.Engine.Networking;
    using System.Linq;
    using UnityEngine;
    using CodeHatch.Engine.Events.Prefab;
    using CodeHatch.Inventory.Blueprints;
    using CodeHatch.TerrainAPI;
    #endregion
    #region Header
    namespace Oxide.Plugins
    {
        [Info("Zombies", "juk3b0x", "1.2.0")]
        public class zombies : ReignOfKingsPlugin
        #endregion
        {
            #region LanguageAPI
            private void LoadDefaultMessages()
            {
                lang.RegisterMessages(new Dictionary<string, string>
                {
                    { "NoAdmin", "You have no permission to open the gates of Hell!" },
                    { "NoArgument", "You have not set an argument for the number of spawned creatures, using default value of {0}" },
                    { "TooMany", "You cannot spawn more than 20 Villagers per Player with GatesOfHell (Server Lag)!" },
                    { "WrongConfig", "You need to activate at least one creature in the configfile to spawn it! Reload the plugin afterwards." }
                }, this);
            }
            string GetMessage(string key, string userId = null) => lang.GetMessage(key, this, userId);
            #endregion
            #region Config
            bool Zombies;
            int CreatureAmount;
            void Init() => LoadDefaultConfig();
            protected override void LoadDefaultConfig()
            {
                // General Config
                Config["Do you want zombies to spawn?"] = Zombies = GetConfig("Do you want zombies to spawn?", true);
                Config["AMOUNT of creatures to spawn"] = CreatureAmount = GetConfig("AMOUNT of creatures to spawn", 5);
                SaveConfig();
            }

            T GetConfig<T>(string name, T defaultValue) => Config[name] == null ? defaultValue : (T)System.Convert.ChangeType(Config[name], typeof(T));
            #endregion
           [ChatCommand("zombies")]
            void OpenTheGatesOfHell(Player player, string cmd, string[] input)
            {
                if (!player.HasPermission("admin")&& !player.HasPermission("mod")) { PrintToChat(player, string.Format(GetMessage("NoAdmin", player.Id.ToString()))); return;}
                string z = "villager";
                if (input.IsNullOrEmpty()) { CreatureAmount = GetConfig("AMOUNT of creatures to spawn", 5); PrintToChat(player, string.Format(GetMessage("NoArgument", player.Id.ToString())), CreatureAmount.ToString()); }
                else CreatureAmount = int.Parse(string.Concat(input));

                if (CreatureAmount > 20) { CreatureAmount = 20; PrintToChat(player, string.Format(GetMessage("TooMany", player.Id.ToString()))); }
                if (Zombies)
                {
                    timer.Repeat(3f, (CreatureAmount / 2), () =>
                    {
                        foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                        {
                            Vector3 RandomPosition = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                            Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                            SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, z);
                        }
                    });
                    timer.Repeat(3f, (CreatureAmount / 2), () =>
                    {
                        foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                        {
                            Vector3 RandomPosition = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                            Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                            SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, w);
                        }
                    });
                }
                else if (Zombies)
                {
                    timer.Repeat(3f, (CreatureAmount), () =>
                    {
                        foreach (Player connectedplayer in Server.AllPlayersExcept(Server.GetPlayerFromString("Server")))
                        {
                            Vector3 RandomPosition = Vector3Util.Randomize(connectedplayer.Entity.Position, -100, 100);
                            Vector3 RandomToSurfacePosition = new Vector3(RandomPosition.x, TerrainAPIBase.GetTerrainHeightAt(RandomPosition), RandomPosition.z);
                            SpawnSingleCreatureAroundEveryPlayer(RandomToSurfacePosition, connectedplayer, z);
                        }
                    });
                }
                else if (!Zombies) { PrintToChat(player, string.Format(GetMessage("WrongConfig", player.Id.ToString())));return; }

            }
            #region Utility
            void SpawnSingleCreatureAroundEveryPlayer(Vector3 RandomToSurfacePosition,Player player, string zw)
            {
                NetworkInstantiationArgs newNetInstArgs = new NetworkInstantiationArgs();
                newNetInstArgs.Information = InformationType.Prefab;
                newNetInstArgs.NetworkAware = true;
                newNetInstArgs.OwnerId = Server.GetPlayerByName("Server").Id;
                newNetInstArgs.SocialOwnerId = 0;
                InvItemBlueprint[] lala = new InvItemBlueprint[InvDefinitions.Instance.Blueprints.AllDefinedBlueprints.Count()];
                lala = InvDefinitions.Instance.Blueprints.AllDefinedBlueprints;
                InvItemBlueprint bptouse = new InvItemBlueprint();
                foreach (var blueprint in lala)
                {
                    if (!blueprint.Name.ToLower().Contains(zw)) continue;
                    bptouse = blueprint;
                }
                CustomNetworkInstantiate.Instantiate(bptouse, RandomToSurfacePosition, player.Entity.Rotation, newNetInstArgs);
            }
            #endregion
        }
    }