Inherits DesignType attributes and elements
Inherits DesignType fields
Inherits DesignType properties
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.
These codes are used in various functions that need to check for or list spaceobjects.
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 starting with 'obj' work on any SpaceObject. Due to the generic nature of SpaceObjects this is likely the largest set of functions in tScript.
SpaceObjects also take the lion's share of event definitions in the game.
Identical format to getglobaldockscreen
For systems, stations, ships, at object creation.
Populated variables:
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)
Populated variables:
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.
Populated variables:
Version 0.99 uses aGateObj instead of aGate (as in previous versions) to be consistent with <OnObjEnteredGate>.
For asteroids.
Todo: check both this and designtype version and find difference?
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
Populated variables:
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.
Populated variables:
This was primarily used before <OnOrdersCompleted>.
Populated variables:
Populated variables:
Populated variables:
Appears to be used to prevent the player from bypassing the heretic quarentine with a jumpdrive.
Populated variables:
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.
events called at any ships that explode. The parameters are: Populated variables:
(New in 1.07)
Populated variables:
(New in 1.07)
Populated variables:
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: