GetRandomPosition() static private method

Generated a random Vector3 with the given min and max values
static private GetRandomPosition ( int min = 200, int max = 750 ) : Vector3
min int
max int
return Vector3
Exemplo n.º 1
0
        private async Task DoTheAction(Ped ped, List <Ped> pedsToShoot)
        {
            Ped pedToShoot = pedsToShoot == null?Utilities.GetClosestPed(ped) : ped.GetClosestPedFromPedList(pedsToShoot);

            if (pedToShoot == null || pedToShoot.IsDead)
            {
                return;
            }

            int chance = Utils.rnd.Next(10);

            if (chance >= 0 && chance <= 5)
            {
                ped.Task.ShootAt(pedToShoot);
            }
            else
            {
                Vector3 pos = ped.GetOffsetPosition(Utils.GetRandomPosition(5, 25));
                ped.Task.RunTo(pos);
                while (World.GetDistance(pos, ped.Position) >= 3f)
                {
                    await BaseScript.Delay(10);
                }
                ped.Task.ShootAt(pedToShoot);
            }
        }
Exemplo n.º 2
0
 public SlowVehicle()
 {
     InitInfo(World.GetNextPositionOnStreet(Game.PlayerPed.GetOffsetPosition(Utils.GetRandomPosition())));
     ShortName          = "Slow vehicle";
     CalloutDescription = "";
     ResponseCode       = 2;
     StartDistance      = 120f;
 }
Exemplo n.º 3
0
 public UnconsciousPerson()
 {
     InitInfo(World.GetNextPositionOnStreet(Game.PlayerPed.GetOffsetPosition(Utils.GetRandomPosition())));
     ShortName          = "Unconscious person";
     CalloutDescription = "";
     ResponseCode       = 3;
     StartDistance      = 200f;
 }
Exemplo n.º 4
0
 public Mugging()
 {
     InitInfo(World.GetNextPositionOnStreet(Game.PlayerPed.GetOffsetPosition(Utils.GetRandomPosition())));
     ShortName          = "Mugging";
     CalloutDescription = "";
     ResponseCode       = 3;
     StartDistance      = 120f;
 }
Exemplo n.º 5
0
 public ActiveShooters()
 {
     InitInfo(World.GetNextPositionOnStreet(Game.PlayerPed.GetOffsetPosition(Utils.GetRandomPosition(300, 800))));
     ShortName          = "Active shooters";
     CalloutDescription = "";
     ResponseCode       = 3;
     StartDistance      = 150f;
 }