Skip to content

Access Entity Local Variable

Access Entity Local Variable

Gets or set the value of a local variable on a specific entity.

Properties

System

Name Explanation Type
Entity The entity whose local variable will be accessed. Actor Reference
Get Value Whether the command reads the entity variable value into a global or local variable. Toggle
Global Variable The global variable index to read from or write to. Number
Local Variable The local variable index to read from or write to. Number
Reference Variable The index of the local variable on the target entity to access. Number
Set Value Whether the command writes a value to the entity variable. Toggle
Use Global Variable Whether to use a global variable as the source or destination. Toggle
Use Local Variable Whether to use a local variable as the source or destination. Toggle
Use Value Whether to set the entity variable to a literal value instead of copying from a global or local variable. Toggle
Value The literal value to set the entity variable to when Use Value is enabled. String

Examples

Read Entity 0 Local Variable 0 into Global Variable 0

This reads the value of local variable 0 on entity 0 and stores it in Global Variable 0.

$gv[0] = entity_var(entity(0), 0);
{"Data":{"GlobalIndex":0,"IsGetter":true,"IsGlobal":true,"IsLocal":false,"IsValue":false,"LocalIndex":0,"ReferenceIndex":0,"Target":{"ReferenceType":0,"Index":0,"IsSelf":false,"IsEntity":true,"IsPartyMember":false,"Identifier":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Metadata":null},"Value":"","Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Entity.EntityLocalVariableAccessCommand"}

Set Entity 0 Local Variable 0 to a String Value

This sets local variable 0 on entity 0 to the string "hello".

entity_var(entity(0), 0, "hello");
{"Data":{"GlobalIndex":0,"IsGetter":false,"IsGlobal":false,"IsLocal":false,"IsValue":true,"LocalIndex":0,"ReferenceIndex":0,"Target":{"ReferenceType":0,"Index":0,"IsSelf":false,"IsEntity":true,"IsPartyMember":false,"Identifier":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Metadata":null},"Value":"hello","Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Entity.EntityLocalVariableAccessCommand"}

Copy Global Variable 5 to Entity 0 Local Variable 0

This copies the value of Global Variable 5 into local variable 0 on entity 0.

entity_var(entity(0), 0, $gv[5]);
{"Data":{"GlobalIndex":5,"IsGetter":false,"IsGlobal":true,"IsLocal":false,"IsValue":false,"LocalIndex":0,"ReferenceIndex":0,"Target":{"ReferenceType":0,"Index":0,"IsSelf":false,"IsEntity":true,"IsPartyMember":false,"Identifier":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Metadata":null},"Value":"","Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Entity.EntityLocalVariableAccessCommand"}