예제 #1
0
 public void HelpHunter()
 {
     TimesTold++;
     if (TimesTold < 5)
     {
         Vector3 pos = World.GetSafeCoordForPed(Game.Player.Character.Position + (Game.Player.Character.ForwardVector * 40), false);
         HunterPed.Task.RunTo(pos);
     }
     else
     {
         TimesTold = 0;
         LivelyWorld.AddQueuedConversation("~b~[Hunter]~w~You're not very good as a Spotter.");
     }
 }
예제 #2
0
        public void Process()
        {
            if ((!Game.Player.Character.IsInRangeOf(HunterPed.Position, DespawnRange) || !HunterPed.IsAlive) && !Finished)
            {
                Finished = true;
            }
            if (LivelyWorld.CanWeUse(HunterDog) && !HunterDog.IsInRangeOf(HunterPed.Position, 5f) && HunterDog.IsStopped)
            {
                Function.Call(Hash.TASK_GO_TO_ENTITY, HunterDog, HunterPed, -1, 2f, 1f, 0f, 0);
            }

            if (!Notified && Game.Player.Character.IsStopped && Game.Player.Character.IsInRangeOf(HunterPed.Position, 8f))
            {
                Notified = true;
                LivelyWorld.AddQueuedConversation("~b~[Hunter]~w~: Hey man wandering alone in the woods, why don't you give me a hand here. If you spot any animal, tell me, ok?");
                LivelyWorld.AddQueuedHelpText("If you spot prey, press ~INPUT_CONTEXT~ to tell the ~b~Hunter~w~.");
                World.SetRelationshipBetweenGroups(Relationship.Like, HunterRLGroup, Game.GenerateHash("PLAYER"));
                World.SetRelationshipBetweenGroups(Relationship.Like, Game.GenerateHash("PLAYER"), HunterRLGroup);
            }
            if (!HunterPed.IsInCombat && HunterPed.IsStopped)
            {
                patience++;
                if (!PlayedCall && LivelyWorld.RandomInt(0, 10) <= 5)
                {
                    Function.Call(Hash.PLAY_SOUND_FROM_ENTITY, -1, "PLAYER_CALLS_ELK_MASTER", HunterPed, 0, 0, 0);
                    PlayedCall = true;
                }
            }
            else if (PlayedCall)
            {
                PlayedCall = false;
            }
            if (HunterPed.IsInCombat)
            {
                foreach (Ped ped in World.GetAllPeds())
                {
                    if (ped.HeightAboveGround < 3f && !ped.IsHuman && !ped.IsAlive && HunterPed.IsInCombatAgainst(ped))
                    {
                        Function.Call(Hash._0x0DC7CABAB1E9B67E, ped, true); //Load Collision

                        //target = ped;
                        TaskSequence seq = new TaskSequence();

                        //Function.Call(Hash._PLAY_AMBIENT_SPEECH1, 0, "KILLED_ALL", "SPEECH_PARAMS_FORCE");
                        Function.Call(Hash.TASK_GO_TO_ENTITY, 0, ped, -1, 1f, 3f, 0f, 0);
                        Function.Call(Hash.SET_BLOCKING_OF_NON_TEMPORARY_EVENTS, 0, false);

                        seq.Close();
                        HunterPed.Task.PerformSequence(seq);
                        seq.Dispose();
                        if (TimesTold > 0)
                        {
                            LivelyWorld.AddQueuedConversation("~b~[Hunter]~w~: Thanks, man.~n~~g~$10~w~ for your help.");
                            Game.Player.Money += 10;
                            TimesTold          = 0;
                        }
                        break;
                    }
                }
            }
            else
            {
                if (patience > 5)
                {
                    //HunterPed.RelationshipGroup = HunterRLGroup;
                    foreach (Ped ped in World.GetNearbyPeds(HunterPed, 5f))
                    {
                        if (ped.IsDead)
                        {
                            if (Game.Player.Character.IsInRangeOf(HunterPed.Position, 20f))
                            {
                                Kills++;

                                LivelyWorld.AddQueuedConversation("~b~[Hunter]~w~: That's one for the pot!");
                                if (Kills > 4 && LivelyWorld.CanWeUse(HunterCar))
                                {
                                    LivelyWorld.AddQueuedConversation("~b~[Hunter]~w~:That's enough for today."); Finished = true;
                                }
                                else if (Kills > 1)
                                {
                                    LivelyWorld.AddQueuedConversation("~b~[Hunter]~w~: " + Kills + " already!");
                                }
                            }
                            if (LivelyWorld.CanWeUse(HunterCar))
                            {
                                Function.Call(GTA.Native.Hash.SET_ENTITY_LOAD_COLLISION_FLAG, ped, true); //Load Collision

                                Function.Call(Hash.SET_ENTITY_RECORDS_COLLISIONS, ped, true);             //Load Collision

                                ped.IsPersistent = true;
                                LivelyWorld.TemporalPersistence.Add(ped);
                                ped.Position = HunterCar.Position + (HunterCar.ForwardVector * -2) + (HunterCar.UpVector * 2);
                                Function.Call(Hash.SET_PED_TO_RAGDOLL, ped, 2000, 2000, 3, true, true, false);
                                Function.Call(Hash.CREATE_NM_MESSAGE, 1151);
                                Function.Call(Hash.GIVE_PED_NM_MESSAGE, ped, true);
                            }
                            else
                            {
                                ped.Delete();
                            }
                            break;
                        }
                    }
                    HunterPed.BlockPermanentEvents = false;
                    Vector3 pos = HunterPed.Position;
                    Function.Call(Hash.TASK_WANDER_IN_AREA, HunterPed, pos.X, pos.Y, pos.Z, 100f, 2f, 3f);
                    patience  = 0;
                    TimesTold = 0;
                }
            }
        }