Molotov after last throw

General support.
Post Reply
User avatar
kwsystems
Contributor
Contributor
Posts: 22
Joined: Sat May 02, 2020 11:43 am

Hi,

When using the molotov and I throw all of them I got this error below.
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <437ba245d8404784b9fbab9b439ac908>:0)
bl_GunManager+<ChangeGun>d__52.MoveNext () (at Assets/MFPS/Scripts/Weapon/Main/bl_GunManager.cs:426)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <480508088aee40cab70818ff164a29d5>:0)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
bl_GunManager:InputManagerControll() (at Assets/MFPS/Scripts/Weapon/Main/bl_GunManager.cs:575)
bl_GunManager:InputControl() (at Assets/MFPS/Scripts/Weapon/Main/bl_GunManager.cs:252)
bl_GunManager:OnUpdate() (at Assets/MFPS/Scripts/Weapon/Main/bl_GunManager.cs:193)
bl_UpdateManager:Update() (at Assets/MFPS/Scripts/Utility/bl_UpdateManager.cs:170)
and then Im not able to switch to any weapon until I die.
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Hi,

I found the problem, it only happens when Input Manager addon is used, to fix it simply replaces the function InputManagerControll() in bl_GunManager.cs with this:

Code: Select all

void InputManagerControll()
    {
        if (!CanSwich) return;

        if (bl_Input.isGamePad)
        {
            if (bl_Input.isButtonDown("NextWeapon"))
            {
                SwitchNext();
            }

            if (bl_Input.isButtonDown("PreviousWeapon"))
            {
                SwitchPrevious();
            }
        }
        else
        {
            if (bl_Input.isButtonDown("Weapon1") && CanSwich && currentWeaponIndex != 0)
            {
               ChangeCurrentWeaponTo(0);
            }
            if (bl_Input.isButtonDown("Weapon2") && CanSwich && currentWeaponIndex != 1)
            {
                ChangeCurrentWeaponTo(1);
            }
            if (bl_Input.isButtonDown("Weapon3") && CanSwich && currentWeaponIndex != 2)
            {
               ChangeCurrentWeaponTo(2);
            }
            if (bl_Input.isButtonDown("Weapon4") && CanSwich && currentWeaponIndex != 3)
            {
               ChangeCurrentWeaponTo(3);
            }
        }

        //fast fire knife
        if (bl_Input.isButtonDown("FastKnife") && CanSwich && currentWeaponIndex != 3 && !isFastFire)
        {
            DoFastKnifeShot();
        }
    }
How to find your Invoice Number: Here
How to find your Order Number: Here
Post Reply