private void OnPedDeleted(AdvancedPed sender) { if (Blip) { Blip.Delete(); } }
protected override void CreateInternal(out Vehicle vehicle, out AdvancedPed[] peds) { vehicle = EntityCreator.CreateEMSVehicle(SpawnLocation.Position, SpawnLocation.Heading); int seats = Math.Min(vehicle.PassengerCapacity + 1, 2); Paramedics = new Paramedic[seats]; peds = new AdvancedPed[seats]; for (int i = 0; i < seats; i++) { Paramedic p = new Paramedic(Vector3.Zero, 0.0f); p.PreferedVehicleSeatIndex = i - 1; p.Ped.WarpIntoVehicle(vehicle, i - 1); Paramedics[i] = p; peds[i] = p; } }
protected override void CreateInternal(out Vehicle vehicle, out AdvancedPed[] peds) { vehicle = EntityCreator.CreateFirefighterVehicle(SpawnLocation.Position, SpawnLocation.Heading, FirefighterRole.Engine); int seats = Math.Min(vehicle.PassengerCapacity + 1, 4); Firefighters = new Firefighter[seats]; peds = new AdvancedPed[seats]; for (int i = 0; i < seats; i++) { Firefighter f = new Firefighter(Vector3.Zero, 0.0f); f.PreferedVehicleSeatIndex = i - 1; f.Ped.WarpIntoVehicle(vehicle, i - 1); f.Equipment.SetEquipped <FireGearEquipment>(false); Firefighters[i] = f; peds[i] = f; } }
private void GiveTasks(bool allShouldReceiveTask) { AdvancedPed chattingPed1 = null, chattingPed2 = null; if (Plugin.Random.Next(100) < 70) { chattingPed1 = MathHelper.Choose(Unit.Peds); chattingPed2 = MathHelper.Choose(Unit.Peds.Where(f => f != chattingPed1).ToArray()); chattingPed1.Ped.Tasks.Clear(); chattingPed2.Ped.Tasks.Clear(); Vector3 targetPos = chattingPed1.Ped.GetOffsetPositionFront(1.5f); chattingPed2.AI.WalkTo(targetPos, targetPos.GetHeadingTowards(chattingPed1.Ped), 1.0f).Finished += (t, aborted) => { NativeFunction.Natives.TaskChatToPed(chattingPed1.Ped, chattingPed2.Ped, 16, 0f, 0f, 0f, 0f, 0f); NativeFunction.Natives.TaskChatToPed(chattingPed2.Ped, chattingPed1.Ped, 16, 0f, 0f, 0f, 0f, 0f); }; } foreach (AdvancedPed a in Unit.Peds) { if (a != chattingPed1 && a != chattingPed2 && (allShouldReceiveTask || Plugin.Random.Next(101) < Plugin.Random.Next(10, 50))) { a.AI.WalkTo((MathHelper.Choose(Unit.Vehicle.FrontPosition, Unit.Vehicle.RearPosition, Unit.Vehicle.RightPosition, Unit.Vehicle.LeftPosition)).Around2D(2.5f, 8f), MathHelper.GetRandomSingle(0f, 360f), 1.0f).Finished += (t, aborted) => { switch (Plugin.Random.Next(4)) { default: case 0: NativeFunction.Natives.TaskUseMobilePhone(t.Ped, 1, MathHelper.Choose(0, 1, 2)); break; case 1: NativeFunction.Natives.TaskStartScenarioInPlace(t.Ped, "WORLD_HUMAN_SMOKING", 0, true); break; case 2: NativeFunction.Natives.TaskStartScenarioInPlace(t.Ped, "WORLD_HUMAN_HANG_OUT_STREET", 0, true); break; case 3: NativeFunction.Natives.TaskStartScenarioInPlace(t.Ped, "WORLD_HUMAN_STAND_IMPATIENT", 0, true); break; } }; } } }
internal AIController(AdvancedPed owner) { Owner = owner; }