-
Notifications
You must be signed in to change notification settings - Fork 94
modify_variable
Ryzom Core Wiki edited this page Jul 8, 2024
·
5 revisions
title: Modify Variable description: published: true date: 2023-03-16T23:13:44.117Z tags: editor: markdown dateCreated: 2023-03-16T22:32:12.240Z
The modify_variable action modifies the value of one of the logic variables.
Each group comes with a set of 4 variables with IDs ranging from 0 to 3. Variables are floating point values.
Local variables are the variables of the current group, and they are expressed with a 'v' followed by the variable ID (0-3), for example: v0
.
Note that foreign variables are accessible only if the group name is unique in the manager or in the world. They are expressed with the group name followed by a colon ':' and then followed by a local variable identifier (v), for example: group_1:v2
.
Constant values are floating-point numerical expressions in base 10.
<local_variable | foreign_variable> < = | + | - | * | / > <local_variable | foreign_variable | constant_value>
- <local_variable | foreign_variable>: Name of the local or foreign variable to modify.
- <= | + | - | * | />: Operator to apply to the variable. The
+
operator acts like+=
in C. - <local_variable | foreign_variable | constant_value>: Name of the local or foreign variable, or constant value to use in the operation.
This example modifies variable 3 of my_npc_group, incrementing it by 1.
my_npc_group:v3 + 1
-
Condition If: A similar action that performs a conditional test on group variables and executes a sub-action if the condition is met. This action can be used in conjunction with
modify_variable
. -
Code: An action that executes a block of AI script code. This action can be used for more advanced variable manipulation that cannot be achieved with
modify_variable
. -
Random Select: An action that executes one of its child actions at random. This action can be useful in combination with
modify_variable
to create randomized behavior.