I'm writting this tutorial with the assumption that you already know how to build rooms, manipulate the polygons, and a lot
of the other basic MaxED functions. If not you'll probably want to check out some other tutorials first.

The FSM may seem complex at first but once you get a hang of it its a breeze. Not only that, you begin to realize just how
dynamic Max Payne really is. Here are some example scripts and I'll explain what each part of the script does. Note: These pages might take a bit to load on dialup connections. There are a lot of pictures ;)


The Syntax
this->a_play3dsound(breakable, glass_shatter, "");



This
Refers to the object that the FSM is attached to(the one you're editing at that moment.)

->
This tells the engine that you're done adding objects for it to interact with and you now want to type the
command.

a_play3dsound()
The command that we're using. It does what it sounds like and plays a 3D sound for the specified
object(s). In this case, this.

breakable, glass_shatter, ""
These attributes go in the paranthesis for the command a_play3dsound.
Breakable
refers to the sound library 'breakable.txt', glass_shatter is the sound to be played from the text. The
double quotes at the end are used for defining which bone the sound plays from. Since we're not referring to a character we leave it empty.


You can also use an object to refer to another object. If an object is in the same room as the first one you can use:

parent::object2->a_play3dsound(breakable, glass_shatter, "");


Parent tells the program to look at the current object's parent(the room object.) Then to look for an item in
that room with the name of object2.

If you want to talk about an object in a separate room you could use:

::room2::item2->a_play3dsound(breakable, glass_shatter, "");

This will get the program to look for item2 in room2.

Things to note


Now that we have a basic understanding its time to do something fun =) For our first FSM trick we're going to make a
breakable televison. First, make a true room and make yourself something that looks something like a TV. When you're
done, copy and paste the TV and tie both of them to your room. You'll probably want to put a broken glass looking texture
for the screen of the television. I did this by making another polygon, sizing it to the screen, and placing the
broken computer screen texture from the Official library on it. Also added a light grey alpha layer to it to give a
nice transparent look.

Make both of the TVs dynamic by selecting each in Transform Mode(F5) and pushing 'D' Say yes to making it dynamic and yes
to keeping the lightmaps. Rename one TV to TV_Normal and the other to TV_Broken. Turn on the BulletCollides and
DynamicCollisions flags for each.

Now, select the non-broken one and push '4' to get to the FSM menu and push the 'Messages' button. We want the TV to break
when its shot so we need to edit the category for DO_BulletCollides. Push the Add button under 'Send Before'. For
each of the lines I type below you'll need to add a new line in the same section.

this->a_play3dsound(breakable, glass_shatter, "");
this->do_hide(true);
this->ps_starteffect(glass_shatter_window_50x50cm, "");
parent::TV_Broken->do_hide(false);

Now accept all changes and select the broken TV. Goto its FSM menu the same way but this time select the Startup
tab. Enter this:

this->do_hide(true);

This makes the 2nd TV hidden as it's initial state. All we have to do now is to drop the TVs on top of each other and its
all set. If you compiled your map to check it out you might be wondering why the particle effect doesn't show or only shows
partially. It seems that the particle effect will emminate from the object's center. I've heard from a pretty reliable
source that it depends on the pivot point. If this is the case then I must be doing something horribly
wrong. No matter where I put that sucker the particles stay where they are. This is how I worked around it:

Create a trigger of any type, the size doesn't matter, and name it Shatter. Place it near the face of the TV and center it
across the face.
Now, go into your TV_Normal FSM Messages and edit this->ps_starteffect(glass_shatter_window_50x50cm, "");
to parent::Shatter->ps_starteffect(glass_shatter_window_50x50cm, ""); Next edit your trigger's FSM. Under the
startup tab and add this->t_enable(false); We do this last bit so that the trigger isn't affected by anything but
the TV being shot.

Just for Fun On to more advanced stuff -->