public static void SurvivorGroupSpawn(Vector3 pos, GroupType groupType = 3, int groupSize = -1, PedTasks pedTasks = 1) { if (groupType == GroupType.Random) { int num = RandoMath.CachedRandom.Next(0, 3); if (num == 0) { groupType = GroupType.Friendly; } if (num == 1) { groupType = GroupType.Neutral; } if (num == 2) { groupType = GroupType.Hostile; } } List <Ped> list = new List <Ped>(); PedGroup group = new PedGroup(); if (groupSize == -1) { groupSize = RandoMath.CachedRandom.Next(3, 9); } int num2 = 0; while (true) { if (num2 >= groupSize) { foreach (Ped ped2 in list) { if (group.MemberCount < 1) { group.Add(ped2, true); continue; } group.Add(ped2, false); } group.FormationType = FormationType.Default; foreach (Ped ped3 in group.ToList(true)) { PlayerGroup.SetPedTasks(ped3, pedTasks); } return; } SurvivorPed ped = SurvivorSpawn(pos); if (groupType == GroupType.Friendly) { ped.pedEntity.RelationshipGroup = Relationships.FriendlyGroup; ped.pedEntity.AddBlip(); ped.pedEntity.CurrentBlip.Color = BlipColor.Blue; ped.pedEntity.CurrentBlip.Scale = 0.65f; ped.pedEntity.CurrentBlip.Name = "Friendly"; } else if (groupType == GroupType.Neutral) { ped.pedEntity.RelationshipGroup = Relationships.NeutralGroup; ped.pedEntity.AddBlip(); ped.pedEntity.CurrentBlip.Color = BlipColor.Yellow; ped.pedEntity.CurrentBlip.Scale = 0.65f; ped.pedEntity.CurrentBlip.Name = "Neutral"; } else if (groupType == GroupType.Hostile) { ped.pedEntity.RelationshipGroup = Relationships.HostileGroup; ped.pedEntity.AddBlip(); ped.pedEntity.CurrentBlip.Color = BlipColor.Red; ped.pedEntity.CurrentBlip.Scale = 0.65f; ped.pedEntity.CurrentBlip.Name = "Hostile"; } list.Add(ped.pedEntity); num2++; } }
public static void SurvivorGroupSpawn(Vector3 pos, GroupType groupType = GroupType.Random, int groupSize = -1, PedTasks pedTasks = PedTasks.Wander) { if (groupType == GroupType.Random) { int rndGroupType = RandoMath.CachedRandom.Next(0, 3); if (rndGroupType == 0) { groupType = GroupType.Friendly; } if (rndGroupType == 1) { groupType = GroupType.Neutral; } if (rndGroupType == 2) { groupType = GroupType.Hostile; } } List <Ped> peds = new List <Ped>(); PedGroup group = new PedGroup(); if (groupSize == -1) { groupSize = RandoMath.CachedRandom.Next(3, 9); } for (int i = 0; i < groupSize; i++) { SurvivorPed sPed = SurvivorSpawn(pos); if (groupType == GroupType.Friendly) { sPed.pedEntity.RelationshipGroup = Relationships.FriendlyGroup; sPed.pedEntity.AddBlip(); sPed.pedEntity.CurrentBlip.Color = BlipColor.Blue; sPed.pedEntity.CurrentBlip.Scale = 0.65f; sPed.pedEntity.CurrentBlip.Name = "Friendly"; } else if (groupType == GroupType.Neutral) { sPed.pedEntity.RelationshipGroup = Relationships.NeutralGroup; sPed.pedEntity.AddBlip(); sPed.pedEntity.CurrentBlip.Color = BlipColor.Yellow; sPed.pedEntity.CurrentBlip.Scale = 0.65f; sPed.pedEntity.CurrentBlip.Name = "Neutral"; } else if (groupType == GroupType.Hostile) { sPed.pedEntity.RelationshipGroup = Relationships.HostileGroup; sPed.pedEntity.AddBlip(); sPed.pedEntity.CurrentBlip.Color = BlipColor.Red; sPed.pedEntity.CurrentBlip.Scale = 0.65f; sPed.pedEntity.CurrentBlip.Name = "Hostile"; } peds.Add(sPed.pedEntity); } foreach (Ped ped in peds) { if (group.MemberCount < 1) { group.Add(ped, true); } else { group.Add(ped, false); } } group.FormationType = 0; List <Ped> groupPeds = group.ToList(true); foreach (Ped ped in groupPeds) { PlayerGroup.SetPedTasks(ped, pedTasks); } }