Page 1 of 1

Target selection programming-HELP

PostPosted: Sat May 30, 2009 8:49 am
by Lambinator
I have been programming for a while and can do most functions, but I need help on this issue.
How do i have an actor target one specific actor when several targets are available.
it would be good to also have other parameters and such, but i can work that in later easy.
I need a script where an actor can select a target (an actor with an "enemy" variable set to true) out of several possible targets,
probably using range as the deciding factor, and use the targets variables (like x, y, velocity's and angles) for the targeting script.

It is probably related to an array of all the x's and y's of the targets and the actor picking the one with the one with the lowest distance, but I have no Idea how to do it!!

SOMEONE HELP ME!!!!!

Re: Target selection programming-HELP

PostPosted: Sat May 30, 2009 3:04 pm
by jimmynewguy
here's how i did closest in my newer strategy game makslane made the original code, i just edited it :)

Re: Target selection programming-HELP

PostPosted: Tue Jun 02, 2009 10:49 am
by Lambinator
I just sorted it out. it took hours and its some pretty awesome code.
Its all here if you want and its PERFECT!!!! :D
don't be afraid to use the code for your own purposes either.

By the by does anyone have the code to work out a TRUE distance? :?
Things on angles have warped lengths. Try it if your not sure.

PS the red units(the gunners) draw actor script is 5 copy's of it self to speed the long process up.
(i know i should have increased the frame rate but that gets messy in my games)