Stunt Island Tutorial #2 - Making a guided weapon

In this simple tutorial I'll explain how to make a guided
weapon, in this case a missile fired by your plane. The
fired missile will lock on and track the target aircraft,
which is a Tupolev Tu-95 "Bear". There is one limitation
added to this tutorial and that is that you must be beyond
a certain fixed point roughly halfway between the two
starting points before you can fire your weapon.
I'll try to explain all these following steps in layman's
terms so they are easy to follow and understand. I'll also
point out a couple of options that you can incorporate
yourself to automate things just a bit and a couple of
options you have for determining the firing range.

The setup:

File Name           :SETS\TEMP.SET
Printed at          :Tue Dec 08 06:40:24 1992
Stunt Title         :User
Initial Recorder    :On
First Take          :0
Crash Penalty       :0
Equipment Status    :Gear Up  Flaps Up  Brakes Off
Time of Day         :12:00
Init Play View      :Pilot w/Cockpit
Init Camera View    :1
Initial Weapon      :None
Maximum Takes       :99
Take Penalty        :0

Prop #1
Prop Name       :F16C Falcon
Method          :Face
Watch           :Off            Watch Object        :1
Zoom            :1              Autozoom            :Off
N/S             :31607          E/W                 :227
Altitude        :9000
Pitch           :0              Pitch Anim          :0
Roll            :0              Roll Anim           :0
Yaw             :60             Yawing Anim         :0
Speed           :600
Visible         :On             Collision           :On
Explosion       :Off            Shadow              :On
Locked          :Off            Placed              :On

Prop #2
Prop Name       :Spotter Plane
Method          :Spot           Method Object       :1
Watch           :On             Watch Object        :1
Zoom            :1              Autozoom            :Off
Distance        :160            Distance Anim       :0
Offset Pitch    :-14            Offset Pitch Anim   :0
Offset Yaw      :180            Offset Yaw Anim     :0
Visible         :Off            Collision           :Off
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #3
Prop Name       :Camera#1
Method          :Follow         Method Object       :12
Watch           :Off            Watch Object        :1
Zoom            :1              Autozoom            :Off
Distance        :217            Distance Anim       :0
Offset Pitch    :-15            Offset Pitch Anim   :0
Offset Yaw      :0              Offset Yaw Anim     :0
Visible         :Off            Collision           :Off
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #4
Prop Name       :Camera#1
Method          :Spot           Method Object       :12
Watch           :Off            Watch Object        :1
Zoom            :1              Autozoom            :Off
Pitch           :4              Pitch Anim          :0
Roll            :0              Roll Anim           :0
Yaw             :331            Yawing Anim         :0
Distance        :128            Distance Anim       :0
Offset Pitch    :-6             Offset Pitch Anim   :0
Offset Yaw      :91             Offset Yaw Anim     :0
Visible         :Off            Collision           :Off
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #5
Prop Name       :Camera#1
Method          :Follow         Method Object       :20
Watch           :Off            Watch Object        :1
Zoom            :1              Autozoom            :Off
Distance        :17             Distance Anim       :0
Offset Pitch    :0              Offset Pitch Anim   :0
Offset Yaw      :22             Offset Yaw Anim     :0
Visible         :Off            Collision           :Off
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #6
Prop Name       :Camera#1
Method          :Spot           Method Object       :12
Watch           :Off            Watch Object        :12
Zoom            :1              Autozoom            :Off
Pitch           :4              Pitch Anim          :0
Roll            :0              Roll Anim           :0
Yaw             :130            Yawing Anim         :0
Distance        :314            Distance Anim       :0
Offset Pitch    :0              Offset Pitch Anim   :0
Offset Yaw      :255            Offset Yaw Anim     :0
Visible         :Off            Collision           :Off
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #11
Prop Name       :00060X00020
Method          :Follow         Method Object       :1
Watch           :Off            Watch Object        :1
Distance        :1              Distance Anim       :0
Offset Pitch    :0              Offset Pitch Anim   :0
Offset Yaw      :180            Offset Yaw Anim     :0
Visible         :Off            Collision           :On
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #12
Prop Name       :Tupolev 142 Bear
Method          :Free
Watch           :Off            Watch Object        :1
N/S             :41005          E/W                 :8483
Altitude        :9000
Pitch           :0              Pitch Anim          :0
Roll            :0              Roll Anim           :0
Yaw             :60             Yawing Anim         :0
Speed           :300            Acceleration        :0
Heading Pitch   :0              Heading Pitch Anim  :0
Heading Yaw     :0              Heading Yaw Anim    :0
Visible         :On             Collision           :On
Explosion       :Off            Shadow              :On
Locked          :Off            Placed              :On

Prop #13
Prop Name       :18000X18000
Method          :Free
Watch           :Off            Watch Object        :1
N/S             :38127          E/W                 :5368
Altitude        :0
Pitch           :0              Pitch Anim          :0
Roll            :0              Roll Anim           :0
Yaw             :41             Yawing Anim         :0
Speed           :0              Acceleration        :0
Heading Pitch   :0              Heading Pitch Anim  :0
Heading Yaw     :0              Heading Yaw Anim    :0
Visible         :Off            Collision           :On
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #16
Prop Name       :Sphere 00075r
Method          :Attach         Method Object       :12
Watch           :Off            Watch Object        :1
Distance        :0              Distance Anim       :0
Offset Pitch    :0              Offset Pitch Anim   :0
Offset Yaw      :0              Offset Yaw Anim     :0
Visible         :Off            Collision           :On
Explosion       :Off            Shadow              :Off
Locked          :Off            Placed              :On

Prop #20
Prop Name       :AIM-7 Sparrow
Method          :Attach         Method Object       :1
Watch           :Off            Watch Object        :1
Distance        :0              Distance Anim       :0
Offset Pitch    :0              Offset Pitch Anim   :0
Offset Yaw      :46             Offset Yaw Anim     :0
Visible         :Off            Collision           :Off
Explosion       :Off            Shadow              :On
Locked          :Off            Placed              :On

Both aircraft start offshore of the large airport near 
the west part of the island. Since these are the major 
props these are visible, and collision is turned on
for both of these props. The sphere is attached to the
Tu-95 (prop#12) and will serve to trigger the event
program when the missile (prop#20) strikes it at any 
point. The sphere's visibility is turned off so it is not
seen or filmed. However, it remains visible in the set
designer at all times. All cameras have their visibility
turned off as do the two collision windows, since these
are merely production tools and not something you want
to actually see in the finished process.

You may have noticed that the missile (prop#20) has most
its settings at the bottom turned "off", i.e., visibility,
collision, explode.  All except the shadow. This is so the
missile remains invisible until fired. It also prevents it
from exploding from having contact with your fighter. An
explosion won't hurt your plane, since it is not set to
explode in the event program nor in its own settings, but
having the missile explode as the take starts removes it
from use and spoils the cameral shots of your fighter.
The shadow is left on, so that when fired it will have a
shadow, but since the missile is pretty well hidden by 
your plane its shadow is hidden by the shadow of your own
plane before it is fired.

The next thing you will note is that there is a collision
window (prop#11) actually attached to your aircraft! The
reason for this is to intercept those "stupid" missiles
fired by your plane when the weapons selector is set to
fire missiles. Although I didn't try it, it may even do
the same thing for the guns. This effectively makes them
harmless. Placing this collision window where I did, keeps
the "stupid" missiles from assuming a normal flight path
ahead of your plane. All you will see is a flash when they 
are fired. This is due to the fact that they are detonating
on the attached collision window. As specified by one of 
the events in the event program. This flash can also be
used to enhance the illusion of your "smart" missile being
fired.

Prop #13 is the second collison window, 18000x18000 in size.
This window determines if the F-16 has approached within 
the specified distance you want the user to be at before
he can successfully launch his missile. This collision 
between this window and the F-16 is checked for in the 
event program. Any attempt to fire the weapons before you
contact this window results in a failure.

The second collision window (prop#13) is stationary.
For a more sophisticated method you can attach a huge
sphere to either plane, and when the sphere contacts
the opposite plane in the tutorial it allows you to
fire weapons succussfully. Spheres do to their nature
are not a good choice for realism however. Since a 
sphere is round it allows you to make contact at
any angle. You could actually be above the target plane
and be allowed to fire a weapon successfully. A better
and more reailist prop to use would be a huge 
collision window attached to your plane, much like prop
#11 is attach to your plane, but in this case this
window would be placed at a distance from your plane, 
say at maximum distance allowed 999 feet. This window
would be set to collide, but not be visible and no
shadow. It would be place ahead of your plane, so that
you would actually would have to be facing the target
plane before you could fire. 999 feet is a bit close
though, so a second prop could be used. As described above
a huge sphere could be placed around the target plane.
The radius of the sphere if it is big enough and the
distance the collision window is from your plane would
give you a more realistic distance to fire from. The
use of the sphere would allow the fixed collision window
to make contact with it from any angle, while the window
itself would limit you to facing the target. An event
would have to be programmed that checked for a collision
between the window and the sphere and allow the firing
of the missile, either by setting a flag or modifying one.
As stated, I kept the actual setup simple and did not
use these methods. I also kept the event program simple 
by not having the program check to see if the plane was
facing the target when the missile if fired. With this
tutorial, the event program only checks to make sure that
you contacted the fixed window at least one time. If you
have then you can fire your missile even if you are not
heading for the target.  However, the missile, prop#20,
will only "seek" in the direction it is facing when 
launched, so in a sense you do have to face the target
aircraft in order to destroy it. Props set to "seek" will
head in the direction they are facing and then when 
arriving at the sought prop it will circle it endlessly.
So you have to "kill" the missile after you set it to
explode on the target, and the target will have to be
set to "kill" after being struck. I tried using just
"explode" and the Tu-95 still remained in view after the
explosion.

Event program:

Event#1                 One Shot
If AIM-7 Sparrow(20) hits Sphere 00075r(16)
 And nothing
 And nothing
Then explode Tupolev 142 Bear(12)
 And change Sphere 00075r(16)'s method to Free
 And play 'Explosion#7' on chan 2, vol= 4.
 And kill AIM-7 Sparrow(20)
 And wait 5 seconds
 And fade to 0%
 And finish - success

This event checks to see if the sphere attached to the
target and the missile (prop#20) have collided. It then
explodes the target prope, plays an explosion, and kills
the graphic of the missile. It then waits 5 seconds, fades
to black and exits to a success message.

Event#2                 One Shot
If weapon count = 1
 And nothing
 And nothing
Then change AIM-7 Sparrow(20)'s visibility to 1
 And change AIM-7 Sparrow(20)'s speed to 1500
 And play 'Missile Fire' on chan 2, vol= 4.
 And wait 2 seconds
 And change AIM-7 Sparrow(20)'s method to Seek
 And change AIM-7 Sparrow(20)'s method obj to 12
 And change AIM-7 Sparrow(20)'s collideability to 1

This even checks the weapon count to see if a weapon
has been fired. If it has it changes the weapon's
visibility to ON, changes the speed of the weapon to
1500 mph, plays the weapon firing sound, waits two
seconds to change it from an "attach" to a "seek" prop
to enable it to find the target aircraft on its own, 
which is set in the following line with the method obj
line, and then it finally sets its collideability to "on"
so it can actually collide with the sphere around the 
target plane. This event is what makes the missile 
"smart". 

Event#3                 One Shot
If Any Weapon hits 00060X00020(11)
 And nothing
 And nothing
Then kill 1st Object

This event's only purpose is to check for any weapon hitting 
that attached collision window to your aircraft. This is what
kills the "stupid" missiles as they are fired and gives you
the "flash" effect as they explode.

Event#4                 One Shot
If 18000X18000(13) hits F16C Falcon(1)
 And nothing
 And nothing
Then set flag #1 to 1

This event's purpose is to check to see if the Falcon has
hit the large collision window and sets a flag to 1 if it
has. Flag 1 doesn't actually do anything, but something
was needed in the THEN spot.

Event#5                 One Shot
If weapon count = 1
 And event #4 hasnt happened
 And nothing
Then set flag #0 to 0
 And finish - too early

This is the event that cuts to a failure message when you
fire a weapon before you reach the large collision window
in event 4.

This simple tutorial did not take into account the use of
guns instead of missile, but I suspect that it will 
function in the same manner as the event program makes no
distinction between missiles and guns. I'm not even sure
that the missile (prop#20) won't fire when you select
guns. More event programming will have to be incorporated
should you desire that the guns not be used, but it is 
nothing that I'm going to go into here and now.

Well, that's it for this little tutorial. I kept it pretty
simple, and it may have a number of holes like I explained
but my main purpose was to show you how to get a weapon to
seek out a specified target. Camera angles can also be 
triggered by the collision windows as long as you don't 
choose "NO" when asked if you want use autoedit when you
start Stunt Island. I hope this helps someone out.
