Exemplo n.º 1
0
        public AIConvoy Setup(int children)
        {
            leader = new GroundAI();
            TeamManager.SetupTeam(this);

            var spawnPos = leader.Team.GroundSpawnPoint.Position;
            var pedModel = new Model(PedHash.Pilot02SMM);
            var vehModel = new Model(VehicleHash.Barracks);

            var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, spawnPos));

            vehicle.Vehicle.EngineRunning = true;
            vehicle.Vehicle.Heading = leader.Team.GroundSpawnPoint.Heading;

            vehicle.AddBlip();
            vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit;

            var ped = new ManageablePed(World.CreatePed(pedModel, spawnPos));
            ped.Ped.RelationshipGroup = leader.Team.RelationshipGroup;
            ped.Ped.BlockPermanentEvents = false;
            ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver);

            leader.Manage(ped, vehicle);

            AddChildren(children);

            return this;
        }
Exemplo n.º 2
0
        public AIConvoy Setup(int children)
        {
            leader = new GroundAI();
            TeamManager.SetupTeam(this);

            var spawnPos = leader.Team.GroundSpawnPoint.Position;
            var pedModel = new Model(PedHash.Pilot02SMM);
            var vehModel = new Model(VehicleHash.Barracks);

            var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, spawnPos));

            vehicle.Vehicle.EngineRunning = true;
            vehicle.Vehicle.Heading       = leader.Team.GroundSpawnPoint.Heading;

            vehicle.AddBlip();
            vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit;

            var ped = new ManageablePed(World.CreatePed(pedModel, spawnPos));

            ped.Ped.RelationshipGroup    = leader.Team.RelationshipGroup;
            ped.Ped.BlockPermanentEvents = false;
            ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver);

            leader.Manage(ped, vehicle);

            AddChildren(children);

            return(this);
        }
Exemplo n.º 3
0
        public void AddChildren(int count = 0)
        {
            var spawnPos = leader.Team.GroundSpawnPoint.Position;
            var pedModel = new Model(PedHash.Pilot02SMM);
            var vehModel = new Model(VehicleHash.Barracks3);

            if (!pedModel.IsLoaded)
            {
                pedModel.Request(1000);
            }

            if (!vehModel.IsLoaded)
            {
                vehModel.Request(1000);
            }

            for (int i = 0; i < count; i++)
            {
                var parent = children.Count > 0 ? children.Last() : leader;

                var childAsset = new GroundAI();
                var pos        = parent.ManagedVehicle.Position - parent.ManagedVehicle.ForwardVector * 6;
                var vehicle    = new ManageableVehicle(World.CreateVehicle(vehModel, pos));

                vehicle.Vehicle.EngineRunning = true;
                vehicle.Vehicle.Heading       = leader.Team.GroundSpawnPoint.Heading;
                vehicle.AddBlip();
                vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit;

                Function.Call(Hash.SET_ENTITY_LOAD_COLLISION_FLAG, vehicle.Handle, true);

                var ped = new ManageablePed(new Ped(Function.Call <int>(Hash.CREATE_PED_INSIDE_VEHICLE, vehicle.Handle, 6, pedModel.Hash, -1, 0, 0)));
                ped.Ped.RelationshipGroup    = leader.Team.RelationshipGroup;
                ped.Ped.BlockPermanentEvents = false;
                ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver);

                childAsset.Manage(ped, vehicle);
                children.Add(childAsset);
            }
        }
Exemplo n.º 4
0
        public void AddChildren(int count = 0)
        {
            var spawnPos = leader.Team.GroundSpawnPoint.Position;
            var pedModel = new Model(PedHash.Pilot02SMM);
            var vehModel = new Model(VehicleHash.Barracks3);

            if (!pedModel.IsLoaded)
                pedModel.Request(1000);

            if (!vehModel.IsLoaded)
                vehModel.Request(1000);

            for (int i = 0; i < count; i++)
            {
                var parent = children.Count > 0 ? children.Last() : leader ;

                var childAsset = new GroundAI();
                var pos = parent.ManagedVehicle.Position - parent.ManagedVehicle.ForwardVector * 6;
                var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, pos));

                vehicle.Vehicle.EngineRunning = true;
                vehicle.Vehicle.Heading = leader.Team.GroundSpawnPoint.Heading;
                vehicle.AddBlip();
                vehicle.CurrentBlip.Sprite = BlipSprite.BountyHit;

                Function.Call(Hash.SET_ENTITY_LOAD_COLLISION_FLAG, vehicle.Handle, true);

                var ped = new ManageablePed(new Ped(Function.Call<int>(Hash.CREATE_PED_INSIDE_VEHICLE, vehicle.Handle, 6, pedModel.Hash, -1, 0, 0)));
                ped.Ped.RelationshipGroup = leader.Team.RelationshipGroup;
                ped.Ped.BlockPermanentEvents = false;
                ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver);

                childAsset.Manage(ped, vehicle);
                children.Add(childAsset);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Follow another ground asset.
 /// </summary>
 /// <param name="asset"></param>
 public void StartFollow(GroundAI asset)
 {
     Function.Call(Hash._TASK_VEHICLE_FOLLOW, ManagedPed.Handle, ManagedVehicle.Handle, asset.ManagedPed.Handle, 40f, 262275, 10);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Follow another ground asset.
 /// </summary>
 /// <param name="asset"></param>
 public void StartFollow(GroundAI asset)
 {
     Function.Call(Hash._TASK_VEHICLE_FOLLOW, ManagedPed.Handle, ManagedVehicle.Handle, asset.ManagedPed.Handle, 40f, 262275, 10);
 }