View Single Post
Old 04-03-2013, 06:11 AM   #281
Thrak Farelle
@Thrak Farelle
Join Date: Mar 2008
Posts: 3
Originally Posted by JCarter426 View Post
// 341: A creature can have up to three classes.  This function determines the
// creature's class (CLASS_TYPE_*) based on nClassPosition.
// - nClassPosition: 1, 2 or 3
// - oCreature
// * Returns CLASS_TYPE_INVALID if the oCreature does not have a class in
//   nClassPosition (i.e. a single-class creature will only have a value in
//   nClassLocation=1) or if oCreature is not a valid creature.
int GetClassByPosition(int nClassPosition, object oCreature=OBJECT_SELF);
So, if you want to check if a creature has any particular class:
int StartingConditional(){

	object oCreature = [whatever];
	int iClass = [whatever];
	int iC1 = GetClassByPosition(1, oCreature);
	int iC2 = GetClassByPosition(2, oCreature);
	int iC3 = GetClassByPosition(3, oCreature);

if(	iC1 == iClass ||
	iC2 == iClass ||
	iC3 == iClass ){
	return TRUE;
return FALSE;

I'm not sure how the class positions get assigned, so depending on what you need it could be trickier than just that.
Thanks very much, combining some of that with code from another script that had another bit of what I needed allowed me to write the necessary script, and I've tested it ingame, so I know it works

Thanks again
Thrak Farelle is offline   you may: quote & reply,