SetUserArray

From ZDoom Wiki
Jump to navigation Jump to search

int SetUserArray (int tid, str name, int pos, int value)

Usage

Sets one of the affected actor's user array-bound variables. Variables of native arrays, arrays 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 array. Acceptable array types are int, double and bool.
  • pos: the position in the array, 0-indexed.
  • value: the value to give to the array position. If the type of the array 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 array's variable.

Examples

This function adds a rank to the specified 'skill' in the activator.

function void SetRanks (int skill, int amt)
{
    SetUserArray(0, "user_skills", skill, amt + GetUserArray(0, "user_skills", skill));
}

See also