funny dance missiles with SetProjectileTarget

funny dance missiles with SetProjectileTarget

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Locked
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

funny dance missiles with SetProjectileTarget

Post by knorke » 22 Mar 2014, 07:34

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.
Attachments
tp_projectile_test.lua
(4.55 KiB) Downloaded 21 times
1 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10200
Joined: 24 Jan 2006, 21:12

Re: funny dance missiles with SetProjectileTarget

Post by PicassoCT » 22 Mar 2014, 11:27

Awesome and not rocketsience.. or wait awesome and rocketsience..
Now we all can go vonBraun into every direction..

weee... ccomender has macross missiles now
0 x

User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: funny dance missiles with SetProjectileTarget

Post by jK » 22 Mar 2014, 15:49

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.
0 x

User avatar
smoth
Posts: 22295
Joined: 13 Jan 2005, 00:46

Re: funny dance missiles with SetProjectileTarget

Post by smoth » 22 Mar 2014, 16:23

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?
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10200
Joined: 24 Jan 2006, 21:12

Re: funny dance missiles with SetProjectileTarget

Post by PicassoCT » 22 Mar 2014, 16:28

inb4 insult writing rocket ..
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: funny dance missiles with SetProjectileTarget

Post by knorke » 22 Mar 2014, 18:41

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.
0 x

User avatar
Karl
Panzerstahl Developer
Posts: 746
Joined: 01 Apr 2010, 21:05

Re: funny dance missiles with SetProjectileTarget

Post by Karl » 22 Mar 2014, 22:51

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
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10200
Joined: 24 Jan 2006, 21:12

Re: funny dance missiles with SetProjectileTarget

Post by PicassoCT » 22 Mar 2014, 23:13

Yes you can..

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

User avatar
smoth
Posts: 22295
Joined: 13 Jan 2005, 00:46

Re: funny dance missiles with SetProjectileTarget

Post by smoth » 23 Mar 2014, 00:32

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
0 x

User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: funny dance missiles with SetProjectileTarget

Post by knorke » 23 Mar 2014, 01:19

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.
0 x

User avatar
Karl
Panzerstahl Developer
Posts: 746
Joined: 01 Apr 2010, 21:05

Re: funny dance missiles with SetProjectileTarget

Post by Karl » 23 Mar 2014, 09:10

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
0 x

User avatar
smoth
Posts: 22295
Joined: 13 Jan 2005, 00:46

Re: funny dance missiles with SetProjectileTarget

Post by smoth » 23 Mar 2014, 15:16

I thought we had a tag to delay when tracking becomes active?
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14571
Joined: 17 Nov 2005, 02:43

Re: funny dance missiles with SetProjectileTarget

Post by Forboding Angel » 29 Mar 2014, 07:03

PicassoCT wrote:inb4 insult writing rocket ..
A nuke that writes FU in the sky before hitting?
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10200
Joined: 24 Jan 2006, 21:12

Re: funny dance missiles with SetProjectileTarget

Post by PicassoCT » 29 Mar 2014, 11:52

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
0 x

User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14571
Joined: 17 Nov 2005, 02:43

Re: funny dance missiles with SetProjectileTarget

Post by Forboding Angel » 25 Mar 2015, 08:06

Fucking thread necro.
0 x

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10200
Joined: 24 Jan 2006, 21:12

Re: funny dance missiles with SetProjectileTarget

Post by PicassoCT » 25 Mar 2015, 09:22

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.
0 x

Locked

Return to “Lua Scripts”