Duplicating a Model Object

Last modified: February 24 2014 12:52:41.        
For infos or suggestions, see the credits page        
  File System structure Editing Basics Hex/DC examples RevEngEd 2

Support Wikipedia

Warning! This page is deprecated and the procedure illustrated might not work. Instead, please refer to RevEngEd 2 editor pages.

"Model Objects" are a particular category of objects, recognized by DC||ED, as shown in this image. In this example, you can see several "la_ammo..." objects inside the "Model Object" category of the file "Normandy2_mp_zone/actors.bin", which are the ammo/medikit crates you can find in-game. To be specific, those who have "la_ammo01" as Model are ammo crates, those who have "la_ammo02" as Model are medikit crates.

In this example, I'll show you how to successfully duplicate a crate. First of all, let's decide if we want a new ammo crate or a new medikit crate. Let's say we want a new ammo crate, so search the list of "Model Objects" for an object which has "la_ammo01" as Model. In Normandy2_Mp_Zone there is (for example) the la_ammo_7 object.

I'll create a new mission, as explained previously, called NORMANDY2_MP_ZONE_NEW, which is (by now) a copy of the NORMANDY2_MP_ZONE extracted from MISSION.DTA.

Open "Normandy2_mp_zone_new/actors.bin" with DC||ED and right-click the "la_ammo_7" object. Select the "Duplicate" option and call it "new_crate" (notice that the new name is 9 letters, like the original one. It's not mandatory when duplicating, but it's advisable and mandatory for this example): image.
Now I advice to save (several times), exit DC||ED and re-open "Normandy2_mp_zone_new/actors.bin" with DC||ED. And also making a back-up copy of actors.bin. DC||ED it's very prone to mess up files, especially when multiple operations are done without closing it every once in a while.

Select the "new_crate" object and set X position to 30.0 and Z position to -10.0: image. According to the "coords and moving" tutorial, the new crate will be placed in front of the bank. Enter in game and have a look. The new crate is there, but closed. If you try to walk against it, you'll find out that it's also not interagible and incorporeal, like a ghost. That's because duplicating a "Model Object" with DC||ED only create a portion of the object (I call header), but does not create a second portion (I call definition).

Open "Normandy2_mp_zone_new/actors.bin" with the hex editor and press CTRL+F (Find functionality). Search for "la_ammo_7" and be sure to check the "Find text" option: image. You'll find 2 entries: the header and the definition. Now do the same, searching for "new_crate". You'll find only the header*, and we must create manually the definition.

============
A few informations before doing the job. The actors.bin file is divided into 2 main areas. The first part contains the headers, and is organized using byte-counts and pointers. So deleting or inserting bytes in the first part, without correct several other bytes across the file, will lead to crashes and bad files! The second part contains the definitions, which are listed the one after each other. So inserting a new definition between other definitions (or at the very end of file) won't create any problem. The only thing to take care of is not to put a definition in the middle of another one, breaking it. Finally, two objects which act at the same manner (for example 2 ammo crates) have the same identical definition.
============

Search again for definition of "la_ammo_7" and have a look at it. There are many similar blocks of bytes, each containing a "la_ammo_..." string. Those are all the definitions for the crates. To know where a definition start, look for the 2 symbols : they are the first 2 bytes for crates definitions. Copy the "la_ammo_7" block and paste it next to this. Reaplace the string "la_ammo_7" with the string "new_crate": image.
If the new string ("new_crate") would have been longer or shorter than the old one ("la_ammo_7"), other bytes (counters) in the definition had to be changed! (see ??? for further information)
Obviously, the string contained inside the definition always match its relating header.

Enter in game and have a look. The crate now works correctly.

In this very example, copying the definition at the end of file would not have worked. I don't know why. Maybe, the last definition (m_nm2_socha_) is corrupted. Copying the new definition just before the last definition works. Corrupted files or other accidents like this are frequent, so save often and make a lot of backups!

* You have to move the cursor to the beginning of file, before searching, because Tiny Hexer only searcher from cursor onward.