I was bored so I gave it some more thought to open up more possibilities.
This can be extended to multiple levels of disgust (or even friendliness, depends on the configuration) towards subraces.
Disclaimer: I didn't test this in the toolset, I wrote it here on the forums, so may have a few syntax errors :)
Base code here:
// List of possible subraces and the attitude of commoners or merchants towards them
//
// Format: "[subrace name]:[attitude], [subrace name 2]:[attitude2], ..."
//
// (Example) Attitudes:
// 0: neutral
// 1: distrusted
// 2: hated
string sSubraceAttitudes = "sun elf:0, hill dwarf:0, aasimar:1, tiefling:2";
// Get the attitude towards a player subrace
// The attitudes are listed before the sSubraceAttitudes variable
int DetermineAttitude(string sSubrace);
int DetermineAttitude(string sSubrace) {
if (sSubrace == "") {
// default is neutral for no subrace
return 0;
}
int iSrPosition = FindSubString(sSubraceAttitudes, GetStringLowerCase(sSubrace));
if (iSrPosition < 0) {
// The player has a subrace, but we don't know about it. Should not happen
// returning neutral for now, should ask the player to bug report this
return 0;
}
// Find the attitude associated with the given subrace
int iSrOffset = iSrPosition + GetStringLength(sSubrace) + 1;
int iAttitude = StringToInt(GetSubString(sSubraceAttitudes, iSrOffset, 1));
return iAttitude;
}
And an example on how to use it:
// on merchant open somewhere in the code
switch (DetermineAttitude(sSubrace)) {
case 0:
// open store normally
break;
case 1:
// I don't like you, but eh, here you go
break;
case 2:
// Go away you freak!
break;
}
You can assign different meanings to numbers, though this has a limit of 10 possible attitudes (0-9), but that should be more than enough.
Cheers!
EDIT: You can make sSubraceAttitudes
a parameter for the function and then the attitudes can be fully customised for whatever purpose you want to use this script :)