GetRandomStop(float)

Returns a randomly selected object with the tag "NW_STOP" that is within the area of the calling object.

object GetRandomStop(
    float fMaxDistance
);

Parameters

fMaxDistance

Float used to determine the distance to look for the object within the area.


Description

Returns a randomly selected object with the tag "NW_STOP" that is within the area of the calling object.

If fMaxDistance is non-zero, will return OBJECT_INVALID if the stop is too far away.

The first time this is called in a given area, it cycles through all the stops in the area and stores them.

Remarks

Checks against a local integer "ANIM_STOPS_INITIALIZED" that is saved on the area to see if this function has already been called. If it has not, then all the instances of objects with the tag "NW_STOP" are located and saved in a series of local objects named "ANIM_STOP_" + instance number.

The next time this function is called, one of the "ANIM_STOP_" objects are randomly selected. If that object is not located at a distance less than or equal to the specified range (fMaxDistance) from the calling object or if it is not a valid object, then the function returns OBJECT_INVALID. Otherwise the selected object is returned.

Requirements

#include "x0_i0_anims"


Version

???

See Also

functions:  GetNearestObjectByTag | GetObjectByTag
categories:  Get Data from Object Functions


author: Baragg, editor: Mistress, contributor: Kookoo