Checking for Psion Class

Moderator: Event DM

Post Reply
User avatar
Deider
Demigod of Posts
Posts: 13259
Joined: Sun May 11, 2003 12:33 pm
Timezone: GMT -8
Location: California

Checking for Psion Class

Post by Deider » Sun Dec 12, 2004 9:33 am

I'm writing a script that needs to check to see if a PC has psion levels.

This is what I've tried to use:

Code: Select all

int nPsionLvl = GetLevelByClass(CLASS_TYPE_PSIONICIST, oPC);
I'm pretty sure I got the CLASS_TYPE_ variable right for the psion class, but the script does not compile because it doesn't consider PSIONICIST to be valid. Is there a script I need to include, a script somewhere that defines this new class type variable, to get my script to compile?

EDIT: Fuzz has told me that the psionicist class is entry #200 in the copap .tlk file. If that helps in any way... :)
User avatar
KaiRal Windspar
Elder Sage
Posts: 3635
Joined: Fri Jun 11, 2004 5:36 am
Location: Seattle
Contact:

Post by KaiRal Windspar » Sun Dec 12, 2004 10:22 am

It is technically considered a PrC, right? Isn't that relevant?
User avatar
Deider
Demigod of Posts
Posts: 13259
Joined: Sun May 11, 2003 12:33 pm
Timezone: GMT -8
Location: California

Post by Deider » Sun Dec 12, 2004 10:58 am

Don't think so - I've checked for the Shifter class before using this function, and it worked. The standard PrCs have their own variables, like CLASS_TYPE_SHIFTER.

Tried this from another angle. The classes are also defined by integers - monk is 4, for example. Fuzz checked for me and the psion class seems to be #60. So I tried this out:

Code: Select all

void main()
{
object oPC = GetPCSpeaker();
int nCount = 1;
int nPsionCheck = GetClassByPosition(nCount, oPC);

while (nCount < 4)
{
    if (nPsionCheck = 60)
    {
        //do some secret gnome stuff
    }
    else {return;}
nCount++;
}
}
... but it didn't work. Am I just making a stupid coding mistake here? It's 6am, I should be sleeping, but I want to figure this out :)
User avatar
Themicles
CoPaP Ambassador
Posts: 2673
Joined: Wed Jan 29, 2003 10:45 pm
Location: Wolverine Lake, MI
Contact:

Post by Themicles » Sun Dec 12, 2004 11:50 am

The TLK has absolutely nothing to do with this.

The classes 2da file is where you want to look for the number.

The constant name probably doesn't work unless it was added to the inc_constants. Check in there for it.

*was out drinking with friends last night, and woke up too damn early for no good reason*

-Themicles
A wise man does not dwell on his past. He learns from it, he grows from it, and then moves ahead into his future.

And some wise words from a wise man. :P
Orleron wrote:You have to excuse Themi. Tact, diplomacy, and softness are not his best traits, but he does not mean anything by his writing. He's a nice guy. You just get used to it after a while because he doesn't seem to learn. :)
Alustriel
Apprentice Scholar
Posts: 853
Joined: Mon Apr 07, 2003 12:08 pm
Location: GMT+1/+2 dst
Contact:

Post by Alustriel » Sun Dec 12, 2004 11:58 am

Check if the file inc_constant contains the line (was an update some time ago), if so then the constant can be used:
const int CLASS_TYPE_PSIONICIST = 60;


This should work whether or not the constant is defined, although I rather use the constant for future maintenance

void main()
{
object oPC = GetPCSpeaker();
if (GetLevelByClass(60, oPC)>=1)
{
//do some secret gnome stuff
}
dougnoel
Team Member; Retired with Honors
Posts: 6261
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)
Contact:

Post by dougnoel » Sun Dec 12, 2004 1:06 pm

Yeah, you need to have the file inc_constants.nss in your module. You also need to have it included in your script. If you don't have the file, you can extract it from a mod. (I have a current copy I can upload for you too.)

Please don't define the constant again. You can cause problems for someone later on if both those files get included in another script, or if one includes the otehrs. And the error message isn't very helpful when you declare a constant twice.

In three easy steps:
1.)Slap this line at the top of your script:
#include "inc_constants"
2.) Save the script.
3.) Then go to the constants tab on the right of the screen. Type in class_type in the search box and you will see a big list of all of them. You can find the Psion one (it will be bolded because it's not a Bioware const), double-click on it and it will be inserted into your code wherever your cursor is.
User avatar
Deider
Demigod of Posts
Posts: 13259
Joined: Sun May 11, 2003 12:33 pm
Timezone: GMT -8
Location: California

Post by Deider » Mon Dec 13, 2004 7:40 am

Thanks guys!! :D

EDIT: Hey doug, could you upload the current version? The one I found was from August of 2003. Or just mail it to me at deider@avlis.org. Thanks! :)
dougnoel
Team Member; Retired with Honors
Posts: 6261
Joined: Fri May 14, 2004 4:59 pm
Location: VA (GMT -4)
Contact:

Post by dougnoel » Mon Dec 13, 2004 6:41 pm

Deider wrote:Thanks guys!! :D

EDIT: Hey doug, could you upload the current version? The one I found was from August of 2003. Or just mail it to me at deider@avlis.org. Thanks! :)
I'll get it to you this evening when I get home.
Post Reply