Originally Posted by
acow
Do you have any [specific]* input to give regarding the "I have a question @everyone"?
SPS is the simple way, just mark the centers of the areas with any SPS tool, store it in your code, check which of the two areas you are closest to by computing the distance from SPS.GetPlayerPos() to all the centers you have, pick the closet one.
so basically something like this could work:
Code:
function GetMySpot(spots:TPointArray; maxDist:Int32; out spotId:Int32): Boolean; //returns the ID of which spot you are in
var
i:Int32;
p:TPoint;
begin
p := SPS.GetPlayerPos();
spotId := 0;
for i:=1 to High(spots) do
if Sqr(p.x-spots[i].x) + Sqr(p.y-spots[i].y) < Sqr(p.x-spots[spotId].x) + Sqr(p.y-spots[spotId].y) then
spotId := i;
Result := Sqr(p.x-spots[spotId].x) + Sqr(p.y-spots[spotId].y) < Sqr(maxDist);
end;
var
spots:TPointArray = [[400,400], [900,200]]; //The centers of each spot, gather them with any SPS tool
current:Int32;
begin
if GetMySpot(spots, 250, current) then
begin
WriteLn('I am in range of ', spots[current] );
end else
WriteLn('I am too far away from any of the spots');
end.
Alternatively you can use SPS.IsInPolygon(polygon: TPointArray); where you'd have to create a polygon of each spot, still using any SPS path making tool, and then just loop over each polygon and test until one returns True.
But honestly.. I don't like answering questions like this, anyone can answer this so I prefer not to be bothered with it.
Tho I have to question why you don't know what spot you are in beforehand, since it's your script, and you should be in control of that already.