GetUserVariable

From ZDoom Wiki
Jump to: navigation, search

GetUserVariable (int tid, str name)

Usage

Retrieves the value of one of the affected actor's user or native variables. Native variables are variables which are preceded by the keyword native when declared.

Parameters

  • tid: the TID of the affected actor. If 0, the script's activator is used.
  • name: the name of the variable. Acceptable variable types are int, double, bool, string and name.

Return value

The value stored in the variable. double is returned as a fixed-point value, while name is returned as a string.

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