Race and skill check problem

Hello,

Please, I really, really need some help here. I can’t, for the sake of me, make this script work as intended. Before doing that, you may ask yourself, “why don’t you use the gc scrips”? Well, because the node conversation does not work properly if I do that. I mean, the game recognizes my race, but it does not make the skill roll.

So I’m trying the script below. The problem? No matter what number I put for the skill check (even if is just 2), the game won’t make the skill roll. It won’t even display in the chat box if it was a failure or a sucessful. So, please, what am I doing wrong here? Thanks, thanks so much.

int StartingConditional()
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();

// The PC must be one of the listed races.
if ( GetRacialType(oPC) != RACIAL_SUBTYPE_DROW  &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_SVIRFNEBLIN  &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_GRAY_DWARF  &&
     GetRacialType(oPC) != RACIAL_TYPE_GRAYORC  &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_TIEFLING  &&
     GetRacialType(oPC) != RACIAL_TYPE_HALFORC  &&
     GetRacialType(oPC) != RACIAL_TYPE_YUANTI &&
 GetRacialType(oPC) != RACIAL_SUBTYPE_HALFDROW &&
 GetRacialType(oPC) != RACIAL_SUBTYPE_AASIMAR )
    return FALSE;

// The PC must pass a DC 18 diplomacy check.
if (  !GetIsSkillSuccessful(oPC, SKILL_DIPLOMACY, 18) )
    return FALSE;

// If we make it this far, we have passed all tests.
return TRUE;

}

I think you should put every condition between parenthesis

if ( (GetRacialType(oPC) != RACIAL_SUBTYPE_DROW) &&
(GetRacialType(oPC) != RACIAL_SUBTYPE_SVIRFNEBLIN) && …

   (GetRacialType(oPC) != RACIAL_SUBTYPE_AASIMAR)   )
 return FALSE;

We don’t have the racial subtypes in NWN1, nor the whole shebang with the multiple controllable characters for that matter, so my opinion’ll be of limited help, but I can spot one thing you could try:

Have you tried adding a debug message to the GetRacialType check to see if the script is aborting before the skill roll happens? The RACIAL_SUBTYPE_* constants versus RACIAL_TYPE_* constants thing makes me a tad suspicious. It’d make sense for the subtypes to have been implemented independently from the overall racial types.

// The PC must be one of the listed races.
if ( GetRacialType(oPC) != RACIAL_SUBTYPE_DROW        &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_SVIRFNEBLIN &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_GRAY_DWARF  &&
     GetRacialType(oPC) != RACIAL_TYPE_GRAYORC        &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_TIEFLING    &&
     GetRacialType(oPC) != RACIAL_TYPE_HALFORC        &&
     GetRacialType(oPC) != RACIAL_TYPE_YUANTI         &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_HALFDROW    &&
     GetRacialType(oPC) != RACIAL_SUBTYPE_AASIMAR )
     {
     SendMessageToPC(oPC, "Not the right racial type.");
     return FALSE;
     }

@Claudius33

Didn’t work. The skill check is not made.

@TheBarbarian

This is for NwN 2 :slight_smile:

Ok, this is getting even more interesting and frustrating.

First of all, I did what Claudius33 suggested:

int StartingConditional()
{
// Get the PC who is involved in this conversation
object oPC = GetPCSpeaker();

// The PC must be one of the listed races.
if ( (GetRacialType(oPC) != RACIAL_SUBTYPE_DROW )  &&
   ( GetRacialType(oPC) != RACIAL_SUBTYPE_SVIRFNEBLIN )  &&
   ( GetRacialType(oPC) != RACIAL_SUBTYPE_GRAY_DWARF )  &&
   ( GetRacialType(oPC) != RACIAL_TYPE_GRAYORC )  &&
   ( GetRacialType(oPC) != RACIAL_SUBTYPE_TIEFLING )  &&
   ( GetRacialType(oPC) != RACIAL_TYPE_HALFORC )  &&
   ( GetRacialType(oPC) != RACIAL_TYPE_YUANTI ) &&
   ( GetRacialType(oPC) != RACIAL_SUBTYPE_HALFDROW ) &&
   ( GetRacialType(oPC) != RACIAL_SUBTYPE_AASIMAR) )
    return FALSE;

// The PC must pass a DC 18 persuade check.
if (  (!GetIsSkillSuccessful(oPC, SKILL_DIPLOMACY, 18)) )
    return FALSE;

// If we make it this far, we have passed all tests.
return TRUE;

}

Then I tested with different races. When I play a drow, the skill check is made. If I play a duergar, the check is not made. If I play a Yuanti, the check is made. If i play an Aasimar, the check is not made.

What?

Sorry, I concentrated on the conditioning. You have to use GetSubRace(object oTarget) when you check a subrace.

2 Likes

…And that solved my problem. Can’t thank you enough, @Claudius33 !

ps. the sub-brackets aren’t needed here. the non-equivalence operator has precedence over the and-operator

they don’t hurt the code tho.

 
edit: but note that table linked, is just an example of what precedence is: ie, we’re doing NwScript (not C etc.)

2 Likes

racial subtypes in 2 are very dependent on racial type. In fact on a creature blueprint in Nwn2, the race can’t even be set (although it’s displayed) – one sets the subtype instead and the race itself is auto-selected accordingly.

The association between race and subrace is defined in RacialSubtypes.2da, iirc

3 Likes