コード例 #1
0
        protected override void Process()
        {
            if (Game.LocalPlayer.Character.Position.DistanceTo(_oneSpawn.Spawn) > 150f)
            {
                return;
            }

            if (!_one)
            {
                _one = new Ped(_pData.Model, _oneSpawn.Spawn, _oneSpawn.Heading);
                _one.MakeMissionPed();
                ScenarioHelper();
            }

            if (Game.LocalPlayer.Character.Position.DistanceTo(_oneSpawn.Spawn) < 6f && _beginDialogue == false)
            {
                "Beginning Dialog".AddLog();

                _beginDialogue = true;
                _one.Tasks.Clear();
                GameFiber.Sleep(0500);
                _one.Face(Game.LocalPlayer.Character);
                Game.DisplayHelp("Press ~y~Y~w~ to start the interrogation");
            }
            if (Game.IsKeyDown(Keys.Y) && !_interrStarted)
            {
                if (_areaBlip.Exists())
                {
                    _areaBlip.Delete();
                }
                _one.Face(Game.LocalPlayer.Character);
                GameFiber.Sleep(0500);
                if (Vector3.Distance2D(Game.LocalPlayer.Character.Position, _one.Position) < 1.5f)
                {
                    Game.LocalPlayer.Character.Position = Game.LocalPlayer.Character.RearPosition;
                }
                _interrogation = new Interrogation(InterrogationCreator.InterrogationLineCreator(InterrogationCreator.Type.VictimFamily, _one), _one);
                _interrogation.StartDialog();
                _interrStarted = true;
                _interrStarted = true;
            }

            if (_interrStarted && Game.LocalPlayer.Character.Position.DistanceTo(_one.Position) > 50f)
            {
                _vfData = new ReportData(ReportData.Service.VicFamily, _one, _interrogation.InterrgoationText);
                this.Attributes.NextScripts.Clear();
                this.Attributes.NextScripts.Add("Sa_3b_Wait");
                SetScriptFinished();
            }
        }
コード例 #2
0
        protected override void Process()
        {
            if (Game.LocalPlayer.Character.Position.DistanceTo(_oneSpawn.Spawn) > 150f)
            {
                return;
            }

            if (!_one)
            {
                _one = new Ped(_sData.Model, _oneSpawn.Spawn, _oneSpawn.Heading);
                _one.MakeMissionPed();
                _one.ResetVariation();
                _one.Heading = _oneSpawn.Heading;

                GameFiber.StartNew(delegate
                {
                    "_one.Task.Start".AddLog();
                    while (Game.LocalPlayer.Character.Position.DistanceTo(_one) > 5f)
                    {
                        _one.Task_Scenario(_scenario);
                        while (NativeFunction.Natives.IS_PED_USING_ANY_SCENARIO <bool>(_one))
                        {
                            GameFiber.Yield();
                        }
                        GameFiber.Yield();
                    }
                    NativeFunction.Natives.TASK_TURN_PED_TO_FACE_ENTITY(_one, Game.LocalPlayer.Character, -1);
                });
            }

            if (Game.LocalPlayer.Character.Position.DistanceTo(_oneSpawn.Spawn) < 10f && !_notified)
            {
                _notified = true;
                Game.DisplayHelp("While you don't have enough information to arrest the ~r~suspect~w~ nothing is stopping you from have a conversation!");
                _one.Tasks.Clear();
                GameFiber.Sleep(1000);
                _one.Face(Game.LocalPlayer.Character);
            }

            if (Game.LocalPlayer.Character.Position.DistanceTo(_oneSpawn.Spawn) < 3f && !_beginDialogue)
            {
                _beginDialogue = true;
                if (_areaBlip.Exists())
                {
                    _areaBlip.Delete();
                }
                Game.DisplayHelp("Press ~y~Y~w~ to ask the ~r~suspect~w~ some questions.");
            }

            if (Game.IsKeyDown(Keys.Y) && !_interrStarted)
            {
                _one.Tasks.ClearImmediately();
                GameFiber.Sleep(0500);
                _one.Face(Game.LocalPlayer.Character);

                GameFiber.Sleep(1000);
                _interrogation = new Interrogation(InterrogationCreator.InterrogationLineCreator(InterrogationCreator.Type.Suspect, _one), _one);
                _interrogation.StartDialog();
                _interrStarted = true;
            }

            if (_interrStarted && _interrogation.HasEnded && !_leaveNotified)
            {
                _sReportData   = new ReportData(ReportData.Service.SusFamily, _one, _interrogation.InterrgoationText);
                _leaveNotified = true;
                Game.DisplayHelp("It looks like the ~r~suspect~w~ is done talking, leave the scene before you lose the case");
                StartTimer();
            }

            if (_interrStarted && Game.LocalPlayer.Character.DistanceTo(_one) > 20f)
            {
                if (!_interrogation.HasEnded)
                {
                    return;
                }

                var value = _interrogation.QuestionList.Where(q => q.Value == false)
                            .Aggregate(100, (current, q) => current - 15);

                var medal = MissionPassedScreen.Medal.Gold;
                if (value >= 80 && value < 100)
                {
                    medal = MissionPassedScreen.Medal.Silver;
                }
                else if (value < 80)
                {
                    medal = MissionPassedScreen.Medal.Bronze;
                }

                var handler = new MissionPassedHandler("Suspect Interrogation", value, medal);

                handler.AddItem("Spoke to Suspect", "", MissionPassedScreen.TickboxState.Tick);
                var num = 0;
                foreach (var q in _interrogation.QuestionList)
                {
                    num++;
                    var correct = q.Value ? "Correct" : "Incorrect";
                    handler.AddItem($"Question {num}", correct, MissionPassedScreen.TickboxState.None);
                }

                handler.Show();
                SetScriptFinished();
            }
        }