Discuss this page on this page's [[typGetDataField Talk Page|Talk Page]]
=== typGetDataField ===
^ Syntax | (typGetDataField unid attrib) -> data |
^ Arguments | unid: The unid of the type you want to get the value of an attribute from. |
^ | attrib: The name of the attribute you want to get. |
^ Returns | data: The value of the attribute. |
^ Category | [[data function|data]], [[type function|type]], [[unid function|unid]] |
^ Description | Returns the value of an attribute for a type. The attributes we have access to are determined by the game engine. |
=== Variants ===
There are many variants on this function, depending on the type and the attribute
(typGetDataField weaponUNID "ammoType") -> UNID of ammo used by weapon (Nil if weapon does not use ammo)
(typGetDataField launcherUNID "variantCount") -> number of missiles supported by launcher
(typGetDataField launcherUNID "ammoType:0") -> UNID of first missile type
(typGetDataField launcherUNID "ammoType:n") -> UNID of nth missile type
(typGetDataField weaponUNID "speed") -> shot speed
(typGetDataField sovereignUNID "name") -> name of sovereign
(typGetDataField weaponUNID "firerate") -> returns the firerate, 1000/n gives the value in ticks
(typGetDataField weaponUNID "repeatCount") -> returns the value of the weapon repeating attribute +1
(typGetDataField weaponUNID "isAlternating") -> returns a boolean (True/Nil)
(typGetDataField weaponUNID "sound") -> returns the UNID of the sound effect
=== Example ===
Return to [[:Functions]] list