Author Topic: Identify PC Familars/Companions  (Read 304 times)

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
Identify PC Familars/Companions
« on: December 27, 2012, 07:56:19 pm »


               Looking for help regarding familiars and animal compainions.  Specifially, I track the number of PCs in each area in order to do a host of things, such as run my spawn system and area cleaners.

I've recently discovered that familiars return TRUE for GetIsPC.  The Lexicon says that it returns true for familiars who are posessed.

Can someone verify the following for me?
1)  Unposessed familiars will return TRUE for GetIsPC as well?
2)  Do animal companions also return in the same way as familiars for GetIsPC?
3)  Is there a simple way to determine whether or not a PC has an active familiar (and/or companion if #2 above is true)

Any help is appreciated - especially how similar checks have been handled.

Thanks!
               
               

               
            

Legacy_BelowTheBelt

  • Hero Member
  • *****
  • Posts: 699
  • Karma: +0/-0
Identify PC Familars/Companions
« Reply #1 on: December 27, 2012, 10:03:23 pm »


               Been doing some looking and it seems GetAssociate may provide some help here. Would still appreciate some insight into the above questions as well as any comments about the below.

In my OnExit script, I'm including the following (excerpted):

int iPCCount = GetLocalInt (oArea, "PCsInArea");
object oAssociate;
int iAssociate;
for (iAssociate =1; iAssociate<=99; iAssociate ++)
{
//looking for familiars
oAssociate = GetAssociate (ASSOCIATE_TYPE_FAMILIAR, oPC, iAssociate);
if (oAssociate ==OBJECT_INVALID)
{
iAssociate = iAssociate -1;
break;
}
}
iPCCount = iPCCount - 1 - iAssociate; //existing area PC count minus the PC minus the familiars
if (iPCCount <0)
{
iPCCount =0;
}
SetLocalInt (oArea, "PCsInArea", iPCCount);

I can then execute any area cleaners, etc..

Comments?
               
               

               


                     Modifié par BelowTheBelt, 27 décembre 2012 - 10:04 .