User Tools

Site Tools


set_entity_property

Differences

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

Link to this comparison view

Next revision
Previous revision
set_entity_property [2017/05/12 14:21] – external edit 127.0.0.1set_entity_property [2021/04/21 18:51] (current) justin
Line 2: Line 2:
 ---- ----
  
-Sets a custom property for an entity to the specified value. This property can then be referenced elsewhere.+Sets a custom property for an [[entity]] to the specified value. This property can then be referenced elsewhere, for example when evaluating a condition. When editing this function in the [[Script Editor]], the [[Variable Expression Builder]] provides an easy way to choose which value you'd like to assign to the property. These properties can also be given values via [[script_syntax|assignment statements]] (i.e. the "Assign Value" visual [[script]] node) or even pre-defined with initial startup values from their [[Entity Properties]] panel in the [[Map Editor]].
  
 +====Signature:====
 <code python> <code python>
-set_entity_property(self"prop_name""prop_value")+set_entity_property(entityproperty_nameproperty_value)
 </code> </code>
  
 ^Argument^Description^Type^Required^ ^Argument^Description^Type^Required^
-|self|Description.|[[String]]|Yes| +|entity|[[entity|Entity]] on which the property will be stored.|[[Entity]]|Yes| 
-"prop_name"|Description.|[[String]]|Yes| +|property_name|Name of the property.|[[String]]|Yes| 
-"prop_value"|Description.|[[String]]|Yes|+|property_value|Value that will be assigned to the property.|[[String]], [[Number]], [[Boolean]]|Yes| 
 + 
 +<WRAP center round info 100%> 
 +You can also store general, game-wide properties that are not specific to a [[tile]], [[object]], or [[character]]. For more information, see [[Set Global Property]]. 
 +</WRAP>
  
 ====Example:==== ====Example:====
-<code python+<code bauxite
-set_entity_property(self, "prop_name", "prop_value")+set_entity_property("chest01", "opened", true);
 </code> </code>
-//Results://+//Results:// A property is stored on the "chest01" [[entity]] with a [[Boolean]] value of "true".
  
 <WRAP center round tip 100%> <WRAP center round tip 100%>
-Use the **Set Entity Property** function to ...+Use the **Set Entity Property** function to keep track of important information about specific [[entity|entities]], for example whether an [[NPC]] has already been visited by the player.
 </WRAP> </WRAP>
  
set_entity_property.1494624069.txt.gz · Last modified: 2017/05/12 14:21 by 127.0.0.1