Page MenuHomeFeedback Tracker

PlayerBase::GetNoisePresenceInAI
Assigned, UrgentPublic

Description

just requesting info about PlayerBase::GetNoisePresenceInAI
what it's used for, and if it's serverside/client side.
as it stands, it always seems to return 0.

and i cant seem to find any visible systems for determining if the player is making sound or audio sources in a location.
or how zombies determine threats based on sound.
can these be made public if they exist please?

Details

Severity
Feature
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce

tried client side as an rpc:

modded class PlayerBase
{
int Spatial_noisepresence = 0;

    void PlayerBase()
    {
    #ifndef SERVER
    GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(Spatial_NoisePresence, 1000, true);
   #endif
    }


    int Spatial_GetNoise()
    {
        return Spatial_noisepresence; // always returns 0
    }

    void Spatial_GetThreat(CallType type, ParamsReadContext ctx, PlayerIdentity sender, Object target) 
    {
        if (type != CallType.Server) return;

        Param1 < int > data;
        if (!ctx.Read(data)) return;
        if (sender == null) return;
        Spatial_noisepresence = data.param1;
    }

    void Spatial_NoisePresence()
    {
        if (this)
        {
            int threat = GetNoisePresenceInAI();
            GetRPCManager().SendRPC("DayZ-Expansion-AI-Dynamic", "Spatial_GetThreat", new Param1<int>(threat), true, NULL);   
        }
    }
}

and tried serverside :

void audiocheck(int loop)
{
    int totalnoise = 0;
    int insidercount = m_insiders.Count();
    if (loop < 1) return;
    if (insidercount > 0)
    {
      for (int i = 0; i < insidercount; ++i)
      {
          PlayerBase player = PlayerBase.Cast(m_insiders.Get(i).GetObject());
          if (!player) continue;
          int player_noise = player.GetNoisePresenceInAI();
          SpatialDebugPrint("Player noise in area: " + player_noise); // always prints 0
          totalnoise += player_noise;
      }
      if (totalnoise > 1)
      {
        if ((totalnoise / insidercount) > insidercount)
        {
          SpawnCheck();
          return;  
        }
      }
    }
    GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(audiocheck, 1000, false, --loop);
}

Event Timeline

Geez changed the task status from New to Assigned.Sep 25 2023, 4:12 PM
lava76 added a subscriber: lava76.Oct 21 2023, 11:10 AM