Forum rules - please read before posting.

Container duplicate default objects

If I have a container that has an object by default, and the character takes it, when he leaves the room and re-enters the container, he has the object inside again.

However, if I take the object that appears by default, and put another inside, and leave the room, when I re-enter there is only the new object and the initial object has not been generated.

The container has Remember Container

Comments

  • What's your AC version, and does this still occur if you add a separate item to the Container by default, and leave it alone during testing?

  • My version is 1.72.4
    It happens when I test or if I build the game

    Occur when I add a one or two item to the Container by default, and the player catch, go to another room, and return.
    The player finds the items in the container again, even though he already has them in his inventory. This does not happen if when you pick them up you leave something in the container.

    Sorry for my bad english :# and thank you Chris

  • In a backup or duplicate project, import the latest AC release - does the issue persist?

  • edited April 2022

    Works! If I upgrade to version 1.75.2 the problem is over.

    I'm going to work in a copy, because I'm afraid that the game will become unstable.

    For now the only difference is that the player has greatly slowed down his speed.

    Very grateful Chris!

  • The character is very slow, and it does not matter if I modifies the walk speed or the run speed.

  • Did you re-assign your own game's Managers after importing the update?

    I would need more details - can you share the Player's full Inspector and Settings Manager?

  • Yes, I reasign my game Managers.
    For some reason, the speed value of the NavMeshAgent is impossible to change at run time.
    In my game I modify the speed of the NavMeshAgent with my own script. When the player presses shift I reduce the speed by half. I have discovered that after the update my script is not able to change the speed value of the NavMeshAgent of the player. I don't understand why, everything is the same. What changed in the update?
    If I change the speed of the NavMeshAgent from the Inspector it changes the speed of the player's movement, but I need to be able to change it during runtime

  • using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.AI;
    using AC;

    public class SneakController : MonoBehaviour
    {
    float noise;
    NavMeshAgent agent;
    public float crouchSpeed = 1f;
    public float walkSpeed = 3f;
    public float runSpeed = 3f;
    float actualSpeed;
    float actualSlow = 1;
    public GameObject myHead;
    public Animator anim;
    public GameObject circulo;

    void Start()
    {
        agent = GetComponent<NavMeshAgent>();
        circulo.SetActive(false);
        GameObject[] focos = GameObject.FindGameObjectsWithTag("Cono");
        foreach (GameObject foco in focos)
        {
            foco.GetComponent<Projector>().enabled = false;
        }
    }
    
    void Update()
    {
        anim.SetFloat("Velocity", agent.velocity.magnitude);
        if (Input.GetKeyUp(KeyCode.LeftControl))//se levanta, deja de ir modo sigilo
        {
            anim.SetBool("Sigilo", false);
        }
        if (Input.GetKey(KeyCode.LeftControl))//va sigiloso
        {
            actualSpeed = crouchSpeed;
            anim.SetBool("Sigilo", true);
            CamaraSigilo();
        }
        /*else if (Input.GetKey(KeyCode.LeftShift) && agent.velocity.magnitude > 0.1)
        {
            actualSpeed = runSpeed;
        }*/
        else
        {
            actualSpeed = walkSpeed;
        }
        ChangeSpeed();
    }
    
    public void ChangeSpeed()
    {
        agent.speed = actualSpeed / actualSlow;
        print("agentSpeed=" + agent.speed);
        noise = agent.velocity.magnitude * 1.5f;
        if(GetComponentInChildren<AlertArea>() != null)
            GetComponentInChildren<AlertArea>().distance = noise;
    }
    
    public float GetNoise()
    {
        return noise;
    }
    
    public GameObject WhatIsMyHead()
    {
        return myHead;
    }
    
    public void CamaraSigilo()
    {
        if ((GameObject.FindGameObjectWithTag("Tejado")) != null)
            GameObject.FindGameObjectWithTag("Tejado").SetActive(false);
        FindObjectOfType<NPCs>().CamaraSigilo();
        circulo.SetActive(true);
        GameObject[] focos = GameObject.FindGameObjectsWithTag("Cono");
        foreach (GameObject foco in focos)
        {
            foco.GetComponent<Projector>().enabled = true;
        }
    }
    
    public void FueraFoco()
    {
        circulo.SetActive(false);
        GameObject[] focos = GameObject.FindGameObjectsWithTag("Cono");
        foreach (GameObject foco in focos)
        {
            foco.GetComponent<Projector>().enabled = false;
        }
    }
    

    }

  • this is my SneakController sript

  • Works properly, but for some reason another force maintains the speed value of the NavMeshAgent

  • another force maintains the speed value of the NavMeshAgent

    That'll be the NavMeshAgent Integration component, which syncs the NavMeshAgent's values with that of the AC character's walk/run speeds.

    Instead of changing the NavMeshAgent, change the AC character's walk/run speed:

    GetComponent<AC.Char>().walkSpeedScale = newWalkSpeed;
    GetComponent<AC.Char>().runSpeedScale = newRunSpeed;
    
  • Thanks Chris! I revolve the problem

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.