Exemple #1
0
        //車に乗ってたら緊急脱出する
        private void EscapeVehicle()
        {
            var player = PlayerPed;

            if (!player.IsInVehicle())
            {
                return;
            }
            var playerVec = player.CurrentVehicle;

            if (!playerVec.IsSafeExist())
            {
                return;
            }

            Game.Player.CanControlRagdoll = true;
            player.CanRagdoll             = true;

            player.ClearTasksImmediately();
            player.Position += new Vector3(0, 0, 0.5f);
            player.SetToRagdoll();
            player.ApplyForce(new Vector3(0, 0, EscapePower) + playerVec.Velocity, InfernoUtilities.CreateRandomVector() * 10.0f);

            StartCoroutine(DelayParachute());
        }
Exemple #2
0
        private IEnumerable <object> HitohanabiCoroutine()
        {
            //プレイや周辺の15m上空を設定
            var targetPosition = core.PlayerPed.Position.Around(20) + new Vector3(0, 0, 15);
            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, 50))
                    )
                {
                    //まだの人をリストにくわえる
                    if (pedList.Count < 30 && !pedList.Contains(targetPed))
                    {
                        pedList.Add(targetPed);
                        if (targetPed.IsInVehicle())
                        {
                            targetPed.Task.ClearAllImmediately();
                        }
                        targetPed.CanRagdoll = true;
                        targetPed.SetToRagdoll();
                    }
                }

                foreach (var targetPed in pedList.Where(x => x.IsSafeExist()))
                {
                    //すいこむ
                    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) * 4);
                    }
                }
                yield return(null);
            }

            //バクハツシサン
            foreach (var targetPed in pedList.Where(x => x.IsSafeExist()))
            {
                targetPed.Kill();
                targetPed.ApplyForce(InfernoUtilities.CreateRandomVector() * 10);
            }
            GTA.World.AddExplosion(targetPosition, GTA.ExplosionType.Rocket, 2.0f, 1.0f);

            //終了
            ParupunteEnd();
        }
        private void BomBatAction(Ped ped)
        {
            if (ped.HasBeenDamagedBy(Weapon.BAT))
            {
                GTA.World.AddExplosion(ped.Position + Vector3.WorldUp * 0.5f, GTA.ExplosionType.Grenade, 40.0f,
                                       0.5f);


                var randomVector = InfernoUtilities.CreateRandomVector();
                ped.ApplyForce(randomVector * Random.Next(10, 20));
                ped.Kill();
                Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, ped);
            }
            else if (ped.HasBeenDamagedBy(Weapon.KNIFE))
            {
                GTA.World.AddExplosion(ped.Position, GTA.ExplosionType.Molotov1, 0.1f, 0.0f);
                Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, ped);
            }
            else if (ped.HasBeenDamagedBy(Weapon.GOLFCLUB))
            {
                var randomVector = InfernoUtilities.CreateRandomVector();
                ped.SetToRagdoll(100);
                ped.Velocity = randomVector * 1000;
                ped.ApplyForce(randomVector * Random.Next(2000, 4000));
                Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, ped);
            }
            else if (ped.HasBeenDamagedBy(Weapon.UNARMED) /*&& !ped.HasBeenDamagedByPed(PlayerPed)*/)
            {
                NativeFunctions.ShootSingleBulletBetweenCoords(
                    ped.Position + new Vector3(0, 0, 1),
                    ped.GetBoneCoord(Bone.IK_Head), 1, WeaponHash.StunGun, null, 1.0f);
                Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, ped);
            }
            else if (ped.HasBeenDamagedBy(Weapon.HAMMER))
            {
                if (!ped.IsInRangeOf(PlayerPed.Position, 10))
                {
                    return;
                }
                Shock(ped);
                Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, ped);
            }
            else if (ped.HasBeenDamagedBy(Weapon.Poolcue))
            {
                var blowVector = -ped.ForwardVector;
                ped.SetToRagdoll(1);
                ped.Velocity = blowVector * 10;
                ped.ApplyForce(blowVector * Random.Next(20, 40));
                Function.Call(Hash.CLEAR_PED_LAST_WEAPON_DAMAGE, ped);
            }
        }
        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();
        }