Hi guys, pleased to see you discussing the distance involved in units from a position to a player.
As of fairly recent we do have Denied in SSB but currently only for the player that drops the flag.
I have been messing with this distance factor and have come across all sorts of problems.
My idea is to only play the Denied sound to players who are a certain distance from the dropped position.
However it depends whether the Red Player or the Blue Player dropped the flag as the distance varies.
I save the dropped flag players position and then walk around the map and measure the distance from that point.
The drop is fairly normal I think:
var int DenyLoc;
if (VSize(Receiver.Location - FlagStands[iTeam].Location) < 500 && VSize(FlagStands[Flag.Team].Location) > 500)
DenyLoc = VSize(Receiver.Location);
// This is the trigger from !xxx in 'function bool MutatorTeamMessage'
for (Pn = Level.PawnList; Pn != None; Pn = Pn.NextPawn)
a = DenyLoc;
b = VSize(Pn.Location);
c = FMax(a, b) - Min(a, b);
Log("****** DenyLoc = "$a$" | Pn = "$b$" | Distance = "$c);
This is a pic of the distances measured, depending on Red or Blue drops.
Position 1 is where the player dropped the flag.
Weird how the distance vary.
*** Edit ***
Ok I think I figured it out.
One needs to measure from the dropped flag to the opposing base then divide by whatever % distance you want other to hear the sound.