public void CreateScenario(int scenario) { GameFiber.StartNew(delegate { Logger.LogTrivial(this.GetType().Name, "Scenario: " + scenario); if (scenario == 1) // SHOOT { Logger.LogDebug(this.GetType().Name, "Scenario: Shoot"); ped.Inventory.GiveNewWeapon(weaponAssets.GetRandomElement(true), 9999, true); Vector3 posToShoot = ped.Position + (ped.ForwardVector * MathHelper.GetRandomSingle(1.5f, 8.0f)) + (ped.UpVector * MathHelper.GetRandomSingle(8.0f, 20.0f)) + (ped.RightVector * MathHelper.GetRandomSingle(-15.0f, 15.0f)); NativeFunction.CallByName <uint>("TASK_SHOOT_AT_COORD", ped, posToShoot.X, posToShoot.Y, posToShoot.Z, -1, (uint)Rage.FiringPattern.BurstFire); } else if (scenario == 2) // PROTEST { Logger.LogDebug(this.GetType().Name, "Scenario: Protest"); ped.Tasks.PlayAnimation("special_ped@griff@monologue_1@monologue_1e", "iamnotaracist_4", 5.0f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); ped.Tasks.Wander(); pedObj = new Rage.Object("prop_cs_protest_sign_01", Vector3.Zero); pedObj.AttachToEntity(ped, ped.GetBoneIndex(PedBoneId.RightPhHand), Vector3.Zero, Rotator.Zero); GameFiber.StartNew(delegate { //GameFiber.StartNew(delegate //{ // while (!hasEnded && ped.Exists() && ped.IsAlive && !Functions.IsPedArrested(ped)) // { // if (Vector3.Distance(Game.LocalPlayer.Character.Position, ped.Position) < 17.5f) // { // if (new Random().Next(0, 151) < 20) // { // string[] protestSpeeches = { "GENERIC_CURSE_MED", "GENERIC_CURSE_HIGH", "GENERIC_FUCK_YOU" }; // ped.PlayAmbientSpeech(null, protestSpeeches[new Random().Next(protestSpeeches.Length)], 0, SpeechModifier.Force); // } // GameFiber.Sleep(2500); // } // GameFiber.Yield(); // } //}); GameFiber.Sleep(125); while (ped.IsPlayingAnimation("special_ped@griff@monologue_1@monologue_1e", "iamnotaracist_4") && ped.IsPersistent) { GameFiber.Yield(); } if (!hasEnded && pedObj.Exists()) { pedObj.Detach(); } if (!hasEnded && pedObj.Exists()) { pedObj.Dismiss(); } }); } else if (scenario == 3) // DRUNK NUDE GUY { Logger.LogDebug(this.GetType().Name, "Scenario: Drunk nude guy"); ped.SetMovementAnimationSet("move_m@drunk@verydrunk"); ped.Tasks.Wander(); } else if (scenario == 4) // GUITARRIST { Logger.LogDebug(this.GetType().Name, "Scenario: Guitarrist"); ped.Tasks.PlayAnimation("amb@world_human_musician@guitar@male@base", "base", 5.0f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); ped.Tasks.Wander(); pedObj = new Rage.Object(guitarModels.GetRandomElement(true), Vector3.Zero); pedObj.AttachToEntity(ped, ped.GetBoneIndex(PedBoneId.LeftPhHand), Vector3.Zero, Rotator.Zero); GameFiber.StartNew(delegate { GameFiber.Sleep(500); while (ped.IsPlayingAnimation("amb@world_human_musician@guitar@male@base", "base") && ped.IsPersistent) { GameFiber.Yield(); } if (!hasEnded && pedObj.Exists()) { pedObj.Detach(); } if (!hasEnded && pedObj.Exists()) { pedObj.Dismiss(); } }); } else if (scenario == 5) // TOPLESS GIRL { Logger.LogDebug(this.GetType().Name, "Scenario: Topless girl"); ped.Tasks.PlayAnimation("amb@world_human_prostitute@hooker@base", "base", 5.0f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); ped.Tasks.Wander(); } else if (scenario == 6) // SUNBATHE { Logger.LogDebug(this.GetType().Name, "Scenario: Sunbathe"); AnimationDictionary maleAnimDict = sunbatheMale.GetRandomElement(true); AnimationDictionary femaleAnimDict = sunbatheFemale.GetRandomElement(true); if (ped.IsMale) { ped.Tasks.PlayAnimation(maleAnimDict, "base", 2.0f, AnimationFlags.Loop); } else if (ped.IsFemale) { ped.Tasks.PlayAnimation(femaleAnimDict, "base", 2.0f, AnimationFlags.Loop); } ped.BlockPermanentEvents = true; GameFiber.StartNew(delegate { GameFiber.Sleep(500); if (ped.IsMale) { while (ped.IsPlayingAnimation(maleAnimDict, "base") && ped.IsPersistent) { GameFiber.Yield(); } if (!hasEnded && ped.Exists()) { ped.BlockPermanentEvents = false; } } else if (ped.IsFemale) { while (ped.IsPlayingAnimation(femaleAnimDict, "base") && ped.IsPersistent) { GameFiber.Yield(); } if (!hasEnded && ped.Exists()) { ped.BlockPermanentEvents = false; } } }); } else if (scenario == 7) // FREAK OUT GUY { Logger.LogDebug(this.GetType().Name, "Scenario: Freak out guy"); string animName = monkeyFreakOutAnimNames.GetRandomElement(); ped.Tasks.PlayAnimation("missfbi5ig_30monkeys", animName, 5.0f, AnimationFlags.Loop); ped.BlockPermanentEvents = true; GameFiber.StartNew(delegate { GameFiber.Sleep(500); while (ped.IsPlayingAnimation("missfbi5ig_30monkeys", animName) && ped.IsPersistent && ped.Exists()) { GameFiber.Yield(); } if (!hasEnded && ped.Exists()) { ped.BlockPermanentEvents = false; } }); } else if (scenario == 8) // EPSILON { Logger.LogDebug(this.GetType().Name, "Scenario: Epsilon"); ped.Tasks.PlayAnimation("rcmepsilonism3", "ep_3_rcm_marnie_meditating", 2.0f, AnimationFlags.Loop); ped.BlockPermanentEvents = true; GameFiber.StartNew(delegate { GameFiber.Sleep(500); while (!hasEnded) { if (ped.Exists()) { if (Vector3.Distance(Game.LocalPlayer.Character.Position, ped.Position) < 6.0f) { if (ped.IsMale) { ped.PlayAmbientSpeech(epsilonVoicesMale.GetRandomElement(), "KIFFLOM_GREET", 0, SpeechModifier.Force); } else { ped.PlayAmbientSpeech(epsilonVoicesFemale.GetRandomElement(), "KIFFLOM_GREET", 0, SpeechModifier.Force); } break; } } GameFiber.Yield(); } if (!hasEnded && ped.Exists()) { ped.BlockPermanentEvents = false; } }); } else if (scenario == 9) // BONGOS { Logger.LogDebug(this.GetType().Name, "Scenario: Bongos"); ped.Tasks.PlayAnimation("amb@world_human_musician@bongos@male@idle_a", "idle_a", 5.0f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); ped.Tasks.Wander(); pedObj = new Rage.Object(bongosModel, Vector3.Zero); pedObj.AttachToEntity(ped, ped.GetBoneIndex(PedBoneId.LeftPhHand), Vector3.Zero, Rotator.Zero); GameFiber.StartNew(delegate { GameFiber.Sleep(500); while (ped.IsPlayingAnimation("amb@world_human_musician@bongos@male@idle_a", "idle_a") && ped.IsPersistent && ped.Exists()) { GameFiber.Yield(); } if (!hasEnded && pedObj.Exists()) { pedObj.Detach(); } if (!hasEnded && pedObj.Exists()) { pedObj.Dismiss(); } }); } else if (scenario == 10) // BEGGER { Logger.LogDebug(this.GetType().Name, "Scenario: Begger"); string[] idles = { "idle_a", "idle_b", "idle_c" }; string idleUsed = idles.GetRandomElement(); ped.Tasks.PlayAnimation("amb@world_human_bum_freeway@male@idle_a", idleUsed, 5.0f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); ped.Tasks.Wander(); pedObj = new Rage.Object(beggersSignModels.GetRandomElement(), Vector3.Zero); pedObj.AttachToEntity(ped, ped.GetBoneIndex(PedBoneId.RightPhHand), Vector3.Zero, Rotator.Zero); GameFiber.StartNew(delegate { GameFiber.Sleep(125); while (ped.IsPlayingAnimation("amb@world_human_bum_freeway@male@idle_a", idleUsed) && ped.IsPersistent && ped.Exists()) { GameFiber.Yield(); } if (!hasEnded && pedObj.Exists()) { pedObj.Detach(); } if (!hasEnded && pedObj.Exists()) { pedObj.Dismiss(); } }); } else if (scenario == 11) // NUDE GIRL CHEERING { Logger.LogDebug(this.GetType().Name, "Scenario: Topless girl cheering"); char[] letters = { 'a', 'b', 'c', 'd' }; ped.Tasks.PlayAnimation("amb@world_human_cheering@female_" + letters.GetRandomElement(), "base", 5.0f, AnimationFlags.Loop); } else if (scenario == 12) // Pushups { Logger.LogDebug(this.GetType().Name, "Scenario: Pushups"); Tuple <AnimationDictionary, string>[] anims = { new Tuple <AnimationDictionary, string>("amb@world_human_push_ups@male@idle_a", "idle_d"), new Tuple <AnimationDictionary, string>("amb@world_human_push_ups@male@base", "base") }; Tuple <AnimationDictionary, string> animUsed = anims.GetRandomElement(); ped.Tasks.PlayAnimation(animUsed.Item1, animUsed.Item2, 2.0f, AnimationFlags.Loop); ped.BlockPermanentEvents = true; GameFiber.StartNew(delegate { GameFiber.Sleep(500); while (ped.IsPlayingAnimation(animUsed.Item1, animUsed.Item2) && ped.IsPersistent && ped.Exists()) { GameFiber.Yield(); } if (!hasEnded && ped.Exists()) { ped.BlockPermanentEvents = false; } }); } }); }
public static void EnableBinoculars() { GameFiber.StartNew(delegate { _isActive = true; Rage.Object binocular = new Rage.Object("prop_binoc_01", Game.LocalPlayer.Character.Position); binocular.AttachToEntity(Game.LocalPlayer.Character, Game.LocalPlayer.Character.GetBoneIndex(PedBoneId.RightPhHand), Vector3.Zero, Rotator.Zero); Game.LocalPlayer.Character.Tasks.PlayAnimation("amb@world_human_binoculars@male@base", "base", 8f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); GameFiber.Sleep(1000); Camera binocCam = new Camera(true); binocCam.AttachToEntity(binocular, new Vector3(0.0f, -0.1f, 0.0f), true); binocCam.Rotation = Game.LocalPlayer.Character.Rotation; _isTextureRenderRunning = true; Game.RawFrameRender += RawFrameRender; while (true) { //float moveSpeed = (binocCam.FOV / 100)/* * 3.0f*/; WildernessCallouts.Common.DisEnableGameControls(false, GameControl.LookUpDown, GameControl.LookLeftRight, GameControl.WeaponWheelPrev, GameControl.WeaponWheelNext, GameControl.SelectWeapon, GameControl.SelectNextWeapon, GameControl.SelectPrevWeapon, GameControl.Sprint); //float leftRight = NativeFunction.CallByName<float>("GET_DISABLED_CONTROL_NORMAL", 0, (int)GameControl.LookLeftRight); //float upDown = NativeFunction.CallByName<float>("GET_DISABLED_CONTROL_NORMAL", 0, (int)GameControl.LookUpDown); if (Controls.ToggleBinoculars.IsJustPressed() || Game.LocalPlayer.Character.IsDead || Game.LocalPlayer.Character.IsInAnyVehicle(false)) { break; } //if (/*wheelBackwards != 0*/Game.IsKeyDownRightNow(Settings.ZoomOutBinocKey) && binocCam.FOV < 75.0f) binocCam.FOV += 0.51225f; //if (/*wheelForwards != 0*/Game.IsKeyDownRightNow(Settings.ZoomInBinocKey) && binocCam.FOV > 1.0f) binocCam.FOV -= 0.51225f; //if (/*leftRight < -0.05f*/Game.IsKeyDownRightNow(Settings.LookLeftBinocKey)) binocCam.SetRotationYaw(binocCam.Rotation.Yaw + moveSpeed); //if (/*leftRight > 0.05f*/Game.IsKeyDownRightNow(Settings.LookRightBinocKey)) binocCam.SetRotationYaw(binocCam.Rotation.Yaw - moveSpeed); //if (/*upDown < -0.05f*/Game.IsKeyDownRightNow(Settings.LookUpBinocKey) && binocCam.Rotation.Pitch <= 85.0f) binocCam.SetRotationPitch(binocCam.Rotation.Pitch + moveSpeed); //if (/*upDown > 0.05f*/Game.IsKeyDownRightNow(Settings.LookDownBinocKey) && binocCam.Rotation.Pitch >= -85.0f) binocCam.SetRotationPitch(binocCam.Rotation.Pitch - moveSpeed); float moveSpeed = (binocCam.FOV / 100) * (WildernessCallouts.Common.IsUsingController() ? 3.5f : 5.25f); float upDown = NativeFunction.Natives.GET_DISABLED_CONTROL_NORMAL <float>(0, (int)GameControl.LookUpDown) * moveSpeed; float leftRight = NativeFunction.Natives.GET_DISABLED_CONTROL_NORMAL <float>(0, (int)GameControl.LookLeftRight) * moveSpeed; binocCam.Rotation = new Rotator(binocCam.Rotation.Pitch - upDown, binocCam.Rotation.Roll, binocCam.Rotation.Yaw - leftRight); if (binocCam.Rotation.Pitch >= 85.0f) { binocCam.SetRotationPitch(84.98f); } else if (binocCam.Rotation.Pitch <= -85.0f) { binocCam.SetRotationPitch(-84.98f); } float wheelForwards = NativeFunction.Natives.GET_DISABLED_CONTROL_NORMAL <float>(0, (int)GameControl.WeaponWheelPrev) * 1.81125f; float wheelBackwards = NativeFunction.Natives.GET_DISABLED_CONTROL_NORMAL <float>(0, (int)GameControl.WeaponWheelNext) * 1.81125f; if (WildernessCallouts.Common.IsUsingController()) { binocCam.FOV -= wheelBackwards - wheelForwards; } else { binocCam.FOV -= wheelForwards - wheelBackwards; } if (binocCam.FOV > 75.0f) { binocCam.FOV = 75.0f; } else if (binocCam.FOV < 1.0f) { binocCam.FOV = 1.0f; } if (Controls.ToggleBinocularsHeliCamNightVision.IsJustPressed() && !WildernessCallouts.Common.IsNightVisionActive() && !WildernessCallouts.Common.IsThermalVisionActive()) { NativeFunction.Natives.PLAY_SOUND_FRONTEND(-1, "THERMAL_VISION_GOGGLES_ON_MASTER", 0, 1); WildernessCallouts.Common.SetNightVision(true); GameFiber.Sleep(25); } else if (Controls.ToggleBinocularsHeliCamNightVision.IsJustPressed() && WildernessCallouts.Common.IsNightVisionActive()) { NativeFunction.Natives.PLAY_SOUND_FRONTEND(-1, "THERMAL_VISION_GOGGLES_OFF_MASTER", 0, 1); WildernessCallouts.Common.SetNightVision(false); GameFiber.Sleep(25); } if (Controls.ToggleBinocularsHeliCamThermalVision.IsJustPressed() && !WildernessCallouts.Common.IsThermalVisionActive() && !WildernessCallouts.Common.IsNightVisionActive()) { NativeFunction.Natives.PLAY_SOUND_FRONTEND(-1, "THERMAL_VISION_GOGGLES_ON_MASTER", 0, 1); WildernessCallouts.Common.SetThermalVision(true); GameFiber.Sleep(25); } else if (Controls.ToggleBinocularsHeliCamThermalVision.IsJustPressed() && WildernessCallouts.Common.IsThermalVisionActive()) { NativeFunction.Natives.PLAY_SOUND_FRONTEND(-1, "THERMAL_VISION_GOGGLES_OFF_MASTER", 0, 1); WildernessCallouts.Common.SetThermalVision(false); GameFiber.Sleep(25); } if (!Game.LocalPlayer.Character.IsPlayingAnimation("amb@world_human_binoculars@male@base", "base")) { Game.LocalPlayer.Character.Tasks.PlayAnimation("amb@world_human_binoculars@male@base", "base", 8f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); } Game.LocalPlayer.Character.Heading = binocCam.Rotation.Yaw; //if (Settings.General.IsDebugBuild) Game.DisplaySubtitle("FOV: " + binocCam.FOV.ToString() + " PITCH: " + binocCam.Rotation.Pitch + " YAW: " + binocCam.Rotation.Yaw + " MOVE SPEED: " + moveSpeed.ToString(), 1000); GameFiber.Yield(); } if (WildernessCallouts.Common.IsNightVisionActive()) { NativeFunction.Natives.PLAY_SOUND_FRONTEND(-1, "THERMAL_VISION_GOGGLES_OFF_MASTER", 0, 1); WildernessCallouts.Common.SetNightVision(false); } if (WildernessCallouts.Common.IsThermalVisionActive()) { NativeFunction.Natives.PLAY_SOUND_FRONTEND(1, "THERMAL_VISION_GOGGLES_OFF_MASTER", 0, 1); WildernessCallouts.Common.SetThermalVision(false); } binocCam.Delete(); _isTextureRenderRunning = false; Game.RawFrameRender -= RawFrameRender; Game.LocalPlayer.Character.Tasks.Clear(); GameFiber.Sleep(250); binocular.Delete(); WildernessCallouts.Common.DisEnableGameControls(true, GameControl.LookUpDown, GameControl.LookLeftRight, GameControl.WeaponWheelPrev, GameControl.WeaponWheelNext, GameControl.SelectWeapon, GameControl.SelectNextWeapon, GameControl.SelectPrevWeapon, GameControl.Sprint); _isActive = false; }); }
public void Start(bool cleanUpOnEnd = true) { if (PedToRescue.Exists()) { Game.DisplayNotification("~b~" + Settings.General.Name + ":~w~ Dispatch, I need an air ambulance in " + Game.LocalPlayer.Character.Position.GetZoneName()); GameFiber.Sleep(1000); Game.DisplayNotification("~b~Dispatch:~w~ Roger, " + Settings.AirAmbulance.ParamedicName.ToLower() + " en route"); Functions.PlayScannerAudioUsingPosition("WE_HAVE MEDICAL_EMERGENCY IN_OR_ON_POSITION UNITS_RESPOND_CODE_99 OUTRO OFFICER_INTRO HELI_APPROACHING_DISPATCH", Game.LocalPlayer.Character.Position); Vector3 posToFly = PedToRescue.Position + Vector3.WorldUp * 32.5f; GameFiber.Sleep(100); NativeFunction.CallByName <uint>("TASK_HELI_MISSION", Pilot, Helicopter, 0, 0, posToFly.X, posToFly.Y, posToFly.Z, 6, 40.0f, 1.0f, 36.0f, 15, 15, -1.0f, 1); while (true) { if (Helicopter.Exists()) { if (Vector3.Distance2D(posToFly, Helicopter.Position) < 7.0f && Helicopter.Speed < 1.0f) { if (Paramedic1.Exists() && Paramedic1.IsInVehicle(Helicopter, false)) { Paramedic1.Tasks.RappelFromHelicopter(); } if (Paramedic2.Exists() && Paramedic2.IsInVehicle(Helicopter, false)) { Paramedic2.Tasks.RappelFromHelicopter().WaitForCompletion(); } break; } } GameFiber.Yield(); } if (PedToRescue.Exists()) { if (Paramedic1.Exists()) { Paramedic1.Tasks.FollowNavigationMeshToPosition(Game.LocalPlayer.Character.Position + Game.LocalPlayer.Character.ForwardVector * 1.1125f, Game.LocalPlayer.Character.Heading - 180.0f, 10.0f); } if (Paramedic2.Exists()) { Paramedic2.Tasks.FollowNavigationMeshToPosition(PedToRescue.Position + Vector3.RelativeRight, PedToRescue.Heading - 180, 10.0f).WaitForCompletion(4500); } } if (Paramedic1.Exists()) { Paramedic1.Tasks.AchieveHeading(Paramedic1.GetHeadingTowards(Game.LocalPlayer.Character)).WaitForCompletion(700); } if (PedToRescue.Exists()) { if (Paramedic1.Exists() && Paramedic1.IsMale) { Paramedic1.PlayAmbientSpeech(epsilonVoices.GetRandomElement(), Globals.Random.Next(2) == 1 ? Speech.GENERIC_HI : Speech.KIFFLOM_GREET, 0, SpeechModifier.ForceShouted); } if (PedToRescue.IsMale) { Game.DisplaySubtitle("~b~" + Settings.AirAmbulance.ParamedicName + ":~w~ " + phraseToSayToThePlayerMaleVersion, 3000); } else { Game.DisplaySubtitle("~b~" + Settings.AirAmbulance.ParamedicName + ":~w~ " + phraseToSayToThePlayerFemaleVersion, 3000); } } GameFiber.StartNew(delegate { if (PedToRescue.Exists()) { if (Paramedic2.Exists()) { Paramedic2.Tasks.AchieveHeading(Paramedic2.GetHeadingTowards(PedToRescue)).WaitForCompletion(800); } if (Paramedic2.Exists()) { Paramedic2.Tasks.PlayAnimation("amb@medic@standing@tendtodead@idle_a", tendToDeadIdles.GetRandomElement(), 2.0f, AnimationFlags.Loop); Paramedic2.PlayAmbientSpeech(null, Speech.GENERIC_SHOCKED_HIGH, 0, SpeechModifier.ForceShouted); } } }); GameFiber.Sleep(1300); if (Paramedic1.Exists() && Paramedic2.Exists()) { Paramedic1.Tasks.FollowNavigationMeshToPosition(Paramedic2.Position + Paramedic2.ForwardVector * 2.25f, Paramedic2.Heading - 180.0f, 10.0f).WaitForCompletion(12750); } if (PedToRescue.Exists() && Paramedic1.Exists()) { Paramedic1.Tasks.AchieveHeading(Paramedic1.GetHeadingTowards(PedToRescue)).WaitForCompletion(800); } if (Paramedic1.Exists()) { Paramedic1.Tasks.PlayAnimation("amb@medic@standing@timeofdeath@base", "base", 2.0f, AnimationFlags.Loop); } _notepad = new Rage.Object("prop_notepad_02", Vector3.Zero); if (Paramedic1.Exists() && _notepad.Exists()) { _notepad.AttachToEntity(Paramedic1, Paramedic1.GetBoneIndex(PedBoneId.LeftPhHand), Vector3.Zero, Rotator.Zero); } GameFiber.Sleep(11750); if (Paramedic1.Exists()) { Paramedic1.Tasks.Clear(); if (Paramedic1.IsMale) { Paramedic1.PlayAmbientSpeech("a_m_m_beach_02_black_full_01", Speech.GENERIC_BYE, 0, SpeechModifier.ForceShouted); } } if (Paramedic2.Exists()) { Paramedic2.Tasks.Clear(); if (Paramedic2.IsMale) { Paramedic2.PlayAmbientSpeech("a_m_o_genstreet_01_white_full_01", Speech.GENERIC_BYE, 0, SpeechModifier.ForceShouted); } } GameFiber.Sleep(1350); if (PedToRescue.Exists()) { PedToRescue.Delete(); } if (Helicopter.Exists()) { if (Paramedic1.Exists()) { Paramedic1.WarpIntoVehicle(Helicopter, 1); } if (Paramedic2.Exists()) { Paramedic2.WarpIntoVehicle(Helicopter, 2); } } GameFiber.Sleep(775); } if (cleanUpOnEnd) { CleanUp(); } }