set properties||doc135441

September 20, 2022


 Entity:setProp(key, value) 
  • The class to which the function belongs:Entity


Set 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.


  • Entity properties of server and client are not synchronized


Variable name type Description
key string property field
value variant attribute value

Code Samples

on the client side of the objectmount script, sets the object's maximum health

this:setProp('maxHp', 60) 
local maxHP = this:prop('maxHp')