User Tools

Site Tools


arma2:port_ofp

This is an old revision of the document!


OFP to ArmA 2 port tutorial

This tutorial shows you how to port your addon from OFP to ArmA 2.

This tutorial will not help you to optimize your addon, it just tells you what to do to get your addon working in-game.

Unpack PBOs

First take the OFP addons in pbo format and unpack them into your work directory (up to you where this is, it might be the ArmA 2 tools directory in P: or any temp dir). Use Kegetys's cpbo or Mikero's ExtractPbo tools to unpack pbos. Easy way to unpack all pbo's in the dir is to call extractpbo from runme.bat file like this:

for %%x in (*.pbo) do (\path\to\extractpbo %%x)

Which would unpack all found pbo's in the current dir.

Convert ODOL -> MLOD

We proceed by converting the P3D models to MLOD format (we assume they are binarized ODOL format at start). Do this by using ODOL Explorer (OdEx). Load up the model, click Save MLOD and overwrite the existing model. Exit OdEx and choose next model.

Its not certain would OdEx save the models properly if you did not restart it between models, but at least it gives you piece of mind that there was nothing faulty going on in the conversion process of models.

Preparing MLOD models

Before ArmA 2 can read the OdEx saved MLOD models, you need to load them up in O2 and save again. It does not matter if its ArmA or ArmA 2 O2 you will be using, both of them saves the proper format.

Missing Textures

Most likely you end up with few to many missing textures from OFP dirs like “data” or “o” and its sub dirs. You simply have to track down all these texture names, use Mikero's MoveObject to change the paths in P3D's and finally copy all the OFP textures into the specified dir on your ported addon.

This is example batch file to go through all P3D's and map “data” dir into myAddon\data\t\ directory:

for %%x in (*.p3d) do (\path\to\moveobject.exe "%%x" data\ myAddon\data\t\ >>log.txt)

Notice the “log.txt” at the end, it is very useful for you to track down what MoveObject did, in fact you can use this log text file to scan the replaced textures.

Prepare Configs

To prepare OFP config.cpp files for ArmA 2 use, one could say that in the first lines what you encounter is the requiredVersion. In OFP you usually have this:

requiredVersion = 1.96;

But for ArmA 2 you need to set it to:

requiredVersion = 1;

There is really no point of setting it to specific version number, as you always (trust me; Always) get some user to come whine that why this addon doesn't work in v?.? etc.

WRP

Regarding WRP terrains, this is one simple example how to port OFP config:

OFP:

 	class DefaultWorld{};
	class Eden: DefaultWorld{};
	class myTerrain: DefaultWorld

This needs to be replaced simply with:

ArmA 2:

	class Utes;
	class myTerrain: Utes

Comment out all class CfgSurfaces because it most likely causes problems.

Prepare WRP

Load WRP in WrpTool. Go to texture mode, select all CTRL-A and then use CTRL-T to bring up texture browser. Alick Add New, then choose for example o\b1.pac texture, use Add to Browser button. Then choose the new texture from the browser, then press SHIFT-LMB somewhere on the selected red cells on map view. Now this new o\b1.pac texture is set as ground texture. Save WRP.

Start your favorite hex editor, load up the WRP and change the o\b1.pac texture to whatever rvmat you wish to use in your terrain for ground texture. More of the WRP single texture details can be found on the PMC WRP tutorial.

Errors from RPT file

ArmA2.rpt file is very good to track down why your addon is not working. Usually it gives you clear indication of the cause of a crash. When you test your addon, open up RPT file to search for clues what models/textures/configs might cause problems.

PMCTODO this page is partial and flagged as todo, please post comments to our forum if you have something to contribute to this tutorial (or to ask more detailed help etc).

arma2/port_ofp.1279251795.txt.gz · Last modified: 2010-07-16 03:43 (external edit)