public override void End() { state = EHostageSituationState.End; if (suspect.Exists()) { suspect.Dismiss(); } if (hostage.Exists()) { hostage.Dismiss(); } if (suspectBlip.Exists()) { suspectBlip.Delete(); } if (hostageBlip.Exists()) { hostageBlip.Delete(); } if (isPursuitInitiated) { Functions.ForceEndPursuit(pursuit); } base.End(); }
public override void Process() { if (state == EHostageSituationState.EnRoute && Vector3.Distance(Game.LocalPlayer.Character.Position, suspect.Position) < 16.5f) { state = EHostageSituationState.OnScene; Scenario(); } if (((!suspect.IsPlayingAnimation(GrabHostageAnimDict, SuspectGrabAnimName) || !hostage.IsPlayingAnimation(GrabHostageAnimDict, HostageGrabbedAnimName)) || (suspect.IsRagdoll || hostage.IsRagdoll)) && arePedsPlayingAnim) { hostage.Tasks.Clear(); suspect.Tasks.Clear(); hostage.ReactAndFlee(suspect); GameFiber.Sleep(1000); if (Globals.Random.Next(4) <= 2) { suspect.Tasks.FightAgainst(Game.LocalPlayer.Character); } else { suspect.ReactAndFlee(Game.LocalPlayer.Character); } arePedsPlayingAnim = false; } if (!suspect.Exists() || suspect.IsDead || Functions.IsPedArrested(suspect)) { this.End(); } base.Process(); }
public override bool OnCalloutAccepted() { state = EHostageSituationState.EnRoute; suspect.Tasks.PlayAnimation(GrabHostageAnimDict, SuspectGrabAnimName, 6.0f, AnimationFlags.Loop); hostage.Tasks.PlayAnimation(GrabHostageAnimDict, HostageGrabbedAnimName, 6.0f, AnimationFlags.Loop); arePedsPlayingAnim = true; suspect.Inventory.GiveNewWeapon(pistols.GetRandomElement(true), 999, true); hostage.Position = suspect.GetOffsetPosition(new Vector3(0f, 0.14445f, 0f)); hostageBlip = new Blip(hostage); hostageBlip.Color = Color.LightBlue; hostageBlip.Scale = 0.75f; suspectBlip = new Blip(suspect); return(base.OnCalloutAccepted()); }
public void Scenario() { int situation = Globals.Random.Next(0, 3); state = EHostageSituationState.Scenario; Logger.LogTrivial(this.GetType().Name, "Scenario: " + situation); hostage.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Speech.GENERIC_SHOCKED_HIGH : Speech.GENERIC_SHOCKED_MED : Speech.GENERIC_FRIGHTENED_HIGH : Speech.GENERIC_FRIGHTENED_MED); suspect.PlayAmbientSpeech(Globals.Random.Next(2) == 1 ? Globals.Random.Next(2) == 1 ? Speech.GENERIC_FUCK_YOU : Speech.GENERIC_INSULT_HIGH : Speech.GENERIC_INSULT_MED); if (situation == 0) { GameFiber.StartNew(delegate { if (suspect.IsAlive) { Game.DisplaySubtitle("~r~Suspect: ~s~Get out of here, this isn't your problem!", 7000); } GameFiber.Sleep(Globals.Random.Next(4250, 17500)); if (suspect.Exists() && suspect.IsAlive && !Functions.IsPedArrested(suspect) && !Functions.IsPedGettingArrested(suspect) && arePedsPlayingAnim) { NativeFunction.Natives.SET_PED_SHOOTS_AT_COORD(suspect, 0.0f, 0.0f, 0.0f, 0); WildernessCallouts.Common.StartParticleFxNonLoopedOnEntity("scr_solomon3", "scr_trev4_747_blood_impact", hostage, new Vector3(0.0f, 0.0f, 0.6f), new Rotator(90.0f, 0.0f, 0.0f), 0.235f); hostage.Kill(); hostage.Tasks.Clear(); suspect.Tasks.Clear(); if (Globals.Random.Next(4) <= 2) { suspect.Tasks.FightAgainst(Game.LocalPlayer.Character); } else { suspect.ReactAndFlee(Game.LocalPlayer.Character); } //suspect.BlockPermanentEvents = false; //hostage.BlockPermanentEvents = false; pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(pursuit, suspect); Functions.SetPursuitIsActiveForPlayer(pursuit, true); isPursuitInitiated = true; } }); } else if (situation == 1) { GameFiber.StartNew(delegate { if (suspect.Exists() && suspect.IsAlive && !Functions.IsPedArrested(suspect) && !Functions.IsPedGettingArrested(suspect) && arePedsPlayingAnim) { GameFiber.Sleep(450); Game.DisplaySubtitle("~r~Suspect: ~s~F**k!", 7000); GameFiber.Sleep(795); //suspect.Tasks.PlayAnimation("reaction@shove", "shove_var_a", 8.0f, AnimationFlags.None); suspect.Tasks.Clear(); GameFiber.Sleep(100); //NativeFunction.CallByName<uint>("TASK_PLAY_ANIM", suspect, "reaction@shove", "shove_var_a", 8f, -4f, 2000, 48, 0f, false, false, false); suspect.Tasks.PlayAnimation("reaction@shove", "shove_var_a", -1, 2.1225f, 1.0f, 0.0f, AnimationFlags.None); GameFiber.Sleep(750); GameFiber.StartNew(delegate { hostage.Tasks.PlayAnimation("dead@fall", "dead_land_up", -1, 2.28f, 1.0f, 0.0f, AnimationFlags.None).WaitForCompletion(); NativeFunction.Natives.SET_PED_TO_RAGDOLL(hostage, 3500, 5000, 0, true, true, false); GameFiber.Sleep(4000); hostage.ReactAndFlee(suspect); }); suspect.Tasks.Clear(); if (Globals.Random.Next(4) <= 2) { suspect.Tasks.FightAgainst(Game.LocalPlayer.Character); } else { suspect.ReactAndFlee(Game.LocalPlayer.Character); } pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(pursuit, suspect); Functions.SetPursuitIsActiveForPlayer(pursuit, suspect); isPursuitInitiated = true; } }); } else if (situation == 2) { GameFiber.StartNew(delegate { if (suspect.IsAlive) { Game.DisplaySubtitle("~r~Suspect: ~s~Stay away or I will shoot!", 7000); } while (Vector3.Distance(Game.LocalPlayer.Character.Position, suspect.Position) > 8.0f && state != EHostageSituationState.End) { GameFiber.Yield(); } if (state != EHostageSituationState.End) { if (suspect.Exists() && suspect.IsAlive && !Functions.IsPedArrested(suspect) && !Functions.IsPedGettingArrested(suspect) && arePedsPlayingAnim) { NativeFunction.Natives.SET_PED_SHOOTS_AT_COORD(suspect, 0.0f, 0.0f, 0.0f, 0); WildernessCallouts.Common.StartParticleFxNonLoopedOnEntity("scr_solomon3", "scr_trev4_747_blood_impact", hostage, new Vector3(0.0f, 0.0f, 0.6f), new Rotator(90.0f, 0.0f, 0.0f), 0.235f); hostage.Kill(); hostage.Tasks.Clear(); suspect.Tasks.Clear(); suspect.ReactAndFlee(Game.LocalPlayer.Character); //suspect.BlockPermanentEvents = false; //hostage.BlockPermanentEvents = false; pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(pursuit, suspect); Functions.SetPursuitIsActiveForPlayer(pursuit, true); isPursuitInitiated = true; } } }); } }