Player Stops Moving? player creation info?

Support for MFPS 2.0
Post Reply
User avatar
Stryder
New Member
New Member
Posts: 1
Joined: Thu Apr 30, 2020 7:59 am

Hey so I've recently purchased and LOVE the systems already. Only thing is I have followed all the steps correctly but my payer stops inputs after a while. I can move with wasd but nothing else works no mouse no crouch etc.

Secondly, I have managed to add players using the handy tutorial but they are still in Tpose unlike the mpfs solider examples who are positioned ready to hold a gun. When I hit play only the AI bots are there the player 1s and 2s wont work if i use the prefab of a player I created using the player creation tutorial. Supper confused about this and there's not a great amount of trouble shooting info on this forum that I have found.

Thanks for your help! this asset seems amazing but trying to find help on topics feels super difficult.
User avatar
Lovatto
Admin
Admin
Posts: 1796
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Hi Stryder,
my payer stops inputs after a while. I can move with wasd but nothing else works no mouse no crouch etc.
-Did you get any log in console when this happens? or have you seen a pattern before this happens?
I have managed to add players using the handy tutorial but they are still in Tpose unlike the mpfs solider examples who are positioned ready to hold a gun
The player prefab will be in the default pose of the player model which usually in a TPose as in your case, what you can do to pose in the Aim pose, is the following: select one of the player prefab TP Weapons and in the inspector of bl_NetworkGun of that TPWeapon click in the "Edit Hand Position" and close the window that will open, that should do it.
When I hit play only the AI bots are there the player 1s and 2s wont work if i use the prefab of a player I created using the player creation tutorial.
Sounds like an error in the player creation, please try to create a new player prefab following the tutorial and post all the logs that you get in the console after you finish.
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
MAC
Contributor
Contributor
Posts: 95
Joined: Sun May 27, 2018 7:59 am
Contact:

Hello,

I get the same problem, the camera and the bot are blocked after a while the error is :

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
bl_AICovertPointManager.GetCloseCover (UnityEngine.Transform target, bl_AICoverPoint overrdidePoint) (at Assets/MFPS/Scripts/GamePlay/AI/bl_AICovertPointManager.cs:99)
bl_AIShooterAgent.Cover (System.Boolean overridePoint, AIAgentCoverArea coverArea) (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIShooterAgent.cs:488)
bl_AIShooterAgent.Follow () (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIShooterAgent.cs:886)
bl_AIShooterAgent.TargetControll () (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIShooterAgent.cs:362)
bl_AIShooterAgent.OnUpdate () (at Assets/MFPS/Scripts/GamePlay/AI/bl_AIShooterAgent.cs:279)
bl_UpdateManager.Update () (at Assets/MFPS/Scripts/Utility/bl_UpdateManager.cs:170)
And cover point are setting , i think, correctly .
MFPS on HDRP --) https://ka2studio.net/
User avatar
Lovatto
Admin
Admin
Posts: 1796
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Thanks for the stack trace,
try replacing the code of the script bl_AICoverPointManager.cs with this:

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class bl_AICovertPointManager : MonoBehaviour
{
    public float MaxDistance = 50;
    public float UsageTime = 10;
    public bool ShowGizmos = true;

    public static List<bl_AICoverPoint> AllCovers = new List<bl_AICoverPoint>();

    public static void Register(bl_AICoverPoint co)
    {
        AllCovers.Add(co);
    }

    private void OnDestroy()
    {
        AllCovers.Clear();
    }

    public bl_AICoverPoint GetCloseCover(Transform target)
    {
        bl_AICoverPoint cover = null;
        float d = MaxDistance;
        for(int i = 0; i < AllCovers.Count; i++)
        {
            float dis = bl_UtilityHelper.Distance(target.position, AllCovers[i].transform.position);
            if(dis < MaxDistance && dis < d)
            {
                d = dis;
                cover = AllCovers[i];
            }
        }
        if (cover == null) return cover;

        if ((Time.time - cover.lastUseTime) <= UsageTime && cover.NeighbordPoints.Count > 0)
        {
            cover = cover.NeighbordPoints[Random.Range(0, cover.NeighbordPoints.Count)];
        }
        cover.lastUseTime = Time.time;
        return cover;
    }

    public bl_AICoverPoint GetCoverOnRadius(Transform target, float radius)
    {
        List<bl_AICoverPoint> list = new List<bl_AICoverPoint>();
        for (int i = 0; i < AllCovers.Count; i++)
        {
            float dis = bl_UtilityHelper.Distance(target.position, AllCovers[i].transform.position);
            if (dis <= radius)
            {
                list.Add(AllCovers[i]);
            }
        }
        bl_AICoverPoint cp = null;
        if (list.Count > 0)
        {
            cp = list[Random.Range(0, list.Count)];
        }
        if(cp == null) { cp = AllCovers[Random.Range(0, AllCovers.Count)]; }

        return cp;
    }

    public bl_AICoverPoint GetCloseCoverForced(Transform target)
    {
        bl_AICoverPoint cover = null;
        float d = 100000;
        for (int i = 0; i < AllCovers.Count; i++)
        {
            float dis = bl_UtilityHelper.Distance(target.position, AllCovers[i].transform.position);
            if (dis < d)
            {
                d = dis;
                cover = AllCovers[i];
            }
        }
        if (cover == null) return cover;

        if ((Time.time - cover.lastUseTime) <= UsageTime && cover.NeighbordPoints.Count > 0)
        {
            cover = cover.NeighbordPoints[Random.Range(0, cover.NeighbordPoints.Count)];
        }
        cover.lastUseTime = Time.time;
        return cover;
    }

    public bl_AICoverPoint GetCloseCover(Transform target, bl_AICoverPoint overrdidePoint)
    {
        bl_AICoverPoint cover = null;
        float d = MaxDistance;
        for (int i = 0; i < AllCovers.Count; i++)
        {
            float dis = bl_UtilityHelper.Distance(target.position, AllCovers[i].transform.position);
            if (dis < MaxDistance && dis < d && AllCovers[i] != overrdidePoint)
            {
                d = dis;
                cover = AllCovers[i];
            }
        }
        if (cover == null) return cover;

        if ((Time.time - cover.lastUseTime) <= UsageTime && cover.NeighbordPoints.Count > 0)
        {
            cover = cover.NeighbordPoints[Random.Range(0, cover.NeighbordPoints.Count)];
        }
        cover.lastUseTime = Time.time;

        return cover;
    }

#if UNITY_EDITOR
    [ContextMenu("Fix Points")]
    private void Fixed()
    {
        bl_AICoverPoint[] sp = FindObjectsOfType<bl_AICoverPoint>();
        RaycastHit r;
        for (int i = 0; i < sp.Length; i++)
        {
            Transform t = sp[i].transform;
            Ray ray = new Ray(t.position + t.up, Vector3.down);
            if (Physics.Raycast(ray, out r, 100))
            {
                t.position = r.point;
            }
        }
    }

    [ContextMenu("Calculate Neighbors")]
    private void CalcuNeighbords()
    {
        bl_AICoverPoint[] sp = FindObjectsOfType<bl_AICoverPoint>();
        for (int i = 0; i < sp.Length; i++)
        {
            Transform t = sp[i].transform;
            sp[i].NeighbordPoints.Clear();
            for (int e = 0; e < sp.Length; e++)
            {
                if (sp[i] == sp[e]) continue;
                if (Vector3.Distance(sp[i].transform.position, sp[e].transform.position) <= 20)
                {
                    sp[i].NeighbordPoints.Add(sp[e]);
                }
            }
            UnityEditor.EditorUtility.SetDirty(sp[i]);
        }
    }
#endif
}
How to find your Invoice Number: Here
How to find your Order Number: Here
Post Reply