Hey all,
No takers yet. Understandable.
I seem to have made some headway on my own. I'll try to explain what I've managed to do and the issues that remain.
My error was treating the LinkedAudio command like an equal to the *AudioChannel function. I realize now that it operates exclusively as an AudioClip and is limited by the same functionality (which answers my last question).
My workaround, correct or otherwise, was to create a custom Audio Type. I labelled this Type as Foosteps.
Conveniently the room I am working on has a Min and MaxScalingLevel set for the Walkable Area. These scaling values give me something to reference when determining a player's relative distance in game, setting the volume level as appropriate.
Using the command Game.SetAudioTypeVolume in conjunction with eVolExistingAndFuture + GetScalingAt, I'm able to create a 'stand in' for SetRoomLocation.
Understand that it's not quite as smooth, since the volume and locations are fixed into 3 separate zones.
My Code looks like this:
Code: ags
This approach 'works', but ideally I'd like a range.
Might want to read this next part slow. I can't figure out a way to make this information easy to digest.
So let's say I want 20% to be the Minimum Volume and 60% to be the Maximum Volume.
Rather than having the Footsteps volume at Max when the player is over 90% scaling, it should be within 50-60% Volume depending on how close they are to 100% scaling.
Then the Median would be from 40-49% Volume (when greater than 58% scaling, but less or equal to 89% scaling), and the Min from 20-39% Volume (Scaling is below 57%).
Any advice for how to do this would be appreciated.
The next major nitpick relates to my second point of the original post.
I tried to experiment with Operators to see if I could create an integer that accounts for all View Loops.
My code looked something like this (doesn't work at all, I clearly don't use Operators enough):
Declared variables.
Code: ags
Then inside the function...
Code: ags
This does work for a single instance of View Loop 0, but it doesn't work for all instances. I believe it has something to do with the 'frame1' function.
I don't know if it's possible to create a 'frameX' function or if I should try a different approach all-together.
In the meantime, the 'bloated' method of scripting a sound per individual loop+frame does work. Saying that, I'm optimistic there's a better method to condense the code.
- Haff
No takers yet. Understandable.
I seem to have made some headway on my own. I'll try to explain what I've managed to do and the issues that remain.
My error was treating the LinkedAudio command like an equal to the *AudioChannel function. I realize now that it operates exclusively as an AudioClip and is limited by the same functionality (which answers my last question).
My workaround, correct or otherwise, was to create a custom Audio Type. I labelled this Type as Foosteps.
Conveniently the room I am working on has a Min and MaxScalingLevel set for the Walkable Area. These scaling values give me something to reference when determining a player's relative distance in game, setting the volume level as appropriate.
Using the command Game.SetAudioTypeVolume in conjunction with eVolExistingAndFuture + GetScalingAt, I'm able to create a 'stand in' for SetRoomLocation.
Understand that it's not quite as smooth, since the volume and locations are fixed into 3 separate zones.
My Code looks like this:
// Sets the Volume Scaling for the Footsteps Audio Type as it relates to Walkable Area Scaling
//Max Value
if (GetScalingAt(player.x, player.y) >= 90)
{
Game.SetAudioTypeVolume(eAudioTypeFootsteps, 60, eVolExistingAndFuture);
}
//Min Value
else if (GetScalingAt(player.x, player.y) <= 57)
{
Game.SetAudioTypeVolume(eAudioTypeFootsteps, 20, eVolExistingAndFuture);
}
//Median Value
else
{
Game.SetAudioTypeVolume(eAudioTypeFootsteps, 40, eVolExistingAndFuture);
}
This approach 'works', but ideally I'd like a range.
Might want to read this next part slow. I can't figure out a way to make this information easy to digest.
So let's say I want 20% to be the Minimum Volume and 60% to be the Maximum Volume.
Rather than having the Footsteps volume at Max when the player is over 90% scaling, it should be within 50-60% Volume depending on how close they are to 100% scaling.
Then the Median would be from 40-49% Volume (when greater than 58% scaling, but less or equal to 89% scaling), and the Min from 20-39% Volume (Scaling is below 57%).
Any advice for how to do this would be appreciated.
The next major nitpick relates to my second point of the original post.
I tried to experiment with Operators to see if I could create an integer that accounts for all View Loops.
My code looked something like this (doesn't work at all, I clearly don't use Operators enough):
Declared variables.
int f, loop;
Then inside the function...
loop = (f >= 0 && f <= 7);
ViewFrame *frame1 = Game.GetViewFrame(EGOWLKDAY, loop, 3);
frame1.LinkedAudio = aFS_Wood1;
This does work for a single instance of View Loop 0, but it doesn't work for all instances. I believe it has something to do with the 'frame1' function.
I don't know if it's possible to create a 'frameX' function or if I should try a different approach all-together.
In the meantime, the 'bloated' method of scripting a sound per individual loop+frame does work. Saying that, I'm optimistic there's a better method to condense the code.
- Haff