Author Topic: Random NPC Heads Script *FIXED*  (Read 875 times)

Legacy_mwplayer

  • Newbie
  • *
  • Posts: 38
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #15 on: June 24, 2011, 03:38:01 am »


               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 '<img'>

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 .
                     
                  


            

Legacy_CID-78

  • Sr. Member
  • ****
  • Posts: 261
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #16 on: June 24, 2011, 07:57:38 am »


               be carefull not all bodyparts are counted from 1 and up. heads has gaps in their array.
               
               

               
            

Legacy_Snarkblat

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #17 on: June 24, 2011, 05:45:46 pm »


               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 .
                     
                  


            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #18 on: June 24, 2011, 07:17:54 pm »


               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.
               
               

               
            

Legacy_Snarkblat

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #19 on: June 26, 2011, 06:50:22 pm »


               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 .
                     
                  


            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #20 on: July 09, 2011, 12:03:17 am »


               

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
               
               

               
            

Legacy_DM_Vecna

  • Hero Member
  • *****
  • Posts: 501
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #21 on: July 10, 2011, 05:46:12 am »


                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;     &
               
               

               
            

Legacy_Taino

  • Sr. Member
  • ****
  • Posts: 268
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #22 on: July 10, 2011, 07:25:59 pm »


               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 .
                     
                  


            

Legacy_DM_Vecna

  • Hero Member
  • *****
  • Posts: 501
  • Karma: +0/-0
Random NPC Heads Script *FIXED*
« Reply #23 on: July 10, 2011, 11:28:14 pm »


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