User Tools

Site Tools


crpl:docs:getunitattribute

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
crpl:docs:getunitattribute [2013/09/01 21:35] – Minor editorial changes Grauniadcrpl:docs:getunitattribute [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 1: Line 1:
-~~DISCUSSION~~ 
 <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]] <- [[crpl:crplreference| CRPL reference]] <- [[crpl:crplreference#unit_commands|Unit Commands]]
 =====  GetUnitAttribute  ===== =====  GetUnitAttribute  =====
Line 8: Line 7:
  
 === Description === === Description ===
-GetUnitAtrribute allows you to query various attributes on different units.+GetUnitAttribute allows you to query various attributes on different units. 
 + 
 +====Unit Constants ==== 
  
 The constant must be one of the following: The constant must be one of the following:
  
-^Command^Desc+^Command^Description^Value
-|CONST_COORDX| The x coordinate of the unit. | +CONST_ACPACKETREQUESTDELAY | The delay between AC packet requests for the unit. Only works for CRPLTowers. |10
-|CONST_COORDY| The y coordinate of the unit. | +| CONST_AMMO | The unit's ammo. Floating point value. |17
-|CONST_ISDESTROYED| If the unit is destroyed.  Can only be read, not set. | +| CONST_AMMOAC | The unit's AntiCreeper ammo. Floating point value. |19
-|CONST_ISLANDED| If the unit is landed.  Can only be read, not set. Only ever not true for units that can move.| +CONST_BEAMTARGET (1.66) Whether the unit is targeted by Beams|32
-|CONST_HEALTH| The unit's health.  Floating point value. | +CONST_BUILDCOST How many packets it takes to build the unit. Only works for CRPLTowers. |5
-|CONST_MAXHEALTH| The unit's max health.  Floating point value. +CONST_CANREQUESTAMMO | Whether the unit can request Ammo packets. Only works for CRPLTowers. |11
-|CONST_AMMO| The unit's ammo.  Floating point value.| +CONST_CELLHEIGHT | The width of space that the unit takes. Read/Write for CRPLTowers, read-only for everything else|25
-|CONST_MAXAMMO| The unit's max ammo.  Floating point value.+CONST_CELLWIDTH | The width of space that the unit takes. Read/Write for CRPLTowers, read-only for everything else|24
-|CONST_AMMOAC| The unit's AntiCreeper ammo.  Floating point value.| +CONST_CONNECTABLE If the unit can connect to the player's network grid. Only works for CRPLTowers. |6
-|CONST_MAXAMMOAC|The unit's max AntiCreeper ammo.  Floating point value.| +CONST_COORDX The x coordinate of the unit|0
-|CONST_CREATEPZWhether the CrplTower creates a power zone when destroyed Only works for CRPLTowers.| +CONST_COORDY The y coordinate of the unit|1
-|CONST_TAKEMAPSPACE| Whether the CrplTower consumes space on the map (preventing other units from stacking) Only works for CRPLTowers.| +CONST_COUNTSFORVICTORY | Whether the CrplTower must be destroyed before map victory on annihilation game modes. Only works for CRPLTowers. |27
-|CONST_CELLWIDTH| The width of space that the unit takes.  Only worls for CRPLTowers.| +CONST_CREATEPZ | Whether the CrplTower creates a power zone when destroyed. Only works for CRPLTowers. |21
-|CONST_CELLHEIGHT| The width of space that the unit takes.  Only worls for CRPLTowers.| +| CONST_DESTROYMODE | Effect to play when CrplTower is destroyed. Only works for CRPLTowers. -1 means Default, 0 means none, 1 means flash with no sound, 2 means explosion with sound, 3 means explosion with no sound. |34
-|CONST_SUPPORTSDIGITALISWhether the CrplTower supports the growth of Digitalis.  Does not mean that the unit seeds Digitalis, only that it keeps it alive  Only works for CRPLTowers.| +CONST_DESTROYONDAMAGE Whether the unit should be destroyed if its health reaches zero due to enemy fire. |22
-|CONST_COUNTSFORVICTORYWhether the CrplTower must be destroyed before map victory on annihilation game modes.   Only works for CRPLTowers.| +| CONST_HEALRATE | The Heal Rate of a unit. 0.001 is the default. This is the amount of health that is added per frame |14| 
-|CONST_NULLIFIERDAMAGESWhether the CrplTower can be targeted and damaged by Nullifiers.   Only works for CRPLTowers.| +| CONST_HEALTH | The unit's health. Floating point value. |15
-|CONST_SNIPERTARGET| Whether the CrplTower can be targeted and damaged by Snipers  Only works for CRPLTowers.| +| CONST_ISBUILDING | If the unit is in build mode (requests build packets). |4| 
-|CONST_THORTARGET| Whether the CrplTower can be targeted and damaged by Thor main cannons  Only works for CRPLTowers.| +| CONST_ISDESTROYED | If the unit is destroyed. Can only be read, not set. |12| 
-|CONST_DESTROYMODE| Effect to play when CrplTower is destroyed. Only works for CRPLTowers. -1 means Default, 0 means none, 1 means flash with no sound, 2 means explosion with sound, 3 means explosion with no sound.| +| CONST_ISLANDED | If the unit is landed. Can only be read, not set. Only ever not true for units that can move|13
-|CONST_PIXELCOORDX| The X coordinate of the unit on the screen (pixels)+CONST_MAXAMMO The unit's max ammo. Floating point value. |18| 
-|CONST_PIXELCOORDYThe Y coordinate of the unit on the screen (pixels)+| CONST_MAXAMMOAC | The unit's max AntiCreeper ammo. Floating point value. |10| 
-|CONST_HEALRATE| The Heal Rate of a unit.  0.001 is the default.  This is the amount of health that is added per frame| +| CONST_MAXHEALTH | The unit's max health. Floating point value. |16| 
-|CONST_ISBUILDING| If the unit is in build mode (requests build packets).  Only settable for CRPLTowers.| +| CONST_NULLIFIERDAMAGEAMT | Set the amount of damage that a nullifier does to a unit. The default for nullifierdamageamt is 0.  This means that the unit should be destroyed (the normal and default behavior). 0.1, for instance, does 0.1 damage to a unit rather than destroying it.  Assuming the unit has a health more than 0.1, this means multiple nullifiers would be required to destroy the unit.  Negative values will **increase** health.|29| 
-|CONST_BUILDCOSTHow many packets it takes to build the unit.  Only works for CRPLTowers.| +| CONST_NULLIFIERDAMAGES | Whether the CrplTower can be targeted and damaged by Nullifiers. Only works for CRPLTowers. |28
-|CONST_CONNECTABLEIf the unit can connect to the player's network grid. Only works for CRPLTowers.| +CONST_PACKETREQUESTDELAY The delay between packet requests for the unit. Only works for CRPLTowers. |9
-|CONST_REQUESTPACKETS| If the unit can request packets. Only works for CRPLTowers.| +CONST_PIXELCOORDX | The X coordinate of the unit on the screen (pixels) |2| 
-|CONST_REQUESTACPACKETS| If the unit can request AC packets. Only works for CRPLTowers.| +| CONST_PIXELCOORDY | The Y coordinate of the unit on the screen (pixels) |3| 
-|CONST_PACKETREQUESTDELAYThe delay between packet requests for the unit.  Only works for CRPLTowers.| +| CONST_REQUESTACPACKETS | If the unit can request AC packets. Only works for CRPLTowers. WARNING: This one does not persist between saves. |8
-|CONST_ACPACKETREQUESTDELAYThe delay between AC packet requests for the unit. Only works for CRPLTowers.| +CONST_REQUESTPACKETS | If the unit can request packets. Only works for CRPLTowers. |7
-|CONST_CANREQUESTAMMO| Whether the unit can request Ammo packets. Only works for CRPLTowers.| +CONST_SHOWAMMOACBAR  Whether the unit's AC bar is visible. Only works for CRPLTowers. Does not persist across saves.|37
-|CONST_DESTROYONDAMAGE| Whether the unit should be destroyed if its health reaches zero due to enemy fire.|+CONST_SHOWAMMOBAR  Whether the unit's ammo bar is visible. Only works for CRPLTowers. Does not persist across saves.|36
 +CONST_SHOWHEALTHBAR  | Whether the unit's health bar is visible. Only works for CRPLTowers. Does not persist across saves.|35| 
 +| CONST_SNIPERTARGET | Whether the CrplTower can be targeted and damaged by Snipers. Only works for CRPLTowers.|30
 +CONST_SNIPERIGNORELOS | (1.66) On a unit that is targeted by snipers, whether or not the snipers ignore terrain heights when firing. i.e. The unit is "above the terrain" or "flying". |32| 
 +| CONST_SUPPORTSDIGITALIS | Whether the CrplTower supports the growth of Digitalis. Does not mean that the unit seeds Digitalis, only that it keeps it alive. Only works for CRPLTowers. |26| 
 +| CONST_TAKEMAPSPACE | Whether the CrplTower consumes space on the map (preventing other units from stacking). Only works for CRPLTowers. |23| 
 +| CONST_THORTARGET | Whether the CrplTower can be targeted and damaged by Thor main cannonsOnly works for CRPLTowers. |33|
  
  
-=== Examples ===+ 
 +==== Examples ====
 <code> <code>
 # Get the max AC ammo of the current unit. # Get the max AC ammo of the current unit.
  Self CONST_MAXAMMOAC GetUnitAttribute trace  Self CONST_MAXAMMOAC GetUnitAttribute trace
 </code>  </code> 
 +<code>
 +# Show all attributes for a freshly-built CRPL core, or any unit.
 +once
 +ShowTraceLog
 +ClearTraceLog
 +Trace("CONST_ values...")
 +@TraceUnitAttributes(Self) # can pass any unit ID, not just Self.
 +endonce
 +
 +:TraceUnitAttributes
 +->UnitID
 +Trace2(GetUnitAttribute(<-UnitID CONST_ACPACKETREQUESTDELAY) "ACPACKETREQUESTDELAY")
 +Trace2(GetUnitAttribute(<-UnitID CONST_AMMO)                 "AMMO")
 +Trace2(GetUnitAttribute(<-UnitID CONST_AMMOAC)               "AMMOAC")
 +Trace2(GetUnitAttribute(<-UnitID CONST_BUILDCOST)            "BUILDCOST")
 +Trace2(GetUnitAttribute(<-UnitID CONST_CANREQUESTAMMO)       "CANREQUESTAMMO")
 +Trace2(GetUnitAttribute(<-UnitID CONST_CELLHEIGHT)           "CELLHEIGHT")
 +Trace2(GetUnitAttribute(<-UnitID CONST_CELLWIDTH)            "CELLWIDTH")
 +Trace2(GetUnitAttribute(<-UnitID CONST_CONNECTABLE)          "CONNECTABLE")
 +Trace2(GetUnitAttribute(<-UnitID CONST_COORDX)               "COORDX")
 +Trace2(GetUnitAttribute(<-UnitID CONST_COORDY)               "COORDY")
 +Trace2(GetUnitAttribute(<-UnitID CONST_COUNTSFORVICTORY)     "COUNTSFORVICTORY")
 +Trace2(GetUnitAttribute(<-UnitID CONST_CREATEPZ)             "CREATEPZ")
 +Trace2(GetUnitAttribute(<-UnitID CONST_DESTROYMODE)          "DESTROYMODE")
 +Trace2(GetUnitAttribute(<-UnitID CONST_DESTROYONDAMAGE)      "DESTROYONDAMAGE")
 +Trace2(GetUnitAttribute(<-UnitID CONST_HEALRATE)             "HEALRATE")
 +Trace2(GetUnitAttribute(<-UnitID CONST_HEALTH)               "HEALTH")
 +Trace2(GetUnitAttribute(<-UnitID CONST_ISBUILDING)           "ISBUILDING")
 +Trace2(GetUnitAttribute(<-UnitID CONST_ISDESTROYED)          "ISDESTROYED")
 +Trace2(GetUnitAttribute(<-UnitID CONST_ISLANDED)             "ISLANDED")
 +Trace2(GetUnitAttribute(<-UnitID CONST_MAXAMMO)              "MAXAMMO")
 +Trace2(GetUnitAttribute(<-UnitID CONST_MAXAMMOAC)            "MAXAMMOAC")
 +Trace2(GetUnitAttribute(<-UnitID CONST_MAXHEALTH)            "MAXHEALTH")
 +Trace2(GetUnitAttribute(<-UnitID CONST_NULLIFIERDAMAGES)     "NULLIFIERDAMAGES")
 +Trace2(GetUnitAttribute(<-UnitID CONST_PACKETREQUESTDELAY)   "PACKETREQUESTDELAY")
 +Trace2(GetUnitAttribute(<-UnitID CONST_PIXELCOORDX)          "PIXELCOORDX")
 +Trace2(GetUnitAttribute(<-UnitID CONST_PIXELCOORDY)          "PIXELCOORDY")
 +Trace2(GetUnitAttribute(<-UnitID CONST_REQUESTACPACKETS)     "REQUESTACPACKETS")
 +Trace2(GetUnitAttribute(<-UnitID CONST_REQUESTPACKETS)       "REQUESTPACKETS")
 +Trace2(GetUnitAttribute(<-UnitID CONST_SHOWAMMOACBAR)        "SHOWAMMOACBAR")
 +Trace2(GetUnitAttribute(<-UnitID CONST_SHOWAMMOBAR)          "SHOWAMMOBAR")
 +Trace2(GetUnitAttribute(<-UnitID CONST_SHOWHEALTHBAR)        "SHOWHEALTHBAR")
 +Trace2(GetUnitAttribute(<-UnitID CONST_SNIPERTARGET)         "SNIPERTARGET")
 +Trace2(GetUnitAttribute(<-UnitID CONST_SUPPORTSDIGITALIS)    "SUPPORTSDIGITALIS")
 +Trace2(GetUnitAttribute(<-UnitID CONST_TAKEMAPSPACE)         "TAKEMAPSPACE")
 +Trace2(GetUnitAttribute(<-UnitID CONST_THORTARGET)           "THORTARGET")
 +</code>
crpl/docs/getunitattribute.1378071310.txt.gz · Last modified: 2025/02/14 14:56 (external edit)