private async void SpawnRandomZombie() { Vector3 spawnPos = Utils.GetRandomSpawnPosFromPlayer(Game.Player, SpawnerHost.SPAWN_MIN_DISTANCE, SpawnerHost.SPAWN_DESPAWN_DISTANCE); if (!Utils.IsPosShitSpawn(Players, spawnPos, SpawnerHost.SPAWN_MIN_DISTANCE)) { Ped zombie = await EntityUtil.CreatePed(PedHash.Zombie01, PedType.PED_TYPE_MISSION, spawnPos); int zombieHandle = zombie.Handle; API.SetPedCombatRange(zombieHandle, 2); API.SetPedHearingRange(zombieHandle, float.MaxValue); API.SetPedCombatAttributes(zombieHandle, 46, true); API.SetPedCombatAttributes(zombieHandle, 5, true); API.SetPedCombatAttributes(zombieHandle, 1, false); API.SetPedCombatAttributes(zombieHandle, 0, false); API.SetPedCombatAbility(zombieHandle, 0); API.SetAiMeleeWeaponDamageModifier(float.MaxValue); API.SetPedRagdollBlockingFlags(zombieHandle, 4); API.SetPedCanPlayAmbientAnims(zombieHandle, false); int randHealth = Utils.GetRandomInt(1, ZOMBIE_MAX_HEALTH); zombie.MaxHealth = randHealth; zombie.Health = randHealth; zombie.Armor = Utils.GetRandomInt(ZOMBIE_MAX_ARMOR); zombie.RelationshipGroup = ZombieGroup; ZombieAttrChances(zombie); zombie.Task.WanderAround(); zombie.SetDecor(ZOMBIE_DECOR, true); zombies.Add(zombie); } }
private async void SpawnRandomRebelSquad() { Vector3 spawnPos = Utils.GetRandomSpawnPosFromPlayer(Game.Player, SpawnerHost.SPAWN_MIN_DISTANCE, SpawnerHost.SPAWN_DESPAWN_DISTANCE); if (!Utils.IsPosShitSpawn(Players, spawnPos, SpawnerHost.SPAWN_MIN_DISTANCE)) { int rebelAmount = Utils.GetRandomInt(1, REBELSQUAD_MAXMEMBERS); Ped[] rebels = new Ped[rebelAmount]; for (int i = 0; i < rebelAmount; i++) { Ped rebel = await EntityUtil.CreatePed(PedHash.Hillbilly01AMM, PedType.PED_TYPE_MISSION, spawnPos); API.SetPedCombatRange(rebel.Handle, 2); API.SetPedHearingRange(rebel.Handle, float.MaxValue); rebel.RelationshipGroup = RebelSquadGroup; rebel.Weapons.Give(WEAPON_LIST[Utils.GetRandomInt(WEAPON_LIST.Length)], int.MaxValue, true, true); rebel.Accuracy = 100; rebel.Armor = 100; rebel.Task.WanderAround(); rebel.SetDecor(REBELSQUAD_DECOR, true); rebels[i] = rebel; } RebelSquadGroup.SetRelationshipBetweenGroups(ZombieSpawner.ZombieGroup, Relationship.Hate, true); RebelSquadGroup.SetRelationshipBetweenGroups(ArmyHeliSquadSpawner.ArmyHeliSquadGroup, Relationship.Hate, true); rebelSquad = new RebelSquad(rebels); } }
public static async Task <Ped> CreateNeutralEnemyPed(Model model, Vector3 pos, float heading = 0f, WeaponHash weaponHash = WeaponHash.Unarmed) { Ped ped = await EntityUtil.CreatePed(model, PedType.PED_TYPE_MISSION, pos, heading); if (weaponHash != WeaponHash.Unarmed) { ped.Weapons.Give(weaponHash, int.MaxValue, false, true); } ped.RelationshipGroup = RelationshipsHolder.NeutralEnemyPeds; ped.IsEnemy = true; API.SetPedEnemyAiBlip(ped.Handle, true); API.HideSpecialAbilityLockonOperation(ped.Handle, false); return(ped); }
private async Task <Ped> CreateWarehousePed(Model model, Vector3 pos, float heading = 0f) { model.Request(); while (!model.IsLoaded) { await Delay(1); } Ped ped = await EntityUtil.CreatePed(model, PedType.PED_TYPE_SPECIAL, pos, heading, false); ped.RelationshipGroup = RelationshipsHolder.WarehousePeds; ped.CanRagdoll = false; ped.AlwaysKeepTask = true; peds.Add(ped); return(ped); }
private async void SpawnRandomArmyHeli() { Vector3 spawnPos = Utils.GetRandomSpawnPosFromPlayer(Game.Player, SpawnerHost.SPAWN_DESPAWN_DISTANCE, SpawnerHost.SPAWN_DESPAWN_DISTANCE * 2); spawnPos.Z += Utils.GetRandomInt(ARMYHELI_SPAWNHEIGHT_MIN_OFFSET, ARMYHELI_SPAWNHEIGHT_MAX_OFFSET); if (!Utils.IsPosShitSpawn(Players, spawnPos, SpawnerHost.SPAWN_DESPAWN_DISTANCE)) { Vehicle heli = await EntityUtil.CreateVehicle(HELI_LIST[Utils.GetRandomInt(HELI_LIST.Length)], spawnPos, Utils.GetRandomInt(360)); heli.IsInvincible = true; heli.IsEngineRunning = true; Ped pilot = await EntityUtil.CreatePed(PedHash.Blackops01SMY, PedType.PED_TYPE_MISSION, spawnPos); pilot.IsInvincible = true; pilot.RelationshipGroup = ArmyHeliSquadGroup; pilot.SetIntoVehicle(heli, VehicleSeat.Driver); pilot.AlwaysKeepTask = true; pilot.SetDecor(ARMYHELI_DECOR, true); Vector3 targetPos = Game.PlayerPed .GetOffsetPosition(new Vector3(0f, -SpawnerHost.SPAWN_DESPAWN_DISTANCE * 100f, 0f)); API.TaskHeliMission(pilot.Handle, heli.Handle, 0, 0, targetPos.X, targetPos.Y, targetPos.Z, 4, Utils.GetRandomInt(ARMYHELI_MIN_SPEED, int.MaxValue), 0f, -1f, -1, -1, 0, 0); Ped[] gunmans = new Ped[2]; for (int i = 0; i < gunmans.Length; i++) { Ped gunman = await World.CreatePed(PedHash.Blackops01SMY, spawnPos); gunman.IsInvincible = true; gunman.RelationshipGroup = ArmyHeliSquadGroup; gunman.Weapons.Give(WeaponHash.CombatMGMk2, int.MaxValue, true, true); gunman.Accuracy = 100; gunman.AlwaysKeepTask = true; gunman.Task.FightAgainstHatedTargets(float.MaxValue); gunman.SetDecor(ARMYHELI_DECOR, true); gunmans[i] = gunman; } gunmans[0].SetIntoVehicle(heli, VehicleSeat.LeftRear); gunmans[1].SetIntoVehicle(heli, VehicleSeat.RightRear); ArmyHeliSquadGroup.SetRelationshipBetweenGroups(ZombieSpawner.ZombieGroup, Relationship.Hate); armyHeliSquad = new ArmyHeliSquad(heli, pilot, gunmans[0], gunmans[1]); } }
private async void SpawnRandomFlyingByPlane() { Vector3 spawnPos = Utils.GetRandomSpawnPosFromPlayer(Game.Player, SpawnerHost.SPAWN_DESPAWN_DISTANCE, SpawnerHost.SPAWN_DESPAWN_DISTANCE * 2); spawnPos.Z += Utils.GetRandomInt(PLANE_SPAWNHEIGHT_MIN_OFFSET, PLANE_SPAWNHEIGHT_MAX_OFFSET); if (!Utils.IsPosShitSpawn(Players, spawnPos, SpawnerHost.SPAWN_DESPAWN_DISTANCE)) { Vehicle plane = await EntityUtil.CreateVehicle(PLANE_LIST[Utils.GetRandomInt(PLANE_LIST.Length)], spawnPos, Utils.GetRandomInt(360)); plane.IsInvincible = true; plane.IsEngineRunning = true; Ped pilot = await EntityUtil.CreatePed(PedHash.Pilot01SMM, PedType.PED_TYPE_MISSION, spawnPos); pilot.IsInvincible = true; pilot.SetIntoVehicle(plane, VehicleSeat.Driver); pilot.AlwaysKeepTask = true; pilot.Task.FleeFrom(pilot.GetOffsetPosition(new Vector3(0f, -10f, 10f))); flyingByPlane = new FlyingByPlane(plane, pilot); } }