Page 1 of 1

check pawn range from another pawn position?

Posted: Sat Oct 29, 2011 1:57 am
by Nero
Hello.

I'd like to make my WP check whether one object is in a set range of a different object (for example, I want to find object with ID 100000, and check if there's object with ID 110000 in a range of 100 of the 100000 one). How should I go about changing my position to pawn with ID 100000 without actually going to this object?

Or, if there's any other way to do it, please post it.

I'm sure that I've seen it in one WP, but can't find it, so I'd like to be either pointed to that WP if anyone knows which one it was, or a few lines of code that will do what I'd like to do.

Cheers

Re: check pawn range from another pawn position?

Posted: Sat Oct 29, 2011 2:13 am
by lisa

Code: Select all

local pawn1 =
local pawn2 =

local distance = distance(pawn1.X, pawn1.Z, pawn2.X, pawn2.Z)
Obviously you need to add the code for getting the actual pawns

Then you can do what ever calculations you want on distance

Code: Select all

if distance > 10000 then
blah blah
else
thisnthat
end

Re: check pawn range from another pawn position?

Posted: Sat Oct 29, 2011 2:24 am
by Nero
Far simpler that I hoped it would be. Thanks a lot!