Copying all properties and links
NewDark’s DML system makes it easy to copy an archetype from one gamesys to another without missing anything. You’ll find this useful if you have to copy custom particles or anything with a lot of values.
From the object hierarchy you can export an archetype as a DML file, which can then be loaded into another gamesys.
Be aware that the archetype may have custom metaproperties and links to other custom archetypes. They all need to be exported, and loaded in the correct order.
This does rely on the FM author doing things properly and setting all the required properties in the gamesys and not just on the concrete objects.
In this case the archetype is an easy one to deal with as there are no references to other custom archetypes:
At the bottom of the hierarchy window you’ll see an Export button and a DML item in the menu:
Click OK at the next dialog box and then choose a suitable filename. The name and location are up to you.
The DML file will only contain property values, so the archetype will need to be created before Dromed can set them. You can do that yourself in the target mission in Dromed, or you can open the DML file in a text editor and add the following code below the DML1 line and above any property lines:
CreateArch “table” “MetalTable”
Edited DML file example:
In this example, table is the parent archetype and MetalTable is the name of the new archetype that will be created. It helps that the original archetype name is written as a comment in the DML file.
The only reason for using the same parent archetype is to ensure the correct properties are inherited.
Load the target mission/cow.
If you’re using one of the recommended custom menus you should have File > Load DBMod, from which you can load the DML file. If not, use the command dbmod_load instead.
In this example the archetype HandCandle is to be copied:
You can see it inherits from another custom archetype: WallCandle
You can see that HandCandle only has a Model Name property.
The parent archteype, WallCandle is where the rest of the custom behaviour is defined, so this also needs to be exported.
You can see that there’s a custom metaproperty, M-CandleSnuff, so that also needs to be exported (the export to DML feature works from the Metapropties hierarchy too, and Act/React etc).
Examine that metaproperty:
It has a reverse link to yet another custom archetype CandleFlameYellow, which will also require an export, and custom script for good measure, so you need to find out what .osm file it belongs to (in this example it’s a Squirrel script so it’s kept in a .nut file in the FM’s sq_scripts folder).
The candle flame is a straightforward archetype, so all it needs is a DML export:
For complex setups, a bit of care is required to make sure everything gets created correctly. It’s essential that the target item exists before the DML file tries to set properties/links etc.
If you’re doing this for yourself it’s probably easier to create empty Archetypes/metaprops/stims manually in the correct places and then load each DML file to set the properties and links.
If you’re making something for other users it’s better to simplify things…
If you have several DML files, you can copy and paste to make a single one, which will make file management/packaging easier. Each instruction in one of these files essentially says “to this object/archetype/metaprop (etc), add this property with this value…”.
Some archetypes will automatically have a Position property full of zeroes, which ends up in the DML file, but it can be removed from there as it’s not necessary:
(leaving it alone won’t do any harm so if in doubt don’t remove it)
As mentioned, the archetypes have to exist first. If you’ve combined all your DML files, you can insert all of the ‘create’ commands at the start, e.g:
Starting with the custom archetype in question, you need to find all the others if you want the object to behave in the same way in your target mission:
The above may look complicated but after doing it once you’ll see it’s quite a methodical process. It’ll probably be easier to build up a DML file than to manually type up a list archetypes and links followed by property values and link data for the user to set up manually.