get_random_object

This function looks at every object on the map with a specified label (except the object passed in, if any) and returns one of them at random. If no objects are available (whether because there are none with the label, or because the only labeled object is the one passed in as an argument), then the function will return no_object.

This function returns object. Calling this function without storing its return value in a variable is an error.

Arguments

label

The name of a Forge label as a string literal, or the index of a Forge label as an integer constant.

exclude

If this value is not no_object, then the function is not allowed to return this object.

Example

alias current_hill = global.object[0]

current_hill = get_random_object("koth_hill", current_hill)