GetFirstPC

From NWN Lexicon



Contents

[edit] GetFirstPC()

Obtains the first PC

[edit] Description

Returns the first PC in the PC list in order to cycle through all PCs with GetNextPC().



[edit] Remarks

Useful for debugging purposes. If only one person is testing the module you can use SendMessageToPC(GetFirstPC(), "Something Happened") and the first (and only) PC will see that message.


If you are building for multiplayer, be aware of uses of this function. You could be performing tasks on a player that was not your intended target.

[edit] Version

1.22

[edit] Example

// This function cycles through all PCs and counts how many there are
void main()
{
   int nPCs = 0;
   object oPC = GetFirstPC();
   while (GetIsObjectValid(oPC) == TRUE)
   {
      nPCs = nPCs+1; // nPCs++;
      oPC = GetNextPC();
   }
}

[edit] See Also

functions: 

GetNextPC



 author: Tom Cassiotis, editor: Charles Feduke, Mistress
 

Personal tools
Categories