Transcendence Wiki

Documenting the Universe.

User Tools

Site Tools


modding:xml:spaceobject

Summary

  • <StationType> or <ShipClass>
    • Zero or one <DockingPorts>. Can use either maxDist + portAngle + portCount + portRadius or x + y
      • bringToFront=
        • “true”
      • sendToBack=
        • “true”
      • maxDist=
      • portAngle=
      • portCount= Number of ports
      • portRadius= Distance (in pixels) from the center of the object's image
      • rotation=
      • x= Horizontal offset (in pixels) from the center of the object's image. Positive values move the port right.
      • y= Vertical offset (in pixels) from the center of the object's image. Positive values move the port down.
    • Zero or one <Trade>
      • currency=
        • “credit”
      • creditConversion= Percentage
      • max=
      • replenish=
      • <AcceptDonation>
        • criteria=
        • priceAdj= Percentage adjustment
        • actualPrice=
          • “true”
      • Zero or more <Buy>. Station buys items
        • criteria=
        • priceAdj=
          • “variable”
          • “constant:{price}”
          • “unavailable”
      • Zero or more <Sell>. Station sells items
        • criteria=
        • inventoryAdj=
        • levelFrequency=
        • priceAdj=
        • noDescription=
      • <Refuel>
        • criteria=
        • priceAdj=
      • <RepairArmor>
        • criteria=
        • priceAdj=
      • <ReplaceArmor>
        • criteria=
        • priceAdj=
        • messageID=
      • <InstallDevice>
        • upgradeInstallOnly
        • messageID=
      • <UpgradeDevice>
      • <RemoveDevice>
        • upgradeInstallOnly
      • <EnhanceItem>
      • <RepairItem>
      • <BuyShip>
      • <SellShip>
      • <Custom>
    • <Events>
      • <CanDockAsPlayer>
        • gSource
        • aDockTarget
        • Return:
          • True
          • Nil
      • <CanInstallItem>
        • gSource
        • gItem
        • aArmorSeg
        • Return
          • True
          • Nil
      • <GetDockScreen>
        • gSource
        • Return
          • (list UNID Data Priority)
          • (list UNID Priority)
          • (list UNID)
      • <GetExplosionType>
        • gSource
        • Return
          • Nil
          • UNID
          • (UNID bonus cause)
      • <GetPlayerPriceAdj>
        • gSource
        • gItem
        • aObj
        • aService 1)
          • “(serviceNone)”
          • “priceOfferedToPlayer”
          • “priceForPlayerToBuy”
          • “valueOfDonation”
          • “priceToRefuel”
          • “priceToRepairArmor”
          • “priceToReplaceArmor”
          • “priceToInstallDevice”
          • “priceToRemoveDevice”
          • “priceToUpgradeDevice”
          • “priceToEnhanceItem”
          • “priceToRepairItem”
          • “customPrice”
          • “priceOfShipOffered”
          • “priceOfShipForSale”
          • “unknown”
        • aProviderObj
        • gData
        • Return
          • Nil
          • Integer
      • <OnAttacked>
        • gSource
        • aArmorSeg
        • aCause
        • aAttacker
        • aOrderGiver
        • aHitPos
        • aHitDir
        • aDamageHP
        • aDamageType
        • aWeaponType
      • <OnAttackedByPlayer>
        • gPlayerShip
      • <OnCreate>
        • gSource
        • gData
        • aBaseObj
        • aOwnerObj
        • aTargetobj
        • aOrbit
      • <OnCreateOrders>
        • gSource
        • aBaseObj
        • aTargetObj
      • <OnDamage>
        • gSource
        • aArmorSeg
        • aCause
        • aAttacker
        • aOrderGiver
        • aHitPos
        • aHitDir
        • aDamageHP
        • aDamageType
        • aWeaponType
        • Return
          • Integer: Amount of damage to take
      • <OnDataTransfer>
      • <OnDeselected>
        • gSource
        • aPlayer
      • <OnDestroy>
        • gSource
        • aDestroyer
        • aOrderGiver
        • aWreckObj
        • aDestroyReason
      • <OnDockObjAdj>
        • gSource
        • Return
          • Object
          • Nil
      • <OnEnteredGate>
        • gSource
        • aGateObj
        • aDestNodeID
        • aDestEntryPoint
      • <OnEnteredSystem>
        • gSource
        • aGateObj
      • <OnLoad>
        • gSource
        • aVersion
      • <OnMining>
        • gSource
        • aMiner
        • aMinePos
        • aMineDir
        • aMineProbability
        • aHP
        • aDamageType
        • aWeaponType
      • <OnObjBlacklistedPlayer>
        • gSource
        • aObj
      • vOnObjDestroyed>
        • gSource
        • aObjDestroyed
        • aDestroyer
        • aOrderGiver
        • aWreckObj
        • aDestroyReason
      • <OnObjDocked>
        • gSource
        • aObjDocked
        • aDockTarget
      • <OnObjEnteredGate>
        • gSource
        • aObj
        • aGateObj
        • aDestNodeID
        • aDestEntryPoint
      • <OnObjGate>
        • gSource
        • aObj
      • <OnObjJumped>
        • gSource
        • aObj
      • <OnObjJumpPosAdj>
        • gSource
        • aObj
        • aJumpPos
        • Return
          • Position Vector
          • Nil
      • <OnObjReconned>
        • gSource
        • aObj
      • <OnOrderChanged>
        • gSource
      • <OnOrdersCompleted>
        • gSource
      • <OnEventHandlerInit>
      • <OnMissionAccepted>
        • gSource
        • aMissionObj
      • <OnMissionCompleted>
        • gSource
        • aMissionObj
        • aReason
      • <OnPlayerBlacklisted>
        • gSource
      • <OnPlayerEnteredShip>
        • gSource
        • aOldShip
      • <OnPlayerEnteredSystem>
        • gSource
        • Return
          • “followPlayer”
          • “waitForPlayer”
          • Nil
      • <OnPlayerLeftShip>
        • gSource
        • aNewShip
      • <OnPlayerLeftSystem>
        • gSource
        • aGateObj
        • aDestNodeID
        • aDestEntryPoint
        • Return
          • “followPlayer”
          • “waitForPlayer”
          • Nil
      • <OnRandomEncounter>. Not defined. Inherited from DesignType
      • <OnSelected>
        • gSource
        • aPlayer
      • <OnSubordinateAttacked>
        • gSource
        • aObjAttacked
        • aArmorSeg
        • aCause
        • aAttacker
        • aOrderGiver
        • aHitPos
        • aHitDir
        • aDamageHP
        • aDamageType
        • aWeaponType
        • Return
          • True
          • Nil
      • <OnSystemExplosion>
        • gSource
        • aExplosionObj
        • aExplosionUNID
        • aExplosionPos
      • <OnSystemObjAttacked>
        • gSource
        • aObjAttacked
        • aArmorSeg
        • aCause
        • aAttacker
        • aOrderGiver
        • aHitPos
        • aHitDir
        • aDamageHP
        • aDamageType
        • aWeaponType
      • <OnSystemObjDestroyed>
        • gSource
        • aObjDestroyed
        • aDestroyer
        • aOrderGiver
        • aWreckObj
        • aDestroyReason
      • <OnSystemWeaponFire>
        • gSource
        • aFireRepeat
        • aShotObj
        • aWeaponObj
        • aWeaponUNID
        • aWeaponPos
        • aWeaponType
      • <OnTranslateMessage>
        • gSource
        • aMessage
        • Return
          • String
          • Nil
      • <OnUpdate>
        • gSource
  • Note: A stargate with the attribute “uncharted” will cause objGetNearestStargate to ignore it.

Inherits DesignType attributes and elements

Fields

  • descID
  • canInstall
  • canRemove
  • objID
  • pos
  • price
  • status
  • upgradeInstallOnly

Inherits DesignType fields

Properties

  • ascended: If true, then this object is inactive and can be descended into the current system
  • category
    • “beam”
    • “effect”
    • “marker”
    • “missile”
    • “ship”
    • “station”
  • commsKey: If this object appears in the player's Communications menu, this attribute is the key that the player presses to select this object.
  • currency: The UNID of the <EconomyType> that represents the currency used by this station
  • cyberDefenseLevel
  • damaged
  • dockingPorts: Returns a list of structs, each with the following fields
    • objID: The ID of the object currently occupying the port, if any
    • pos: The position vector of the docking port
    • status: Whether the port is occupied by an object or not
      • “inUse”
      • “empty”
  • enabled
  • hasDockingPorts
  • hp
  • id: Also returned by (objGetID object)
  • installArmorMaxLevel
  • installDeviceMaxLevel
  • installDevicePrice
  • installDeviceStatus
  • installItemStatus
  • known: If this attribute is true and this object has a map label, then the object shows up in the System Map
  • level
  • mass
  • paintLayer
  • playerMissionsGiven
  • refuelMaxLevel
  • removeDevicePrice
  • removeDeviceMaxLevel
  • removeItemStatus
  • repairArmorMaxLevel
  • scale
    • “star”
    • “world”
    • “station”
    • “ship”
    • “flotsam”
  • underAttack: True if there is at least one enemy object that with this object as its target

Inherits DesignType properties

Overview

A SpaceObject is a meta-DesignType. You can't make something that is just a SpaceObject, but all ShipClasses and StationTypes are considered SpaceObjects for various funtions and other similarities.

Criteria

These codes are used in various functions that need to check for or list spaceobjects.

Criteria is here as of 1.7a

G         Stargates only
G:xyz;    Stargate with ID 'xyz'
s         Include ships
t         Include stations (including planets)
T         Include structure-scale stations
T:xyz;    Include stations with attribute 'xyz'
A         Active objects only (i.e., objects that can attack)
B:xyz;    Only objects with attribute 'xyz'
D:xyz;    Only objects with data 'xyz'
E         Enemy objects only
F         Friendly objects only
H         Only objects whose base = source
M         Manufactured objects only (i.e., no planets or asteroids)
N         Return only the nearest object to the source
N:nn;     Return only objects within nn light-seconds
NN:nn;    Return only nearest object if it's within nn light seconds (just combination of two above codes)
O:abc;    Ships whose order is abc [docked, patrol, escort etc...]
P         only objects visible to source
J         only objects from a given sovereign
K         only objects that cannot attack
R         Return only the farthest object to the source
R:nn;     Return only objects greater than nn light-seconds away
V         Include Virtual objects
Z         Exclude player
z         Only include player
b         Beam Objects
m         Missile Objects
X         Objects targeting Source
S:d       returns objects sorted by distance (in ascending order)
S:D       returns objects sorted by distance (in descending order)
I:angle   returns only objects that intersect a line from the source at the given angle
+xyz;     Include objects with the attribute xyz
-xyz;     Exclude objects with the attribute xyz
+isPlayerClass:true/false    Filter based on presence of PlayerSettings in object's type, ships only.
+data:attribute              Return objects for which (objGetData theObject 'attribute) would return a non-Nil value
-data:attribute              Return objects for which (objGetData theObject 'attribute) would return a Nil
+isPlanet:true               Return planets
-isPlanet:true               Exclude planets
+property:xyz                Return objects for which (objGetProperty theObject 'xyz) returns a non-Nil value
-property:xyz                Return objects for which (objGetProperty theObject 'xyz) returns Nil
+unid:UNID                   Return objects of type UNID. 
-unid:UNID                   Excludes objects of type UNID

Note: Virtual stations are not searched by default through t; therefore you should use V as well if searching for a virtual station.

Functions

Functions starting with 'obj' work on any SpaceObject. Due to the generic nature of SpaceObjects this is likely the largest set of functions in tScript.

Events

SpaceObjects also take the lion's share of event definitions in the game.

<CanDockAsPlayer>

<GetDockScreen>

Identical format to getglobaldockscreen

<OnAttacked>

<OnAttackedByPlayer>

<OnCreate>

For systems, stations, ships, at object creation.

<OnCreateOrders>

<OnDamage>

Populated variables:

  • gSource: station object
  • aAttacker: object that attacked
  • aHitPos: vector position of hit
  • aHitDir: angle direction from which hit came
  • aDamageHP: hit points of damage
  • aDamageType: type of damage

This event is called when an object is hit by a weapon. The event must return the number of hit points of damage to do to the object. For example, imagine an object that takes half damage from the player (but full damage from all others). The event could check aAttacker and return half of aDamageHP if it is the player and full aDamageHP otherwise.

The event should avoid affecting other objects and should not destroy the station (e.g., by calling objDestroy). If necessary, the event could return a very large number to insure that the station is destroyed. (why is this. Does anyone know)

<OnDestroy>

Populated variables:

  • gSource: ship object
  • aDestroyer: object that caused destruction
  • aWreckObj: ship wreck left behind

The <OnDestroy> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.

<OnDockObjAdj>

<OnEnteredGate>

Populated variables:

  • gSource: station object
  • aGateObj: gate object
  • aGateObj: The gate that was entered (1.07)
  • aDestNodeID: The destination node (1.07)
  • aDestEntryPoint: The destination entry point label (1.07)

Version 0.99 uses aGateObj instead of aGate (as in previous versions) to be consistent with <OnObjEnteredGate>.

<OnEnteredSystem>

<OnEventHandlerInit>

<OnLoad>

<OnMining>

For asteroids.

<OnOrderChanged>

<OnOrdersCompleted>

<OnPlayerEnteredSystem>

<OnPlayerLeftSystem>

<OnRandomEncounter>

Todo: check both this and designtype version and find difference?

<OnTranslateMessage>

Registered SpaceObject Events

All <OnObj*> events let an object know that something happenned to another object to which events it has previously registered.

After calling (objRegisterForEvents receiver object), receiver gets these events for object. Both must be live spaceObjects

<OnObjDestroyed>

Populated variables:

  • aObjDestroyed: the object that was destroyed.
  • aDestroyer: the object that caused the destruction.
  • aOrderGiver: the object that controls aDestroyer (in case aDestroyer is an auton or something).
  • aDestroyReason: One of: (damage, runningOutOfFuel, radiationPoisoning, self, disintegration, weaponMalfunction, ejecta, explosion, shatter, playerCreatedExplosion, enteredStargate, custom).
  • aWreckObj: the wreck left behind the destroyed object.
  • gSource: the object that holds the event.

Is triggerred when an object A has registered for object B events and object B is destroyed. <OnDestroy> is fired on object B, and <OnObjDestroyed> is fired on object A.

0.99c: the <OnObjDestroyed> event now includes the aWreckObj parameter that allows you to access the wreck left behind by a ship. This parameter is sometimes Nil if the ship left no wreck.

See example on earth slaver.

<OnObjDocked>

Populated variables:

  • aObjdocked: the ship that initiated docking.
  • aDockTarget: the object that was docked with.
  • gSource: the object that holds the event.

This was primarily used before <OnOrdersCompleted>.

<OnObjEnteredGate>

Populated variables:

  • aObj: the ship that used the gate.
  • gSource: the object that holds the event.
  • aGateObj: The gate that was entered (1.07)
  • aDestNodeID: The destination node (1.07)
  • aDestEntryPoint: The destination entry point label (1.07)

<OnObjJumped>

Populated variables:

  • aObj: the ship that jumped.
  • gSource: the object that holds the event.
  • (return): ignored

<OnObjJumpPosAdj>

Populated variables:

  • aObj: the ship that jumped.
  • gSource: the object that holds the event.
  • (return): if a vector is returned, change aObj's position to it

Appears to be used to prevent the player from bypassing the heretic quarentine with a jumpdrive.

<OnObjReconned>

Populated variables:

  • aObj: the object that was reconned by the player.
  • gSource: the object that holds the event.

Registered System Events

George's Explination

First, you need to call:

(objRegisterForSystemEvents obj distance)

obj is the object that you want to receive OnSystemWeaponFire distance is the radius (in light-seconds) of the area (centered on obj) that you want to watch for events.

You will then get called at OnSystemWeaponFire whenever a ship or a station fires a weapon (I believe it will also include calls to sysCreateWeaponFire, but only if objSource is not Nil). The parameters to OnSystemWeaponFire are:

aWeaponObj is the object that fired the weapon. aWeaponUNID is the UNID of the weapon being fired. aWeaponPos is the position where the shot originated.

You will also get called at OnSystemExplosion if there are any ships that explode. The parameters are:

aExplosionObj is the ship that exploded. aExplosionUNID is the UNID of the explosion (look in StdExplosions.xml). aExplosionPos is the position of the explosion.

<OnSystemExplosion>

events called at any ships that explode. The parameters are: Populated variables:

  • aExplosionObj is the ship that exploded.
  • aExplosionUNID is the UNID of the explosion (look in StdExplosions.xml).
  • aExplosionPos is the position of the explosion.

<OnSystemObjAttacked>

(New in 1.07)
Populated variables:

  • gSource : the object getting the event
  • aObjAttacked : the object that was attacked
  • aCause : the missile object that hit
  • aAttacker : the object that fired the missile
  • aOrderGiver : the object that ordered the missile to be fired (e.g., if aAttacker is an auton)
  • aHitPos : where it hit
  • aHitDir : the direction from which the hit came
  • aDamageHP : damage hit points
  • aDamageType : damage type
  • aWeaponType : unid of the weapon used

<OnSystemObjDestroyed>

(New in 1.07)
Populated variables:

  • gSource : the object receiving the event
  • aObjDestroyed : the object that was destroyed
  • aDestroyer : the object that fired the missile that destroyed
  • aOrderGiver : the object that ordered the missile to be fired.
  • aWreckObj : the resulting wreck (if any)
  • aDestroyReason : the cause of the destruction (damage, disintegration, etc.)

<OnSystemWeaponFire>

You will then get called at OnSystemWeaponFire whenever a ship or a station fires a weapon (I believe it will also include calls to sysCreateWeaponFire, but only if objSource is not Nil). The parameters to OnSystemWeaponFire are:

Populated variables:

  • aWeaponObj: is the object that fired the weapon.
  • aWeaponUNID: is the UNID of the weapon being fired.
  • aWeaponPos: is the position where the shot originated.
1)
CTradingDesc.cpp, 43
modding/xml/spaceobject.txt · Last modified: 2017/03/08 04:10 by 0xabcdef