示例#1
0
        public static void SurvivorGroupSpawn(Vector3 pos, GroupType groupType = 3, int groupSize = -1, PedTasks pedTasks = 1)
        {
            if (groupType == GroupType.Random)
            {
                int num = RandoMath.CachedRandom.Next(0, 3);
                if (num == 0)
                {
                    groupType = GroupType.Friendly;
                }
                if (num == 1)
                {
                    groupType = GroupType.Neutral;
                }
                if (num == 2)
                {
                    groupType = GroupType.Hostile;
                }
            }
            List <Ped> list  = new List <Ped>();
            PedGroup   group = new PedGroup();

            if (groupSize == -1)
            {
                groupSize = RandoMath.CachedRandom.Next(3, 9);
            }
            int num2 = 0;

            while (true)
            {
                if (num2 >= groupSize)
                {
                    foreach (Ped ped2 in list)
                    {
                        if (group.MemberCount < 1)
                        {
                            group.Add(ped2, true);
                            continue;
                        }
                        group.Add(ped2, false);
                    }
                    group.FormationType = FormationType.Default;
                    foreach (Ped ped3 in group.ToList(true))
                    {
                        PlayerGroup.SetPedTasks(ped3, pedTasks);
                    }
                    return;
                }
                SurvivorPed ped = SurvivorSpawn(pos);
                if (groupType == GroupType.Friendly)
                {
                    ped.pedEntity.RelationshipGroup = Relationships.FriendlyGroup;
                    ped.pedEntity.AddBlip();
                    ped.pedEntity.CurrentBlip.Color = BlipColor.Blue;
                    ped.pedEntity.CurrentBlip.Scale = 0.65f;
                    ped.pedEntity.CurrentBlip.Name  = "Friendly";
                }
                else if (groupType == GroupType.Neutral)
                {
                    ped.pedEntity.RelationshipGroup = Relationships.NeutralGroup;
                    ped.pedEntity.AddBlip();
                    ped.pedEntity.CurrentBlip.Color = BlipColor.Yellow;
                    ped.pedEntity.CurrentBlip.Scale = 0.65f;
                    ped.pedEntity.CurrentBlip.Name  = "Neutral";
                }
                else if (groupType == GroupType.Hostile)
                {
                    ped.pedEntity.RelationshipGroup = Relationships.HostileGroup;
                    ped.pedEntity.AddBlip();
                    ped.pedEntity.CurrentBlip.Color = BlipColor.Red;
                    ped.pedEntity.CurrentBlip.Scale = 0.65f;
                    ped.pedEntity.CurrentBlip.Name  = "Hostile";
                }
                list.Add(ped.pedEntity);
                num2++;
            }
        }
 public InputArgument(PedGroup value) : this((object)value)
 {
 }
示例#3
0
    void OnKeyUp(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.U)
        {
            Ped player = Game.Player.Character;

            Vector3 loc = player.Position + (player.ForwardVector * 5);

            Ped ped = World.CreatePed(PedHash.Cop01SMY, loc);             //Pedone che viene generato

            GTA.UI.ShowSubtitle("~r~Police have spawned, ~y~be careful"); //scritta che compare

            ped.Weapons.Give(WeaponHash.Pistol50, 100, true, true);       //arma del pedone (WeaponHash.nome-arma, colpi, se è disponibile, se è carica)

            ped.Task.FightAgainst(player);                                //attacca il giocatore

            UI.Notify("Mod by Anonik");
        }

        if (e.KeyCode == Keys.I)
        {
            Ped player = Game.Player.Character;

            Vector3 loc = player.Position + (player.ForwardVector * 5);

            Ped ped = World.CreatePed(PedHash.Swat01SMY, loc);

            GTA.UI.ShowSubtitle("~r~Swat have spawned, ~y~be careful");

            ped.Weapons.Give(WeaponHash.CarbineRifle, 250, true, true);

            ped.Task.FightAgainst(player);

            UI.Notify("Mod by Anonik");
        }

        if (e.KeyCode == Keys.O)
        {
            Ped player = Game.Player.Character;

            Vector3 loc = player.Position + (player.ForwardVector * 5);

            Ped ped = World.CreatePed(PedHash.Marine03SMY, loc);

            GTA.UI.ShowSubtitle("~r~Marine spawned, ~y~be careful");

            ped.Weapons.Give(WeaponHash.SpecialCarbine, 250, true, true);

            ped.Task.FightAgainst(player);

            UI.Notify("Mod by Anonik");
        }

        if (e.KeyCode == Keys.X)
        {
            Ped player = Game.Player.Character;

            Vector3 loc = player.Position + (player.ForwardVector * 5);

            Ped bodyguard = World.CreateRandomPed(loc);

            //Ped bodyguard = World.CreatePed(PedHash.Cop01SMY, loc);

            bodyguard.Weapons.Give(WeaponHash.CarbineRifle, 9999, true, true);

            bodyguard.Armor = 100;

            PedGroup ped = player.CurrentPedGroup;

            Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, bodyguard, ped);

            Function.Call(Hash.SET_PED_COMBAT_ABILITY, bodyguard, 100);

            Function.Call(Hash.SET_PED_ACCURACY, bodyguard, 100);

            bodyguard.Task.FightAgainstHatedTargets(50000);

            UI.Notify("Bodyguard Spawned");

            UI.Notify("Mod by Anonik");

            if (player.IsInvincible == true)
            {
                bodyguard.IsInvincible = true;
            }
        }

        if (e.KeyCode == Keys.K)
        {
            Ped player = Game.Player.Character;

            Vector3 loc = player.Position + (player.ForwardVector * 5);

            Ped bodyguard = World.CreatePed(PedHash.Cop01SMY, loc);

            bodyguard.Weapons.Give(WeaponHash.Pistol50, 9999, true, true);

            bodyguard.Armor = 100;

            PedGroup ped = player.CurrentPedGroup;

            Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, bodyguard, ped);

            Function.Call(Hash.SET_PED_COMBAT_ABILITY, bodyguard, 100);

            Function.Call(Hash.SET_PED_ACCURACY, bodyguard, 100);

            bodyguard.Task.FightAgainstHatedTargets(50000);

            UI.Notify("Bodyguard Spawned");

            UI.Notify("Mod by Anonik");

            if (player.IsInvincible == true)
            {
                bodyguard.IsInvincible = true;
            }
        }
    }
 public Enumerator(PedGroup group) => this._group = group;
示例#5
0
 public OutputArgument(PedGroup initvalue) : this((object)initvalue)
 {
 }
        private IEnumerable <object> HitohanabiCoroutine()
        {
            //プレイや周辺の15m上空を設定
            var pedList = new HashSet <Ped>();

            //タイマが終わるまでカウントし続ける
            while (!ReduceCounter.IsCompleted)
            {
                foreach (
                    var targetPed in
                    core.CachedPeds.Where(
                        x => x.IsSafeExist() &&
                        x.IsAlive &&
                        x.IsHuman &&
                        !x.IsCutsceneOnlyPed() &&
                        x.IsInRangeOf(core.PlayerPed.Position, 100))
                    )
                {
                    //まだの人をリストにくわえる
                    if (pedList.Count < 30 && !pedList.Contains(targetPed))
                    {
                        if (PedGroup.Exists(core.PlayerPed.CurrentPedGroup) && core.PlayerPed.CurrentPedGroup.Contains(targetPed))
                        {
                            continue;
                        }

                        var relationShip = targetPed.RelationshipGroup;
                        if (relationShip == core.GetGTAObjectHashKey("PLAYER"))
                        {
                            continue;
                        }                                                                    //ミッション上での仲間は除外する(誤判定が起きる場合があるので暫定)

                        pedList.Add(targetPed);
                        if (targetPed.IsInVehicle())
                        {
                            targetPed.Task.ClearAllImmediately();
                        }
                        targetPed.CanRagdoll = true;
                        targetPed.SetToRagdoll();
                    }
                }

                foreach (var targetPed in pedList.Where(x => x.IsSafeExist()))
                {
                    //すいこむ
                    var targetPos      = (core.PlayerPed.ForwardVector).Normalized();
                    var targetPosition = core.PlayerPed.Position + new Vector3(0, 0, 10) + targetPos * 40;
                    var direction      = targetPosition - targetPed.Position;
                    targetPed.FreezePosition = false;
                    targetPed.SetToRagdoll();
                    var lenght = direction.Length();
                    if (lenght > 5)
                    {
                        direction.Normalize();
                        targetPed.ApplyForce(direction * lenght.Clamp(0, 5) * 30);
                    }
                }
                yield return(null);
            }


            //バクハツシサン
            foreach (var targetPed in pedList.Where(x => x.IsSafeExist()))
            {
                var targetPos      = (core.PlayerPed.ForwardVector).Normalized();
                var targetPosition = core.PlayerPed.Position + new Vector3(0, 0, 10) + targetPos * 40;
                GTA.World.AddExplosion(targetPosition, GTA.ExplosionType.Plane, 2.0f, 0.0f);
                targetPed.ApplyForce(InfernoUtilities.CreateRandomVector() * 10);
            }

            //終了
            ParupunteEnd();
        }
示例#7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object" /> class.
 /// </summary>
 /// <param name="pedGroup">The ped group to wrap.</param>
 public WPedGroup(PedGroup pedGroup)
 {
     PedGroup = pedGroup;
     Init();
 }
示例#8
0
    private void OnKeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode == Keys.X)    // checks if X pressed
        {
            if (num_x >= 7)
            {
                //PREVENT SPAWNING------------------------------------------------
                UI.Notify("You can\'t spawn anymore bodyguards");
            }
            else
            {
                //offset the bodyguard spawn point from player position
                Vector3 spawn_loc = playerPed.Position + (playerPed.ForwardVector * 5);

                //SPAWN PED-------------------------------------------------------


                Ped bodyguard = World.CreatePed(new Model(PedHash.StripperLite), spawn_loc);
                bodyguard.Weapons.Give(WeaponHash.AssaultShotgun, 9999, true, true);
                bodyguard.IsInvincible     = true;
                bodyguard.CanSwitchWeapons = true;

                //add a Blip
                Blip myBlip = bodyguard.AddBlip();
                myBlip.Scale      = 0.5f;
                myBlip.IsFriendly = true;
                myBlip.Color      = BlipColor.Pink;

                // gets the players current group
                PedGroup playerGroup = playerPed.CurrentPedGroup;

                // puts the bodyguard into the players group
                Function.Call(Hash.SET_PED_AS_GROUP_MEMBER, bodyguard, playerGroup);

                //Clear companion tasks and set their task to fighting for you
                bodyguard.Task.ClearAllImmediately();
                Function.Call(Hash.TASK_COMBAT_HATED_TARGETS_IN_AREA, bodyguard, 50000, 0);
                Function.Call(Hash.SET_PED_KEEP_TASK, bodyguard, true);
                Function.Call(Hash.SET_PED_NEVER_LEAVES_GROUP, bodyguard, true);
                // 100 = attack
                Function.Call(Hash.SET_PED_COMBAT_ABILITY, bodyguard, 100);
                //set accuracy
                Function.Call(Hash.SET_PED_ACCURACY, bodyguard, 100);

                UI.Notify("Bodyguard Spawned");
                //----------------------------------------------------------------

                bodyGuards.Add(bodyguard); //add to list
                num_x += 1;                //add 1 to bodyguard count
            }
        }

        if (e.KeyCode == Keys.Z) //check if Z pressed
        {
            //KILL BODYGUARD------------------------------------------------------
            bodyGuards[bodyGuards.Count - 1].Kill();
            bodyGuards[bodyGuards.Count - 1].Delete();
            bodyGuards.RemoveAt(bodyGuards.Count - 1);
            num_x -= 1;
            //--------------------------------------------------------------------
        }
    }
示例#9
0
        public static void SurvivorGroupSpawn(Vector3 pos, GroupType groupType = GroupType.Random, int groupSize = -1, PedTasks pedTasks = PedTasks.Wander)
        {
            if (groupType == GroupType.Random)
            {
                int rndGroupType = RandoMath.CachedRandom.Next(0, 3);
                if (rndGroupType == 0)
                {
                    groupType = GroupType.Friendly;
                }
                if (rndGroupType == 1)
                {
                    groupType = GroupType.Neutral;
                }
                if (rndGroupType == 2)
                {
                    groupType = GroupType.Hostile;
                }
            }
            List <Ped> peds  = new List <Ped>();
            PedGroup   group = new PedGroup();

            if (groupSize == -1)
            {
                groupSize = RandoMath.CachedRandom.Next(3, 9);
            }
            for (int i = 0; i < groupSize; i++)
            {
                SurvivorPed sPed = SurvivorSpawn(pos);
                if (groupType == GroupType.Friendly)
                {
                    sPed.pedEntity.RelationshipGroup = Relationships.FriendlyGroup;
                    sPed.pedEntity.AddBlip();
                    sPed.pedEntity.CurrentBlip.Color = BlipColor.Blue;
                    sPed.pedEntity.CurrentBlip.Scale = 0.65f;
                    sPed.pedEntity.CurrentBlip.Name  = "Friendly";
                }
                else if (groupType == GroupType.Neutral)
                {
                    sPed.pedEntity.RelationshipGroup = Relationships.NeutralGroup;
                    sPed.pedEntity.AddBlip();
                    sPed.pedEntity.CurrentBlip.Color = BlipColor.Yellow;
                    sPed.pedEntity.CurrentBlip.Scale = 0.65f;
                    sPed.pedEntity.CurrentBlip.Name  = "Neutral";
                }
                else if (groupType == GroupType.Hostile)
                {
                    sPed.pedEntity.RelationshipGroup = Relationships.HostileGroup;
                    sPed.pedEntity.AddBlip();
                    sPed.pedEntity.CurrentBlip.Color = BlipColor.Red;
                    sPed.pedEntity.CurrentBlip.Scale = 0.65f;
                    sPed.pedEntity.CurrentBlip.Name  = "Hostile";
                }
                peds.Add(sPed.pedEntity);
            }
            foreach (Ped ped in peds)
            {
                if (group.MemberCount < 1)
                {
                    group.Add(ped, true);
                }
                else
                {
                    group.Add(ped, false);
                }
            }
            group.FormationType = 0;
            List <Ped> groupPeds = group.ToList(true);

            foreach (Ped ped in groupPeds)
            {
                PlayerGroup.SetPedTasks(ped, pedTasks);
            }
        }
        private void OnTick(object sender, EventArgs eventArgs)
        {
            if (this.PlayerPed.IsInVehicle() || MenuConrtoller.MenuPool.IsAnyMenuOpen() || this.PlayerPed.get_CurrentPedGroup().get_MemberCount() <= 0)
            {
                return;
            }
            Ped closest = (Ped)World.GetClosest <Ped>(this.PlayerPosition, (M0[])World.GetNearbyPeds(this.PlayerPed, 1.5f));

            if (Entity.op_Equality((Entity)closest, (Entity)null) || closest.IsInVehicle() || PedGroup.op_Inequality(closest.get_CurrentPedGroup(), this.PlayerPed.get_CurrentPedGroup()))
            {
                return;
            }
            Game.DisableControlThisFrame(2, (Control)51);
            UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_CONTEXT~ to configure this ped.", false);
            if (!Game.IsDisabledControlJustPressed(2, (Control)51))
            {
                return;
            }
            this._selectedPed = closest;
            this._pedMenu.set_Visible(!this._pedMenu.get_Visible());
        }
        private static void OnTick(object sender, EventArgs eventArgs)
        {
            if (MenuConrtoller.MenuPool.IsAnyMenuOpen() || RecruitPeds.PlayerPed.get_CurrentPedGroup().get_MemberCount() >= 6)
            {
                return;
            }
            Ped closest = (Ped)World.GetClosest <Ped>(RecruitPeds.PlayerPosition, (M0[])World.GetNearbyPeds(RecruitPeds.PlayerPed, 1.5f));

            if (Entity.op_Equality((Entity)closest, (Entity)null) || ((Entity)closest).get_IsDead() || (closest.IsInCombatAgainst(RecruitPeds.PlayerPed) || closest.GetRelationshipWithPed(RecruitPeds.PlayerPed) == 5) || (closest.get_RelationshipGroup() != Relationships.FriendlyRelationship || PedGroup.op_Equality(closest.get_CurrentPedGroup(), RecruitPeds.PlayerPed.get_CurrentPedGroup())))
            {
                return;
            }
            Game.DisableControlThisFrame(2, (Control)23);
            UiExtended.DisplayHelpTextThisFrame("Press ~INPUT_ENTER~ to recruit this ped.", false);
            if (!Game.IsDisabledControlJustPressed(2, (Control)23))
            {
                return;
            }
            if (FriendlySurvivors.Instance != null)
            {
                FriendlySurvivors.Instance.RemovePed(closest);
            }
            closest.Recruit(RecruitPeds.PlayerPed);
            if (RecruitPeds.PlayerPed.get_CurrentPedGroup().get_MemberCount() < 6)
            {
                return;
            }
            UI.Notify("You've reached the max amount of ~b~guards~s~.");
        }
示例#12
0
 public enumerator(PedGroup group)
 {
     index      = -2;
     this.group = group;
 }