/// <summary> /// Called when the callout has been accepted. Call base to set state to Running. /// </summary> /// <returns> /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed. /// </returns> public override bool OnCalloutAccepted() { bool isReady = base.OnCalloutAccepted(); this.pursuit = Functions.CreatePursuit(); Functions.SetPursuitCopsCanJoin(this.pursuit, false); Functions.SetPursuitDontEnableCopBlips(this.pursuit, true); // Add blip this.blip = Functions.CreateBlipForArea(this.spawnPoint.Position, 30f); this.blip.Display = BlipDisplay.ArrowAndMap; this.blip.RouteActive = true; // Decide whether prank call or not if (Common.GetRandomBool(0, 5, 1)) { Log.Debug("OnCalloutAccepted: Is prank", this); this.SetAsPrankCall(); } else { try { this.criminals = new List <LPed>(); int random = Common.GetRandomValue(6, 13); for (int i = 0; i < random; i++) { LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.Criminal); if (ValidityCheck.isObjectValid(criminal)) { // Ensure ped is not in a building if (criminal.EnsurePedIsNotInBuilding(criminal.Position)) { Functions.AddToScriptDeletionList(criminal, this); Functions.SetPedIsOwnedByScript(criminal, this, true); criminal.RelationshipGroup = RelationshipGroup.Gang_Biker2; criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); criminal.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate); criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, true); // We don't want the criminal to flee yet criminal.DisablePursuitAI = true; // Set up weapons criminal.Weapons.RemoveAll(); criminal.Weapons.FromType(Weapon.Handgun_Glock).Ammo = 999; criminal.Weapons.FromType(Weapon.Shotgun_Basic).Ammo = 120; criminal.Weapons.FromType(Weapon.Melee_Knife); criminal.Weapons.FromType(Weapon.Thrown_Molotov).Ammo = 2; criminal.Weapons.Select(Weapon.Thrown_Molotov); criminal.DefaultWeapon = Weapon.Shotgun_Basic; criminal.ComplianceChance = Common.GetRandomValue(25, 75); Functions.AddPedToPursuit(this.pursuit, criminal); this.criminals.Add(criminal); } else { Log.Debug("OnCalloutAccepted: Failed to place ped properly outside of building", this); criminal.Delete(); } } } if (this.criminals.Count == 0) { isReady = false; } else { // Create Johnny johnny = new LPed(this.spawnPoint.Position.Around((float)10), "IG_JOHNNYBIKER", LPed.EPedGroup.MissionPed); johnny.PersonaData = new PersonaData(new DateTime(1974, 3, 17, 8, 30, 0, DateTimeKind.Utc), 13, "Johnny", "Klebitz", true, 9, true); johnny.RelationshipGroup = RelationshipGroup.Special; johnny.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate); johnny.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, true); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, true); johnny.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (!johnny.EnsurePedIsNotInBuilding(johnny.Position)) { johnny.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(1.0f, 1.5f, 0); } // We don't want the criminal to flee yet johnny.DisablePursuitAI = true; // Set up weapons johnny.Weapons.RemoveAll(); johnny.Weapons.DesertEagle.Ammo = 999; johnny.Weapons.AssaultRifle_AK47.Ammo = 300; johnny.Weapons.Knife.Ammo = 1; johnny.Weapons.AssaultRifle_AK47.Select(); johnny.DefaultWeapon = Weapon.Rifle_AK47; johnny.ComplianceChance = Common.GetRandomValue(0, 30); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { johnny.GPed }); Functions.AddPedToPursuit(this.pursuit, johnny); this.criminals.Add(johnny); } // Chance to spawn another bunch of suspects fighting each other if (Common.GetRandomBool(0, 2, 1)) { random = Common.GetRandomValue(7, 15); for (int i = 0; i < random; i++) { LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.mafiaModels), LPed.EPedGroup.Criminal); if (ValidityCheck.isObjectValid(criminal)) { Functions.AddToScriptDeletionList(criminal, this); Functions.SetPedIsOwnedByScript(criminal, this, true); criminal.RelationshipGroup = RelationshipGroup.Gang_Italian; criminal.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Companion); criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Italian, true); // We don't want the criminal to flee yet criminal.DisablePursuitAI = true; criminal.Weapons.RemoveAll(); criminal.Weapons.Glock.Ammo = 999; criminal.Weapons.Uzi.Ammo = 999; criminal.Weapons.Knife.Ammo = 1; if (Common.GetRandomBool(0, 50, 1)) { criminal.Weapons.Uzi.Select(); criminal.DefaultWeapon = Weapon.SMG_Uzi; } else { criminal.Weapons.AssaultRifle_M4.Ammo = 999; criminal.Weapons.AssaultRifle_M4.Select(); criminal.DefaultWeapon = Weapon.Rifle_M4; } Functions.AddPedToPursuit(this.pursuit, criminal); this.criminals.Add(criminal); } } // Chance to start fighting immediately if (Common.GetRandomBool(0, 2, 1)) { this.State = EShootoutState.Fighting; this.Engage(); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_3_UNITS_FROM POSITION FOR CRIM_A_DOMESTIC_DISTURBANCE", LPlayer.LocalPlayer.Ped.Position); } } isReady = true; } catch (Exception ex) { Log.Error("OnCalloutAccepted: Cannot create Pursuit instance: " + ex, this); isReady = false; } } // Add states if (isReady) { this.RegisterStateCallback(EShootoutState.WaitingForPlayer, this.WaitingForPlayer); this.RegisterStateCallback(EShootoutState.PlayerIsClose, this.PlayerIsClose); this.RegisterStateCallback(EShootoutState.InCombat, this.InCombat); this.RegisterStateCallback(EShootoutState.Fighting, this.InCombat); this.RegisterStateCallback(EShootoutState.Prank, this.Prank); this.State = EShootoutState.WaitingForPlayer; if (!this.IsPrankCall) { Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_JOHNNY, johnny.PersonaData.FullName, johnny.PersonaData.BirthDay), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); } else { DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Resources.TEXT_INFO_RELAY_SV_JOHNNY_PRANK, Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); }, this, Common.GetRandomValue(3000, 6001)); } Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000); } return(isReady); }
/// <summary> /// Called when the callout has been accepted. Call base to set state to Running. /// </summary> /// <returns> /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed. /// </returns> public override bool OnCalloutAccepted() { bool isReady = base.OnCalloutAccepted(); this.pursuit = Functions.CreatePursuit(); Functions.SetPursuitCopsCanJoin(this.pursuit, false); Functions.SetPursuitDontEnableCopBlips(this.pursuit, true); // Add blip this.blip = Functions.CreateBlipForArea(this.spawnPoint.Position, 30f); this.blip.Display = BlipDisplay.ArrowAndMap; this.blip.RouteActive = true; // Decide whether prank call or not if (Common.GetRandomBool(0, 5, 1) && (!isOfficerCalledIn | !isNGDRequestingAssistance)) { Log.Debug("OnCalloutAccepted: Is prank", this); this.SetAsPrankCall(); } else { try { this.criminals = new List <LPed>(); int random = Common.GetRandomValue(6, 16); for (int i = 0; i < random; i++) { LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.Criminal); if (criminal.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { // Ensure ped is not in a building if (criminal.EnsurePedIsNotInBuilding(criminal.Position)) { Functions.AddToScriptDeletionList(criminal, this); Functions.SetPedIsOwnedByScript(criminal, this, true); criminal.RelationshipGroup = RelationshipGroup.Gang_Biker2; criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); criminal.ChangeRelationship(RelationshipGroup.Criminal, Relationship.Like); criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); // We don't want the criminal to flee yet criminal.DisablePursuitAI = true; criminal.Weapons.RemoveAll(); criminal.Weapons.FromType(Weapon.TLAD_Automatic9mm).Ammo = 999; criminal.DefaultWeapon = Weapon.TLAD_Automatic9mm; if (Common.GetRandomBool(0, 3, 1)) { criminal.Weapons.FromType(Weapon.Rifle_AK47).Ammo = 150; } else { criminal.Weapons.FromType(Weapon.TLAD_AssaultShotgun).Ammo = 128; } criminal.Weapons.FromType(Weapon.Melee_Knife); criminal.Weapons.FromType(Weapon.Thrown_Molotov).Ammo = 1; criminal.Weapons.Select(Weapon.Thrown_Molotov); criminal.CanSwitchWeapons = true; Functions.AddPedToPursuit(this.pursuit, criminal); this.criminals.Add(criminal); } else { Log.Debug("OnCalloutAccepted: Failed to place ped properly outside of building", this); criminal.Delete(); } } } if (this.criminals.Count == 0) { isReady = false; } else { // Create Johnny johnny = new LPed(this.spawnPoint.Position.Around((float)10), "IG_JOHNNYBIKER", LPed.EPedGroup.MissionPed); johnny.PersonaData = new PersonaData(new DateTime(1974, 3, 17, 8, 30, 0, DateTimeKind.Utc), 13, "Johnny", "Klebitz", true, 9, true); johnny.RelationshipGroup = RelationshipGroup.Special; johnny.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, base.OnCalloutAccepted()); johnny.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (johnny.EnsurePedIsNotInBuilding(johnny.Position) == false) { johnny.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(1.0f, 1.5f, 0); } // We don't want the criminal to flee yet johnny.DisablePursuitAI = true; johnny.EquipWeapon(); johnny.Weapons.RemoveAll(); johnny.Weapons.FromType(Weapon.Handgun_DesertEagle).Ammo = 999; johnny.Weapons.FromType(Weapon.TLAD_GrenadeLauncher).Ammo = 100; johnny.Weapons.FromType(Weapon.Melee_Knife).Ammo = 1; johnny.Weapons.Select(Weapon.TLAD_GrenadeLauncher); johnny.DefaultWeapon = Weapon.TLAD_GrenadeLauncher; int tempVar = Common.GetRandomValue(100, 500); johnny.MaxHealth = tempVar; johnny.Health = tempVar; johnny.Armor = 100; johnny.AlwaysDiesOnLowHealth = base.OnCalloutAccepted(); johnny.ComplianceChance = Common.GetRandomValue(0, 25); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { johnny.GPed }); Functions.AddPedToPursuit(this.pursuit, johnny); this.criminals.Add(johnny); // Create Clay clay = new LPed(johnny.Position, "IG_CLAY", LPed.EPedGroup.MissionPed); clay.PersonaData = new PersonaData(new DateTime(1977, 5, 16), 20, "Clay", "", true, 6, true); clay.RelationshipGroup = RelationshipGroup.Special; clay.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); clay.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); clay.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); clay.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); clay.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, base.OnCalloutAccepted()); clay.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (clay.EnsurePedIsNotInBuilding(clay.Position) == false) { clay.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(1.0f, -1.5f, 0); } // We don't want the criminal to flee yet clay.DisablePursuitAI = true; clay.EquipWeapon(); clay.Weapons.RemoveAll(); clay.Weapons.FromType(Weapon.Handgun_Glock).Ammo = 999; clay.DefaultWeapon = Weapon.Handgun_Glock; clay.Weapons.FromType(Weapon.Rifle_M4).Ammo = 150; clay.Weapons.FromType(Weapon.TLAD_PipeBomb).Ammo = 3; clay.Weapons.FromType(Weapon.Melee_Knife); clay.Weapons.Select(Weapon.TLAD_PipeBomb); tempVar = Common.GetRandomValue(200, 400); clay.MaxHealth = tempVar; clay.Health = tempVar; clay.Armor = 20; clay.AlwaysDiesOnLowHealth = base.OnCalloutAccepted(); clay.ComplianceChance = Common.GetRandomValue(0, 25); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { clay.GPed }); Functions.AddPedToPursuit(this.pursuit, clay); this.criminals.Add(clay); // Create Terry terry = new LPed(johnny.Position, "IG_TERRY", LPed.EPedGroup.MissionPed); terry.PersonaData = new PersonaData(new DateTime(1977, 8, 29), 14, "Terry", "", true, 8, true); terry.RelationshipGroup = RelationshipGroup.Special; terry.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); terry.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); terry.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); terry.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); terry.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, base.OnCalloutAccepted()); terry.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (terry.EnsurePedIsNotInBuilding(terry.Position) == false) { terry.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(-1.0f, 1.5f, 0); } // We don't want the criminal to flee yet terry.DisablePursuitAI = true; terry.EquipWeapon(); terry.Weapons.RemoveAll(); terry.Weapons.FromType(Weapon.TLAD_Automatic9mm).Ammo = 999; terry.Weapons.FromType(Weapon.TLAD_AssaultShotgun).Ammo = 128; terry.Weapons.FromType(Weapon.SMG_MP5).Ammo = 300; terry.Weapons.FromType(Weapon.Melee_Knife); terry.Weapons.Select(Weapon.SMG_MP5); terry.DefaultWeapon = Weapon.SMG_MP5; terry.MaxHealth = 250; terry.Health = 250; terry.Armor = 30; terry.ComplianceChance = Common.GetRandomValue(0, 30); terry.AlwaysDiesOnLowHealth = base.OnCalloutAccepted(); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { terry.GPed }); Functions.AddPedToPursuit(this.pursuit, terry); this.criminals.Add(terry); } // If isNGDRequestingAssistance is true and isOfficerCalledIn is false, spawn NGD members to fight with the bikers // If spawned, it'll start fighting immediately if (isNGDRequestingAssistance & !isOfficerCalledIn) { NGD_Personnels = new List <LPed>(); random = Common.GetRandomValue(6, 13); for (int i = 0; i < random; i++) { LPed NGD = new LPed(World.GetPositionAround(this.spawnPoint.Position, 15f).ToGround(), Common.GetRandomCollectionValue <string>(this.NGD_MemberModels), LPed.EPedGroup.Cop); if (NGD.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { Functions.AddToScriptDeletionList(NGD, this); //Functions.SetPedIsOwnedByScript(NGD, this, true); NGD.RelationshipGroup = RelationshipGroup.Cop; NGD.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); NGD.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); NGD.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); // We don't want the personnel to flee yet //NGD.DisablePursuitAI = true; NGD.Weapons.RemoveAll(); NGD.Weapons.Glock.Ammo = 999; NGD.Weapons.BasicShotgun.Ammo = 999; if (Common.GetRandomBool(0, 100, 0)) { NGD.Weapons.BasicSniperRifle.Ammo = 100; NGD.Weapons.BasicSniperRifle.Select(); NGD.DefaultWeapon = Weapon.SniperRifle_Basic; } else { NGD.Weapons.AssaultRifle_M4.Ammo = 999; NGD.Weapons.AssaultRifle_M4.Select(); NGD.DefaultWeapon = Weapon.Rifle_M4; } NGD.PriorityTargetForEnemies = true; // Randomize NGD ped component variation Function.Call("SET_CHAR_RANDOM_COMPONENT_VARIATION", new Parameter[] { NGD.GPed }); this.NGD_Personnels.Add(NGD); } } this.State = EShootoutState.Fighting; this.Engage(); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); // Create random vehicle Vehicle ngdveh1 = World.CreateVehicle(World.GetNextPositionOnStreet(this.spawnPoint.Position.Around(18.1f)).ToGround()); Vehicle ngdveh2 = World.CreateVehicle(ngdveh1.Position.Around(3f).ToGround()); // Release them as an ambient vehicle ngdveh1.NoLongerNeeded(); ngdveh2.NoLongerNeeded(); } // If isNGDRequestingAssistance is false and isOfficerCalledIn is true, spawn police officers to fight with the bikers // If spawned, it'll start fighting immediately else if (!isNGDRequestingAssistance & isOfficerCalledIn) { officers = new List <LPed>(); random = Common.GetRandomValue(4, 6); for (int i = 0; i < random; i++) { LPed officer = null; if (!World.GetZoneName(this.spawnPoint.Position).Contains("Alderney")) { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), Common.GetRandomCollectionValue <string>(copModel), LPed.EPedGroup.Cop); } else { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), stateTrooperModel, LPed.EPedGroup.Cop); } if (officer.isObjectValid()) { Functions.AddToScriptDeletionList(officer, this); officer.RelationshipGroup = RelationshipGroup.Cop; officer.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); officer.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); officer.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); officer.Weapons.Uzi.Ammo = 999; officer.Weapons.Uzi.Select(); officer.PriorityTargetForEnemies = true; this.officers.Add(officer); } } this.State = EShootoutState.Fighting; this.Engage(); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); // Create police vehicle Vehicle polveh1 = World.CreateVehicle(new Model("POLICE"), World.GetNextPositionOnStreet(this.spawnPoint.Position.Around(18.1f)).ToGround()); Vehicle polveh2 = World.CreateVehicle(new Model("POLICE"), polveh1.Position.Around(3f).ToGround()); polveh1.SirenActive = true; polveh2.SirenActive = polveh1.SirenActive; // Release them as an ambient vehicle polveh1.NoLongerNeeded(); polveh2.NoLongerNeeded(); } // If both isNGDRequestingAssistance and isOfficerCalledIn are true, spawn NGD members, NOOSE, and police officers to fight with the bikers // If spawned, it'll start fighting immediately else if (isNGDRequestingAssistance & isOfficerCalledIn) { NGD_Personnels = new List <LPed>(); officers = new List <LPed>(); random = Common.GetRandomValue(8, 12); for (int i = 0; i < random; i++) { LPed NGD = new LPed(World.GetPositionAround(this.spawnPoint.Position, 15f).ToGround(), Common.GetRandomCollectionValue <string>(this.NGD_MemberModels), LPed.EPedGroup.Cop); if (NGD.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { Functions.AddToScriptDeletionList(NGD, this); //Functions.SetPedIsOwnedByScript(NGD, this, true); NGD.RelationshipGroup = RelationshipGroup.Cop; NGD.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); NGD.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); NGD.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); // We don't want the personnel to flee yet //NGD.DisablePursuitAI = true; NGD.Weapons.RemoveAll(); NGD.Weapons.Glock.Ammo = 999; NGD.Weapons.BasicShotgun.Ammo = 999; if (Common.GetRandomBool(0, 100, 0)) { NGD.Weapons.BasicSniperRifle.Ammo = 100; NGD.Weapons.BasicSniperRifle.Select(); NGD.DefaultWeapon = Weapon.SniperRifle_Basic; } else { NGD.Weapons.AssaultRifle_M4.Ammo = 999; NGD.Weapons.AssaultRifle_M4.Select(); NGD.DefaultWeapon = Weapon.Rifle_M4; } NGD.PriorityTargetForEnemies = true; // Randomize NGD ped component variation Function.Call("SET_CHAR_RANDOM_COMPONENT_VARIATION", new Parameter[] { NGD.GPed }); this.NGD_Personnels.Add(NGD); } } random = Common.GetRandomValue(4, 8); for (int i = 0; i < random; i++) { LPed officer = null; if (!World.GetZoneName(this.spawnPoint.Position).Contains("Alderney")) { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), Common.GetRandomCollectionValue <string>(copModel), LPed.EPedGroup.Cop); } else { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), stateTrooperModel, LPed.EPedGroup.Cop); } if (officer.isObjectValid()) { Functions.AddToScriptDeletionList(officer, this); officer.RelationshipGroup = RelationshipGroup.Cop; officer.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); officer.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); officer.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); officer.Weapons.Uzi.Ammo = 999; officer.Weapons.Uzi.Select(); officer.PriorityTargetForEnemies = true; this.officers.Add(officer); } } for (int i = 0; i < 4; i++) { LPed officer = new LPed(World.GetPositionAround(this.spawnPoint.Position, 16.5f), "M_Y_SWAT"); if (officer.isObjectValid()) { Functions.AddToScriptDeletionList(officer, this); officer.RelationshipGroup = RelationshipGroup.Cop; officer.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); officer.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); officer.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); officer.PriorityTargetForEnemies = true; this.officers.Add(officer); } } // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); // Create police and random vehicles Vehicle polveh1 = World.CreateVehicle(new Model("POLICE"), World.GetNextPositionOnStreet(this.spawnPoint.Position.Around((float)Common.GetRandomValue(10, 15))).ToGround()); Vehicle polveh2 = World.CreateVehicle(new Model("POLICE"), polveh1.Position.Around(3f).ToGround()); Vehicle polveh3 = World.CreateVehicle(new Model("NSTOCKADE"), World.GetNextPositionOnStreet(this.spawnPoint.Position).Around(2.0f).ToGround()); Vehicle ngdveh1 = World.CreateVehicle(World.GetNextPositionOnStreet(this.spawnPoint.Position.Around(18.1f)).ToGround()); Vehicle ngdveh2 = World.CreateVehicle(ngdveh1.Position.Around(3f).ToGround()); polveh1.SirenActive = true; polveh2.SirenActive = polveh1.SirenActive; polveh3.SirenActive = polveh2.SirenActive; // Release them as an ambient vehicle polveh1.NoLongerNeeded(); polveh2.NoLongerNeeded(); polveh3.NoLongerNeeded(); ngdveh1.NoLongerNeeded(); ngdveh2.NoLongerNeeded(); } isReady = true; } catch (Exception ex) { Log.Error("OnCalloutAccepted: Cannot create Pursuit instance: " + ex, this); isReady = false; } } // Add states if (isReady) { this.RegisterStateCallback(EShootoutState.WaitingForPlayer, this.WaitingForPlayer); this.RegisterStateCallback(EShootoutState.PlayerIsClose, this.PlayerIsClose); this.RegisterStateCallback(EShootoutState.InCombat, this.InCombat); this.RegisterStateCallback(EShootoutState.Fighting, this.InCombat); this.RegisterStateCallback(EShootoutState.Prank, this.Prank); this.State = EShootoutState.WaitingForPlayer; if (!this.IsPrankCall) { Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_JOHNNY, johnny.PersonaData.FullName, johnny.PersonaData.BirthDay), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); } else { DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Resources.TEXT_INFO_RELAY_SV_JOHNNY_PRANK, Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); }, this, Common.GetRandomValue(3000, 6001)); } Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000); } return(isReady); }