GetRandomFriend(float)

Get a random nearby friend within the specified distance limit, that isn't busy doing something else.

object GetRandomFriend(
    float fMaxDistance
);

Parameters

fMaxDistance

Maximum distance to search for a friend out to.


Description

Get a random nearby friend within the specified distance limit, that isn't busy doing something else.



Remarks

If successfull, this function returns the randomly selected friend. Returns OBJECT_INVALID on failure to find a friend.

This does not set the returned object as a friend with SetCurrentFriend.


Requirements

#include "x0_i0_anims"


Version

???

Example

// Find us a bud and interact with them.
#include "x0_i0_anims"

void main()
{
    // Find a friend within 3 meters.
    object oBud = GetRandomFriend(3.0);

    // If we found one, start talking to them.
    if(OBJECT_INVALID != oBud)
    {
        AnimActionStartTalking(oBud);
    }
}

See Also

functions:  GetCurrentFriend | SetCurrentFriend
categories:  Get Data from Object Functions


author: Baragg, editor: Mistress, contributor: Kookoo