GetRandomFriend

From NWN Lexicon


Contents

[edit] GetRandomFriend(float)

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

object GetRandomFriend(
    float fMaxDistance
);

[edit] Parameters

fMaxDistance

Maximum distance to search for a friend out to.


[edit] Description

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



[edit] 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 .


[edit] Requirements

#include " x0_i0_anims "


[edit] Version

???

[edit] 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);
    }
}

[edit] See Also

functions: 

SetCurrentFriend



author: Baragg, editor: Mistress, contributor: Kookoo

Personal tools
Categories