Table of Contents

Lesson 1: Creating your first addon

Lesson 1: Creating your first addon by Brsseb

Preparing for the lesson

Before we can begin making the addon we should get & set up all the stuff needed. We must create the folder the addon should be in and get all the texture files. We`ll also need a config-file. This can be downloaded from this site. A PBO utilitiy is also needed.

Here is what you need:

The textures are all in *.pac format. *.pac & *.paa are the standards used by OFP. The images was originally JPG so I had to use an utility called TexViewer to convert them to *.pac. You don't need to worry about converting textures since they are already in *.pac format.

When you`re done with that, your`re ready to start modeling.

Making the structure

Now start O2 and we will begin creating the crate. Its really simple. If you have had a look at the textures (you`ll need the TexViewer for that since they are all *.pac) you`ll see how the structure should look like. Here`s what you should do:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_b_1.jpg

Now you have the basic shape of the crate. But you'll notice that we see the side of the crate in the front view even though it would be more logic to have the front or back of the crate in front view (makes texturing more logic). So lets rotate the crate:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_b_2.jpg

Ok, now have a look at the 3D view. Look at the grid and you`ll notice that the crate`s center is at the Origo. Also that half of the crate is below the grid. This is bad, because on simple objects like this OFP uses the grid as the ground level. So unless we want the crate half-buried into the ground we must move it upwards:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_b_3.jpg pmc.editing.wiki_images_brsseb_brsseb_lesson1_b_4.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_b_5.jpg

Note: If you can`t see some of the vertices in 3D view, try turning “Face Culling” OFF from the View-menu (or hit the 'F' key).

Now that wasnt so hard now was it? Well, the basic shape is done. In the next lessons we will talk about something called Geometry LOD (Level of detail).

Geometry LOD

Understanding LOD (Level of Detail) is somewhat hard, so I wont go into detail about what they really are and describe each type and their use. I'm only going to talk about ONE LOD, the Geometry LOD. Basically that LOD is just an invisible structure made out of vertices that tell OFPs physic engine how to deal with your addon. As you probably know a crate is just a long big heavy box. But the engine doesn't know that so we need to tell it. And that is what the Geometry LOD is for. Without that objects like soldiers and tanks could just run trough the crate. Collision detection is not possible without it. So lets make this now, shall we:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_1.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_2.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_3.jpg

Now you will see that our crate is turned yellow. If you double click the “0.000” LOD you will see that its back to normal. Thats because our crate isn't in the Geometry-LOD but in the “0.000” LOD. But because we turned on “View background LOD” and “View bgrnd LOD in 3d view” under “File-Options” a “ghost” of our crate is being displayed in our new empty LOD, the Geometry LOD. This is useful because we need to now exactly where the original crate structure is during the next few steps. Now double click the “Geometry” LOD and lets continue. We are going to create another crate structure (only this is about 95% its size) so the OFP engine can do proper collision detection on. The reason why we have to make another crate structure for this is that Geometry LOD is invisible & therefore can`t be textured. Now lets get moving:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_4.jpg

Now OFP know how to deal with collision detection. But it can`t be sure on how heavy the crate is. It it 1000kg or only 1/8 kg. And is the back part of the crate more heavier than the front? Now lets put some Mass to our crate:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_6.jpg

As you probably have guessed, the grey boxes indicate how much weight the vertex has. Since the weight of the whole crate is balanced, all boxes should be the same size. To apply weight to a single vertex, press F4 (vertex select mode), select a vertex and enter value. But that's not for this tutorial.

We also have to save a selection for this LOD to work (I don't know why, but if we don't do this, the Geometry LOD will fail). Do this:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_7.jpg

Now each time you double click on the “Component01” in the selection window the content on the Geometry LOD should be selected. Note that each LOD have their own set of saved selections. Therefore “Component01” will only be on this list when you have already double clicked “Geometry” in the LOD window.

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_8.jpg

Now the box is nearly finished. But if you have looked in the external viewer, the crate looks very UGLY. But don't worry, in the next tutorial we will put some nice textures to it.

Texturing

Now lets make our crate look nicer. In your crate-folder there are now two textures, red_side.pac & red_door.pac. Our goal is to apply red_door to the front and back, and red_side to all the other sides.

pmc.editing.wiki_images_brsseb_brsseb_red_door.jpg red_door.pac pmc.editing.wiki_images_brsseb_brsseb_red_side.jpg red_side.pac

We will work with one texture at the time. Lets start with the red_door texture:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_1.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_2.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_3.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_4.jpg

If you have a look at the external viewer, the texture should now be in place. (If you messed it up you`ll have to try again)

pmc.editing.wiki_images_brsseb_brsseb_lesson1_c_5.jpg pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_6.jpg

Now you must do the same thing to the back of the crate. The red_door texture is to be applied there too. Here is what to do:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_7.jpg

Now if everything went OK, you now have the door-textures applied. Now for the remaining 4 sides; top, bottom, right and left. If you have completed the door-texture, you should be able to apply the side-texture all by yourself. Just remember to load the red_side.pac instead of the door-texture. Select one side of the time and apply the texture. You probably need to change the view panels a little bit to make sure that you are “facing the face” you are working on. Here are some shots from the process:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_8.jpg pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_9.jpg

Eventually, the crate should look like this in the external viewer:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_10.jpg

One more thing. Sometimes you need to make sure O2 has got the right path to your textures. If they are wrong, your addon will be textureless in-game even though it looks nice in Bulldozer. Most ingame textures that OFP use are found in the data.pbo. But most unofficial addons have their own textures (like ours). So to make sure that your textures paths points to your addon folder (crate) and not somewhere else, do this:

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_11.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_d_12.jpg

Done? Almost done now. OK, lets move on…

The Config File

Open your config-file (the one you downloaded together with the textures & that should now be in your crate-folder). It looks like this:

pmc.editing.wiki_images_brsseb_brsseb_config.jpg

I am not going into detail about config-files. There are other tutorials out there that describes the different elements of a config file. If you happen to know a little Object Oriented Programming (like C++ or Java), you`ll notice that our Crate has been classified as an Static Building of some sort. But here are the most important stuff to us right now:

So, nothing for you to do here though. I just wanted to show you the config file.

Now lets get your addon in the game!

Finishing our addon

Its almost time to test our addon in OFP. We have just a few steps left.

pmc.editing.wiki_images_brsseb_brsseb_lesson1_f_1.jpg

pmc.editing.wiki_images_brsseb_brsseb_pbotool.jpg

pmc.editing.wiki_images_brsseb_brsseb_lesson1_f_2.jpg pmc.editing.wiki_images_brsseb_brsseb_lesson1_f_3.jpg

NOTE: For the PBO tool to save the file, you MUST enter the .pbo extension after your filename in the save dialog!

Now fire up Operation Flashpoint, start the editor and have a look at your new addon!! Try to run through it to check if the collision detection works. And if you get no error messages and the program doesn't crash, be PROUD! You just completed your first addon for OFP!

pmc.editing.wiki_images_brsseb_brsseb_final.jpg

Download the completed version Brsseb_lesson1_done.rar OFP.Brsseb_Lesson/ Torrent Magnet from below:

magnet:?xt=urn:btih:40aac3407210ddb8ffcee06cdb009c0b099ccdce&xt=urn:btmh:122046986f756bcebf9744dc9f81bc3fc736a54e164113ec62e18c827a4a06271364&dn=OFP.Brsseb_Lesson&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a6969%2fannounce

Any questions/bug reports goes here: brsseb@hotmail.com

Notes

This tutorial was written by Brsseb in ofp.gamepark.cz/_hosted/brsseb/, it was posted here with his permissions, thank you Brsseb!