Apart from standard data types like string (string), integer (int), boolean (bool) and floating point (float) there are some Warzone 2100-specific data types available:
!Data type !Meaning
|INTMESSAGE |Simple. Name of a message as defined in Messages.txt, used mostly for campaign. In most cases it is easier to use a string instead.
|BASEOBJ |Complex. Any of a DROID, FEATURE or STRUCTURE. It is a pointer to some droid/feature/structure on the map, can be NULLOBJECT if it was not assigned to a particular droid/feature/structure. You have access to the following variables:
- baseobj.x
- baseobj.y
- baseobj.z
- baseobj.id - unique ID number
- baseobj.player - player ID
- baseobj.type - one of OBJ_DROID, OBJ_STRUCTURE, OBJ_FEATURE
- baseobj.health - %age number of body points left
- baseobj.clusterID - the cluster the object is a member of
- baseobj.target - target of the object (in case of a multi-turret object returns target of the default weapon)
|DROID |Complex. Defined by the ID got from the world editor. It is a pointer to a particular droid on the map, can be NULLOBJECT when no droid is assigned to the DROID variable. You have access to following variables:
- droid.x
- droid.y
- droid.z
- droid.id - unique ID number
- droid.player - player ID
- droid.type - one of OBJ_DROID, OBJ_STRUCTURE, OBJ_FEATURE
- droid.health - %age number of body points left
- droid.clusterID - the cluster the object is a member of
- droid.target - target of the object (in case of a multi-turret object returns target of the default weapon)
- droid.order - current order of the droid
- droid.orderx - target location of the droid order
- droid.ordery - target location of the droid order
- droid.action - current action of the droid
- droid.body - the BODY of the droid
- droid.propulsion - the PROPULSION of the droid
- droid.weapon - the WEAPON of the droid DROIDID - (simple) literally just an Id of a droid
- droid.selected - holds TRUE if droid is currently selected
- droid.group - the GROUP droid belongs to
|FEATURE |Complex. Defined by the ID got from the world editor. It is a pointer to a map decoration, like a tree, wrecked building, oil resource etc, can be NULLOBJECT. You have access to following variables:
- feature.x
- feature.y
- feature.z
- feature.id - unique ID number
- feature.player - player ID
- feature.type - one of OBJ_DROID, OBJ_STRUCTURE, OBJ_FEATURE
- feature.health - %age number of body points left
- feature.clusterID - the cluster the object is a member of
- feature.target - target of the object (in case of a multi-turret object returns target of the default weapon)
|FEATURESTAT |Simple. Type of a feature as defined in features.txt.
|TEMPLATE |Simple. Name of a template as defined in templates.txt.
|STRUCTURE |Complex. Defined by the ID got from the world editor. It is a pointer to a particular structure on the map, can be NULLOBJECT when no structure is assigned to the STRUCTURE variable. You have access to the foillowing variables:
- structure.x
- structure.y
- structure.z
- structure.id - unique ID number
- structure.player - player ID
- structure.type - one of OBJ_DROID, OBJ_STRUCTURE, OBJ_FEATURE
- structure.health - %age number of body points left
- structure.clusterID - the cluster the object is a member of
- structure.target - target of the object (in case of a multi-turret object returns target of the default weapon)
- structure.stat - the STRUCTURESTAT of the structure, defined in structures.txt
- structure.stattype - structure type (likeREF_HQ etc.; refers to Script function constants)
|STRUCTUREID |Simple. Literally just an ID of a struct.
|STRUCTURESTAT |Simple. Type of a structure as defined in structures.txt.
|BODY |Simple. Name of a body as defined in body.txt.
|PROPULSION |Simple. Name of a propulsion as defined in propulsion.txt.
|ECM |Simple. Name of an ECM as defined in ecm.txt.
|SENSOR |Simple. Name of a sensor as defined in sensor.txt.
|CONSTRUCT |Simple. Name of a construct as defined in construct.txt.
|WEAPON |Simple. Name of a weapon as defined in weapons.txt.
|REPAIR |Simple. Name of a repair type as defined in Repair.txt.
|BRAIN |Simple. Name of a brain type as defined in Brain.txt.
|SOUND |Simple. ID of sound used in playSound().
|LEVEL |Simple. ID of a level as defined in GameDesc.lev.
|RESEARCHSTAT |Simple. Name of a research topic as defined in research.txt.
|GROUP |Complex. A group of droids. Do not confuse GROUP with in-game units' groups that can be accessed with CTRL-<number>, they have nothing in common. GROUP is an internal structure used to simplify unit management. You have access to following variables:
- group.x - average x coord
- group.y - average y coord
- group.members - number of units in the group
- group.health - average %age health of the units
- group.type - type of the group, one of: GT_NORMAL, GT_COMMAND or GT_TRANSPORTER (refer to Script function constants)
- group.commander - commander of the group, if type == GT_COMMAND or NULLOBJECT
|}
Note: The functions objToDroid, objToStructure and objToFeature exist to convert a BASEOBJ to a droid, structure or feature if the base obj is of the right type.
Note: Transporters and commanders cannot be added to a GROUP.
With a complex object it is possible to access information specific to the instance of this object. Acomplex object is usually a pointer to a C structure in the code. For example a DROID is a complex object - its x, y, z can be queried whereas a DROIDID (a simple object - an integer) is just a placeholder for the numeric value of the ID.
{{Scripting manual}} Category:Scripting manual ?
