GetAssociate(int, object, int)

From NWN Lexicon
Jump to: navigation, search
Red bug icon.png Warning: This function has a known bug and may not work as expected in some situations. See Known Bugs for details.

Returns an object's associate.

object GetAssociate(
    int nAssociateType,
    object oMaster = OBJECT_SELF,
    int nTh = 1
);

Parameters

nAssociateType
ASSOCIATE_TYPE_*
oMaster
PC to get the associate of. (Default: OBJECT_SELF)
nTh
Which associate to return. (Default: 1)

Description

Returns the NPC associated object of oMaster of the specified oAssociateType.

Returns OBJECT_INVALID if no such associate exists for oMaster.


Remarks

The nTh parameter is useful because, since version 1.59, you can allow for more than one henchman using the SetMaxHenchmen command. The nTh parameter is thus equivalent to the nInt parameter in GetHenchman. Currently, the only associate type it is possible to have more than one of at a time is henchmen.

Known Issues

Using GetAssociate(ASSOCIATE_TYPE_DOMINATED, 2) will return the same value as GetAssociate(ASSOCIATE_TYPE_DOMINATED, 1) meaning if you code a loop of all associates be careful to only go onto the 2nd associate if it is ASSOCIATE_TYPE_HENCHMAN (see SetMaxHenchmen) or ASSOCIATE_TYPE_SUMMONED (you can get more than one - see EffectSummonCreature).

Version

1.61

See Also

functions: 

SetAssociateState SetMaxHenchmen

constants: 

ASSOCIATE_TYPE_* Constants



 author: Charles Feduke, editor: Lilac Soul