After Daman's suggestion, this is for .lua files that do one thing and do it well, IE, modules. Post whatever you like here, but you must be willing to let others use it without permission. Also, you must document your code for ease of use.
I'll start with my homing missile code.
To use, somewhere in the Create() in the .lua for your projectile put
Code:
self.LTimer = Timer();
dofile("*RTE name*/missile.lua");
and when you want your projectile to home in, put
Code:
HomeInOn(self, self.target, 0.5, 30, 200, 600);
The parameters are
Code:
HomeInOn(projectile, target, turnspeed, maxspeed, lagtime, radius)
projectile to home in (usually self) which must have the above timer LTimer
target actor
turnspeed in arbitrary value, 0.5 is pretty fast
maxspeed in another arbitrary value, a bit less than normal CC m/s
lagtime from when the projectile is created until it activates
radius to search for a target when activating
Pic:
And DL:
MediafireOR