get attribute||doc135440

September 20, 2022

Format

 Entity:prop(key) 
  • The class to which the function belongs:Entity

Description

Get entity properties. The attributes here refer to some general attributes defined by default in the game, such as maximum HP, movement speed, jump height, etc., as well as special attributes, such as damage value, defense value, damage coefficient, etc. used for the calculation of the default damage formula etc., but not all of the properties in the properties panel of the unit in the editor. allowable hereView the field name corresponding to the related attribute.


Parameters

Variable name type Description
key string property field


Value Returned

type Description
variant attribute value


Code Samples

on the client side of the objectmount script, get the maximum life value of the object

local maxHP = this:prop('maxHp')
print(maxHP)