User Tools

Site Tools


dromed:copy_to_gamesys

Copying Archetypes from one Gamesys to Another

:T1: :T2: :SS2:

Copying all properties and links

Introduction

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.

A DML file is a plain text file that tells the game to make certain changes to the mission or the gamesys after it’s been loaded into memory. The purpose appears to be to allow people to release patches for missions (original or fan-made) without violating the terms and conditions that prohibit editing the missions themselves. FMs can be hosted on any website so even if modification was permitted it would be impossible to have all online copies updated. This feature can also be used, as will be seen here, to make changes in Dromed.

Basic Procedure

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.

Simple Example

Export

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.

Optional Tweak

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:

This is useful if you’re making a package designed for other Dromed users to install and the object should have a complicated set of properties.
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.

Import

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.

The above example is so simple it’s probably quicker to just note the properties and re-make them manually (or instruct the user to do that), but it’s a good way of showing the general process.

Complex Example

In this example the archetype HandCandle is to be copied:

You can see it inherits from another custom archetype: WallCandle

Export


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).

Keep Going…

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).

Reverse links (e.g. the ~ParticleAttachement link in this example) do not get exported, only forwards links, so that link won’t be defined in the DML for M-CandleSnuff, but the forwards link will be defined in the DML for CandleFlameYellow

Export the Final Archetype!

The candle flame is a straightforward archetype, so all it needs is a DML export:

As mentioned in the previous note, this DML will include a forwards particle link to the CandleFlameYellow metaprop.

Import

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…

Simplifying 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)

Archetype Creation Code

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:

If you’d prefer to keep the DML files separate you could include the above in another file and instruct the user to run that first, or just use each CreateArch command in each file and make sure the correct loading order is 100% clear to the user. But a single file is much easier.

General Procedure

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:

  • Look at the archetype and any parent archetypes.
  • Follow any links to see if they refer to custom archetypes.
    • Look at those custom archetypes too and follow their links!
  • Also look at all properties in case they refer to custom archetypes, e.g. Tweq > Emit, AI→Responses→Alert Response etc.
  • See if any custom Act/React stims are involved
  • Schema properties and SoundDescription links may lead to custom schema archetypes, but these must not be made with DML files - you have to find the entry in the relevant schema files and import them properly. This it outside the scope of this tutorial.

Summary

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.

Magus R Soul

dromed/copy_to_gamesys.txt · Last modified: 2020/09/18 00:18 by r_soul