====== Import AI From Dromed Deluxe ======
This tutorial describes how to copy an AI from Dromed Deluxe to be used in a stand-alone mission. The examples are for a $$FireMageX$$, but are typical for any AI, or even regular objects.
In this tutorial I assume that you have two folders, one with __Dromed Deluxe__, and the other with a regular installation of __Thief__. You could also use just one folder, but then it is more difficult to notice when you have forgotten to copy a file.
You should also be using a mission with a custom gamesys. Before starting, make a copy of your current gamesys and mission, just in case something goes wrong.
===== Folders and Files =====
Begin with making some folders in your __Thief__ folder, if you haven't already.
Thief2 \
+ obj
+ mesh \
| + txt16
+ snd
You will also need a ''schema'' folder, but we'll copy that one later.
You will copy the files for the AI model (''.bin'' and ''.cal'') and skin (''.gif'') from __DeDx__. Go to the ''mesh'' folder in __DeDx__. Find the files ''fmage.bin'' and ''fmage.cal'', copy them to the your own ''mesh'' folder. From the ''mesh\txt16'' folder, copy ''fmage.gif'' to your ''mesh\txt16'' folder. There is also a PCX image used for the corpse. If you don't copy this, then Dromed will crash when you try to pick up your mage. The image file is specified in [[dromed:property:InvRendType|Inventory->Render Type]]: $$Alternate Bitmap$$. For the fire mage, it is ''xfmage''. You find these files in the ''obj'' folder, //not// in ''txt16''. Copy it to the ''obj'' folder of your mission.
===== Archetypes =====
Open Dromed twice, one with your current mission and another with ''basemis.mis'' from __DeDx__.
Open the object hierarchy of __DeDx__ and find the $$FireMageX$$ archetype. Mages are listed under $$physical\Creature\Animal\Human\MageTypesX$$. But $$MageTypesX$$ doesn't exist in your own gamesys, so you'll have to create it.
In your object hierarchy, select the $$Human$$ archetype, then click ``Add``. Type __``MageTypesX``__ in the box and click "OK". You will see that the new archetype has been added at the end of the list.
Now select the new $$MageTypesX$$ and click ``Edit``. Do the same in __DeDx__. You will see a list of properties: ''AI->Ranged Combat'', ''AI->AI Core'', etc. You have to copy all these properties to your $$MageTypesX$$ archetype. It helps to move the windows around so you can see the __DeDx__ properties and your new properties at the same time. When you've created all the properties, click on ``Done``.
Now select your new $$MageTypesX$$ again and click on ``Add``. In the box type __``FireMageX``__ and the new archetype will appear. Select $$FireMageX$$ and click ``Edit`` in your gamesys and in __DeDx__. As you did before, copy all the properties of the fire mage from __DeDx__ to your new archetype. But **don't** copy the links, because you don't have the projectiles that the mage is linked to. You'll have to create the projectiles before you can add the links.
Now would be a good time to save your gamesys and make a backup copy.
Open the list of links for the $$FireMageX$$ archetype in __DeDx__. You can write down the link data now so you won't have to come back here later. Select the ID number of the link, then click on ``To``. A window with the properties of the projectile object is now shown. You can also see the parent archetype of the projectile, which is $$firebolt$$. This is a standard object (all the custom archetypes in __DeDx__ end with ''X''), so you don't have to create it. But you may not know where to find $$firebolt$$ in your gamesys. Keep clicking on lower archetypes until you get all the parent names: $$physical\Projectile\CritterShots\firebolt\FireMageBoltX$$.
Create the $$FireMageBoltX$$ archetype in your gamesys using $$firebolt$$ as the parent. Keep the object window from __DeDx__ open so you can copy the properties. After the projectile is created, you can finally make the link from $$FireMageX$$ to $$FireMageBoltX$$. Remember to copy the link data from __DeDx__.
This object only had one link. But you will have to find the destination and create a copy of it (if necessary) for each link from your new archetype. You might also have to create new meta-properties, although there were none for the fire mage.
===== Schemas =====
Now you need to copy the sounds for the AI. (Save your gamesys and make another backup.) You will need the schema files for the new sounds. The easiest thing is to simply copy the folder named ''schema'' from __DeDx__ to your working __Thief__ folder. Both __DeDx__ schemas and standard __Thief__ schemas are included there. You can edit the schemas, or delete the parts you will never use, after you've copied the files. But if you're not comfortable with creating or modifying custom schemas, then you should leave the files alone -- you don't want to make a mistake that would prevent the game from working.
Now you should have this in your __Thief__ folder:
Thief2 \
+ obj
+ mesh \
| + txt16
+ snd
+ schema
Open Dromed and in the command line type __``reload_schemas``__. If there is a problem, an error message will be shown in the status bar at the bottom of the window. There is also the possibility that Dromed will crash on you with the message:
Ran out of abstract obj ID's
Re-run with a larger obj_min. (File: objsys.cpp, Line: 367)
Click ``No``, Dromed won't let you ignore this error.
Schemas need object IDs, and there are a lot of them in __DeDx__. Open ''dark.cfg'' in your __Thief__ folder and fine the line:
min_obj_id -8192
Change it to:
min_obj_id -10240
Then save the file and start Dromed again. Type the Dromed command ``purge_missing_obj`` and then ``reload_schemas`` and it should work.
When you load schemas, they are imported entirely into your gamesys and Dromed doesn't need the files anymore. So it isn't necessary to put the ''schema'' folder in the ZIP file of your mission. Some people include new schemas anyway, just for reference. But if you add or change something later and need to reload the schemas again, you need //all// the schema files or it won't work. Don't think that "the other stuff is already there, I only have to add the new schema". It doesn't work that way.
===== Sounds =====
The sounds for the speech of the mages are in the folders ''mage1'' and ''mage2''. Copy those folders into your ''snd'' folder. __Thief__ will assign one of those voices to the AI when you play the game. If you'd rather use just one, then choose the voice you like and copy only that folder. If you do that, you'll need to set the property [[dromed:property:SpchVoice|Speech->Voice]] to ``vmage1`` or ``vmage2`` when you create the AI in Dromed.
For the mage shots, you need to look in the schema file named ''MiscSFX.sch''. All the schema files are plain text and can be opened with Notepad. Search for "''MAGE FIRE BOLT''". After that, and right before the line that begins with ''env_tag'', you will see ''mgfire''. This is the name of the WAV file you need. In the __DeDx__ folder, you'll find it in ''snd\t1sfx''. Copy it to your ''snd'' folder. You don't need to create the ''t1sfx'' folder, but it doesn't hurt if you do -- you can even name it just ''sfx'' or whatever you like. Dromed ignores other folders inside the ''snd'' folder. (But this also means you can't have two files with the same name but in different folders.)
There, all is done. You should be able to create a $$FireMageX$$ object and have it work. The files and folders you copied are:
Thief2 \
+ obj \
| + xfmage.pcx
+ mesh \
| + fmage.bin
| + fmage.cal
| + txt16 \
| + fmage.gif
+ snd \
| + vmage1 \
| | + ... lots of files ...
| + mgfire.wav
+ schema \
+ ... lots of files ...
Remember to include these files in the ZIP archive of your mission. Except the schemas, which aren't needed to play the game.