Aller au contenu

Photo

Finding the class of a PC


  • Veuillez vous connecter pour répondre
3 réponses à ce sujet

#1
Hardishane

Hardishane
  • Members
  • 5 messages
Ok... I've gone through the functions and so far, I've been unable to identify the function, if any, that alows for checking of class... that is see which class the entering PC is.

The backdrop here is: The PC wakes up on a beach with no memory (except for name, race and class) or equipment,. 
As such I've decided that most PC's will start off with an alignment of N, but certain classes (as you know) has alignment restrictions, so a paladin has to be LG. But how can I identify the class of the PC? If they are higher than lvl 1 they will not enter at the same spot as newly created char, so multi-classing should not be an issue here.

the Script so far is like this.... with thx to Morbane for the removal of items Image IPB

void main()
{
 object oPC = GetEnteringObject();
 
 if(GetLocalInt(oPC, "looseitems") == TRUE) return;
 
 object oFM = GetFirstFactionMember(oPC, FALSE);
 object oItem = GetFirstItemInInventory(oFM);
 while (GetIsObjectValid(oFM))
 {
  while (GetIsObjectValid(oItem))
  {
   DestroyObject(oItem, 0.0f, FALSE);
   oItem = GetNextItemInInventory(oFM);
  }
  int nSlot = 0;
  while ( nSlot <= NUM_INVENTORY_SLOTS )
  {
   object oItem = GetItemInSlot(nSlot, oFM);
   if (GetIsObjectValid(oItem))
   {
    DestroyObject(oItem, 0.0f, 0);
   }
   nSlot++;
  }
  oFM = GetNextFactionMember(oFM, FALSE);
 }
 
 /*
This should be in a conditional, class related (Paladin, Warlock)

switch(oPC, nclass)
 {
  case class_TYPE_MONK :
  {
   AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
   AdjustAlignment(oPC, ALIGNMENT_LAWFUL, 50);
  }
  case class_TYPE_WARLOCK:
  {
   AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
   AdjustAlignment(oPC, ALIGNMENT_CHAOTIC, 50);
  }
  case class_TYPE_FIGHTER: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_BARBARIAN: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_BARD: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_CLERIC: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_DRUID: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_FAVORED_SOUL: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_RANGER: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_ROGUE: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_SORCERER: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_SPIRIT_SHAMAN: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
  case class_TYPE_WIZARD: AdjustAlignment(oPC, ALIGNMENT_NEUTRAL, 50);
 }
 */ 
 
SetLocalInt(oPC, "looseitems", TRUE);
}

I just have no idea how to implement the alignment adjustment... as no function seems to get the class type Image IPB

Any input is welcome Image IPB

#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
GetclassByPosition. You need to loop through the four possible classes.

Note: the word class in the function has a capital C.

Regards

Modifié par Kaldor Silverwand, 13 avril 2012 - 04:16 .


#3
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
BAH! Ninja'd. Very well, Kaldor, we shall meet again, we shall!

#4
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
Csl Library has a search box, should help you find things. Not that the functions are all links, so you can quickly both see proper examples of usage, reference on core library functions.

Reference fo that function classByPosition

Hoping that helps not only with this issue but future ones as well. ( source code this is built from is on dropbox )

I hand out weapons based on class, feats, etc to new characters on my server which is a similar problem, ignoring other areas such as feats the class related portion is as follows. A starting character only has one class.

iWeaponBaseItemType = CSLGetBestBaseItemByclass( oPC, GetclassByPosition(1, oPC), iWeaponBaseItemType );

Reference for CSLGetBestBaseItemByclass

Modifié par painofdungeoneternal, 13 avril 2012 - 05:18 .