Skip to content

Getting Character Race

Is there a way to get the race in a script?

It would be fine as a string or .2da line number. Using NWNXEE would also be fine, but didn't see a function in there either.

It seems to be easy to do in a conversation, but I can't find a way to access it inside a script. I don't know if its possible to pass from a conversation to a script, but I wouldn't be able to do this. I need some things done on client enter.

Comments

  • YnneadYnnead Member Posts: 3
    edited June 2018
    That is racial type not race. If they are all outsider or something you can't tell the difference between them.

    Edit

    Just to clarify that function will return the line number in the .2da or the constant in the .2da? I don't want to break feats like favored enemy, by having new races with the same racial type have different constants.
  • YnneadYnnead Member Posts: 3
    No, I didn't mean subrace.

    From testing I think that GetRacialType returns the line number in the .2da. The constant in the .2da is likely equal to the line number.

    With that I think creating new races that should have the same racial type in racialtypes.2da (so they are selectable during character creation) already breaks things like favored enemy.

    Does anyone have an idea on how to fix that?
  • ZeroarkZeroark Member Posts: 22
    edited June 2018
    Depends a lot on which script hook you are using it:

    If you use it on a "OnPlayerEquipItem" scipt:
    int RacialType = GetRacialType(GetPCItemLastEquippedBy());

    If you use it on a module "OnEnter" script:
    int RacialType = GetRacialType(GetEnteringObject());

    And so on, with that you will get the racial number on the racialtype.2da of the PC that triggered that event. The way on determining who triggered which event varies depending on each event.

    You can get more information on all the events, and how to get who triggered them over here: https://nwnlexicon.com/index.php?title=Category:Events

    As for the "Favored Enemy"part, well I've just noticed on that as well. It's not that it breaks it, it's just that we need to somehow to be able to specify (Either scripting or 2da, or something?) to tell that a new feat X is the one for Favored Enemy: Race X, but I totally understand where you want to get.

    EDIT:
    By the way, I think I get you now. You want to make a new race that has the SAME racial type as an already existing one? I believe that is not possible, and for that you would need to make Subraces. (Same RACIAL TYPE, different names for each)
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    edited June 2018
    You could use a combination of GetRacialType with GetAppearanceType. If they have the same racial type then appearance type could separate out who's who as long as there is a valid appearance type that goes along with their new race. Otherwise you will probably need to use "subrace" or some other saved variable to determine the race.
Sign In or Register to comment.