Skip to content

Issue when comparing classes.

void main()
 {
     object oCreature = OBJECT_SELF;
     int nFirstClass = GetClassByPosition(1, oCreature);
     if (nFirstClass != CLASS_TYPE_FIGHTER)
         SendMessageToPC(GetFirstPC(), "Bing");
     else
         SendMessageToPC(GetFirstPC(), "Bong");
}

This is a cut out of an OnDeath script meant to check whether or not a class is a base NWN class or a custom NWN class/Prestige Class.

The issue that, in this case, on the death of a level 1 fighter the result of 'bing' is displayed despite the fact that it should be showing 'bong' as it is a fighter.

Comments

  • ProlericProleric Member Posts: 1,316
    Does the code work prior to death?

    Maybe the function returns CLASS_TYPE_INVALID if the creature is dead?
  • CartoonkarlCartoonkarl Member Posts: 2
    Figured it out. Was a logical error on my side, some information is missing from the example.
Sign In or Register to comment.