Esempio n. 1
0
        private void CreatePed(MapObject mapObject, Model model)
        {
            var ped = new Ped(
                World.CreatePed(model, mapObject.Position - Vector3.WorldUp, mapObject.Rotation.Z)?.Handle ?? 0);

            if (!mapObject.Dynamic)
            {
                ped.FreezePosition = true;
            }

            ped.Quaternion = mapObject.Quaternion;
            if (mapObject.Weapon != null)
            {
                ped.Weapons.Give(mapObject.Weapon.Value, 15, true, true);
            }
            SetScenario(mapObject, ped);
            if (Enum.TryParse(mapObject.Relationship, out Relationship relationship))
            {
                if (relationship == Relationship.Hate)
                {
                    ped.RelationshipGroup = Game.GenerateHash("HATES_PLAYER");
                }

                World.SetRelationshipBetweenGroups(relationship, ped.RelationshipGroup,
                                                   Game.Player.Character.RelationshipGroup);

                World.SetRelationshipBetweenGroups(relationship, Game.Player.Character.RelationshipGroup,
                                                   ped.RelationshipGroup);

                if (relationship == Relationship.Companion)
                {
                    ped.CanBeTargetted    = false;
                    ped.RelationshipGroup = Game.Player.Character.RelationshipGroup;
                }
            }

            ped.BlockPermanentEvents = false;
            model.MarkAsNoLongerNeeded();
            Peds?.Add(ped);
        }
Esempio n. 2
0
        public override bool OnBeforeCalloutDisplayed()
        {
            //Create our ped in the world
            Suspect myPed = new Suspect("Suspect1", "a_m_y_mexthug_01", SpawnPoint.Around(10), 0);

            //Create the vehicle for our ped
            Vehicle myVehicle = new Vehicle("DUKES2", SpawnPoint);

            //Now we have spawned them, check they actually exist and if not return false (preventing the callout from being accepted and aborting it)
            if (!myPed.Exists())
            {
                return(false);
            }
            if (!myVehicle.Exists())
            {
                return(false);
            }

            //Add the Ped to the callout's list of Peds
            Peds.Add(myPed);

            //If we made it this far both exist so let's warp the ped into the driver seat
            myPed.WarpIntoVehicle(myVehicle, -1);

            // Show the user where the pursuit is about to happen and block very close peds.
            this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);
            this.AddMinimumDistanceCheck(5f, myPed.Position);

            // Set up our callout message and location
            this.CalloutMessage  = "Example Callout Message";
            this.CalloutPosition = SpawnPoint;

            //Play the police scanner audio for this callout (available as of the 0.2a API)
            Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT CRIME_RESIST_ARREST IN_OR_ON_POSITION", SpawnPoint);

            return(base.OnBeforeCalloutDisplayed());
        }
Esempio n. 3
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;
            }
        }
Esempio n. 4
0
 // add ped to floor
 public void Add(Ped ped)
 {
     Peds.Add(ped);
 }