Importing Monsters, Items and Scenery
This section describes how to use the Import Monsters and Import Items commands to automate the process of constructing component definitions for monsters and items.
Importing Monsters
Creating a Name File
The
first thing you need to do is create a text file relating the monster
index numbers to the names you want to give the component definitions
in Sketchup. The name of the file isn't important -- I'll call it Monsters.txt here, although you can use something more specific such as RubiconMonsters.txt if you like. The only requirement is that it have an extension of some kind (we'll see why later).
Each
line of the file should contain an index number and a name, separated
by a hyphen. The index numbers correspond to the order of the monster
entries in the physics file, starting at 0. For example, the first few
lines describing the Marathon 2 monsters might look like this:
01-Minor Tick
02-Major Tick
03-Kamikaze Tick
04-Minor S'pht
05-Major S'pht
The
lines don't have to be in numerical order, and you only need to include
lines for the monsters you're going to use. Note that the first entry
displayed in Anvil, number 0 ("Marine") corresponds to the player,
which you almost certainly won't need (player starting positions are
represented by a different kind of object).
If you are using a
number of different physics files which assign different monsters to
the same monster number, you can add a lowercase letter suffix to the
monster number to distinguish them. For example, a monster name file
for Rubicon might contain
01a-Lab Rat
01b-Minor S'pht'Wr
02a-Rat
02b-Major S'pht'Wr
Leading
zeroes are optional -- the end result is the same with or without them.
However, they can be useful on some platforms for causing the filenames
created in the next step to sort in the right order.
Creating the Images
Now
you need to open up the Shapes file in your favourite shape editor and
export two images for each variation of each monster, a front view and
a back view. To make sure you get the right images, look at the
"Graphic Collection", "Color Table" and "Stationary Sequence ID"
settings in the physics file (under the "Appearance and Sounds" tab in
Anvil). The frames for that sequence in that collection will give you
an idea of which bitmaps to look for. Set the view to the appropriate
colour table, pick two suitable bitmaps for a front and back view, and
export them.
The images must be put in a folder named after the name list file. For example, if your name file is called Monsters.txt, the images must be put in a folder called Monsters in the same folder as the name file.
Each pair of images should be named according to the following pattern:
index-filename-Front.ext
index-filename-Back.ext
where index is the corresponding monster number from Monsters.txt
(including the letter suffix if any). The filename can be anything you
want, although something descriptive is recommended. For example,
monster number 1 from Marathon 2 might have image files called
01-MinorTick-Front.bmp
01-MinorTick-Back.bmp
The back images are optional. If you don't supply a back image, the same image will be used for both the front and the back.
Note that if you included leading zeroes in Monsters.txt, they must be included in the image file names as well.
If
you export the images directly from Anvil or ShapeFusion, they will
have a blue background for the transparent areas. If you want, you can
use an image editor or other means to convert them into images with
alpha transparency, so they will look better in Sketchup.
Preparing to Import
Now fire up Sketchup with a new, empty document and do the following:
- Delete the set square
- Open the Components window
- Select "In Model" from the drop-down list
- Choose Purge Unused from the
menu
You should now have a completely empty component list, ready for the next step.
Importing
Choose Plugins>Marathon>Import Monsters command and select the Monsters.txt
file. MarathUp will first import all the images and create textures
from them. Then it will create a component definition for each monster.
Importing
textures for a complete set of monsters may take a noticeable time,
during which time Sketchup may appear to be frozen, so be patient.
 | Note: There seems to be a bug that causes Sketchup to get into an
infinite loop when using this script to import a large number of
objects at once, so you may need to break them up into smaller sets,
each with its own name file and image folder. A dozen or so objects per
set seems to be a comfortable number for it to handle.
|
If there are any problems with the Monsters.txt file or the way you've named your images, you will get a list of error messages explaining what went wrong.
If all goes well, switch to List View under
and you should see a list of components named according to the descriptions in your Monsters.txt
file. (Note -- there seems to be a bug in Sketchup causing them not to
show up properly in the Thumbnails view sometimes. The List view seems
to be more reliable.) Try one of them out by dragging it into the model
window. You should see a rectangle with the appropriate images on the
front and back.
Saving as a Library
You can save the components you've just imported as a library for easy use in any Sketchup file. Choose Save library as... from
and select an appropriate location on your disk and a name to save it
under. The new library will appear under the drop-down menu on the
Components window under Favourites.
You can also open a previously saved component library using Open an existing library... from
.
Re-importing
If
you make changes or additions to your Monsters.txt or image files, you
can re-run the importing process. When you do that, you will be asked
two questions. First, you will be asked whether to reload the images
files corresponding to previously-imported monster textures. If you
answer Yes, all the image files will be re-loaded; if you answer No, only newly-added image files will be loaded.
Unless you know that some of the existing ones have changed, it's better to answer No here, as re-loading all the images can take some time and put a fair bit of strain on Sketchup.
Second,
you will be asked whether to update previously-created component
instances. This should be fairly quick and painless, so answering Yes
here won't usually cause any harm. An exception would be if you have
made manual modifications to previously-imported component definitions
and don't want them wiped out. If you answer No, components will be created for newly-added monsters, but existing ones will be left alone.
Importing Items and Scenery
Importing
items (objects the player can pick up) and scenery is almost exactly
the same as importing monsters. You create a name file, called
something suitable such as Items.txt or Scenery.txt, and a corresponding Items or Scenery folder containing front and back images. All the same naming conventions apply. Then you use Import Items or Import Scenery to import them.
 | Due
to the aforementioned infinite-loop bug, breaking the scenery into
subsets is recommended. The five scenery collections provide a
convenient division for this purpose.
|
Relating
item and scenery numbers to shapes is a somewhat different process, as
it's not controlled by the physics file, but by tables built into the
game engine, plus MML modifications. The basic correspondences for
Marathon 2 and Infinity are listed in Appendix A. You will then have to take into account any changes specified by MML files being used.
Next we'll look at some things that be done
using parameters.
---