Exemplo n.º 1
0
        /// <summary>
        /// Setup fighter for the local player.
        /// </summary>
        public void Setup()
        {
            var vehModel = new Model(VehicleHash.Lazer);

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

            //Create the vehicle
            var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, Team.JetSpawnPoint.Position));
            vehicle.Heading = Team.JetSpawnPoint.Heading;

            vehicle.Vehicle.EngineRunning = true;
            vehicle.IsInvincible = true;
            vehicle.MaxSpeed = 110;
            ManagedVehicle = vehicle;
            ManagedVehicle.EnterWater += EnterWater;

            irFlares = new IRFlareManager();

            irFlares.SetupWithVehicle(ManagedVehicle.Vehicle);

            //Handle the ped
            var ped = new ManageablePed(Game.Player.Character);
            ped.Ped.RelationshipGroup = Team.RelationshipGroup;
            ped.Ped.SetIntoVehicle(vehicle.Vehicle, VehicleSeat.Driver);
            ped.IsInvincible = true;

            ManagedPed = ped;
            ManagedPed.ExitVehicle += ExitVehicle;

            interpCam = new InterpolatingCamera(vehicle.GetOffsetInWorldCoords(new Vector3(-2f, -2f, 10f)));
            interpCam.MainCamera.PointAt(vehicle);
            interpCam.Start();

            engineFX1 = new LoopedPTFX("core", "ent_sht_extinguisher");
            engineSound = new GameSound("SPRAY", "CARWASH_SOUNDS");

            boostTimer.Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Setup fighter for the AI player.
        /// </summary>
        public void Setup()
        {
            var vehModel = new Model(VehicleHash.Blimp);

            OutputArgument outVec = new OutputArgument(), outFlt = new OutputArgument();

            var pos = TeamManager.CenterMap;

            Function.Call(Hash.GET_RANDOM_VEHICLE_NODE, pos.X, pos.Y, pos.Z, 1200f, 1, 1, 1, outVec, outFlt);

            var spawnPos = Scripts.GetValidSpawnPos(outVec.GetResult<Vector3>() + new Vector3(0, 0, 400f));

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

            var vehicle = new ManageableVehicle(World.CreateVehicle(vehModel, spawnPos));
            vehicle.LodDistance = 2000;
            vehicle.Heading = outFlt.GetResult<float>();
            vehicle.Vehicle.EngineRunning = true;
            Function.Call(Hash.SET_VEHICLE_EXPLODES_ON_HIGH_EXPLOSION_DAMAGE, vehicle.Handle, true);

            vehicle.Vehicle.BodyHealth = 1000;
            vehicle.MaxHealth = 1000;
            vehicle.MaxSpeed = 0;

            var blip = vehicle.AddBlip();
            blip.Sprite = BlipSprite.Blimp;
            blip.Scale = 0.8f;
            blip.Alpha = 220;

            var cl = TeamManager.GetColorFromTeamIndex(Team.Index);

            Function.Call(Hash.SET_BLIP_SECONDARY_COLOUR, blip.Handle, cl.R, cl.G, cl.B);
            Function.Call((Hash)0xB81656BC81FE24D1, blip.Handle, 1);

            ManagedVehicle = vehicle;
        }
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 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.º 5
0
 /// <summary>
 /// Assign a ManageablePed and ManageableVehicle object to this ground asset.
 /// </summary>
 /// <param name="Pilot"></param>
 /// <param name="Vehicle"></param>
 /// <returns></returns>
 public GroundAI Manage(ManageablePed Driver, ManageableVehicle Vehicle)
 {
     ped = Driver;
     vehicle = Vehicle;
     return this;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Assign a ManageableVehicle object to this objective blimp.
 /// </summary>
 /// <param name="Pilot"></param>
 /// <param name="Vehicle"></param>
 /// <returns></returns>
 public ObjectiveEntity Manage(ManageableVehicle Vehicle)
 {
     vehicle = Vehicle;
     return this;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Assign a ManageablePed and ManageableVehicle object to this fighter.
 /// </summary>
 /// <param name="Pilot"></param>
 /// <param name="Vehicle"></param>
 /// <returns></returns>
 public ActiveFighter Manage(ManageablePed Pilot, ManageableVehicle Vehicle)
 {
     ped = Pilot;
     vehicle = Vehicle;
     return this;
 }