Maybe I'm too late and you already solved this but I thought about this some more and maybe the following will help solve the discrepancy in distances that you have found.
A couple things first, I could be wrong about any of this 🙂
- It feels like a lifetime ago that I had to work with vectors in any serious capacity. I could probably use a refresher on my vector fundamentals.
- Since I haven't done any mapping, I don't know where the Origin, point (0,0,0), is. I'm not sure if it is fixed in a corner of one of the views or it is expected to be roughly in the center of a map.
When you save the magnitude / distance of a particular location like this:
DenyLoc = VSize(Receiver.Location);
I think the DenyLoc variable should now hold the distance from the Receiver's location and the Origin.
Then later:
b = VSize(Pn.Location);
Now it seems like the abs( DenyLoc - b) should equal VSize( DenyLoc - Pn.Location), I don't think that is always the case though. Technically speaking by the reverse triangle inequality given vector A and B:
VSize( A - B ) >= abs( VSize(A) - VSize(B) )
More details here:
https://en.wikipedia.org/wiki/Vector_algebra_relations
In your original posted code I would suggest trying this:
var vector DenyLoc; //if you need to store the location to use elsewhere and can't just access receiver.location directly
if (VSize(Receiver.Location - FlagStands[iTeam].Location) < 500 && VSize(FlagStands[Flag.Team].Location) > 500)
{
if (CTFReplicationInfo(Level.Game.GameReplicationInfo).FlagList[iTeam].bHome)
DenyLoc = Receiver.Location;
}
// This is the trigger from !xxx in 'function bool MutatorTeamMessage'
for (Pn = Level.PawnList; Pn != None; Pn = Pn.NextPawn)
{
if (Pn.IsA('TournamentPlayer'))
{
b = VSize( DenyLoc - Pn.Location );
// b should now hold the distance between this player and the denied location
}
}
Log(" ");
If all of the above ends up being correct I would also revisit this one:
&& VSize(FlagStands[Flag.Team].Location) > 500)
and make sure it is what you intended to do.
Forgive me if I'm incorrect in any of this and/or if you have already fixed the issue.