Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--------------------------//
- // Created By: JediMindTrix //
- // Created On: 3/27/2015 //
- //--------------------------//
- //--------------------------------------------------------------------------------//
- // Description/Instructions //
- // //
- // //
- //This script is designed to allow a player to switch their head model //
- //from their default, chosen one at character creation, to any of the available //
- //hooded/masked/hooded+masked head's provided by Bioware and Hakpaks. This is //
- //accomplished through a theoretical rest menu option. Another rest menu option //
- //would revert the players head back to the original. The default head is stored //
- //on the PC the first time they make use of the script, and remains there unless //
- //removed by a DM via the in-game console (A special tool would be cumbersome). //
- // //
- //This command is: "dm_setvarint jmt_OrigHeadChk 0". This will allow a new //
- //default head to be set in the event of a a DM-assisted Head Change. //
- // //
- //Theoretically, this script should be called in the Actions Taken handle of the //
- //appropriate conversation node. //
- //--------------------------------------------------------------------------------//
- //--------------------------------------------------------------------------------//
- // Constants //
- // //
- //These defined constants are mainly used for legibility in the Function //
- //Execution. Each constant has been named after the appearance of the //
- //corresponding model. Further descriptions have been included for //
- //some (see below). Each number called by the constants below corresponds to a //
- //specific head model number; this model number in turn corresponds to a head //
- //number viewable in toolset on any of the dynamic races (except Half-Orcs, as //
- //they have no masked/hooded head models). //
- // //
- //--------------------------------------------------------------------------------//
- //DWARF MALES
- const int MALE_DWARF_HOOD_BEARD = 18; //Stereotypical Beard
- //DWARF FEMALES
- const int FEMALE_DWARF_HOOD_GOATEE = 17;
- const int FEMALE_DWARF_HOOD_BGOATEE = 19; //Sporting a bigger goatee
- const int FEMALE_DWARF_HOOD_NOGOATEE = 23;
- //ELF MALES
- const int MALE_ELF_HOOD_MASK = 15; //default Bioware
- const int MALE_ELF_HOOD_LONGHAIR = 24; //LotR style
- const int MALE_ELF_HOOD_MASK_LONGHAIR = 27;
- //ELF FEMALES
- const int FEMALE_ELF_HOOD_MASK = 14; //default Bioware
- const int FEMALE_ELF_HOOD_GALADRIEL = 34; //Galadriel Model
- const int FEMALE_ELF_HOOD_MASK_EYES = 46; //default Bioware w/colored eyes
- const int FEMALE_ELF_HOOD_MEH = 107;
- //GNOME MALES
- const int MALE_GNOME_HOOD = 14; //Default Bioware
- const int MALE_GNOME_HOOD_MASK = 17; //Bioware Elf-Style
- const int MALE_GNOME_MASK = 18;
- //GNOME FEMALES
- const int FEMALE_GNOME_HOOD = 5; //default Bioware
- //HALFLING MALES
- const int MALE_HALF_HOOD_MASK = 9;
- const int MALE_HALF_HOOD = 11;
- const int MALE_MASK = 15;
- const int MALE_HOOD_MASK_ALT = 17; //alternate take on 9
- const int MALE_MASK_ALT = 18;
- //HALFLING FEMALES
- const int FEMALE_HALF_HOOD_MASK = 3;
- const int FEMALE_HALF_HOOD = 9;
- const int FEMALE_HALF_HOOD_MASK_2 = 10; //Bioware Elf-Style
- //HALF_ELF MALES
- const int MALE_HELF_HOOD = 2;
- const int MALE_HELF_MASK = 31;
- const int MALE_HELF_HOOD_BEARD = 36;
- const int MALE_HELF_MASK_BIG = 47; //Large version of 31
- const int MALE_HELF_HELSING = 188; //Hat w/Mask
- //HALF_ELF FEMALES
- const int FEMALE_HELF_HOOD = 12;
- const int FEMALE_HELF_HOOD_MASK = 44;
- const int FEMALE_HELF_HOOD_MASK_JEWELS = 143; //looks arabian
- const int FEMALE_HELF_VISAS = 161; //Visas' head from KOTOR 2
- const int FEMALE_HELF_HOOD_HEADDRESS = 162; //Hood and decoration
- //HUMAN MALES
- const int MALE_HUMAN_HOOD = 2;
- const int MALE_HUMAN_MASK = 31;
- const int MALE_HUMAN_HOOD_BEARD = 36;
- const int MALE_HUMAN_ALT_MASK = 47;
- const int MALE_HUMAN_HELSING = 188; //Hat and Mask
- //HUMAN FEMALES
- const int FEMALE_HUMAN_HOOD = 12;
- const int FEMALE_HUMAN_HOOD_MASK = 44;
- const int FEMALE_HUMAN_HOOD_MASK_JEWELS = 143; //Arabian Look
- const int FEMALE_HUMAN_VISAS = 161; //Visas from KOTOR 2
- const int FEMALE_HUMAN_HOOD_HEADDRESS = 162; //Hood and Decoration
- //HALF-ORCS HAVE NO HOODS/MASKS :'(
- //------------------------------------------------------------------------------
- // Function Prototypes
- //------------------------------------------------------------------------------
- //This function retrieves the Gender and Racial Type of object oPC and combines
- //the value's into a single callable integer for the switch below. NOTE: Race and
- //gender are always 1 higher than in the .2da. So a Male Dwarf is "11", rather than
- //"00" (which would be invalid).
- int GetGenderRaceValue(object oPC);
- //This function set's oPC's Original Head number to a local variable stored on the
- //PC. This is mainly to function as a safety net to prevent the rest of the script
- //from turning one of the hood heads into the player's default head model.
- //This variable can be erased by a DM in case of permanent headchange.
- void SetPCOriginalHead(object oPC);
- //------------------------------------------------------------------------------
- // Function Implementation
- //------------------------------------------------------------------------------
- int GetGenderRaceValue(object oPC)
- {
- int iPCGender = GetGender(oPC) + 1; //Get's Gender, add's 1 to value
- int iPCRace = GetRacialType(oPC) + 1; //Get's Race, and add's 1 to value
- string sGenderRace = IntToString(iPCGender) + IntToString(iPCRace); //Converts iPCGender + iPCRace into
- //from two seperate integers into a single string
- int iGenderRace = StringToInt(sGenderRace); //Converts sGenderRace into an int we can then call from
- //a switch.
- return iGenderRace;
- }
- void SetPCOriginalHead(object oPC)
- {
- if (GetLocalInt(oPC, "jmt_OrigHeadChk")==TRUE) return; //Stops the function if it's already been fired
- {
- SetLocalInt(oPC, "jmt_PCOriginalHead", GetCreatureBodyPart(CREATURE_PART_HEAD, oPC)); //Set's the original head value
- SetLocalInt(oPC, "jmt_OrigHeadChk", TRUE); //Set's a "DoOnce" command that will prevent overwriting PC's default head
- SendMessageToPC(oPC, "Head has been checked and set to PC"); //Debug Code to Comment Out
- }
- }
- //------------------------------------------------------------------------------
- // Function Execution
- //------------------------------------------------------------------------------
- object oPC = GetPCSpeaker(); //Get's Conversation Speaker
- int iGenderRace = GetGenderRaceValue(oPC); //Call Custom Function
- int iCurrentHead = GetCreatureBodyPart(CREATURE_PART_HEAD, oPC); //Get's the current head
- void main()
- {
- //Begin safety check (prevent default head overwriting)
- SetPCOriginalHead(oPC); //Call our default head function
- //End safety check
- switch(iGenderRace) //Race and Gender Check
- {
- case 11: //Begin Male Dwarf Case Statement
- {
- switch(iCurrentHead) //Head Check & Switch. Since there's only one suitable Dwarf model,
- //There's only a default action.
- {
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_DWARF_HOOD_BEARD, oPC);
- }
- break; //End Male Dwarf Case Statement
- }
- case 21: //Begin Female Dwarf Case Statement
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 17: //Case 17 = FEMALE_DWARF_HOOD_GOATEE (The default head number that this
- //script switches a Female Dwarven PC's head too.)
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_DWARF_HOOD_BGOATEE, oPC);
- break;
- }
- case 19: //Case 19 = FEMALE_DWARF_HOOD_BGOATEE; this is how the cycle is carried through,
- //by specifying a case with the same model number as the head that the script
- //previously switched too.
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_DWARF_HOOD_NOGOATEE, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_DWARF_HOOD_GOATEE, oPC);
- }
- break;
- }
- case 12: //Male Elf
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 15:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_ELF_HOOD_LONGHAIR, oPC);
- break;
- }
- case 24:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_ELF_HOOD_MASK_LONGHAIR, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_ELF_HOOD_MASK, oPC);
- }
- break;
- }
- case 22: //Female Elf
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 14:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_ELF_HOOD_GALADRIEL, oPC);
- break;
- }
- case 34:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_ELF_HOOD_MASK_EYES, oPC);
- break;
- }
- case 46:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_ELF_HOOD_MEH, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_ELF_HOOD_MASK, oPC);
- }
- break;
- }
- case 13: //Male Gnome
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 14:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_GNOME_HOOD_MASK, oPC);
- break;
- }
- case 17:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_GNOME_MASK, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_GNOME_HOOD, oPC);
- }
- break;
- }
- case 23: //Female Gnome
- {
- switch(iCurrentHead)//Head Check & Switchh
- {
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_GNOME_HOOD, oPC);
- }
- break;
- }
- case 14: //Male Halfling
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 9:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HALF_HOOD, oPC);
- break;
- }
- case 11:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_MASK, oPC);
- break;
- }
- case 15:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HOOD_MASK_ALT, oPC);
- break;
- }
- case 17:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_MASK_ALT, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HALF_HOOD_MASK, oPC);
- }
- break;
- }
- case 24: //Female Halfling
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 3:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HALF_HOOD, oPC);
- break;
- }
- case 9:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HALF_HOOD_MASK_2, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HALF_HOOD_MASK, oPC);
- }
- break;
- }
- case 15: //Male Half-Elf
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 2:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HELF_MASK, oPC);
- break;
- }
- case 31:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HELF_HOOD_BEARD, oPC);
- break;
- }
- case 36:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HELF_MASK_BIG, oPC);
- break;
- }
- case 47:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HELF_HELSING, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HELF_HOOD, oPC);
- }
- break;
- }
- case 25: //Female Half-Elf
- {
- switch (iCurrentHead)//Head Check & Switch
- {
- case 12:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HELF_HOOD_MASK, oPC);
- break;
- }
- case 44:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HELF_HOOD_MASK_JEWELS, oPC);
- break;
- }
- case 143:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HELF_VISAS, oPC);
- break;
- }
- case 161:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HELF_HOOD_HEADDRESS, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HELF_HOOD, oPC);
- }
- break;
- }
- case 17: //Male Humans
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 2:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HUMAN_MASK, oPC);
- break;
- }
- case 31:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HUMAN_HOOD_BEARD, oPC);
- break;
- }
- case 36:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HUMAN_ALT_MASK, oPC);
- break;
- }
- case 47:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HUMAN_HELSING, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, MALE_HUMAN_HOOD, oPC);
- }
- break;
- }
- case 27: //Female Humans
- {
- switch(iCurrentHead)//Head Check & Switch
- {
- case 12:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HUMAN_HOOD_MASK, oPC);
- break;
- }
- case 44:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HUMAN_HOOD_MASK_JEWELS, oPC);
- break;
- }
- case 143:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HUMAN_VISAS, oPC);
- break;
- }
- case 161:
- {
- SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HUMAN_HOOD_HEADDRESS, oPC);
- break;
- }
- default: SetCreatureBodyPart(CREATURE_PART_HEAD, FEMALE_HUMAN_HOOD, oPC);
- }
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement