Next Previous Contents

7. TMObject Reference

The following is a reference for every object that can be placed in a .tmd file and will actually be useful to you. Each subsection is titled with the name of the object, followed by its fields, children, and lists.

Emphasized children indicate that this object expects only one element in that child, and will therefore choose the last added.

Emphasized fields indicate that the field takes a string, otherwise the field is numeric.

Descriptions enclosed in (internal: ) indicate that portion of the object is for internal use, or can be for internal use in some cases, but the object is not entirely internal. The explanations provided for internal descriptions are simply for completeness' sake; they are not likely to be useful for writing plugins or scenarios.

Any fields or children which were not introduced in v0.2 are marked as such.

7.1 action

Actions represent things that happen within the game universe as a result of something, usually a condition( reference) being met or a mission being accepted.

Fields

changeLongdesc

Changes the description of the mission.

changeTitle

Changes the title of the mission.

endMission

If non-zero, end the mission.

generated

(internal: whether or not this action was generated on the fly)

message

Display this message as a pop-up dialog for the player to read

money

Award the player this amount of money. Negative is fine if you're feeling vengeful.

setStage

Set the current stage to this number. For multi-stage missions, you must set this to some non-zero value when the mission is first given, as the onStage field of Condition only works with nonzero values. A zero value (the default) for this has no effect.

Children

giveCargo

Give these frozencargos( reference) to the player.

spawnFleet

Spawns the given fleets; only effective if the player is not on a planet. Note that if this fleet is going to be of importance to the mission (i.e. for a kill quest or an escort job) it must be unique to this mission and the player must only have one instance of this mission at a time.

takeCargo

Take these frozencargos away from the player. If the player doesn't have a given cargo, (or does but it's not marked as being mission related) the action is ignored.

This object has no lists.

7.2 addon

Addons represent things which can be bought in parts shops; these are either weapons, ammunition for weapons, or enhancements for ships.

Fields:

cost

The cost of this addon.

describe

The text that will be displayed in the "buy parts" dialog as the description of this addon.

hardpoints

The number of hardpoints required for this addon. Mainly for 'external' addons, like weapons or more cargo room, but not a more efficient engine.

mass

The amount of mass that this addon takes up.

max

For non-zero numbers, this is the most of this particular addon that a ship can have. An amount of zero means that there is no limit.

title

The text that will be displayed in the "buy parts" dialog as the name of this addon. Note that this can be different from the weapon's title, if this is a weapon addon.

type

What kind of addon this is. If type is set to 0, the program will expect a ship enhancement. If it's set to 1, a weapon or ammunition for a weapon will be expected.

Children:

item

The actual item which will be added on. For weapons and ammunition, this is the weapon/ammo object itself. For ship enhancements, this should be a ship object with its attributes modified toward whatever enhancement is desired. The ship being added on to will be 'added' to this ship - all the target's attributes will be changed by the addon's. For example, an addon which would raise the maximum fuel capacity of a ship by 100 would have a ship with its maxFuel field set to 100, and everything else set to zero.

This object has no lists.

7.3 cargo

This is used to specify a generic kind of cargo - for varying prices, a frozencargo( reference) is required.

Fields:

title

The name that appears in the 'trade goods' dialog.

baseprice

The base price of this cargo - how much, on average, it costs.

This object has no children or lists.

7.4 condition

This is used primarily within missions( reference) to lay out a set of conditions which must be met before an action will be taken, or a mission will be made available.

Fields:

afterDays

For non-zero values of this entry, more than this many days must have passed for the player since the mission was undertaken.

answeredYesTo

Player must answer 'yes' to the question in this field

freeCargo

The player must have at least this much free cargo space.

generated

(internal: Whether or not this condition was generated on the fly)

onStage

The mission must be on the given stage. Note that this only works for non-zero values.

randomChance

Just a probability between 0 and 1 (exclusive; since the default is 0, it's treated like a 1) Note that this chance may not be entirely accurate; missions can have their conditions checked more than once in certain conditions.

Children:

action

If all the conditions of this condition are met, perform the given actions( reference) - note this will only happen in the 'conditions' child of missions. Actions associated with prerequisites, for example, will not be taken.

neverHadTheseMissions

The player must have never undertaken any of the missions on this list.

notHaveTheseMissions

The player must not be currently undertaking any of the missions on this list.

playerAt

The player is at any of the given locations. Note that, if the player is on a planet, the location for the purposes of this condition is that planet and not the sector it's in.

spawnDead

All of the given fleets, presumably spawned by an earlier action, must have then been destroyed or driven off.

This object has no lists.

7.5 fleet

This is used to provide a generic grouping of a number of ships, as well as to give them behaviors

Fields:

followPlayer

When the player jumps out, there's this much a chance that this fleet will follow.

greeting

Upon being hailed, this is the message which will first appear.

type

The type of fleet. Current types are:

0: Trading:

Jumps in, goes to a planet, stops for a bit, then leaves

1: Patrol:

Jumps in, wanders about aimlessly. These never jump out.

2: Wandering Patrol:

Jumps in, wanders about for a while, jumps out. The duration of its stay is determined by the min/maxStay fields.

maxStay

For wandering patrols, the maximum amount of time that the fleet will stay in the sector

minStay

For wandering patrols, the minimum amount of time that the fleet will stay in the sector

reaction

The reaction of this fleet to being attacked. Valid reactions are:

0: Ignore:

Just go on about our business.

1: Run away:

Accelerate as fast as we can, begin jumping out.

2: Shoot back sometimes:

If our owner's feelings toward the attacker are <0, we'll attack.

3: Shoot back always:

Attack!

Children:

followSectors

If this fleet follows the player, it will only follow if the sector the player is going into is on this list. If the list is empty, however, there are no restrictions on where the fleet will go.

mission

(internal: If this fleet is currently in use by a mission, this will point to it.)

ships

This child holds the ships in the fleet. Note that these should be frozenships( reference)- regular ships are not used because frozenships can hold cargo (which may at some point be capturable), weapons (with which the ships can fight back), or generic addons to provide variety.

owner

The organization ( reference) to which this fleet belongs. This is who will get angry at you if you shoot at this fleet.

This object has no lists.

7.6 frozencargo

A frozencargo is a specific instance of cargo - i.e. one for sale on a specific planet or one on board your ship.

Fields:

price

This is the change to the base price that this specific cargo should be. -50 would mean that the cargo is selling for 50 less than the base price, while 50 would mean 50 credits more. (internal:In saved games, this price is the average price that the player purchased the cargo for)

amount

This indicates how much of this cargo the ship assigned to it has. Only useful if this object is getting assigned to a ship.

missionRelated

This indicates that this cargo is mission related. Players can't sell mission related cargo, nor does the price matter. Set to 1 for cargo you're using on missions.

Children:

parent

The cargo( reference) that this is an instance of.

This object has no lists.

7.7 frozenship

A frozenship is a specific instance of a ship. This is mostly internal, but is used by planet( reference), gamestate( reference), and fleet( reference).

Fields:

angle

(internal: The current angle of the ship, where 0 = directly up)

boarded

(internal: whether or not this ship has been boarded before)

comp

(internal: current computer integrity)

cost

The amount that this ship costs. Required for planet usage.

engines

(internal: current engine integrity)

fuel

The amount of fuel aboard this ship. Required for gamestate and planet usage; be sure to gas ships up before giving them to the player!

hull

(internal: The current hull integrity)

nav

(internal: current navigation integrity)

shields

(internal: The current shield level.)

speedx

(internal: The current speed of the ship along the X-axis)

speedy

(internal: The current speed of the ship along the Y-axis)

title

The name that will be displayed in the user's targeting box when this ship is targeted. This is the only required field for fleet( reference) usage.

weap

(internal: current weapons integrity)

x

The current x-location of the ship. Required for gamestate usage; the initial location of the player.

y

The current y-location of the ship. Required for gamestate usage; the initial location of the player

Children:

ship

The kind of ship( reference) that this frozenship is an instance of.

cargo

Any cargo that the ship is carrying. Note that these are frozencargo( reference)s, so be sure to set the amount and price of anything you put here.

addons

Any addons ( reference) this ship has.

parentfleet

(internal: The fleet that this ship belongs to)

This object has no lists.

7.8 gamestate

The gamestate object is bootstrapping information for the entire system. There should only be one; it indicates where the game should begin (internal: In saved games, it indicates where the player left off - most these entries are applicable to saved games as well).

Fields:

day

The current day upon the start of the game.

pilot

(internal: The name of the player.)

money

The amount of money the player has.

Children:

activeship

The player's ship; a frozenship( reference).

cursector

The sector( reference) that the player is in.

frozenships

(internal: Every other ship in the player's sector)

hud

A hudstates( reference) object indicating the default HUD configuration.

map

The map( reference) of the universe that we'll be using.

missions

(internal: The player's current missions( reference))

options

(internal: The player's chosen options( reference))

orgs

Every organization( reference) in the game.

playerOrg

Which of those organizations is the one the player belongs to

This object has no lists.

7.9 hudstates

These are used on startup and internally in saved games to keep track of the status of the various HUD boxes.

Fields:

console

Whether or not the console is visible

navbox

Whether or not the navigation box is visible.

radar

Whether or not the radar is visible

status

Whether or not the status box is visible

target

Whether or not targeting information is visible.

systems

Whether or not system (engines, weapons, nav, etc.) information is displayed in the status box. Unlike the other settings, this is not changeable by the player, and is in place for backwards compatability and any scenario which either does not want to deal with systems or likes to keep the player guessing. [New in 0.9]

This object has no children or lists.

7.10 image

This is a bitmapped image.

Fields:

filename

The filename of this image. Note that this is not the path; TraderMissions will search along the paths given in the options for the filename, and use the last one it finds. The image itself can be in any format that the SDL_Image library supports. Any magenta (R: 255, G: 0, B: 255) pixels will be regarded as transparent.

This object has no children or lists.

7.11 map

This indicates every sector in the universe. Not every sector defined must be in this list, but every sector you want the player to be able to reach should be.

Fields:

cacheValid

(internal: Because the game doesn't require you to set a planet's ( reference) "parent" child, it must generate it itself. Since, in future versions of the TM engine, a planet's parent may change, this flag is set to indicate that the parents are still valid. Any actions which change a planet's parent should reset this flag.) If you are setting the 'parent' child of the sectors yourself, set this field to '1'.

Children:

sectors

Every sector the game knows about. If you put a sector in another sector's 'links' child, but not in this list, strange things will happen. Try it out!

This object has no fields or lists.

7.12 mission

Missions are half of what makes up TraderMissions. They represent tasks for the player to undertake, whether voluntary or not. (Note: due to the way that actions are processed, any list of actions that includes an 'end mission' action will be completely processed regardless of whether other actions follow the 'end mission' action or not)

A mission, when created, goes through a step called 'solidification'. During this step, any randomization required is done, and the longdesc and title fields go through substitution processes. Tags that will be substituted are as follows:

^AMOUNT

The amount of random cargo.

^CARGONAME

The name of the cargo chosen.

^DESTINATION

The destination chosen at random

^DAYS

The number of days the player has to complete the random destination mission

Note that substitutions will not take place for inappropriate tags. For instance, if the mission has a random destination but not random cargo, ^AMOUNT will remain untouched.

Fields:

assigned

(internal: The day on which this mission was assigned)

longdesc

A longer description of this mission. Shown in the same places as the title, but with more detail.

randomCargoMin

Minimum amount of cargo to assign for this mission. Note that an amount of zero for this field indicates that this mission does not have random cargo

randomCargoMax

The maximum amount of cargo to assign for this mission. If you want a fixed amount of cargo, set this to a number less than or equal to randomCargoMin.

randomJumpsMin

Minumum number of jumps that any random destination mission must include. Zero is perfectly fine, if you don't care that you might get missions to the same planet you're on. Just ensure that this isn't so restrictive that no locations match the criteria, otherwise the game will freeze up.

randomTimePadding

If non-zero, this indicates that the random destination mission also has a time limit on it. The amount of time allowed will be sectors*(shipDaysPerSector+randomTimePadding)

stage

(internal: What stage the mission is on)

taken

(internal: Whether or not this mission has ever been taken)

title

A short description of this mission. It will be displayed on the mission job board and the 'missions' panel of the information dialog.

Children:

conditions

Conditions that will be checked as the mission goes on. Currently checked upon entry to a sector and upon landing on a planet. If any are true, their associated actions are performed.

parent

(internal: When the player accepts a (non job-board) mission, or it is created for the job board, this mission is cloned. Some elements are filled in (i.e., if this is a random mission, values are generated) and it then becomes the player's responsibility. This child points to the original mission.)

preparation

The actions to take once the player accepts or is given the mission.

prereqs

The conditions that the player must satisfy before getting this mission

randomCargo

One of the items in this list will be chosen at random to be the cargo. If this is empty or randomCargoMin is less than or equal to zero, this is not a mission involving random cargo. Note that ordinary cargo( reference) objects should be used here, not frozencargo( reference).

randomDest

One of the locations in this list will be chosen at random to be the destination. If this is empty, this is not a mission with a random destination

spawned

(internal: Fleets created by actions are listed here, unless they're dead, in which case they're moved to the spawnsDead list)

spawnsDead

(internal: If an action creates a fleet, and that fleet is later destroyed (or jumps out), it will be added to this list.)

sponsors

The organization(s) which are sponsoring this mission.

timeoutAction

An action( reference) to take place if a random destination mission times out.

This object has no lists.

7.13 organization

An organization is like a government, corporation, or the player. Essentially, it's anything that you want to be able to own ships and sectors.

Fields:

friendlyFireMult

hitPenalty is multiplied by this if our attitude toward the attacker is positive. This is to prevent accidental fire from ruining attitudes.

fuelCutoff

If this organization's feelings toward you are below this cutoff, they will not give you fuel if you ask.

gullability

When an allied/enemy organization reports that it is changing its feelings toward another organization, this is the extent to which we change our feelings toward the other organization.

helpCutoff

If this organization's feelings toward you are below this cutoff, they won't help you if you're under attack.

heroCutoff

If this organization's feelings toward you are above this cutoff, they'll help you when you ask even if they're currently busy.

hitPenalty

If a ship we own has been hit by a weapon, this is the base amount by which our attitude toward that weapon's owner goes down.

hostile

If our attitude toward another organization is below this threshold, and we spot one of their ships in the same sector as us, we react as though we've been shot at.

okFuelMsg

The message to display when we've agreed to give the player fuel.

okHelpMsg

The message to display when we've agreed to help the poor besieged player

planetCutoff

If this organization's feelings toward you are below this cutoff, they'll ban you from landing on their planets.

rejectMsg

The message to display when a ship of this organization rejects the player's plea for help/fuel/whatever

villainCutoff

If this organization's feelings toward you are below this cutoff, they won't even answer your hails.

title

The name of this organization as it will appear to the player.

Children

allies

Those organizations considered by this organization to be its allies. Friendly fire by allied organizations is ignored for reputation purposes. Any event which raises an organization's standing with this organization will also raise its standing with its allies. The same holds for events which lower attitude.

enemies

Those organizations considered to be enemies of this organization. Essentially the opposite of allies; any event which raises an organization's standing with this one will lower its standing with its enemies.

Lists:
attitudes

Our attitude toward every other organization. This list must be as long and in the same order as the list of organizations in gamestate( reference)

7.14 planet

Planets are landable objects within a sector.

Fields:

describe

A more verbose description of the planet

title

The name of this planet as it appears when you land on it.

x

The x-location of this planet within a sector.

y

The y-locatio of this planet within a sector

landdist

The minimum distance you must be from this planet to land upon it.

noRefuel

If non-zero, this planet cannot refuel the player. [New in 0.9]

Children:

image

The image ( reference) representing the planet.

missions

Missions( reference) possibly available on the job board for this planet. 'Job board' button will appear if this is non-empty, even if player is not qualified for any of the missions.

parent

(internal: The sector( reference) that this planet is in. This is generated on the fly whenever it's needed.) You do not need to set this, but you can if you want missions that have random destinations to be processed faster.

port

frozencargo( reference) for sale on this planet.

shipyard

frozenships( reference) available for sale.

special

These are Missions that do not appear on the job board for this planet, but which are automatically given to the player provided the prerequisites are met.

terrain

An optional image that will be shown in the background of the planet upon landing. [New in 0.9.0]

upgrades

addons( reference) available on this planet.

This object has no lists.

7.15 sector

A sector is the basic area of space. Sectors can have zero or more planets within them, and can also have links to other sectors.

Fields:

busyness

Every second, there this chance that we'll re-examine the fleets child and possibly choose another to jump in.

description

Detailed information about the sector, will be shown alongside the map when this sector is selected.

mapx

The x-location of this sector on the map

mapy

The y-location of this sector on the map

title

The name of this sector, as shown on the map and navigation HUD.

visited

(internal: Whether or not this sector has been visited.) Set to 1.0 for sectors you want visible on the map (i.e. not labeled as "Unknown") upon the start of the game. The sector the game starts in will automatically be made visble.

Children:

fleets

Every possible fleet( reference) that can be in this sector. Their chances of appearing are defined in the 'fleetChance' list.

links

Other sectors that the player can jump to from this one

owner

The organization( reference) that owns this sector.

planets

planets( reference) in this sector.

special

These are missions( reference) which will automatically be given to the player upon arrival in the sector (either from another sector, or from a planet), provided the conditions are met.

Lists:

fleetChance

When the sector is first created, and every second thereafter, the game checks this list to see what, if anything, should jump into the sector. Each child of 'fleets' has a corresponding entry in the fleetChance list (therefore, they should be in the same order) which is the chance that it will jump in. The only caveat is for chances of exactly 1.0 -- the fleet will be in the sector at the beginning, but no more will ever jump in. This is useful for patrolling-type fleets, which never jump out.

7.16 ship

Ships are those things you fly around in space.

Fields:

acceleration

The acceleration of this ship, in pixels per second squared.

angular

The number of degrees this ship can turn in one second

cargospace

The maximum units of cargo that this ship can hold.

hardpoints

The number of hardpoints on this ship.

jumpdist

The distance (in pixels) that the ship will arrive from the center of the destination sector's center.

jumptime

The amount of time (in seconds) that the player must hold down the 'jump' key in order to jump.

mass

The amount of mass this ship has for addons.

maxComp

Integrity of computer systems. If zero, targeting and HUD is disabled when shields are disabled. [New in 0.9]

maxEngines

Engine shielding integrity. If zero, engines are disabled when shields are disabled [New in 0.9]

maxfuel

The maximum amount of fuel that this ship can carry. One jump requires 100 fuel.

maxHull

Hull integrity of the ship. If zero, the ship is destroyed when shields are diabled.[New in 0.9]

maxNav

Integrity of navigation system. If zero, ability to jump is disabled when shields are disabled [New in 0.9]

maxrof

This is the delay between the firing of each primary weapon. (To prevent them from clumping up on the screen when fired, there is a small delay)

maxspeed

The maximum speed, in pixels/second, that this ship can attain.

maxWeap

Weapons system integrity. If zero, weapons are disabled when shields are disabled. [New in 0.9]

regen

The amount of shielding that this ship will regenerate in one second.

shields

The maximum amount of shielding on this ship.

title

The name of this type of ship.

traveltime

The number of days that a jump in this vessel will increment the global "current day" counter by.

Children:

image

A specially-formatted image( reference). The image is six times the ship's width by six times the ship's height. In each shipWidth x shipHeight 'cell', there is an image of the ship at a certain angle (where the angle is increased 10 degrees for each cell, starting with 0 degrees in the upper left, 50 in the upper right, and 350 in the lower right).

This object has no lists.

7.17 test

The test object was created to test the parser and repository. It is included in this reference for practice purposes; those unfamiliar with writing TMD code can use test objects with no worries.

Fields:

test

A string.

number

A numeric field.

Children:

dummychild1

A child.

dummychild2

And its brother.

Lists:

listtest

A list.

7.18 weapon

A weapon is used to shoot at other ships. If this is a secondary weapon with ammo, the only required portions are the primary, isAmmo, rof, and title fields. If this is ammo, fill out everything as normal except for rof and title

Fields:

acceleration

If a seeking weapon, the amount of acceleration it has, in pixels per second squared.

angular

The number of degrees this weapon can turn in one second

damage

The amount of damage this weapon does upon impact.

isAmmo

Whether or not this is ammunition for a weapon.

primary

Whether or not this is a primary weapon. Primary weapons are fired all at once (more or less) while secondary weapons must be selected and can only be fired one at a time. Secondary weapons may also have ammunition. If this is ammunition for a secondary weapon, it counts as a secondary weapon.

rof

The rate of fire of this weapon; the minimum number of seconds between shots.

seeking

One of the following flags:

0:

The weapon does not seek. (it's a 'dumbfire' weapon)

1:

The weapon will seek in the same manner that ships do (i.e. has to turn, accelerate, etc)

title

The title of this weapon. If this is a secondary weapon, this is the name that will appear on the HUD. Otherwise, this name will not be used.

turreted

Whether or not this is a 'turreted' weapon - turreted weapons start aimed at their target.

topspeed

The top speed of this weapon - Note that non-seeking (and some seeking) weapons always travel at their top speed.

ttl

The time-to-live of this weapon; the number of seconds after it is fired that it will vanish.

Children:

ammo

The ammunition that this weapon requires, if any. Only secondary weapons may require ammunition.

image

The image( reference) of the projectile that this weapon shoots. It is in the same format as the ship( reference) image.

This object has no lists.


Next Previous Contents