SetUserVariable

From ZDoom Wiki
Jump to: navigation, search

int SetUserVariable (int tid, str name, value)

Usage

Sets one of the affected actor's user variables. Native variables, variables which are preceded by the keyword native when declared, cannot be set by this function.

Parameters

  • tid: the TID of the affected actors. If 0, the script's activator is used.
  • name: the name of the variable. Acceptable variable types are int, double and bool.
  • value: the value to give to the variable. If the type of the variable is double, this must be passed as a fixed-point value.

Return value

The total number of actors the function iterated through in an attempt to set their variable.

Examples

This script increases the amount of XP that the activating enemy rewards upon death.

script "EnemyExp" (int amt)
{
    SetUserVariable(0, "user_rewardxp", amt + GetUserVariable(0, "user_rewardxp"));
}

See also