Forums » Community Projects

Targeting Functions

Dec 30, 2013 Nyscersul link
I have been searching for a function throughout the race car wiki, that would allow me to set a specific target through scripting. I have found the functions for manipulating matrices, and for finding the object id's for the targets, i am just lost as to how to set a target for weapons fire. Another question i have, is it possible to perform a function that could usually be bound to a key. I intend to write a plugin that functions with missiles, so it needs to be able to a) Find a list of targets in range, b) separate valid targets from non valid targets, c) select the chosen target, d) fire the missiles. I am sure that i can manage points a) and b), and the arrangements around points c) and d), but i cannot find functions to enable the main functionality, that of setting the game's target to that chosen, and commencing fire.

Please help me find the correct functions, also, i would like to know if the object id's are simply a string variable that is passed on as a normal variable, or if it is more complicated than that...

Thanks in advance :)

Dec 30, 2013 Pizzasgood link
Targeting is done with the 'radar' table:

To start shooting:

To stop shooting:
gkinterface.GKProcessCommand('+Shoot2 0')

Primary trigger is Shoot2, secondary is Shoot1, and tertiary is Shoot3. Yeah, it's a goofy ordering.
Dec 31, 2013 draugath link
Jan 01, 2014 Nyscersul link
So the gkinterface command would accept anything that can be bound?

Also, what did you mean by the foreachplayer bit?

Thanks for the reply.
Jan 01, 2014 Pizzasgood link
Nearly anything. It won't work with the rotation and strafing commands.

ForEachPlayer() iterates through all the players you can see in the sector and runs a callback function on each one, so I assume he meant that you could use that to acquire your list of potential targets.