Target selection programming-HELP

You must understand the Game Editor concepts, before post here.

Target selection programming-HELP

Postby Lambinator » Sat May 30, 2009 8:49 am

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!!!!!
Walk softly and carry a big gun.

Power is our common goal, sanity is optional.
User avatar
Lambinator
 
Posts: 23
Joined: Sun Apr 19, 2009 12:55 am
Location: In my secret la....... wait....I mean I'm at home.
Score: 1 Give a positive score

Re: Target selection programming-HELP

Postby jimmynewguy » Sat May 30, 2009 3:04 pm

here's how i did closest in my newer strategy game makslane made the original code, i just edited it :)
Attachments
Closest.zip
(11.79 KiB) Downloaded 135 times
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: Target selection programming-HELP

Postby Lambinator » Tue Jun 02, 2009 10:49 am

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)
Attachments
targeting.zip
this is a demonstration for a friend without GE
(747.47 KiB) Downloaded 174 times
targeting test.zip
This is the source code. download this one.
(99.4 KiB) Downloaded 122 times
Walk softly and carry a big gun.

Power is our common goal, sanity is optional.
User avatar
Lambinator
 
Posts: 23
Joined: Sun Apr 19, 2009 12:55 am
Location: In my secret la....... wait....I mean I'm at home.
Score: 1 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest