Example #1
0
        public override bool OnCalloutAccepted()
        {
            vehicle = new Vehicle(SpawnUtil.GetRandomCivilianCarModel(), SpawnPoint)
            {
                IsPersistent = true
            };

            driver = vehicle.CreateRandomDriver();
            driver.IsPersistent         = true;
            driver.BlockPermanentEvents = true;
            // Set the ped drunk
            NativeFunction.Natives.SET_PED_CONFIG_FLAG(driver, 100, true);

            driver.Tasks.CruiseWithVehicle(214f, VehicleDrivingFlags.DriveAroundVehicles | VehicleDrivingFlags.DriveAroundObjects | VehicleDrivingFlags.AllowWrongWay | VehicleDrivingFlags.AllowMedianCrossing |
                                           VehicleDrivingFlags.AvoidHighways | VehicleDrivingFlags.DriveAroundObjects);

            Blip        = driver.AttachBlip();
            Blip.Sprite = BlipSprite.Enemy;
            Blip.Scale  = 0.5f;
            Blip.SetColor(BlipColor.Red);
            Blip.SetRouteColor(BlipColor.LightRed);

            ScannerMessages.DisplayDispatchText("Driver Under The Influence", "Reports of a ~y~driver~w~ under the ~r~influence~w~. Test the driver for ~r~alcohol~w~ and ~r~narcotics.");

            return(base.OnCalloutAccepted());
        }
        public override bool OnCalloutAccepted()
        {
            vehicle = new Vehicle(SpawnUtil.GetRandomEmergencyCarModel(), SpawnPoint);
            vehicle.IsPersistent = true;

            if (!vehicle) // vehicle fails to be created
            {
                Game.LogTrivial("Rel.C: Vehicle does not exists");
                return(false);
            }

            thief = new Ped(SpawnPoint.Around(1.5f))
            {
                IsPersistent         = true,
                BlockPermanentEvents = true
            };

            thief.WarpIntoVehicle(vehicle, -1);

            if (!thief)
            {
                Game.LogTrivial("Rel.C: Thief does not exists");
                return(false);
            }

            if (MathHelper.GetRandomInteger(5) != 3)
            {
                var window = vehicle.Windows[0];
                if (!vehicle.Exists())
                {
                    Game.LogTrivial("Rel.C: Vehicle does not exist when breaking the window");
                    return(false);
                }
                vehicle.IsStolen = true;
                window.Smash();
                ScannerMessages.DisplayDispatchText("Stolen Emergency Vehicle", "The vehicle was ~r~stolen~w~ from police station. Chase the suspect.");
            }
            else
            {
                thief.Inventory.GiveNewWeapon(WeaponHash.Pistol, 90, true);
                ScannerMessages.DisplayDispatchText("Stolen Emergency Vehicle", "The vehicle was ~r~hijacked~w~.");
                this.ResponseType = CalloutResponseType.Code99;
            }

            pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(pursuit, thief);
            Functions.SetPursuitAsCalledIn(pursuit);
            Functions.SetPursuitIsActiveForPlayer(pursuit, true);
            Functions.SetPursuitCopsCanJoin(pursuit, true);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.LocalUnit);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.LocalUnit);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.LocalUnit);
            Functions.RequestBackup(thief.Position, EBackupResponseType.Pursuit, EBackupUnitType.AirUnit);

            return(base.OnCalloutAccepted());
        }
        public override bool OnCalloutAccepted()
        {
            armoredCar = new Vehicle("stockade", SpawnPoint);
            armoredCar.IsPersistent = true;

            bool driver = false;

            for (int i = 0; i < MathHelper.GetRandomInteger(2, 4); i++)
            {
                var ped = new Ped(SpawnPoint.Around(15f))
                {
                    IsPersistent         = true,
                    BlockPermanentEvents = true
                };

                ped.Inventory.GiveNewWeapon(SpawnUtil.GetRandomArmedRobberWeapon(), short.MaxValue, true);

                if (!driver) // make them warp into correct location
                {
                    driver = true;
                    ped.WarpIntoVehicle(armoredCar, -1);
                    ped.Tasks.CruiseWithVehicle(armoredCar, 250f, VehicleDrivingFlags.Emergency);
                }
                else
                {
                    ped.WarpIntoVehicle(armoredCar, -2);
                }

                var attribute = Functions.GetPedPursuitAttributes(ped);
                attribute.SurrenderChancePittedAndCrashed    = 10.2f;
                attribute.SurrenderChancePittedAndSlowedDown = 5.2f;
                attribute.SurrenderChanceCarBadlyDamaged     = 23.2f;
                attribute.AverageSurrenderTime               = 8;
                attribute.AverageFightTime                   = 2;
                attribute.SurrenderChancePitted              = 2.5f;
                attribute.SurrenderChanceTireBurst           = 1.2f;
                attribute.SurrenderChanceTireBurstAndCrashed = 5.1f;
                attribute.BurstTireMaxDrivingSpeedMult       = 0.10f;
                attribute.BurstTireSurrenderMult             = 10;

                Functions.SetPedResistanceChance(ped, 85.9f);

                robbers.Add(ped);
            }

            Blip = new Blip(armoredCar)
            {
                Sprite         = BlipSprite.Enemy, // For some reason RPH uses GTAO blip (No 270)
                IsFriendly     = false,
                IsRouteEnabled = true
            };

            Blip.SetColor(BlipColor.Red); // use native blip color to match vanilla design :)

            return(base.OnCalloutAccepted());
        }
Example #4
0
        public override bool OnBeforeCalloutDisplayed()
        {
            ResponseType    = CalloutResponseType.Code2;
            ReportedByUnits = false;
            SpawnPoint      = SpawnUtil.GenerateSpawnPointAroundPlayer(250, 550);

            this.AddMaximumDistanceCheck(650f, SpawnPoint);
            this.AddMinimumDistanceCheck(200f, SpawnPoint);

            return(base.OnBeforeCalloutDisplayed());
        }
        public override bool OnBeforeCalloutDisplayed()
        {
            ResponseType    = CalloutResponseType.Code3;
            ReportedByUnits = MathHelper.GetRandomInteger(11) != 5;
            SpawnPoint      = SpawnUtil.GenerateSpawnPointAroundPlayer(200f, 500f);

            this.AddMinimumDistanceCheck(150f, SpawnPoint);
            this.AddMaximumDistanceCheck(550f, SpawnPoint);

            return(base.OnBeforeCalloutDisplayed());
        }
Example #6
0
        public override bool OnBeforeCalloutDisplayed()
        {
            SpawnPoint      = SpawnUtil.GenerateSpawnPointAroundPlayer(300f, 600f);
            ResponseType    = CalloutResponseType.Code2;
            ReportedByUnits = false;

            // Don't let it get too far away!
            this.AddMaximumDistanceCheck(650f, SpawnPoint);
            this.AddMinimumDistanceCheck(280f, SpawnPoint);

            return(base.OnBeforeCalloutDisplayed());
        }
Example #7
0
        public override bool OnCalloutAccepted()
        {
            var model = SpawnUtil.GetRandomCivilianCarModel();

            car = new Vehicle(model, SpawnPoint)
            {
                IsPersistent = true
            };

            car.Windows[0].Smash();                              // so it's stolen recently
            car.DirtLevel = MathHelper.GetRandomSingle(0f, 15f); // add some dirt
            car.IsStolen  = true;

            // Only if STP installed
            if (ExternManager.StopThePedInstalled && MathHelper.GetRandomInteger(0, 5) == 3)
            {
                StopThePedFunctions.SetVehicleHasNoRegistration(car);
            }

            thief = car.CreateRandomDriver();
            thief.IsPersistent         = true;
            thief.BlockPermanentEvents = true;

            if (MathHelper.GetRandomInteger(0, 4) == 2)
            {
                Functions.AddPedContraband(thief, ContrabandType.Misc, "Brick");
            }

            Blip        = car.AttachBlip();
            Blip.Sprite = BlipSprite.Enemy;
            Blip.Scale  = 0.5f;
            Blip.SetColor(BlipColor.Red);
            Blip.SetRouteColor(BlipColor.Red);
            Blip.IsRouteEnabled = true;

            var attribute = Functions.GetPedPursuitAttributes(thief);

            attribute.SurrenderChanceCarBadlyDamaged     = 20.5f;
            attribute.BurstTireMaxDrivingSpeedMult       = 0.30f;
            attribute.SurrenderChancePitted              = 34.2f;
            attribute.SurrenderChanceTireBurst           = 20.2f;
            attribute.SurrenderChanceTireBurstAndCrashed = 50.2f;
            attribute.SurrenderChancePittedAndCrashed    = 42.2f;

            Functions.SetPedResistanceChance(thief, 80f);
            thief.Tasks.CruiseWithVehicle(30f);

            ScannerMessages.DisplayDispatchText("Stolen Vehicle", "Track down the ~g~vehicle~w~ and arrest the ~r~suspect.");

            return(base.OnCalloutAccepted());
        }
Example #8
0
    private IEnumerator CorDelaySpawnOnDeath()
    {
        yield return(new WaitForSeconds(delayDeath));

        if (prefabDeathSubstitute != null)
        {
            instantiator.InjectPrefab(Instantiate(prefabDeathSubstitute, gameObject.transform.position,
                                                  gameObject.transform.rotation));
        }

        SpawnUtil.Spawn(spawnObjects, instantiator, this.gameObject);

        Destroy(this.gameObject);
    }
        public override bool OnBeforeCalloutDisplayed()
        {
            if (!SpawnUtil.TryGenerateSpawnPointOnPedWalk(250, 450, false, out Vector3 spawn))
            {
                Game.LogTrivial("Rel.C: Failed to find spawn point");
                return(false);
            }

            SpawnPoint      = spawn;
            ResponseType    = CalloutResponseType.Code3;
            ReportedByUnits = true;

            this.AddMinimumDistanceCheck(200f, spawn);
            this.AddMaximumDistanceCheck(500f, spawn);

            return(base.OnBeforeCalloutDisplayed());
        }
    private IEnumerator CorDelaySpawnOnDeath()
    {
        _rigidBody2D.bodyType = RigidbodyType2D.Static;
        isDead.Value          = true;

        yield return(new WaitForSeconds(delayDeath));

        if (prefabDeathSubstitute != null)
        {
            instantiator.InjectPrefab(Instantiate(prefabDeathSubstitute, gameObject.transform.position,
                                                  gameObject.transform.rotation));
        }

        playerStats.AddScore(scoreReward);
        SpawnUtil.Spawn(spawnObjects, instantiator, this.gameObject);

        Destroy(this.gameObject);
    }