Difference between revisions of "DCS func getObjectID"

From DCS World Wiki - Hoggitworld.com
(Created page with "{{Template:dcs_funcs |fName= getObjectID |vNum= 1.2.4 |par1= Unit |par2= |par3= |par4= |desc= Returns the runtime object Id associated with the uni...")
 
 
(One intermediate revision by the same user not shown)
Line 40: Line 40:
 
|notes=  If you ever serialized an object like a unit, weapon, etc it would be something like the following:  
 
|notes=  If you ever serialized an object like a unit, weapon, etc it would be something like the following:  
 
     object = {
 
     object = {
       ["_id"] = 13777728,
+
       ["id_"] = 13777728,
 
     }
 
     }
 +
As a result you can also get the objectID without calling this function. For example:
  
 +
    local unit = Unit.getByName('bob')
 +
    env.info(unit["id_"])
 
}}
 
}}
 
[[Category:Class Functions|getObjectID]]
 
[[Category:Class Functions|getObjectID]]
 
[[Category:Game Patch 1.2.4|getObjectId]]
 
[[Category:Game Patch 1.2.4|getObjectId]]

Latest revision as of 21:34, 6 May 2024

Scripting Root

Envrioment: Mission Scripting
Function: getObjectID Added with: 1.2.4
Member Of: Unit
Syntax: number Unit.getObjectID(Class Self )
Description: Returns the runtime object Id associated with the unit. Every single object on the map is represented by a unique objectID value.


Return Value: number
Return Example: 13777728
Examples:
Related Functions: Unit Functions: isActive, getPlayerName, getID, getNumber, getCategoryEx, getObjectID, getController, getGroup, getCallsign, getLife, getLife0, getFuel, getAmmo, getSensors, hasSensors, getRadar, getDrawArgumentValue, getNearestCargos, enableEmission, getDescentCapacity

Object Functions: isExist, destroy, getCategory, getTypeName, getDesc, hasAttribute, getName, getPoint, getPosition, getVelocity, inAir

Coalition Object Functions: getCoalition, getCountry

Notes: If you ever serialized an object like a unit, weapon, etc it would be something like the following:
   object = {
      ["id_"] = 13777728,
   }

As a result you can also get the objectID without calling this function. For example:

   local unit = Unit.getByName('bob')
   env.info(unit["id_"])