Page 1 of 1

funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 07:34
by knorke
tl;dr: SetProjectileTarget to make projectiles fly elsewhere

Image
Missiles fly off in random directions, then go after target.
aka http://tvtropes.org/pmwiki/pmwiki.php/M ... leMassacre

This is not something finished, just result of testing "new" functions of 93.0
Have not seen those used so much, maybe it is useful as tutorial or start point in some way.

More example usage:
Image

1) after launch missiles fly downwards, then fly towards target in low altitude along the ground

2) missiles do a loop over the shooter (why not)

3) missiles fly away to side before going after target

4) missiles fly normally towards target, then split up, then go after target

5) missiles go after target, after short time fly up higher than launch altitude, then go after target again.

7) -----v
Image
Missiles wiggle around, then raise up high to hit target from above


How:
Usually targeted projectiles in Spring only aim towards one target.
So if target is stationary that means they either fly
a) in a straight line towards target
b) in some arc towards target
(unless wibble, wobble and wabble tags are used which gives some randomness)

Make all projectiles target towards coordinate 0,0,0:

Code: Select all

function gadget:ProjectileCreated(proID, proOwnerID)
Spring.SetProjectileTarget (proID, 0, 0, 0)
So one can aim the projectile towards x,y,z and some time later make it aim towards x2,y2,z2 then again bit later towards x3,y3,z3 etc. and the projectile will fly along those "waypoints."
The last "waypoint" should be the original target: This way one can make missiles that do all sort of random flying but in the end still precisely hit the target.

Not that complicated really. Slight difficulty: projectiles can target units, features,coordinates (in air or on ground) and other projectiles.
That is the reason for the targetTable blablabla because those cases need to be handled.

This way one can do like this:

Code: Select all

local originalTarget = getTargetTable (proID)
...funny missile madness here...
addProjectileRedirect (proID, originalTarget, 150)
without worry whether the original target was unit, feature,etc

How to use:
Set up the WatchWeapon blablub, then do:
addProjectileRedirect (projectileID, targetTable, delayInFrames)
(chain as many as you want)

delayInFrames is delay in frames until the projectile goes towards this target.

The targetTable can be made with function makeTargetTable() or read it from a projectile with getTargetTable()


Image

Note:
-function makeTargetTable only works for ground targets, lazy.

-SetProjectileCEG to change effect of projectile is useful for testing.
Best CEGs that leave loooong smoke trails.

-Testing is easier with missiles that have long flightime and decent speed/turnrates so they can actually follow the waypoints.

-The redirects should be tweaked to work with the weaponDef: If the missile is so fast that it reaches target in 0.1 seconds then no use to try to give it new course after 2 seconds etc.

Re: funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 11:27
by PicassoCT
Awesome and not rocketsience.. or wait awesome and rocketsience..
Now we all can go vonBraun into every direction..

weee... ccomender has macross missiles now

Re: funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 15:49
by jK
Spring.SetProjectileTarget isn't needed for the most important effects. Missiles follow the emitdir of their emit piece (iirc depending on turret tag), so just rotate that piece and the missiles will fly in all directions.

Re: funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 16:23
by smoth
I am not sure what is different between here and kdr's loli mod with the bunny. I don't even know where to begin to hunt it down but he added a bunch of tags for macross style stuff.

did you try combining them with your current work for even more bizarre patterns?

Re: funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 16:28
by PicassoCT
inb4 insult writing rocket ..

Re: funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 18:41
by knorke
jK:
Think you mean fixedlauncher = true.
With fixedlauncher=true tag the missiles launch in the direction of their emit-piece and then instantly start turning towards the target.
Normal missiles always do an arc towards target then once lined up with target they continue in straight line. Even if the arc starts starts of in a funny direction the possible flight paths are still somewhat limited.

For most launchers fixedlauncher=true would also result in unrealistic looking sideways starting, with SetProjectileTarget the missiles can launch normal and then do the wiggling, instead of launching "sideways":
Image
red line shows orientation of missile.
Also makes it bit easier to get the wanted radius of arc, how far away from launcher the missile is at the apex etc.
See the other examples too.

Re: funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 22:51
by Karl
hmm It looks interesting... Might be useful for something
maybe it is possible to fake "crazy" electronic cannon or some sort like with that


But is it possible to have such kind of rocket arc for (Starburst-)Missiles?
Currently the default Starburst-missile arc sucks balls and you need to add insanely huge rate thing (cba too look up it up) so that it wont collide with hills
Image

Re: funny dance missiles with SetProjectileTarget

Posted: 22 Mar 2014, 23:13
by PicassoCT
Yes you can..

even cooler, you can make cruise missile kind rockets, that adapt to terrain..

Re: funny dance missiles with SetProjectileTarget

Posted: 23 Mar 2014, 00:32
by smoth
PicassoCT wrote:even cooler, you can make cruise missile kind rockets, that adapt to terrain..
knorke said nothing of the sort and even aircraft in spring run through mountains sometimes

Re: funny dance missiles with SetProjectileTarget

Posted: 23 Mar 2014, 01:19
by knorke
Karl:
yes, flight paths like these pictures are possible.
No idea how good Starburst-missiles can be redirected, but afaik they always launch vertically straight up? So they could not work either way like in these pictures.
PicassoCT wrote:even cooler, you can make cruise missile kind rockets, that adapt to terrain..
yes. The first example "after launch missiles fly downwards, then fly towards target in low altitude along the ground" is like that a bit.
See the commented out line:
addProjectileRedirect (proID, makeTargetTable(tx,Spring.GetGroundHeight (tx,tz)+100,tz), 10)
Makes the missile fly 100 elmo above ground.
To do similiar with just fixedLauncher=true one would have to carefully tweak turnrate,speed, acceleration etc of missile. And then if the aircraft flies a bit too low it might still bam the missile into ground.
With more waypoints it might give pretty cool results when the missile actually follows the terrain slopes...

Another thing:
One could use different flight paths according to circumstances.
For example if the target is close then just attack it normal.
If the target is far away then do the wiggling.
If the target is a tank attack it from above.
If the target is a ship attack it in low-altitude flight etc.

Re: funny dance missiles with SetProjectileTarget

Posted: 23 Mar 2014, 09:10
by Karl
knorke wrote:Karl:
yes, flight paths like these pictures are possible.
No idea how good Starburst-missiles can be redirected, but afaik they always launch vertically straight up? So they could not work either way like in these pictures.
.
That sounds good then, I might toy around that soon.
Yes they do after the Flighttime ends up they fly straight to the target
which is imo the most retarded thing ever.

The workaround for this would be to add insanely large Flighttime and aswell the missile speed to make it up

> http://i.imgur.com/t7btwCx.jpg I think to add compatibility for Starburst you would need to add something for the script to wait thill it's flighttime is done

Re: funny dance missiles with SetProjectileTarget

Posted: 23 Mar 2014, 15:16
by smoth
I thought we had a tag to delay when tracking becomes active?

Re: funny dance missiles with SetProjectileTarget

Posted: 29 Mar 2014, 07:03
by Forboding Angel
PicassoCT wrote:inb4 insult writing rocket ..
A nuke that writes FU in the sky before hitting?

Re: funny dance missiles with SetProjectileTarget

Posted: 29 Mar 2014, 11:52
by PicassoCT
the prophet emanuel all saw it coming.. and you cast him out, the reckoning is near..

All praise be upon the Fuck in the sky, let us sing the hymn composed by Elton John:
Rocketman

Re: funny dance missiles with SetProjectileTarget

Posted: 25 Mar 2015, 08:06
by Forboding Angel
Fucking thread necro.

Re: funny dance missiles with SetProjectileTarget

Posted: 25 Mar 2015, 09:22
by PicassoCT
I distinctly remember that pinguins fuck there frozzen stiff dead. And what is the masscott of linux? Exactly.
With the magotts wriggling it almost feels like the real thing.