public static void SetPlayer(IPlayer player, BotType botType) { if (botType == BotType.None) { return; } BotManager.SpawnBot(botType, BotFaction.None, player, player.GetTeam()); }
public static void CreateNewBot(IEnumerable <string> arguments) { if (arguments.Count() < 1) { return; } var botTypeStr = arguments.First(); var botType = BotType.None; if (SharpHelper.TryParseEnum(botTypeStr, out botType)) { arguments = arguments.Skip(1); } else { ScriptHelper.PrintMessage("--BotExtended spawn bot--", ScriptHelper.ERROR_COLOR); ScriptHelper.PrintMessage("Invalid query: " + botTypeStr, ScriptHelper.WARNING_COLOR); return; } var team = PlayerTeam.Independent; if (arguments.Any()) { if (TryParseTeam(arguments.First(), out team)) { arguments = arguments.Skip(1); } } var count = 1; if (arguments.Any()) { if (int.TryParse(arguments.First(), out count)) { count = (int)MathHelper.Clamp(count, Constants.BOT_SPAWN_COUNT_MIN, Constants.BOT_SPAWN_COUNT_MAX); } else { count = 1; } } for (var i = 0; i < count; i++) { BotManager.SpawnBot(botType, player: null, team: team, ignoreFullSpawner: true); } // Dont use the string name in case it just an index var bot = count > 1 ? " bots" : " bot"; ScriptHelper.PrintMessage("Spawned " + count + " " + SharpHelper.EnumToString(botType) + bot + " to " + team); }
private bool TurnIntoZombie() { if (Body.IsRemoved || Body.IsBurnedCorpse) { return(false); } var player = Game.CreatePlayer(Body.GetWorldPosition()); var zombieType = BotHelper.GetZombieType(Type); var oldProfile = Body.GetProfile(); var oldWeapons = BotHelper.GetWeaponSet(Body); // TODO: test gun with lazer once gurt fixed https://www.mythologicinteractiveforums.com/viewtopic.php?f=31&t=4000 ScriptHelper.LogDebug(Type, "->", zombieType); player.SetBotName(Body.Name); // NOTE: set right now so SpawnLine dialogue will show the bot name correctly var zombie = BotManager.SpawnBot(zombieType, Faction, player, BotManager.GetBot(Body).InfectTeam); var zombieBody = zombie.Player; var modifiers = Body.GetModifiers(); // Survivor has fake MaxHealth to have blood effect on the face if (Enum.GetName(typeof(BotType), BotManager.GetBot(Body).Type).StartsWith("Survivor")) { modifiers.CurrentHealth = modifiers.MaxHealth = 50; } else { modifiers.CurrentHealth = modifiers.MaxHealth * 0.75f; } zombieBody.SetModifiers(modifiers); zombieBody.SetProfile(BotHelper.ToZombieProfile(oldProfile)); BotHelper.Equip(zombieBody, oldWeapons); Body.Remove(); Body = zombieBody; Body.SetBotBehaivorActive(false); Body.AddCommand(new PlayerCommand(PlayerCommandType.StartCrouch)); IsTurningIntoZombie = true; return(true); }