Ejemplo n.º 1
0
        private void SpawnEnemiesOnSurface()
        {
            var spawnRegion = PlayerPed.Position.Around(25f);
            var random      = new Random();
            var totalAliens = random.Next(8, 13);

            for (int i = 0; i < totalAliens; i++)
            {
                var randDist   = Function.Call <float>(Hash.GET_RANDOM_FLOAT_IN_RANGE, 20f, 100f);
                var spawnPoint = spawnRegion.Around(randDist);
                var ground     = World.GetGroundHeight(spawnPoint + Vector3.WorldUp);
                if (ground == 0)
                {
                    continue;
                }

                var ped = GtsLibNet.CreateAlien(null, spawnPoint, random.Next(20, 180));
                ped.Position = new Vector3(ped.Position.X, ped.Position.Y, ground);
                ped.Weapons.Give((WeaponHash)Game.GenerateHash("weapon_pulserifle"), 15, true, true);
                ped.AddBlip();
                ped.IsOnlyDamagedByPlayer = true;
                _alienPeds.Add(ped);
                Script.Yield();
            }
        }
Ejemplo n.º 2
0
        public void Start()
        {
            var spawnRegion = new Vector3(-9946.63f, -10148.71f, 1000.36f);
            var random      = new Random();

            for (var i = 0; i < 15; i++)
            {
                var randDist   = Function.Call <float>(Hash.GET_RANDOM_FLOAT_IN_RANGE, 20f, 100f);
                var spawnPoint = spawnRegion.Around(randDist);
                var ground     = World.GetGroundHeight(spawnPoint + Vector3.WorldUp);
                if (ground == 0)
                {
                    continue;
                }
                var ped = GtsLibNet.CreateAlien(null, spawnPoint, random.Next(135, 220));
                ped.Position = new Vector3(ped.Position.X, ped.Position.Y, ground);
                ped.Weapons.Give((WeaponHash)Game.GenerateHash("weapon_pulserifle"), 15, true, true);
                ped.AddBlip();
                ped.IsOnlyDamagedByPlayer = true;
                _hostiles.Add(ped);
                Script.Yield();
            }

            var ufoModel = new Model("zanufo");

            ufoModel.Request();
            while (!ufoModel.IsLoaded)
            {
                Script.Yield();
            }
            for (var i = 0; i < 4; i++)
            {
                var randDist   = Function.Call <float>(Hash.GET_RANDOM_FLOAT_IN_RANGE, 40f, 145f);
                var spawnPoint = spawnRegion.Around(randDist);
                var vehicle    = World.CreateVehicle(ufoModel, spawnPoint);
                vehicle.PlaceOnGround();
                vehicle.IsOnlyDamagedByPlayer = true;
                var pedModel = (Model)GtsLibNet.GetAlienModel();
                pedModel.Request();
                while (!pedModel.IsLoaded)
                {
                    Script.Yield();
                }
                var ped = vehicle.CreatePedOnSeat(VehicleSeat.Driver, pedModel);
                var b   = ped.AddBlip();
                b.Sprite = (BlipSprite)422;
                b.Name   = "UFO";
                ped.IsOnlyDamagedByPlayer = true;
                Function.Call(Hash.SET_CURRENT_PED_VEHICLE_WEAPON, ped,
                              Game.GenerateHash("VEHICLE_WEAPON_PLAYER_LAZER"));
                GtsLibNet.GivePedAlienAttributes(ped);
                pedModel.MarkAsNoLongerNeeded();
                _hostiles.Add(ped);
                _ufos.Add(vehicle);
                Script.Yield();
            }
            ufoModel.MarkAsNoLongerNeeded();
        }
Ejemplo n.º 3
0
        private void EnterShuttle()
        {
            var dist = PlayerPed.Position.DistanceTo(_shuttlePosition);

            if (dist > ShuttleInteractDistance)
            {
                return;
            }
            Game.DisableControlThisFrame(2, Control.Enter);
            GtsLibNet.DisplayHelpTextWithGxt("SHUT_ENTER");
            if (!Game.IsDisabledControlJustPressed(2, Control.Enter))
            {
                return;
            }
            PlacePlayerInShuttle();
        }
Ejemplo n.º 4
0
        public void Update()
        {
            if (PlayerPed.IsDead)
            {
                EndScenario(false);
            }

            switch (_missionStep)
            {
            case 0:
                var distToColonel = _colonel.Position.DistanceTo(PlayerPed.Position);
                if (distToColonel > 1.75)
                {
                    return;
                }
                World.DrawMarker(MarkerType.UpsideDownCone, _colonel.Position + Vector3.WorldUp * 1.5f,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.35f, 0.35f, 0.35f), Color.Gold);
                GtsLibNet.DisplayHelpTextWithGxt("END_LABEL_1");
                if (Game.IsControlJustPressed(2, Control.Context))
                {
                    Function.Call(Hash._PLAY_AMBIENT_SPEECH1, _colonel.Handle, "Generic_Hi", "Speech_Params_Force");
                    PlayerPed.Heading = (_colonel.Position - PlayerPed.Position).ToHeading();
                    PlayerPed.Task.ChatTo(_colonel);
                    PlayerPed.Task.StandStill(-1);
                    _colonel.Task.ChatTo(PlayerPed);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_1", 5000);
                    Script.Wait(3000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_2", 5000);
                    Script.Wait(3000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_3", 6000);
                    Script.Wait(3000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_4", 6000);
                    Script.Wait(3000);
                    Game.FadeScreenOut(1000);
                    Script.Wait(1000);
                    PlayerPed.Task.ClearAllImmediately();
                    PlayerPed.FreezePosition = false;
                    _colonel.Delete();
                    _colonel.CurrentBlip?.Remove();
                    Script.Wait(1000);
                    Game.FadeScreenIn(1000);
                    Script.Wait(1000);
                    Core.HeliTransport?.ShowHelp();
                    _missionStep++;
                }
                break;

            case 1:
                DidStart = true;
                if (!_isSatelliteMessageShown)
                {
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_5", 5000);
                    _isSatelliteMessageShown = true;
                }
                if (!_dishesInitialized)
                {
                    if (!Blip.Exists(_dishesAreaBlip))
                    {
                        _dishesAreaBlip           = World.CreateBlip(_dishesArea, 200);
                        _dishesAreaBlip.ShowRoute = true;
                        _dishesAreaBlip.Alpha     = 155;
                        _dishesAreaBlip.Color     = BlipColor.Yellow;
                    }
                    var dist = PlayerPed.Position.DistanceToSquared(_dishesArea);
                    if (dist > 40000)
                    {
                        return;
                    }
                    _dishesAreaBlip?.Remove();
                    _dishes.ForEach(dish =>
                    {
                        dish.CreateLaptop();
                        dish.CreateBlip();
                    });
                    _dishesInitialized = true;
                }
                _dishes.ForEach(x => x.Update());
                foreach (var dish in _dishes)
                {
                    if (!dish.CheckedForData)
                    {
                        var dist = dish.Position.DistanceTo(PlayerPed.Position);
                        if (dist > 1.75f)
                        {
                            continue;
                        }
                        GtsLibNet.DisplayHelpTextWithGxt("INTRO_LABEL_6");
                        if (!Game.IsControlJustPressed(2, Control.Context))
                        {
                            continue;
                        }
                        PlayerPed.FreezePosition = true;
                        PlayerPed.Task.StandStill(-1);
                        PlayerPed.Position = dish.Position;
                        PlayerPed.Heading  = dish.Heading;

                        var groundZ = new OutputArgument();
                        Function.Call(Hash.GET_GROUND_Z_FOR_3D_COORD, PlayerPed.Position.X,
                                      PlayerPed.Position.Y, PlayerPed.Position.Z, groundZ, false);
                        PlayerPed.Position = new Vector3(PlayerPed.Position.X, PlayerPed.Position.Y,
                                                         groundZ.GetResult <float>());

                        PlayerPed.Task.PlayAnimation("missbigscore2aswitch", "switch_mic_car_fra_laptop_hacker",
                                                     4f, -1, AnimationFlags.None);

                        Script.Wait(3000);

                        PlayerPed.FreezePosition = false;
                        PlayerPed.Task.ClearAll();
                        dish.CheckedForData = true;
                        dish.RemoveBlip();
                    }
                }
                _missionStep += _dishes.All(x => x.CheckedForData) ? 1 : 0;
                break;

            case 2:
                if (!_isHumaneLabsMessageShown)
                {
                    Function.Call(Hash.PLAY_MISSION_COMPLETE_AUDIO, "FRANKLIN_BIG_01");
                    while (!Function.Call <bool>(Hash.IS_MISSION_COMPLETE_PLAYING))
                    {
                        Script.Yield();
                    }
                    ScaleFormMessages.Message.SHOW_MISSION_PASSED_MESSAGE(Game.GetGXTEntry("INTRO_LABEL_8"));
                    Effects.Start(ScreenEffect.SuccessNeutral, 5000);
                    Script.Wait(4500);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_7");
                    _isHumaneLabsMessageShown = true;
                }
                if (_humaneLabsBlip == null)
                {
                    _humaneLabsBlip = new Blip(World.CreateBlip(_humaneLabsEnterance).Handle)
                    {
                        Color     = BlipColor.Yellow,
                        Name      = "Humane Labs",
                        ShowRoute = true
                    }
                }
                ;
                _missionStep++;
                break;

            case 3:
                if (PlayerPed.IsInVehicle())
                {
                    return;
                }
                World.DrawMarker(MarkerType.VerticalCylinder, _humaneLabsEnterance - Vector3.WorldUp,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.5f, 0.5f, 0.5f), Color.Gold);
                var distance = Vector3.Distance(PlayerPed.Position, _humaneLabsEnterance);
                if (distance <= 1.5f)
                {
                    GtsLibNet.DisplayHelpTextWithGxt(
                        "INTRO_LABEL_9");     // "Press ~INPUT_CONTEXT~ to enter/exit humane labs."

                    if (Game.IsControlJustPressed(2, Control.Context))
                    {
                        Game.FadeScreenOut(1);
                        PlayerPed.Position = _humaneLabsExit - Vector3.WorldUp;
                        PlayerPed.Heading  = 173.5802f;
                        Game.FadeScreenIn(750);
                        _missionStep++;
                    }
                }
                break;

            case 4:
                _humaneLabsBlip?.Remove();
                Peds.Add(World.CreatePed(PedHash.Marine02SMM, new Vector3(3534.057f, 3671.142f, 27.12115f),
                                         331.006f));
                Peds.Add(World.CreatePed(PedHash.Scientist01SMM, new Vector3(3539.069f, 3663.527f, 27.12188f),
                                         172.762f));
                Peds.Add(World.CreatePed(PedHash.Scientist01SMM, new Vector3(3534.83f, 3660.603f, 27.12189f),
                                         316.3855f));
                Peds.Add(World.CreatePed(PedHash.Scientist01SMM, new Vector3(3537.047f, 3664.484f, 27.12189f),
                                         172.7052f));
                StartScenarioChecked(Peds[0], "WORLD_HUMAN_GUARD_STAND");     // guard
                StartScenarioChecked(Peds[1], "WORLD_HUMAN_CLIPBOARD");
                StartScenarioChecked(Peds[2], "WORLD_HUMAN_CLIPBOARD");
                StartScenarioChecked(Peds[3], "WORLD_HUMAN_AA_COFFEE");
                var b = Peds[3]?.AddBlip();
                if (b != null)
                {
                    b.Name  = "Scientist";
                    b.Color = BlipColor.Yellow;
                }
                Peds.ForEach(p =>
                {
                    if (p == null)
                    {
                        return;
                    }

                    p.CanRagdoll        = false;
                    p.RelationshipGroup = PlayerPed.RelationshipGroup;
                });
                _missionStep++;
                break;

            case 5:
                if (Peds[3] == null)
                {
                    DeletePeds();
                    _missionStep--;     // go back and request again.
                    return;
                }
                var mainScientist = Peds[3];
                distance = Vector3.Distance(mainScientist.Position, PlayerPed.Position);
                if (distance > 1.3f)
                {
                    return;
                }
                GtsLibNet.DisplayHelpTextWithGxt("INTRO_LABEL_10");     // "Press INPUT_TALK to talk to the scientist".
                if (Game.IsControlJustPressed(2, Control.Talk))
                {
                    Function.Call(Hash._PLAY_AMBIENT_SPEECH1, mainScientist.Handle, "Generic_Thanks",
                                  "Speech_Params_Force_Shouted_Critical");
                    mainScientist.Task.AchieveHeading((PlayerPed.Position - mainScientist.Position).ToHeading());
                    Script.Wait(1000);
                    Function.Call(Hash.PLAY_MISSION_COMPLETE_AUDIO, "FRANKLIN_BIG_01");
                    while (!Function.Call <bool>(Hash.IS_MISSION_COMPLETE_PLAYING))
                    {
                        Script.Yield();
                    }
                    ScaleFormMessages.Message.SHOW_MISSION_PASSED_MESSAGE(Game.GetGXTEntry("INTRO_LABEL_11"));
                    Effects.Start(ScreenEffect.SuccessNeutral, 5000);
                    Script.Wait(750);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_12");
                    mainScientist.CurrentBlip?.Remove();
                    _missionStep++;
                }
                break;

            case 6:
                CreateColonel();
                _humaneLabsBlip?.Remove();
                _humaneLabsBlip = new Blip(World.CreateBlip(_humaneLabsExit).Handle)
                {
                    Color = BlipColor.Yellow,
                    Name  = "Outside"
                };
                _missionStep++;
                break;

            case 7:
                World.DrawMarker(MarkerType.VerticalCylinder, _humaneLabsExit - Vector3.WorldUp,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.5f, 0.5f, 0.5f), Color.Gold);
                distance = Vector3.Distance(PlayerPed.Position, _humaneLabsExit);
                if (distance > 1.3f)
                {
                    return;
                }
                GtsLibNet.DisplayHelpTextWithGxt(
                    "INTRO_LABEL_9");     // "Press ~INPUT_CONTEXT~ to enter/exit humane labs."
                if (Game.IsControlJustPressed(2, Control.Context))
                {
                    Game.FadeScreenOut(1);
                    PlayerPed.Position = _humaneLabsEnterance - Vector3.WorldUp;
                    PlayerPed.Heading  = -173.5802f;
                    _humaneLabsBlip?.Remove();
                    Peds?.ForEach(p => p?.Delete());
                    Script.Wait(750);
                    Game.FadeScreenIn(1000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_13");
                    _missionStep++;
                }
                break;

            case 8:
                distance = PlayerPed.Position.DistanceToSquared(_colonel.Position);
                if (distance > 3f)
                {
                    return;
                }
                World.DrawMarker(MarkerType.UpsideDownCone, _colonel.Position + Vector3.WorldUp * 1.5f,
                                 Vector3.RelativeRight, Vector3.Zero, new Vector3(0.35f, 0.35f, 0.35f), Color.Gold);
                GtsLibNet.DisplayHelpTextWithGxt("END_LABEL_1");

                if (Game.IsControlJustPressed(2, Control.Context))
                {
                    PlayerPed.Heading = (_colonel.Position - PlayerPed.Position).ToHeading();
                    PlayerPed.Task.ChatTo(_colonel);
                    PlayerPed.Task.StandStill(-1);
                    _colonel.Task.ChatTo(PlayerPed);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_14");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_15");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_16");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_17");
                    Script.Wait(5000);
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_18");
                    Script.Wait(2000);
                    Function.Call(Hash._PLAY_AMBIENT_SPEECH1, PlayerPed.Handle, "Generic_Thanks",
                                  "Speech_Params_Force");
                    GtsLibNet.ShowSubtitleWithGxt("INTRO_LABEL_19");
                    Script.Wait(4000);
                    Game.FadeScreenOut(1500);
                    Script.Wait(1500);
                    PlayerPed.Task.ClearAll();
                    _colonel?.Delete();
                    Game.FadeScreenIn(1500);
                    Function.Call(Hash.PLAY_MISSION_COMPLETE_AUDIO, "FRANKLIN_BIG_01");
                    while (!Function.Call <bool>(Hash.IS_MISSION_COMPLETE_PLAYING))
                    {
                        Script.Yield();
                    }
                    ScaleFormMessages.Message.SHOW_MISSION_PASSED_MESSAGE(Game.GetGXTEntry("INTRO_LABEL_20"));
                    Effects.Start(ScreenEffect.SuccessNeutral, 5000);
                    Script.Wait(4500);
                    UI.ShowSubtitle(Game.GetGXTEntry("GO_TO") + " ~p~Space~s~.");
                    EndScenario(true);
                }
                break;
            }
        }