//::////////////////////////////////////////////// //:: Appearance changing dynamic conversation //:: appearconv.nss //::////////////////////////////////////////////// /** @file Conversation to change appearance Allows for add/remove wings/tails, head changes, portrait, and overall appearance @author Primogenitor @date Created - 2006.09.26 */ //::////////////////////////////////////////////// //::////////////////////////////////////////////// #include "prc_alterations" #include "inc_dynconv" ////////////////////////////////////////////////// /* Constant defintions */ ////////////////////////////////////////////////// const int STAGE_ENTRY = 0; const int STAGE_APPEARANCE = 510; const int STAGE_HEAD = 520; const int STAGE_WINGS = 530; const int STAGE_TAIL = 540; const int STAGE_BODYPART = 550; const int STAGE_BODYPART_CHANGE = 551; const int STAGE_PORTRAIT = 560; const int STAGE_EQUIPMENT = 590; const int STAGE_EQUIPMENT_SIMPLE = 591; //e.g. shield const int STAGE_EQUIPMENT_LAYERED = 592; //e.g. helm const int STAGE_EQUIPMENT_COMPOSITE = 593; //e.g. sword const int STAGE_EQUIPMENT_COMPOSITE_B = 594; const int STAGE_EQUIPMENT_ARMOR = 595; //e.g. armor const int CHOICE_RETURN_TO_PREVIOUS = 0xEFFFFFFF; ////////////////////////////////////////////////// /* Aid functions */ ////////////////////////////////////////////////// void AddPortraits(int nMin, int nMax, object oPC) { int i; string sName; for(i=nMin;i abort return; if(nValue == DYNCONV_SETUP_STAGE) { // Check if this stage is marked as already set up // This stops list duplication when scrolling if(!GetIsStageSetUp(nStage, oPC)) { // variable named nStage determines the current conversation node // Function SetHeader to set the text displayed to the PC // Function AddChoice to add a response option for the PC. The responses are show in order added if(nStage == STAGE_ENTRY) { // Set the header SetHeader("What aspect of your appearance do you wish to alter?"); // Add responses for the PC AddChoice("Model", 1, oPC); int bCanHaveWings; int bCanHaveTail; string sModelType = Get2DACache("appearance", "MODELTYPE", GetAppearanceType(oPC)); if(sModelType == "P") { bCanHaveTail=TRUE; bCanHaveWings=TRUE; } else { if(TestStringAgainstPattern("**W**", sModelType)) bCanHaveWings=TRUE; if(TestStringAgainstPattern("**T**", sModelType)) bCanHaveTail=TRUE; } if(sModelType == "P") AddChoice("Head", 2, oPC); if(bCanHaveWings) AddChoice("Wings", 3, oPC); if(bCanHaveTail) AddChoice("Tail", 4, oPC); if(sModelType == "P") AddChoice("Other bodypart including tattoos", 5, oPC); if(bCanHaveTail) AddChoice("Portrait", 6, oPC); AddChoice("Equipment", 7, oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_APPEARANCE) { SetHeader("Select an appearance to assume"); AddChoice("Return to previous", CHOICE_RETURN_TO_PREVIOUS, oPC); AddAppearances(0, GetPRCSwitch(FILE_END_APPEARANCE), oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_HEAD) { SetHeader("Select a head"); AddChoice("Return to previous step", CHOICE_RETURN_TO_PREVIOUS, oPC); AddChoice("Goto first head", 1, oPC); AddChoice("Next head", 2, oPC); if(GetCreatureBodyPart(CREATURE_PART_HEAD, oPC) > 0) AddChoice("Previous head", 3, oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_WINGS) { SetHeader(""); AddChoice("Return to previous step", CHOICE_RETURN_TO_PREVIOUS, oPC); AddWings(0, GetPRCSwitch(FILE_END_WINGS), oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_TAIL) { SetHeader(""); AddChoice("Return to previous step", CHOICE_RETURN_TO_PREVIOUS, oPC); AddTails(0, GetPRCSwitch(FILE_END_TAILS), oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_BODYPART) { SetHeader("Which bodypart?"); AddChoice("Return to previous step", CHOICE_RETURN_TO_PREVIOUS, oPC); AddChoice("Right shin", CREATURE_PART_RIGHT_SHIN, oPC); AddChoice("Left shin", CREATURE_PART_LEFT_SHIN, oPC); AddChoice("Right thigh", CREATURE_PART_RIGHT_THIGH, oPC); AddChoice("Left thigh", CREATURE_PART_LEFT_THIGH, oPC); AddChoice("Torso", CREATURE_PART_TORSO, oPC); AddChoice("Right forearm", CREATURE_PART_RIGHT_FOREARM, oPC); AddChoice("Left forearm", CREATURE_PART_LEFT_FOREARM, oPC); AddChoice("Right bicep", CREATURE_PART_RIGHT_BICEP, oPC); AddChoice("Left bicep", CREATURE_PART_LEFT_BICEP, oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_BODYPART_CHANGE) { SetHeader("Select a change"); AddChoice("Return to previous step", CHOICE_RETURN_TO_PREVIOUS, oPC); AddChoice("Goto first bodypart", 1, oPC); AddChoice("Next bodypart", 2, oPC); int nPart = GetLocalInt(oPC, "BodypartToChange"); if(GetCreatureBodyPart(nPart, oPC) > 0) AddChoice("Previous bodypart", 3, oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_PORTRAIT) { SetHeader("Select a portrait"); AddChoice("Return to previous step", CHOICE_RETURN_TO_PREVIOUS, oPC); AddPortraits(0, GetPRCSwitch(FILE_END_PORTRAITS), oPC); MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values } else if(nStage == STAGE_EQUIPMENT) { SetHeader("Select a piece of equipment to modify"); AddChoice("Return to previous step", CHOICE_RETURN_TO_PREVIOUS, oPC); if(!array_exists(oPC, "PRC_ItemsToUse")) { array_create(oPC, "PRC_ItemsToUse"); int nSlot; for(nSlot = 0; nSlot < 14; nSlot++) { object oItem = GetItemInSlot(nSlot, oPC); //only modify identified items if(GetIsObjectValid(oItem) && GetIdentified(oItem)) { AddChoice(GetName(oItem), array_get_size(oPC, "PRC_ItemsToUse")); array_set_object(oPC, "PRC_ItemsToUse", array_get_size(oPC, "PRC_ItemsToUse"), oItem); } } object oItem = GetFirstItemInInventory(oPC); while(GetIsObjectValid(oItem)) { //only modify identified items if(GetIdentified(oItem)) { AddChoice(GetName(oItem), array_get_size(oPC, "PRC_ItemsToUse")); array_set_object(oPC, "PRC_ItemsToUse", array_get_size(oPC, "PRC_ItemsToUse"), oItem); } oItem = GetNextItemInInventory(oPC); } } else { int i; for(i=0;i