Quote from: FortressCaulfield on Thu 04/07/2024 15:05:50Do I just have to give up on him having naturalistic pathing and add a simple frame counter to do the room swaps, only worrying about his position if the player enters a room he's in or vice versa?
Quick answer: yes. Only the room the player is currently in is loaded, so the engine doesn't have access to walkable area masks etc. for other rooms, and cannot do pathfinding there.
It would probably be possible to do some quick math when the player enters the room the roaming character is currently in to determine where they should be based on the timing, to achieve the same effect from the player's POV.
Quote from: FortressCaulfield on Thu 04/07/2024 15:05:50Also is there a way to adjust the volume of sound effects without having to tie it to a char or channel or object?
Sure. If you group all sound effects under a particular AudioType, you can adjust the default volume for that AudioType (Game.SetAudioTypeVolume); or you can adjust it individually as you play the sound:
AudioChannel* ac = myClip.Play();
ac.Volume = 80;
This code is technically unsafe because AudioClip.Play() will return null if the clip fails to play for some reason—for example that you've exceeded the number of available AudioChannels and the currently playing audio is all higher-priority than the clip you're trying to play. So to be on the safe side you should do a null-check, but this is pretty tedious to do every time, and I think most game makers tend to cross their fingers and hope to get away with it.
Or you could write a helper function:
Channel* PlayVolume(this AudioClip*, int vol)
{
AudioChannel* ac = myClip.Play();
if(ac != null)
ac.Volume = vol;
}
And then you can just call:
myClip.PlayVolume(80);