Aller au contenu

Photo

Random NPC Heads Script *FIXED*


  • Veuillez vous connecter pour répondre
23 réponses à ce sujet

#1
Snarkblat

Snarkblat
  • Members
  • 52 messages
I've been working on a script that fires on a creatures on spawn event to give random body parts, skin color, hair etc.

So far I'm only testing the head part.  The script compiles fine but only gives the last random head in a sequence. For example: if I have 12 heads availiable, it always picks the 12th. If I have 6, it always picks the 6th. I feel like there's something extremely obvious I'm overlooking and I would appreciate any input you can give me.


//Random Head Script
void main()
{

      switch(Random(12))
      {
            case 0:  SetCreatureBodyPart(CREATURE_PART_HEAD, 1, OBJECT_SELF);
            case 1:  SetCreatureBodyPart(CREATURE_PART_HEAD, 2, OBJECT_SELF);
            case 2:  SetCreatureBodyPart(CREATURE_PART_HEAD, 3, OBJECT_SELF);
            case 3:  SetCreatureBodyPart(CREATURE_PART_HEAD, 4, OBJECT_SELF);
            case 4:  SetCreatureBodyPart(CREATURE_PART_HEAD, 5, OBJECT_SELF);
            case 5:  SetCreatureBodyPart(CREATURE_PART_HEAD, 6, OBJECT_SELF);
            case 6:  SetCreatureBodyPart(CREATURE_PART_HEAD, 7, OBJECT_SELF);
            case 7:  SetCreatureBodyPart(CREATURE_PART_HEAD, 8, OBJECT_SELF);
            case 8:  SetCreatureBodyPart(CREATURE_PART_HEAD, 9, OBJECT_SELF);
            case 9:  SetCreatureBodyPart(CREATURE_PART_HEAD, 10, OBJECT_SELF);
            case 10: SetCreatureBodyPart(CREATURE_PART_HEAD, 11, OBJECT_SELF);
            case 11: SetCreatureBodyPart(CREATURE_PART_HEAD, 12, OBJECT_SELF);
            case 12: SetCreatureBodyPart(CREATURE_PART_HEAD, 13, OBJECT_SELF);
      }
}

Modifié par Snarkblat, 26 juin 2011 - 05:53 .


#2
Snarkblat

Snarkblat
  • Members
  • 52 messages
I should be clear I've also tested a script that separates it into race and gender and encountered the same problem.


void main()
{

if ((GetRacialType(OBJECT_SELF)==RACIAL_TYPE_HUMAN))
{

if (GetGender(OBJECT_SELF)==GENDER_FEMALE)
{
switch(Random(12))
{
case 0: SetCreatureBodyPart(CREATURE_PART_HEAD, 1, OBJECT_SELF);
case 1: SetCreatureBodyPart(CREATURE_PART_HEAD, 2, OBJECT_SELF);
case 2: SetCreatureBodyPart(CREATURE_PART_HEAD, 3, OBJECT_SELF);
case 3: SetCreatureBodyPart(CREATURE_PART_HEAD, 4, OBJECT_SELF);
case 4: SetCreatureBodyPart(CREATURE_PART_HEAD, 5, OBJECT_SELF);
case 5: SetCreatureBodyPart(CREATURE_PART_HEAD, 6, OBJECT_SELF);
case 6: SetCreatureBodyPart(CREATURE_PART_HEAD, 7, OBJECT_SELF);
case 7: SetCreatureBodyPart(CREATURE_PART_HEAD, 8, OBJECT_SELF);
case 8: SetCreatureBodyPart(CREATURE_PART_HEAD, 9, OBJECT_SELF);
case 9: SetCreatureBodyPart(CREATURE_PART_HEAD, 10, OBJECT_SELF);
case 10: SetCreatureBodyPart(CREATURE_PART_HEAD, 11, OBJECT_SELF);
case 11: SetCreatureBodyPart(CREATURE_PART_HEAD, 12, OBJECT_SELF);
case 12: SetCreatureBodyPart(CREATURE_PART_HEAD, 13, OBJECT_SELF);

}
}
else
{
switch(Random(6))
{
case 0: SetCreatureBodyPart(CREATURE_PART_HEAD, 1, OBJECT_SELF);
case 1: SetCreatureBodyPart(CREATURE_PART_HEAD, 2, OBJECT_SELF);
case 2: SetCreatureBodyPart(CREATURE_PART_HEAD, 3, OBJECT_SELF);
case 3: SetCreatureBodyPart(CREATURE_PART_HEAD, 4, OBJECT_SELF);
case 4: SetCreatureBodyPart(CREATURE_PART_HEAD, 5, OBJECT_SELF);
case 5: SetCreatureBodyPart(CREATURE_PART_HEAD, 6, OBJECT_SELF);
case 6: SetCreatureBodyPart(CREATURE_PART_HEAD, 7, OBJECT_SELF);

}

}
}
else if ((GetRacialType(OBJECT_SELF)==RACIAL_TYPE_ELF))
{
if (GetGender(OBJECT_SELF)==GENDER_FEMALE)
{
switch(Random(5))
{
case 0: SetCreatureBodyPart(CREATURE_PART_HEAD, 1, OBJECT_SELF);
case 1: SetCreatureBodyPart(CREATURE_PART_HEAD, 2, OBJECT_SELF);
case 2: SetCreatureBodyPart(CREATURE_PART_HEAD, 3, OBJECT_SELF);
case 3: SetCreatureBodyPart(CREATURE_PART_HEAD, 4, OBJECT_SELF);
case 4: SetCreatureBodyPart(CREATURE_PART_HEAD, 5, OBJECT_SELF);
case 5: SetCreatureBodyPart(CREATURE_PART_HEAD, 6, OBJECT_SELF);
}
}
else
{
switch(Random(5))
{
case 0: SetCreatureBodyPart(CREATURE_PART_HEAD, 1, OBJECT_SELF);
case 1: SetCreatureBodyPart(CREATURE_PART_HEAD, 2, OBJECT_SELF);
case 2: SetCreatureBodyPart(CREATURE_PART_HEAD, 3, OBJECT_SELF);
case 3: SetCreatureBodyPart(CREATURE_PART_HEAD, 4, OBJECT_SELF);
case 4: SetCreatureBodyPart(CREATURE_PART_HEAD, 5, OBJECT_SELF);
case 5: SetCreatureBodyPart(CREATURE_PART_HEAD, 6, OBJECT_SELF);

}

}
}

}

#3
Xardex

Xardex
  • Members
  • 217 messages
You must break your cases in switches or they wont work properly, try this:
case 0:  SetCreatureBodyPart(CREATURE_PART_HEAD, 1, OBJECT_SELF); break;
( add to all cases )

Also if you have more then 1 line in a case (or two, if you count break), you need to put {} for the lines like this:
switch ()
{
  case 1:
  {}
  break;
  case 2:
........
}

I hate switches and almost never use them. <_<

Modifié par Xardex, 23 juin 2011 - 11:12 .


#4
Calvinthesneak

Calvinthesneak
  • Members
  • 656 messages
How does the random function work, I know for some things like C++ random needs to be multiplied by 10 to make it a full integer.. I spose I should go look up the Lexicon.

http://www.nwnlexico...ion.random.html

#5
Snarkblat

Snarkblat
  • Members
  • 52 messages
Xardex: Oh my god, thank you! I can't believe I overlooked that. I did as you said and it worked beautifully. Now my city is populated with random NPCs running around. I can't wait to implement this code for other things as well, hair color, skin.

Thanks again <3

Modifié par Snarkblat, 23 juin 2011 - 11:12 .


#6
kalbaern

kalbaern
  • Members
  • 824 messages
Yup, do as suggested above and ... add one to all of your random numbers. 0 thru 5 is not random 5, its random 6. Random 5 is 0 thru 4.

#7
Xardex

Xardex
  • Members
  • 217 messages
Well, the page you linked explains it better then I could...

Generally if I want a random integer I do " Random(x)+1 "

Modifié par Xardex, 23 juin 2011 - 11:16 .


#8
Snarkblat

Snarkblat
  • Members
  • 52 messages

Xardex wrote...

Well, the page you linked explains it better then I could...

Generally if I want a random integer I do " Random(x)+1 "


Could you explain that a little further? You say you don't use switches. Is there a simpler way to do my above script without switches? Because when it comes to randomizing colors... there's 175 of them. I don't want to have to write 175 lines of code.

Edit: I read the link but I'm afraid it's still a little bit lost on me.

Modifié par Snarkblat, 23 juin 2011 - 11:20 .


#9
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
SetCreatureBodyPart(CREATURE_PART_HEAD, Random(5)+1, OBJECT_SELF);

#10
Snarkblat

Snarkblat
  • Members
  • 52 messages

GhostOfGod wrote...

SetCreatureBodyPart(CREATURE_PART_HEAD, Random(5)+1, OBJECT_SELF);





Brilliant... I just tested it out and every NPC spawned with a beautiful and rather "unique" appearance. ;) 

Here's a screenshot of in-game. oi51.tinypic.com/fz0n0l.jpg

Cudos to you, sir. You've just saved me a lot of grief. 

#11
Xardex

Xardex
  • Members
  • 217 messages
Switches are a neat way of doing things, and to my understanding good performance vice... Its a personal preference, I only use them if I have to. Obviously the piece from Ghost is even better in this case, but if you have more then two variables to randomize depending on a third one, like randomizing the 3 weapon parts depending on base item, you have to use switches.

If you plan on randomizing the clothing aswell, I'll be very intrested in how you managed if you didn't either use switches or create a boatload of if statements.

Modifié par Xardex, 23 juin 2011 - 11:41 .


#12
kalbaern

kalbaern
  • Members
  • 824 messages
int iHair;
        switch(Random(6))
            {
            case 0:  iHair = 003; break;
            case 1:  iHair = 007; break;
            case 2:  iHair = 015; break;
            case 3:  iHair = 009; break;
            case 4:  iHair = 167; break;
            case 5:  iHair = 124; break;
            }
int nHairColor = iHair;
SetCreatureBodyPart(CREATURE_PART_HEAD, Random(5)+1, OBJECT_SELF);
SetColor(OBJECT_SELF,COLOR_CHANNEL_HAIR,nHairColor);

That should give you 6 different hair colorings.

#13
Snarkblat

Snarkblat
  • Members
  • 52 messages
I've compiled the working script and will post here for anyone else who wants to use it. Thanks to all who helped out. ^-^

I'm also using a Commoner Walker system which automatically assigns random clothing, but I can't for the life of me remember what it's called.

//Random NPC Script
void main()
{

SetCreatureBodyPart(CREATURE_PART_HEAD, Random(20)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_RIGHT_FOREARM, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_RIGHT_FOREARM, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_RIGHT_BICEP, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_LEFT_BICEP, Random(2)+1, OBJECT_SELF);
SetColor(OBJECT_SELF, COLOR_CHANNEL_HAIR, Random(175)+1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_SKIN, Random(175)+1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_1, Random(175)+1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_2, Random(175)+1);




}

#14
Snarkblat

Snarkblat
  • Members
  • 52 messages
Hmm apparently the Random function also works for random portrait selection as well, but there's no assignment according to race or gender. Has anyone found a solution to this?

SetPortraitId(OBJECT_SELF, Random(60)+1);

#15
DM_Vecna

DM_Vecna
  • Members
  • 280 messages
You can have lots of fun with this. In my PW I have all kinds of randomness running including a demographics for the region that they spawned in. This all runs from one male and one female NPC

#16
mwplayer

mwplayer
  • Members
  • 19 messages
There's a SetPhenoType function if you don't already know about it. Though that values aren't just 1, 2 etc.

0 = normal

2 = large

It would have look something like this I think:

int iPheno;
switch(Random(2))
{
case 0: iPheno = 0; break;
case 1: iPheno = 2; break;
}
SetPhenoType(iPheno, OBJECT_SELF);


I haven't tested it out, but it compiled. Anyways, thanks for your script so far! It looks pretty sic. I think I might use it for my npcs :P

EDIT: Well a brute force method for the portrait would be to make if statements for each race/gender, and do switch/case for the different portraits for each.

Modifié par mwplayer, 24 juin 2011 - 03:16 .


#17
CID-78

CID-78
  • Members
  • 1 124 messages
be carefull not all bodyparts are counted from 1 and up. heads has gaps in their array.

#18
Snarkblat

Snarkblat
  • Members
  • 52 messages
I seem to be having the same problem this guy did: http://social.biowar...2/index/5893711

Sometimes the random heads won't show and I end up with headless torsos walking around, or an empty set of clothes. It seems completely random happening around 10% of the time. I tried spawning the random NPCS from another location and beaming them back but it doesn't fix the issue. Adding a delay to the randomization code doesn't do anything - they don't even change appearance.

It's also not a matter of a non existent model, so I'm stumped on how to solve the problem.

Modifié par Snarkblat, 24 juin 2011 - 04:46 .


#19
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Have you tried it like Krevett suggested. You would just let them spawn how you are doing it now. But then in their on spawn script you would jump them to a waypoint in some inaccessible area (no players allowed) and then jump them right back to where they originally spawned. Something like this:


void main()
{
    location lLocation = GetLocation(OBJECT_SELF);
    //Your randomize stuff here
    ActionJumpToObject(GetWaypointByTag("WP Tag here"));//Tag of WP in inaccessible area
    ActionJumpToLocation(lLocation);
}


Hopefully it helps.

#20
Snarkblat

Snarkblat
  • Members
  • 52 messages
I've modified the script to include race. Someone could take this even further if you wanted. My modules load much quicker now that I don't have 30+ different blueprints of NPCs. It works on encounters too, if you want your bandits and cult members to look different from each other.

Have fun!


//Random NPC Script, put on spawn
void main()
{

//Random Body Parts
SetCreatureBodyPart(CREATURE_PART_HEAD, Random(12)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_RIGHT_FOREARM, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_LEFT_FOREARM, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_RIGHT_BICEP, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_LEFT_BICEP, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_RIGHT_THIGH, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_LEFT_THIGH, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_RIGHT_SHIN, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_LEFT_SHIN, Random(2)+1, OBJECT_SELF);
SetCreatureBodyPart(CREATURE_PART_PELVIS, Random(2)+1, OBJECT_SELF);

//Random Skin and Hair Colors
SetColor(OBJECT_SELF, COLOR_CHANNEL_HAIR, Random(174)+1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_SKIN, Random(6)+1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_1, Random(174)+1);
SetColor(OBJECT_SELF, COLOR_CHANNEL_TATTOO_2, Random(174)+1);

//Random Race
int iRace;
switch(Random(3))
{
case 0: SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_ELF); break;
case 1: SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HUMAN); break;
case 2: SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_DWARF); break;
}

//Random Pheno: Fat or Thin
int iPheno;
switch(Random(2))
{
case 0: iPheno = 0; break;
case 1: iPheno = 2; break;
}
SetPhenoType(iPheno, OBJECT_SELF);

//Random Portrait
SetPortraitId(OBJECT_SELF, Random(120)+1);
}

Modifié par Snarkblat, 26 juin 2011 - 05:57 .


#21
Taino

Taino
  • Members
  • 139 messages

Snarkblat wrote...
I'm also using a Commoner Walker system which automatically assigns random clothing, but I can't for the life of me remember what it's called.

I believe this is what you were talking about. Commoner Package 1.2

#22
DM_Vecna

DM_Vecna
  • Members
  • 280 messages
 Ti fix the head issue make sure that that race has enough heads as not all do. Otherwise it might be issues with them spawning then them perceiving you which might have a clearallaction() or just a lag issue. below is what I do and it seems to work. I have a lot of custom functions but it will get you on the right track. Let me know if you want any other functions and I will post them. setting a variable on the area will run a demographics model so this can work in the Underdark and other areas of your above ground worlds. This was not all my work btw I just pieced it together and asked a lot of questions in here.
from on spawn

AssignCommand(oNPC, ClearAllActions());AssignCommand(oNPC,SetRandomSubrace(oNPC));AssignCommand(oNPC,vec_SetRandomName(oNPC));AssignCommand(oNPC,SetRandomAppearance());AssignCommand(oNPC,SetRandomPhenotype (oNPC));AssignCommand(oNPC,SetRandomSkin(oNPC));AssignCommand(oNPC,SetRandomHair (oNPC));AssignCommand(oNPC,SetCreatureBodyPart(CREATURE_PART_HEAD, iNewApp, oNPC));DelayCommand(1.5,DressTheNPC (oNPC));

Her is the include file 

//////////////////////////////////////////////////////////////////////////////////:: FILENAME: "vec_random_inc"//:: Description: Include file for creating randomly designed npcs in an area//::              Features of the randomization (based on area variables://::              1) Random Subrace            7) Random clothing and cloak//::              2) Random Head            8) Random Name (Specific to race and gender)//::              3) Random Hair Color      9)Random Ability bonuses//::              4) Random Skin Color     10)Random Faction Allegiance//::              5) Random Clothing       11) Random Description (see the "00_descriptions")//::              6) Random PhenoType      12) Faction///////////////////////////////////////////////////////////////////////////:: Created By: DM_Vecna//:: Created On: January/2010////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////#include "00_descriptions"
//recognized Regionsconst string sRegion_1 =    "Benzor" ;const string sRegion_2 =    "Brosna" ;const string sRegion_3 =    "Hebdezi" ;const string sRegion_4 =    "Jumon" ;const string sRegion_5 =    "Mulrok" ;const string sRegion_6 =    "Jacala" ;const string sRegion_7 =    "Elven" ;const string sRegion_8 =    "Dwarven" ;const string sRegion_9 =    "Underdark" ;const string sRegion_10 =    "Drow" ;const string sRegion_11 =   "Duergar" ;const string sRegion_12 =   "Svirfneblin" ;const string sRegion_13 =   "Rhumania" ;
//recognized subracesconst string sHuman_1 =     "Demorocles" ;  //Benzorconst string sHuman_2 =     "Aspian" ;      //Brosnaconst string sHuman_3 =     "Hebdezi" ;     //Abizconst string sHuman_4 =     "Bohemee" ;     //Rhumanian aka: Gypsyconst string sHuman_5 =     "Ing" ;         //Jumonconst string sHuman_6 =     "Jacala" ;      //Jungle Savanahconst string sElf_1 =       "High" ;        //High Elfconst string sElf_2 =       "Sun" ;         //Sun Elfconst string sElf_3 =       "Drow" ;        //Drow Elfconst string sDwarf_1 =     "Shield" ;      //Shield Dwarfconst string sDwarf_2 =     "Duergar" ;     //Duergarconst string sGnome_1 =     "rock" ;        //Rock Gnomeconst string sGnome_2 =     "Svirfneblin" ; //Svirfneblinconst string sHalfling_1 =  "Halfling" ;    //Halflingconst string sHalfOrc_1 =   "Half Orc" ;    //Half Orcconst string sHalfElf_1 =   "Half Elf" ;    //Half Elfconst string sMonster_1 =   "Gnoll" ;       //Gnollconst string sMonster_2 =   "Goblin" ;      //Goblinconst string sMonster_3 =   "Ilithid" ;     //Ilithidconst string sMonster_4 =   "Orc" ;         //Orc
///// FUNCTION DECLARATIONS ////////////////////////////////////////////////////
//sets a random subrace based upon the region of the area the NPC was spawned in.void SetRandomSubrace(object oNPC = OBJECT_SELF);
//Sets a random appearance based upon the subrace field.void SetRandomAppearance();
void SetRandomSkin(object oNPC = OBJECT_SELF);
void SetRandomHair(object oNPC = OBJECT_SELF);
void DressTheNPC(object oNPC = OBJECT_SELF);
/////////////////////////////////////////////////////////////////////////////////////////////SetRandomSubrace
void SetRandomSubrace(object oNPC = OBJECT_SELF){object oNPC = OBJECT_SELF;object oArea = GetArea(OBJECT_SELF);string sRegion = GetLocalString (oArea, "region");int nSubrace = Random(100);

//if(nRace >= 5 && nRace <= 6)
if (sRegion == sRegion_1)    /////////////////////////////////Benzor/Demorocles    {    if (nSubrace <=60)    SetSubRace (oNPC, sHuman_1);   //Demorocles    if (nSubrace >=61 && nSubrace <=70)     SetSubRace (oNPC, sHuman_2);   //Aspian    if (nSubrace >=71 && nSubrace <=75)    SetSubRace (oNPC, sHuman_3);   //Abiz    if (nSubrace >=76 && nSubrace <=78)    SetSubRace (oNPC, sHuman_4);   //Gypsy    if (nSubrace >=79 && nSubrace <=83)    SetSubRace (oNPC, sElf_1);     //High Elf    if (nSubrace >=84 && nSubrace <=91)    SetSubRace (oNPC, sHalfling_1);//Halfling    if (nSubrace >=92 && nSubrace <=98)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace >=99 && nSubrace <=99)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    if (nSubrace ==100)    SetSubRace (oNPC, sHalfOrc_1); //Half Orc    return;    }else if (sRegion == sRegion_2)    /////////////////////////////////////Brosna/Aspian    {    if (nSubrace <=09)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace >=10 && nSubrace <=70)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace >=71 && nSubrace <=75)    SetSubRace (oNPC, sHuman_3);   //Abiz    if (nSubrace >=76 && nSubrace <=76)    SetSubRace (oNPC, sHuman_4);   //Gypsy    if (nSubrace >=77 && nSubrace <=80)    SetSubRace (oNPC, sElf_1);     //High Elf    if (nSubrace >=81 && nSubrace <=85)    SetSubRace (oNPC, sHalfling_1);//Halfling    if (nSubrace >=86 && nSubrace <=98)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace ==99)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    if (nSubrace ==100)    SetSubRace (oNPC, sHalfOrc_1); //Half Orc    return;    }else if (sRegion == sRegion_3)    /////////////////////////////////////Abiz/Jacala    {    if (nSubrace <=10)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace >=11 && nSubrace <=15)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace >=16 && nSubrace <=70)    SetSubRace (oNPC, sHuman_3);   //Abiz    if (nSubrace >=71 && nSubrace <=80)    SetSubRace (oNPC, sHuman_4);   //Gypsy    if (nSubrace >=81 && nSubrace <=82)    SetSubRace (oNPC, sElf_1);     //High Elf    if (nSubrace >=83 && nSubrace <=88)    SetSubRace (oNPC, sHalfling_1);//Halfling    if (nSubrace >=89 && nSubrace <=95)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace >=96 && nSubrace <=99)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    if (nSubrace ==100)    SetSubRace (oNPC, sHalfOrc_1); //Half Orc    return;    }else if (sRegion == sRegion_4)    /////////////////////////////////////////Jumon/Ing    {    if (nSubrace <=00)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace ==01)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace ==02)    SetSubRace (oNPC, sHuman_3);   //Abiz    if (nSubrace >=3 && nSubrace <=95)    SetSubRace (oNPC, sHuman_5);   //Jumon    if (nSubrace ==96)    SetSubRace (oNPC, sElf_1);     //High Elf    if (nSubrace ==97)    SetSubRace (oNPC, sHalfling_1);//Halfling    if (nSubrace ==98)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace ==99)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    if (nSubrace ==100)    SetSubRace (oNPC, sHalfOrc_1); //Half Orc    return;    }else if (sRegion == sRegion_5)    //////////////////////////////////////  Mulrok/All    {    if (nSubrace <=10)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace >=11 && nSubrace <=15)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace >=16 && nSubrace <=25)    SetSubRace (oNPC, sHuman_3);   //Abiz    if (nSubrace >=26 && nSubrace <=28)    SetSubRace (oNPC, sHuman_4);   //Gypsy    if (nSubrace >=29 && nSubrace <=35)    SetSubRace (oNPC, sElf_1);     //High Elf    if (nSubrace >=36 && nSubrace <=45)    SetSubRace (oNPC, sHalfling_1);//Halfling    if (nSubrace >=46 && nSubrace <=55)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace >=56 && nSubrace <=60)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    if (nSubrace >=61 && nSubrace <=65)    SetSubRace (oNPC, sHalfOrc_1); //Half Orc    if (nSubrace >=66 && nSubrace <=85)    SetSubRace (oNPC, sElf_3); //Drow    if (nSubrace >=86 && nSubrace <=95)    SetSubRace (oNPC, sDwarf_2); //Duergar    if (nSubrace >=96 && nSubrace <=100)    SetSubRace (oNPC, sGnome_2); //Svirfneblin    return;    }else if (sRegion == sRegion_6)    ///////////////////////////////////////////Jacala    {    SetSubRace (oNPC, sHuman_6);   //Jacala    return;    }else if (sRegion == sRegion_7)    /////////////////////////////////////////////Elven    {    if (nSubrace <=01)    SetSubRace (oNPC, sHuman_1);    //Benzor    if (nSubrace >=02 && nSubrace <=03)    SetSubRace (oNPC, sHuman_2);    //Brosna    if (nSubrace >=04 && nSubrace <=74)    SetSubRace (oNPC, sElf_1);      //High Elf    if (nSubrace >=75 && nSubrace <=94)    SetSubRace (oNPC, sElf_2);      //Sun Elf    if (nSubrace ==95)    SetSubRace (oNPC, sHalfling_1); //Halfling    if (nSubrace >=96 && nSubrace <=100)    SetSubRace (oNPC, sHalfElf_1);  //Half Elf    return;    }else if (sRegion == sRegion_8)    ///////////////////////////////////////////Dwarven    {    if (nSubrace <=02)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace >=03 && nSubrace <=05)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace >=06 && nSubrace <=10)    SetSubRace (oNPC, sHalfling_1);//Halfling    if (nSubrace >=11 && nSubrace <=100)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    return;    }else if (sRegion == sRegion_9)    /////////////////////////////////////////Underdark    {    if (nSubrace ==00)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace ==01)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace ==02)    SetSubRace (oNPC, sHuman_3);   //Abiz    if (nSubrace >=03 && nSubrace <=17)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace >=18 && nSubrace <=20)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    if (nSubrace >=21 && nSubrace <=25)    SetSubRace (oNPC, sHalfOrc_1); //Half Orc    if (nSubrace >=26 && nSubrace <=40)    SetSubRace (oNPC, sElf_3); //Drow    if (nSubrace >=41 && nSubrace <=65)    SetSubRace (oNPC, sDwarf_2); //Duergar    if (nSubrace >=66 && nSubrace <=80)    SetSubRace (oNPC, sGnome_2); //Svirfneblin    if (nSubrace >=81 && nSubrace <=95)    SetSubRace (oNPC, sMonster_2); //Goblin    if (nSubrace >=96 && nSubrace <=100)    SetSubRace (oNPC, sMonster_4); //Orc    return;    }else if (sRegion == sRegion_10)    //////////////////////////////////////////////Drow    {    if (nSubrace ==00)    SetSubRace (oNPC, sHuman_2);    //Brosna    if (nSubrace ==01)    SetSubRace (oNPC, sHalfOrc_1);  //Half Orc    if (nSubrace >=02 && nSubrace <=85)    SetSubRace (oNPC, sElf_3);      //Drow    if (nSubrace >=86 && nSubrace <=90)    SetSubRace (oNPC, sDwarf_2);    //Duergar    if (nSubrace >=91 && nSubrace <=96)    SetSubRace (oNPC, sMonster_2);  //Goblin    if (nSubrace >=97 && nSubrace <=98)    SetSubRace (oNPC, sMonster_3);  //Ilithid    if (nSubrace >=99 && nSubrace <=100)    SetSubRace (oNPC, sMonster_4);  //Orc    return;    }else if (sRegion == sRegion_11)    /////////////////////////////////////////Duergar    {    if (nSubrace ==00)    SetSubRace (oNPC, sHuman_1);    //Benzor    if (nSubrace ==01)    SetSubRace (oNPC, sHuman_2);    //Brosna    if (nSubrace >=02 && nSubrace <=03)    SetSubRace (oNPC, sHalfOrc_1);  //Half Orc    if (nSubrace >=04 && nSubrace <=13)    SetSubRace (oNPC, sElf_3);      //Drow    if (nSubrace >=14 && nSubrace <=98)    SetSubRace (oNPC, sDwarf_2);    //Duergar    if (nSubrace ==99)    SetSubRace (oNPC, sMonster_2);  //Goblin    if (nSubrace ==100)    SetSubRace (oNPC, sMonster_4);  //Orc    return;    }else if (sRegion == sRegion_12)    //////////////////////////////////////Svirfneblin    {    if (nSubrace <=02)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace >=03 && nSubrace <=10)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace >=11 && nSubrace <=15)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace >=16 && nSubrace <=20)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    if (nSubrace >=21 && nSubrace <=100)    SetSubRace (oNPC, sGnome_2); //Svirfneblin    return;    }else if (sRegion == sRegion_13)    /////////////////////////////////Rhumania    {    if (nSubrace <=7)    SetSubRace (oNPC, sHuman_1);   //Benzor    if (nSubrace >=08 && nSubrace <=14)    SetSubRace (oNPC, sHuman_2);   //Brosna    if (nSubrace >=15 && nSubrace <=70)    SetSubRace (oNPC, sHuman_4);   //Gypsy    if (nSubrace >=71 && nSubrace <=90)    SetSubRace (oNPC, sElf_1);     //High Elf    if (nSubrace >=91 && nSubrace <=95)    SetSubRace (oNPC, sHalfling_1);//Halfling    if (nSubrace >=96 && nSubrace <=99)    SetSubRace (oNPC, sDwarf_1);   //Dwarf    if (nSubrace ==100)    SetSubRace (oNPC, sHalfElf_1); //Half Elf    return;    }else    {    SetSubRace (oNPC, sHuman_1);    return;    }}//////////////////////////////////////////////////////////////////////////////////////SetRandomAppearancevoid SetRandomAppearance(){string sSubRace = GetSubRace (OBJECT_SELF);
if (sSubRace == sHuman_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HUMAN); return;    }else if (sSubRace == sHuman_2)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HUMAN);return;    }else if (sSubRace == sHuman_3)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HUMAN); return;    }else if (sSubRace == sHuman_4)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HUMAN);return;    }else if (sSubRace == sHuman_5)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HUMAN); return;    }else if (sSubRace == sElf_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_ELF); return;    }else if (sSubRace == sElf_2)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_ELF); return;    }else if (sSubRace == sElf_3)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_ELF); return;    }else if (sSubRace == sDwarf_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_DWARF); return;    }else if (sSubRace == sDwarf_2)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_DWARF); return;    }else if (sSubRace == sGnome_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_GNOME); return;    }else if (sSubRace == sGnome_2)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_GNOME); return;    }else if (sSubRace == sHalfling_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HALFLING); return;    }else if (sSubRace == sHalfOrc_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HALF_ORC); return;    }else if (sSubRace == sHalfElf_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_HALF_ELF); return;    }else if (sSubRace == sMonster_1)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_GNOLL_WARRIOR); return;    }else if (sSubRace == sMonster_2)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_GOBLIN_A); return;    }else if (sSubRace == sMonster_3)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_MINDFLAYER); return;    }else if (sSubRace == sMonster_4)    {    SetCreatureAppearanceType(OBJECT_SELF, APPEARANCE_TYPE_ORC_A); return;    }
}
////////////////////////////////////////////////////////////////////////////////////////////////Phenoytpevoid SetRandomPhenotype(object oNPC = OBJECT_SELF){int nPhenotype = Random(9);string sSubRace = GetSubRace (OBJECT_SELF);
if (sSubRace == sHuman_1)    {       if(nPhenotype <=2)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sHuman_2)    {       if(nPhenotype <=2)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sHuman_3)    {       if(nPhenotype <=2)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sHuman_4)    {       if(nPhenotype <=2)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sHuman_5)    {       if(nPhenotype <=2)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sElf_1)    {       if(nPhenotype <=0)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sElf_2)    {       if(nPhenotype <=0)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sElf_3)    {       if(nPhenotype <=0)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sDwarf_1)    {       if(nPhenotype <=5)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sDwarf_2)    {       if(nPhenotype <=5)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sGnome_1)    {       if(nPhenotype <=3)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sGnome_2)    {       if(nPhenotype <=3)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sHalfling_1)    {       if(nPhenotype <=3)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sHalfOrc_1)    {       if(nPhenotype <=5)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (sSubRace == sHalfElf_1)    {       if(nPhenotype <=1)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_DWARF)    {       if(nPhenotype <=5)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_ELF)    {       if(nPhenotype <=0)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_GNOME)    {       if(nPhenotype <=3)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HALFELF)    {       if(nPhenotype <=1)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HALFLING)    {       if(nPhenotype <=3)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HALFORC)    {       if(nPhenotype <=5)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HUMAN)    {       if(nPhenotype <=2)       {       SetPhenoType(PHENOTYPE_BIG, oNPC); return;       }       else       {        SetPhenoType(PHENOTYPE_NORMAL, oNPC); return;       }    return;    } return;}
////////////////////////////////////////////////////////////////////////////////////////////////Skinvoid SetRandomSkin(object oNPC = OBJECT_SELF){//hair and skinint nSkinColor = Random(3);int nSkinToUse;
string sSubRace = GetSubRace (OBJECT_SELF);


if (sSubRace == sHuman_1)//Benzor    {     switch (nSkinColor)        {        case 0: nSkinToUse = 2; break;        case 1: nSkinToUse = 3; break;        case 2: nSkinToUse = 2; break;        case 3: nSkinToUse = 3; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHuman_2)//Brosna    {     switch (nSkinColor)        {        case 0:nSkinToUse = 0; break;        case 1:nSkinToUse = 1; break;        case 2:nSkinToUse = 117; break;        case 3:nSkinToUse = 118; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHuman_3) //hebdezi    {     switch (nSkinColor)        {        case 0:nSkinToUse = 4; break;        case 1:nSkinToUse = 5; break;        case 2:nSkinToUse = 15; break;        case 3:nSkinToUse = 4; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHuman_4) //behomee    {     switch (nSkinColor)        {        case 0:nSkinToUse = 118; break;        case 1:nSkinToUse = 119; break;        case 2:nSkinToUse = 118; break;        case 3:nSkinToUse = 119; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHuman_5) //Ing    {     switch (nSkinColor)        {        case 0:nSkinToUse = 9; break;        case 1:nSkinToUse = 9; break;        case 2:nSkinToUse = 10; break;        case 3:nSkinToUse = 24; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHuman_6) //Jacala    {     switch (nSkinColor)        {        case 0:nSkinToUse = 7; break;        case 1:nSkinToUse = 6; break;        case 2:nSkinToUse = 7; break;        case 3:nSkinToUse = 6; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sElf_1)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 8; break;        case 1:nSkinToUse = 12; break;        case 2:nSkinToUse = 74; break;        case 3:nSkinToUse = 128; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sElf_2)//Sun    {     switch (nSkinColor)        {        case 0:nSkinToUse = 3; break;        case 1:nSkinToUse = 4; break;        case 2:nSkinToUse = 27; break;        case 3:nSkinToUse = 10; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sElf_3) //Drow    {     switch (nSkinColor)        {        case 0:nSkinToUse = 30; break;        case 1:nSkinToUse = 43; break;        case 2:nSkinToUse = 63; break;        case 3:nSkinToUse = 135; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sDwarf_1)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 9; break;        case 1:nSkinToUse = 9; break;        case 2:nSkinToUse = 10; break;        case 3:nSkinToUse = 24; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sDwarf_2) //Duergar    {     switch (nSkinColor)        {        case 0:nSkinToUse = 19; break;        case 1:nSkinToUse = 31; break;        case 2:nSkinToUse = 127; break;        case 3:nSkinToUse = 19; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sGnome_1)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 74; break;        case 1:nSkinToUse = 117; break;        case 2:nSkinToUse = 12; break;        case 3:nSkinToUse = 74; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sGnome_2)//Svirf    {     switch (nSkinColor)        {        case 0:nSkinToUse = 42; break;        case 1:nSkinToUse = 17; break;        case 2:nSkinToUse = 127; break;        case 3:nSkinToUse = 128; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHalfling_1)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 0; break;        case 1:nSkinToUse = 0; break;        case 2:nSkinToUse = 1; break;        case 3:nSkinToUse = 1; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHalfOrc_1)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 39; break;        case 1:nSkinToUse = 107; break;        case 2:nSkinToUse = 113; break;        case 3:nSkinToUse = 123; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (sSubRace == sHalfElf_1)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 1; break;        case 1:nSkinToUse = 9; break;        case 2:nSkinToUse = 8; break;        case 3:nSkinToUse = 3; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_DWARF)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 19; break;        case 1:nSkinToUse = 31; break;        case 2:nSkinToUse = 127; break;        case 3:nSkinToUse = 19; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_ELF)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 8; break;        case 1:nSkinToUse = 12; break;        case 2:nSkinToUse = 74; break;        case 3:nSkinToUse = 128; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_GNOME)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 74; break;        case 1:nSkinToUse = 117; break;        case 2:nSkinToUse = 12; break;        case 3:nSkinToUse = 74; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HALFELF)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 1; break;        case 1:nSkinToUse = 9; break;        case 2:nSkinToUse = 8; break;        case 3:nSkinToUse = 3; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HALFLING)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 0; break;        case 1:nSkinToUse = 0; break;        case 2:nSkinToUse = 1; break;        case 3:nSkinToUse = 1; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HALFORC)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 39; break;        case 1:nSkinToUse = 107; break;        case 2:nSkinToUse = 113; break;        case 3:nSkinToUse = 123; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }else if (GetRacialType(oNPC)==RACIAL_TYPE_HUMAN)    {     switch (nSkinColor)        {        case 0:nSkinToUse = 0; break;        case 1:nSkinToUse = 3; break;        case 2:nSkinToUse = 9; break;        case 3:nSkinToUse = 7; break;        }    SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkinToUse);    return;    }
}////////////////////////////////////////////////////////////////////////////////////////////////hairvoid SetRandomHair(object oNPC = OBJECT_SELF){//hair and skinint nHairColor = Random(3);int nHairToUse;



string sSubRace = GetSubRace (OBJECT_SELF);


if (sSubRace == sHuman_1)//Benzor    {    switch (nHairColor)        {        case 0: nHairToUse = 15; break;        case 1: nHairToUse = 17; break;        case 2: nHairToUse = 35; break;        case 3: nHairToUse = 15; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sHuman_2)//Brosna    {        switch (nHairColor)        {        case 0: nHairToUse = 117; break;        case 1: nHairToUse = 120; break;        case 2: nHairToUse = 126; break;        case 3: nHairToUse = 128; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sHuman_3) //hebdezi    {        switch (nHairColor)        {        case 0: nHairToUse = 79; break;        case 1: nHairToUse = 127; break;        case 2: nHairToUse = 164; break;        case 3: nHairToUse = 22; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sHuman_4) //behomee    {        switch (nHairColor)        {        case 0: nHairToUse = 20; break;        case 1: nHairToUse = 21; break;        case 2: nHairToUse = 31; break;        case 3: nHairToUse = 9; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sHuman_5) //Ing    {        switch (nHairColor)        {        case 0: nHairToUse = 166; break;        case 1: nHairToUse = 171; break;        case 2: nHairToUse = 23; break;        case 3: nHairToUse = 23; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sHuman_6) //Jacala    {        switch (nHairColor)        {        case 0: nHairToUse = 23; break;        case 1: nHairToUse = 56; break;        case 2: nHairToUse = 120; break;        case 3: nHairToUse = 15; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sElf_1)    {        switch (nHairColor)        {        case 0: nHairToUse = 50; break;        case 1: nHairToUse = 9; break;        case 2: nHairToUse = 100; break;        case 3: nHairToUse = 92; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sElf_2)//Sun    {        switch (nHairColor)        {        case 0: nHairToUse = 7; break;        case 1: nHairToUse = 49; break;        case 2: nHairToUse = 53; break;        case 3: nHairToUse = 92; break;        }    SetColor(oNPC, COLOR_CHANNEL_HAIR, nHairToUse);    return;    }else if (sSubRace == sElf_3) //Drow    {        switch (nHairColor)        {        case 0: nHairToUse = 16; break;        case 1: nHairToUse = 166; break;        case 2: nHairToUse = 164; break;        case 3: nHairToUse = 16; break;     &

#23
Taino

Taino
  • Members
  • 139 messages
It cut off the rest of the script. B) What a mess to orginize that. We seriously need a coding on the forum.

Modifié par Taino, 10 juillet 2011 - 06:34 .


#24
DM_Vecna

DM_Vecna
  • Members
  • 280 messages
well, if anyone ever wants anything that I have used just pm me and I can email an erf or something