///////////////////////////////// // RANDOM QUEST & EVENT SYSTEM // // by Grani (Taro) // ///////////////////////////////// // This library contains functions for managing stuff related with random events/quests and associated NPCs. // Utilizing these functions in a manner varying from their intended purpose might result in unexpected or unnecessary behavior. #include "x4_inc_functions" #include "x0_i0_henchman" #include "x2_inc_itemprop" //Generate a random name for an NPC based on race (hu, he, ho, el, dw, gn, ha) and sex (m, f) string GenerateNPCName(string sSex, string sRace); //Generate a random last name for an NPC based on race (hu, he, ho, el, dw, gn, ha) string GenerateNPCLastName(string sRace); //Check if the quest is failed int GetIsQuestFailed(object oPC); //Check if the quest is complete int GetIsQuestComplete(object oPC); //Add a quest journal entry for a PC void AddRandomQuestJournalEntry(object oPC, int nProgression=1); //Get PC and module's difficulty adjusted difficulty class for role-playing skills checks int GetAdjustedSkillDC(object oPC); //Sets custom tokens for conversations and journal entries regarding dynamic quest data - this should be done just before the tokens are used void SetQuestTokens(object oPC); //Set intel tokens (used in inn-keepers' conversations) void SetIntelTokens(object oPC); //Set intel tokens about one of the stored NPCs (used in inn-keepers' conversations) void SetStoredIntelTokens(object oPC, int nPosition); //Set tokens used in gaining intel about famous NPC adventurers void SetAdventurerTokens(object oPC, int nPosition); //Deletes all quest data of a PC void DeleteQuest(object oPC); //Generate a quest for a PC void GenerateQuest(object oPC, object oClient, string sRegion, string sTown=""); //Randomly select an item for a PC other than ammo and throwing weapons, taking their level into account string GenerateRandomItem(object oPC); //Deletes all the NPC data in a given slot of a PC's database - provide PC's database void DeleteStoredNPC(string sDB, int nPosition); //Deletes all the adventurer NPC data in a given slot of a the module's database void DeleteAdventurerNPC(int nPosition); //Stores an NPC in the database of a PC which spawned it - to be used only on specific NPCs void StoreQuestNPC(object oNPC); //Spawns an NPC stored in a PC's database, occupying the slot corresponding to nPosition (1, 2 or 3) object SpawnStoredNPC(object oPC, int nPosition, location lLocation); //Spawn an adventurer NPC from a database object SpawnAdventurerNPC(int nPosition, location lLocation); //Generate an NPC for a quest; returns TRUE on successful NPC generation; int GenerateFreshQuestNPC(object oPC, int nRaceType=RACIAL_TYPE_ALL); //Generate an adventurer NPC int GenerateAdventurerNPC(int nPosition, int nRaceType=RACIAL_TYPE_ALL); //Spawns a quest NPC. It does NOT check if the PC is present in a region in which the NPC is supposed to spawn; this needs to be done externally object SpawnFreshQuestNPC(object oPC, location lLocation); //Randomly select a gem based on the creature's level string GenerateRandomGem(object oCreature); //Randomly select a potion based on the creature's level string GenerateRandomPotion(object oCreature); //Randomly select a rune based on the creature's level string GenerateRandomRune(object oCreature); //Randomly select a miscellaneous item string GenerateRandomMiscItem(); //Randomly spawn item(s) on creature to be looted/stolen from generated mobs void SpawnRandomNPCLoot(object oCreature); //Spawn quest NPCs in an area identified by a given area string void SpawnQuest(object oPC, string sAreaString); //Spawn a client NPC for the purpose of an escort quest object SpawnEscortedClient(object oPC); //Retrieve an escorted client if appropriate - should be put in OnEnter event of a general random area object RetrieveClient(object oPC); //Destroy an escorted client - to be used in OnEnter event of an area to which a PC exits from random areas (and in OnDeath, along with failing the quest) void DestroyEscortedClient(object oPC); //Functions are implemented below. //Generate a random name for an NPC based on race (hu, he, ho, el, dw, gn, ha) and sex (m, f) string GenerateNPCName(string sSex, string sRace) { string sName; if (sRace == "hu" && sSex == "m") { switch (Random(30)) { case 0: sName = "Hinz"; break; case 1: sName = "Edward"; break; case 2: sName = "Morven"; break; case 3: sName = "Algar"; break; case 4: sName = "Chappel"; break; case 5: sName = "Alvaro"; break; case 6: sName = "Timon"; break; case 7: sName = "Carleton"; break; case 8: sName = "Osbert"; break; case 9: sName = "Vollert"; break; case 10: sName = "Barnard"; break; case 11: sName = "Finn"; break; case 12: sName = "Laux"; break; case 13: sName = "Ernesto"; break; case 14: sName = "Mircha"; break; case 15: sName = "Hadrian"; break; case 16: sName = "Terry"; break; case 17: sName = "Reed"; break; case 18: sName = "Milten"; break; case 19: sName = "Sinjin"; break; case 20: sName = "Fulbert"; break; case 21: sName = "Austyn"; break; case 22: sName = "Treves"; break; case 23: sName = "Volkan"; break; case 24: sName = "Othmar"; break; case 25: sName = "Colyn"; break; case 26: sName = "Andre"; break; case 27: sName = "Alden"; break; case 28: sName = "Sebert"; break; case 29: sName = "Duron"; break; } } if (sRace == "hu" && sSex == "f") { switch (Random(30)) { case 0: sName = "Margery"; break; case 1: sName = "Aillsa"; break; case 2: sName = "Lore"; break; case 3: sName = "Mireya"; break; case 4: sName = "Perla"; break; case 5: sName = "Gilla"; break; case 6: sName = "Clarissa"; break; case 7: sName = "Daniella"; break; case 8: sName = "Velda"; break; case 9: sName = "Laverne"; break; case 10: sName = "Melody"; break; case 11: sName = "Imani"; break; case 12: sName = "Zilli"; break; case 13: sName = "Orlina"; break; case 14: sName = "Solvig"; break; case 15: sName = "Klementia"; break; case 16: sName = "Sylvia"; break; case 17: sName = "Feli"; break; case 18: sName = "Christa"; break; case 19: sName = "Minta"; break; case 20: sName = "Tonja"; break; case 21: sName = "Anahi"; break; case 22: sName = "Elena"; break; case 23: sName = "Vroni"; break; case 24: sName = "Paola"; break; case 25: sName = "Daniela"; break; case 26: sName = "Emilia"; break; case 27: sName = "Mayra"; break; case 28: sName = "Xandra"; break; case 29: sName = "Yuliana"; break; } } if (sRace == "ha" && sSex == "m") { switch (Random(30)) { case 0: sName = "Sharner"; break; case 1: sName = "Jonad"; break; case 2: sName = "Quoumo"; break; case 3: sName = "Irafer"; break; case 4: sName = "Halton"; break; case 5: sName = "Janzu"; break; case 6: sName = "Wenser"; break; case 7: sName = "River"; break; case 8: sName = "Falkin"; break; case 9: sName = "Telan"; break; case 10: sName = "Goric"; break; case 11: sName = "Ellan"; break; case 12: sName = "Garwan"; break; case 13: sName = "Danry"; break; case 14: sName = "Finfer"; break; case 15: sName = "Linser"; break; case 16: sName = "Vinras"; break; case 17: sName = "Halret"; break; case 18: sName = "Kaskin"; break; case 19: sName = "Merster"; break; case 20: sName = "Lakas"; break; case 21: sName = "Teret"; break; case 22: sName = "Yartran"; break; case 23: sName = "Zenzin"; break; case 24: sName = "Erfire"; break; case 25: sName = "Norrich"; break; case 26: sName = "Falnad"; break; case 27: sName = "Norumo"; break; case 28: sName = "Flynkin"; break; case 29: sName = "Ewrick"; break; } } if (sRace == "ha" && sSex == "f") { switch (Random(30)) { case 0: sName = "Jayfira"; break; case 1: sName = "Kelzana"; break; case 2: sName = "Marzira"; break; case 3: sName = "Arikis"; break; case 4: sName = "Yojen"; break; case 5: sName = "Neyra"; break; case 6: sName = "Gelree"; break; case 7: sName = "Idane"; break; case 8: sName = "Vasica"; break; case 9: sName = "Paelile"; break; case 10: sName = "Calcey"; break; case 11: sName = "Fenne"; break; case 12: sName = "Malvira"; break; case 13: sName = "Fensica"; break; case 14: sName = "Yoola"; break; case 15: sName = "Hasira"; break; case 16: sName = "Darlyse"; break; case 17: sName = "Eralie"; break; case 18: sName = "Vaelle"; break; case 19: sName = "Hada"; break; case 20: sName = "Frozana"; break; case 21: sName = "Gelri"; break; case 22: sName = "Verphina"; break; case 23: sName = "Kithsica"; break; case 24: sName = "Zefris"; break; case 25: sName = "Maemia"; break; case 26: sName = "Rosla"; break; case 27: sName = "Belvira"; break; case 28: sName = "Dargwen"; break; case 29: sName = "Quni"; break; } } if (sRace == "ho" && sSex == "m") { switch (Random(30)) { case 0: sName = "Hinz"; break; case 1: sName = "Edward"; break; case 2: sName = "Morven"; break; case 3: sName = "Algar"; break; case 4: sName = "Chappel"; break; case 5: sName = "Alvaro"; break; case 6: sName = "Timon"; break; case 7: sName = "Carleton"; break; case 8: sName = "Osbert"; break; case 9: sName = "Vollert"; break; case 10: sName = "Barnard"; break; case 11: sName = "Finn"; break; case 12: sName = "Laux"; break; case 13: sName = "Ernesto"; break; case 14: sName = "Mircha"; break; case 15: sName = "Gorubur"; break; case 16: sName = "Horom"; break; case 17: sName = "Gin"; break; case 18: sName = "Crugark"; break; case 19: sName = "Asiglar"; break; case 20: sName = "Kilitar"; break; case 21: sName = "Grumeruk"; break; case 22: sName = "Marabur"; break; case 23: sName = "Ganunar"; break; case 24: sName = "Dorazur"; break; case 25: sName = "Asubash"; break; case 26: sName = "Oguidurk"; break; case 27: sName = "Hogigul"; break; case 28: sName = "Renamar"; break; case 29: sName = "Garsh"; break; } } if (sRace == "ho" && sSex == "f") { switch (Random(30)) { case 0: sName = "Margery"; break; case 1: sName = "Aillsa"; break; case 2: sName = "Lore"; break; case 3: sName = "Mireya"; break; case 4: sName = "Perla"; break; case 5: sName = "Gilla"; break; case 6: sName = "Clarissa"; break; case 7: sName = "Daniella"; break; case 8: sName = "Velda"; break; case 9: sName = "Laverne"; break; case 10: sName = "Melody"; break; case 11: sName = "Imani"; break; case 12: sName = "Zilli"; break; case 13: sName = "Orlina"; break; case 14: sName = "Solvig"; break; case 15: sName = "Arigh"; break; case 16: sName = "Rawizi"; break; case 17: sName = "Vanetur"; break; case 18: sName = "Grazi"; break; case 19: sName = "Katime"; break; case 20: sName = "Zonesh"; break; case 21: sName = "Tamimi"; break; case 22: sName = "Kirurook"; break; case 23: sName = "Rasotah"; break; case 24: sName = "Rahiti"; break; case 25: sName = "Arori"; break; case 26: sName = "Zonizura"; break; case 27: sName = "Rashimira"; break; case 28: sName = "Kanchu"; break; case 29: sName = "Semotah"; break; } } if (sRace == "gn" && sSex == "m") { switch (Random(30)) { case 0: sName = "Tanwin"; break; case 1: sName = "Orzu"; break; case 2: sName = "Ervyn"; break; case 3: sName = "Yospos"; break; case 4: sName = "Graziver"; break; case 5: sName = "Zilpip"; break; case 6: sName = "Lantor"; break; case 7: sName = "Grapos"; break; case 8: sName = "Brifan"; break; case 9: sName = "Toziver"; break; case 10: sName = "Ianmorn"; break; case 11: sName = "Jedri"; break; case 12: sName = "Ianbis"; break; case 13: sName = "Valben"; break; case 14: sName = "Zilcryn"; break; case 15: sName = "Farlen"; break; case 16: sName = "Kascorin"; break; case 17: sName = "Farston"; break; case 18: sName = "Panagim"; break; case 19: sName = "Farrick"; break; case 20: sName = "Sagrim"; break; case 21: sName = "Davybar"; break; case 22: sName = "Vorpos"; break; case 23: sName = "Bilrick"; break; case 24: sName = "Brixif"; break; case 25: sName = "Bilhim"; break; case 26: sName = "Tranan"; break; case 27: sName = "Callen"; break; case 28: sName = "Jorgrim"; break; case 29: sName = "Alni"; break; } } if (sRace == "gn" && sSex == "f") { switch (Random(30)) { case 0: sName = "Xahani"; break; case 1: sName = "Helnove"; break; case 2: sName = "Daphipine"; break; case 3: sName = "Myrhana"; break; case 4: sName = "Galmiphi"; break; case 5: sName = "Heldira"; break; case 6: sName = "Zinmyn"; break; case 7: sName = "Jelphina"; break; case 8: sName = "Lorixi"; break; case 9: sName = "Carla"; break; case 10: sName = "Fentra"; break; case 11: sName = "Hesmila"; break; case 12: sName = "Reqaryn"; break; case 13: sName = "Tabi"; break; case 14: sName = "Trinove"; break; case 15: sName = "Nyna"; break; case 16: sName = "Nidira"; break; case 17: sName = "Vofi"; break; case 18: sName = "Venceli"; break; case 19: sName = "Selsany"; break; case 20: sName = "Minkini"; break; case 21: sName = "Orna"; break; case 22: sName = "Lillin"; break; case 23: sName = "Krinoa"; break; case 24: sName = "Phinoa"; break; case 25: sName = "Qizyre"; break; case 26: sName = "Trifi"; break; case 27: sName = "Galna"; break; case 28: sName = "Selli"; break; case 29: sName = "Celfi"; break; } } if (sRace == "dw" && sSex == "m") { switch (Random(30)) { case 0: sName = "Melmar"; break; case 1: sName = "Raggrun"; break; case 2: sName = "Krammyr"; break; case 3: sName = "Bannur"; break; case 4: sName = "Hargron"; break; case 5: sName = "Bendain"; break; case 6: sName = "Fartharm"; break; case 7: sName = "Rotrim"; break; case 8: sName = "Bermin"; break; case 9: sName = "Thorryl"; break; case 10: sName = "Tornum"; break; case 11: sName = "Dulkam"; break; case 12: sName = "Ragthrum"; break; case 13: sName = "Krammond"; break; case 14: sName = "Grilmar"; break; case 15: sName = "Armgus"; break; case 16: sName = "Vondir"; break; case 17: sName = "Berrig"; break; case 18: sName = "Daerkohm"; break; case 19: sName = "Gerniv"; break; case 20: sName = "Gorgin"; break; case 21: sName = "Narkin"; break; case 22: sName = "Baivin"; break; case 23: sName = "Hugirel"; break; case 24: sName = "Daidal"; break; case 25: sName = "Gudlin"; break; case 26: sName = "Fuin"; break; case 27: sName = "Grím"; break; case 28: sName = "Din"; break; case 29: sName = "Mali"; break; } } if (sRace == "dw" && sSex == "f") { switch (Random(30)) { case 0: sName = "Gwynnar"; break; case 1: sName = "Tisva"; break; case 2: sName = "Tormura"; break; case 3: sName = "Brallelin"; break; case 4: sName = "Mistria"; break; case 5: sName = "Gymwyn"; break; case 6: sName = "Tislynn"; break; case 7: sName = "Maevtin"; break; case 8: sName = "Ardish"; break; case 9: sName = "Katwaen"; break; case 10: sName = "Lyssros"; break; case 11: sName = "Bretlyl"; break; case 12: sName = "Reddille"; break; case 13: sName = "Lassri"; break; case 14: sName = "Brillemura"; break; case 15: sName = "Gwandielle"; break; case 16: sName = "Barma"; break; case 17: sName = "Brylleris"; break; case 18: sName = "Brolsora"; break; case 19: sName = "Brytri"; break; case 20: sName = "Jynlyn"; break; case 21: sName = "Belleria"; break; case 22: sName = "Daerniss"; break; case 23: sName = "Nasmera"; break; case 24: sName = "Tizdielle"; break; case 25: sName = "Solmyla"; break; case 26: sName = "Maerbera"; break; case 27: sName = "Edmora"; break; case 28: sName = "Myrra"; break; case 29: sName = "Ingdelle"; break; } } if (sRace == "el" && sSex == "m") { switch (Random(30)) { case 0: sName = "Laythi"; break; case 1: sName = "Feradul"; break; case 2: sName = "Dar'Selquis"; break; case 3: sName = "Arievar"; break; case 4: sName = "Seather"; break; case 5: sName = "Mei'Arnis"; break; case 6: sName = "Eilevar"; break; case 7: sName = "Luequis"; break; case 8: sName = "Eilsel"; break; case 9: sName = "Seldre"; break; case 10: sName = "Sehthal"; break; case 11: sName = "Ye'Tiaavel"; break; case 12: sName = "Thervar"; break; case 13: sName = "Renrus"; break; case 14: sName = "Mil'Jarin"; break; case 15: sName = "Nusanael"; break; case 16: sName = "Verontril"; break; case 17: sName = "Ilvain"; break; case 18: sName = "Ryis"; break; case 19: sName = "Renus"; break; case 20: sName = "Thersel"; break; case 21: sName = "Nureth"; break; case 22: sName = "Vonlar"; break; case 23: sName = "Thaavelen"; break; case 24: sName = "Firreth"; break; case 25: sName = "Lorlen"; break; case 26: sName = "Ae'Corin"; break; case 27: sName = "Eillar"; break; case 28: sName = "Gilaias"; break; case 29: sName = "Ialis"; break; } } if (sRace == "el" && sSex == "f") { switch (Random(30)) { case 0: sName = "Alonnahel"; break; case 1: sName = "Sireth"; break; case 2: sName = "Iaothvanna"; break; case 3: sName = "Gaellia"; break; case 4: sName = "Tahloth"; break; case 5: sName = "Corya"; break; case 6: sName = "Tyreth"; break; case 7: sName = "Arillia"; break; case 8: sName = "Throvara"; break; case 9: sName = "Silvena"; break; case 10: sName = "Daentria"; break; case 11: sName = "Am'Aria"; break; case 12: sName = "Tha'Aelta"; break; case 13: sName = "Gwassel"; break; case 14: sName = "Esteledil"; break; case 15: sName = "Lúthes"; break; case 16: sName = "Coneth"; break; case 17: sName = "Laeben"; break; case 18: sName = "Medlí"; break; case 19: sName = "Sírbes"; break; case 20: sName = "Taerhel"; break; case 21: sName = "Ar'Assiela"; break; case 22: sName = "Merilhel"; break; case 23: sName = "Thirisdes"; break; case 24: sName = "Galneth"; break; case 25: sName = "Echuiwen"; break; case 26: sName = "Ioristhel"; break; case 27: sName = "Meridriel"; break; case 28: sName = "Arudriel"; break; case 29: sName = "Al'Firinel"; break; } } if (sRace == "he" && sSex == "m") { switch (Random(30)) { case 0: sName = "Hinz"; break; case 1: sName = "Edward"; break; case 2: sName = "Morven"; break; case 3: sName = "Algar"; break; case 4: sName = "Chappel"; break; case 5: sName = "Alvaro"; break; case 6: sName = "Timon"; break; case 7: sName = "Carleton"; break; case 8: sName = "Osbert"; break; case 9: sName = "Vollert"; break; case 10: sName = "Barnard"; break; case 11: sName = "Finn"; break; case 12: sName = "Laux"; break; case 13: sName = "Ernesto"; break; case 14: sName = "Mircha"; break; case 15: sName = "Nusanael"; break; case 16: sName = "Verontril"; break; case 17: sName = "Ilvain"; break; case 18: sName = "Ryis"; break; case 19: sName = "Renus"; break; case 20: sName = "Thersel"; break; case 21: sName = "Nureth"; break; case 22: sName = "Vonlar"; break; case 23: sName = "Thaavelen"; break; case 24: sName = "Firreth"; break; case 25: sName = "Lorlen"; break; case 26: sName = "Ae'Corin"; break; case 27: sName = "Eillar"; break; case 28: sName = "Gilaias"; break; case 29: sName = "Ialis"; break; } } if (sRace == "he" && sSex == "f") { switch (Random(30)) { case 0: sName = "Margery"; break; case 1: sName = "Aillsa"; break; case 2: sName = "Lore"; break; case 3: sName = "Mireya"; break; case 4: sName = "Perla"; break; case 5: sName = "Gilla"; break; case 6: sName = "Clarissa"; break; case 7: sName = "Daniella"; break; case 8: sName = "Velda"; break; case 9: sName = "Laverne"; break; case 10: sName = "Melody"; break; case 11: sName = "Imani"; break; case 12: sName = "Zilli"; break; case 13: sName = "Orlina"; break; case 14: sName = "Solvig"; break; case 15: sName = "Lúthes"; break; case 16: sName = "Coneth"; break; case 17: sName = "Laeben"; break; case 18: sName = "Medlí"; break; case 19: sName = "Sírbes"; break; case 20: sName = "Taerhel"; break; case 21: sName = "Ar'Assiela"; break; case 22: sName = "Merilhel"; break; case 23: sName = "Thirisdes"; break; case 24: sName = "Galneth"; break; case 25: sName = "Echuiwen"; break; case 26: sName = "Ioristhel"; break; case 27: sName = "Meridriel"; break; case 28: sName = "Arudriel"; break; case 29: sName = "Al'Firinel"; break; } } return sName; } //Generate a random last name for an NPC based on race string GenerateNPCLastName(string sRace) { string sLast1; string sLast2; string sLastName; if (sRace == "hu" || sRace == "ho") { switch (Random(15)) { case 0: sLast1 = "Strat"; break; case 1: sLast1 = "Buck"; break; case 2: sLast1 = "Ac"; break; case 3: sLast1 = "Knot"; break; case 4: sLast1 = "Adding"; break; case 5: sLast1 = "Sag"; break; case 6: sLast1 = "Oak"; break; case 7: sLast1 = "Suther"; break; case 8: sLast1 = "Cot"; break; case 9: sLast1 = "Gar"; break; case 10: sLast1 = "Craw"; break; case 11: sLast1 = "Ander"; break; case 12: sLast1 = "Hart"; break; case 13: sLast1 = "Crutch"; break; case 14: sLast1 = "Cle"; break; } switch (Random(15)) { case 0: sLast2 = "ney"; break; case 1: sLast2 = "ley"; break; case 2: sLast2 = "ton"; break; case 3: sLast2 = "ford"; break; case 4: sLast2 = "ner"; break; case 5: sLast2 = "ke"; break; case 6: sLast2 = "mons"; break; case 7: sLast2 = "dall"; break; case 8: sLast2 = "mes"; break; case 9: sLast2 = "bery"; break; case 10: sLast2 = "ens"; break; case 11: sLast2 = "with"; break; case 12: sLast2 = "ding"; break; case 13: sLast2 = "don"; break; case 14: sLast2 = "holm"; break; } } if (sRace == "ha") { switch (Random(15)) { case 0: sLast1 = "Amber"; break; case 1: sLast1 = "Far"; break; case 2: sLast1 = "Free"; break; case 3: sLast1 = "Little"; break; case 4: sLast1 = "Quick"; break; case 5: sLast1 = "Silver"; break; case 6: sLast1 = "Spring"; break; case 7: sLast1 = "Glitter"; break; case 8: sLast1 = "Brown"; break; case 9: sLast1 = "Many"; break; case 10: sLast1 = "Rain"; break; case 11: sLast1 = "Under"; break; case 12: sLast1 = "Fat"; break; case 13: sLast1 = "Good"; break; case 14: sLast1 = "Sun"; break; } switch (Random(15)) { case 0: sLast2 = "ale"; break; case 1: sLast2 = "brother"; break; case 2: sLast2 = "eye"; break; case 3: sLast2 = "shadow"; break; case 4: sLast2 = "stoat"; break; case 5: sLast2 = "arrow"; break; case 6: sLast2 = "burrow"; break; case 7: sLast2 = "fellow"; break; case 8: sLast2 = "goat"; break; case 9: sLast2 = "hearth"; break; case 10: sLast2 = "shaker"; break; case 11: sLast2 = "fingers"; break; case 12: sLast2 = "hill"; break; case 13: sLast2 = "flower"; break; case 14: sLast2 = "fox"; break; } } if (sRace == "gn") { switch (Random(15)) { case 0: sLast1 = "Wobble"; break; case 1: sLast1 = "Tink"; break; case 2: sLast1 = "Arcane"; break; case 3: sLast1 = "Grind"; break; case 4: sLast1 = "Black"; break; case 5: sLast1 = "Sad"; break; case 6: sLast1 = "Cast"; break; case 7: sLast1 = "Swift"; break; case 8: sLast1 = "Short"; break; case 9: sLast1 = "Bright"; break; case 10: sLast1 = "Tossle"; break; case 11: sLast1 = "Shine"; break; case 12: sLast1 = "Fast"; break; case 13: sLast1 = "Spry"; break; case 14: sLast1 = "Storm"; break; } switch (Random(15)) { case 0: sLast2 = "bonk"; break; case 1: sLast2 = "fuse"; break; case 2: sLast2 = "needle"; break; case 3: sLast2 = "fizz"; break; case 4: sLast2 = "bang"; break; case 5: sLast2 = "spring"; break; case 6: sLast2 = "whistle"; break; case 7: sLast2 = "steel"; break; case 8: sLast2 = "pipe"; break; case 9: sLast2 = "blast"; break; case 10: sLast2 = "spark"; break; case 11: sLast2 = "house"; break; case 12: sLast2 = "master"; break; case 13: sLast2 = "gauge"; break; case 14: sLast2 = "flame"; break; } } if (sRace == "el") { switch (Random(15)) { case 0: sLast1 = "Tal"; break; case 1: sLast1 = "Bera"; break; case 2: sLast1 = "Galon"; break; case 3: sLast1 = "Faelan"; break; case 4: sLast1 = "Mitha"; break; case 5: sLast1 = "Elen"; break; case 6: sLast1 = "Van"; break; case 7: sLast1 = "Felli"; break; case 8: sLast1 = "Fala"; break; case 9: sLast1 = "Alda"; break; case 10: sLast1 = "Undo"; break; case 11: sLast1 = "Tela"; break; case 12: sLast1 = "Ore"; break; case 13: sLast1 = "Ga"; break; case 14: sLast1 = "Kilyn"; break; } switch (Random(15)) { case 0: sLast2 = "del"; break; case 1: sLast2 = "nas"; break; case 2: sLast2 = "vir"; break; case 3: sLast2 = "dalan"; break; case 4: sLast2 = "gathir"; break; case 5: sLast2 = "dirryl"; break; case 6: sLast2 = "rina"; break; case 7: sLast2 = "thiel"; break; case 8: sLast2 = "thalion"; break; case 9: sLast2 = "'smaer"; break; case 10: sLast2 = "'loneme"; break; case 11: sLast2 = "'linail"; break; case 12: sLast2 = "'mirdal"; break; case 13: sLast2 = "gaas"; break; case 14: sLast2 = "leniel"; break; } } if (sRace == "dw") { switch (Random(15)) { case 0: sLast1 = "Under"; break; case 1: sLast1 = "Dim"; break; case 2: sLast1 = "Mud"; break; case 3: sLast1 = "Noble"; break; case 4: sLast1 = "Golden"; break; case 5: sLast1 = "Silver"; break; case 6: sLast1 = "Diamond"; break; case 7: sLast1 = "Steel"; break; case 8: sLast1 = "Gravel"; break; case 9: sLast1 = "Bone"; break; case 10: sLast1 = "Earth"; break; case 11: sLast1 = "Black"; break; case 12: sLast1 = "Beast"; break; case 13: sLast1 = "Wyvern"; break; case 14: sLast1 = "Deep"; break; } switch (Random(15)) { case 0: sLast2 = "buckle"; break; case 1: sLast2 = "brand"; break; case 2: sLast2 = "braid"; break; case 3: sLast2 = "axe"; break; case 4: sLast2 = "hide"; break; case 5: sLast2 = "gut"; break; case 6: sLast2 = "pike"; break; case 7: sLast2 = "fall"; break; case 8: sLast2 = "helm"; break; case 9: sLast2 = "chin"; break; case 10: sLast2 = "chest"; break; case 11: sLast2 = "hammer"; break; case 12: sLast2 = "guard"; break; case 13: sLast2 = "head"; break; case 14: sLast2 = "basher"; break; } } if (sRace == "he" && Random(2) == 1) { switch (Random(15)) { case 0: sLast1 = "Tal"; break; case 1: sLast1 = "Bera"; break; case 2: sLast1 = "Galon"; break; case 3: sLast1 = "Faelan"; break; case 4: sLast1 = "Mitha"; break; case 5: sLast1 = "Elen"; break; case 6: sLast1 = "Van"; break; case 7: sLast1 = "Felli"; break; case 8: sLast1 = "Fala"; break; case 9: sLast1 = "Alda"; break; case 10: sLast1 = "Undo"; break; case 11: sLast1 = "Tela"; break; case 12: sLast1 = "Ore"; break; case 13: sLast1 = "Ga"; break; case 14: sLast1 = "Kilyn"; break; } switch (Random(15)) { case 0: sLast2 = "del"; break; case 1: sLast2 = "nas"; break; case 2: sLast2 = "vir"; break; case 3: sLast2 = "dalan"; break; case 4: sLast2 = "gathir"; break; case 5: sLast2 = "dirryl"; break; case 6: sLast2 = "rina"; break; case 7: sLast2 = "thiel"; break; case 8: sLast2 = "thalion"; break; case 9: sLast2 = "'smaer"; break; case 10: sLast2 = "'loneme"; break; case 11: sLast2 = "'linail"; break; case 12: sLast2 = "'mirdal"; break; case 13: sLast2 = "gaas"; break; case 14: sLast2 = "leniel"; break; } } else if (sRace == "he") { switch (Random(15)) { case 0: sLast1 = "Strat"; break; case 1: sLast1 = "Buck"; break; case 2: sLast1 = "Ac"; break; case 3: sLast1 = "Knot"; break; case 4: sLast1 = "Adding"; break; case 5: sLast1 = "Sag"; break; case 6: sLast1 = "Oak"; break; case 7: sLast1 = "Suther"; break; case 8: sLast1 = "Cot"; break; case 9: sLast1 = "Gar"; break; case 10: sLast1 = "Craw"; break; case 11: sLast1 = "Ander"; break; case 12: sLast1 = "Hart"; break; case 13: sLast1 = "Crutch"; break; case 14: sLast1 = "Cle"; break; } switch (Random(15)) { case 0: sLast2 = "ney"; break; case 1: sLast2 = "ley"; break; case 2: sLast2 = "ton"; break; case 3: sLast2 = "ford"; break; case 4: sLast2 = "ner"; break; case 5: sLast2 = "ke"; break; case 6: sLast2 = "mons"; break; case 7: sLast2 = "dall"; break; case 8: sLast2 = "mes"; break; case 9: sLast2 = "bery"; break; case 10: sLast2 = "ens"; break; case 11: sLast2 = "with"; break; case 12: sLast2 = "ding"; break; case 13: sLast2 = "don"; break; case 14: sLast2 = "holm"; break; } } sLastName = sLast1+sLast2; return sLastName; } //Generate a random weapon of a given type, for a given level object RandomWeapon(int nNewEq, int nWeapon, object oNPC, int nOffhand=FALSE, int nWithShield=FALSE) { //Generate a base item object oWeapon; if (nWeapon == BASE_ITEM_BATTLEAXE) oWeapon = CreateItemOnObject("NW_WAXBT001", oNPC); if (nWeapon == BASE_ITEM_GREATAXE) oWeapon = CreateItemOnObject("NW_WAXGR001", oNPC); if (nWeapon == BASE_ITEM_GREATSWORD) oWeapon = CreateItemOnObject("NW_WSWGS001", oNPC); if (nWeapon == BASE_ITEM_HALBERD) oWeapon = CreateItemOnObject("NW_WPLHB001", oNPC); if (nWeapon == BASE_ITEM_HANDAXE) oWeapon = CreateItemOnObject("NW_WAXHN001", oNPC); if (nWeapon == BASE_ITEM_HEAVYFLAIL) oWeapon = CreateItemOnObject("NW_WBLFH001", oNPC); if (nWeapon == BASE_ITEM_LIGHTFLAIL) oWeapon = CreateItemOnObject("NW_WBLFL001", oNPC); if (nWeapon == BASE_ITEM_LIGHTHAMMER) oWeapon = CreateItemOnObject("NW_WBLHL001", oNPC); if (nWeapon == BASE_ITEM_LONGBOW) oWeapon = CreateItemOnObject("NW_WBWLN001", oNPC); if (nWeapon == BASE_ITEM_LONGSWORD) oWeapon = CreateItemOnObject("NW_WSWLS001", oNPC); if (nWeapon == BASE_ITEM_RAPIER) oWeapon = CreateItemOnObject("NW_WSWRP001", oNPC); if (nWeapon == BASE_ITEM_SCIMITAR) oWeapon = CreateItemOnObject("NW_WSWSC001", oNPC); if (nWeapon == BASE_ITEM_SHORTSWORD) oWeapon = CreateItemOnObject("NW_WSWSS001", oNPC); if (nWeapon == BASE_ITEM_SHORTBOW) oWeapon = CreateItemOnObject("NW_WBWSH001", oNPC); if (nWeapon == BASE_ITEM_TRIDENT) oWeapon = CreateItemOnObject("nw_wpltr001", oNPC); if (nWeapon == BASE_ITEM_WARHAMMER) oWeapon = CreateItemOnObject("NW_WBLHW001", oNPC); if (nWeapon == BASE_ITEM_BASTARDSWORD) oWeapon = CreateItemOnObject("NW_WSWBS001", oNPC); if (nWeapon == BASE_ITEM_DIREMACE) oWeapon = CreateItemOnObject("NW_WDBMA001", oNPC); if (nWeapon == BASE_ITEM_DWARVENWARAXE) oWeapon = CreateItemOnObject("X2_WDWRAXE001", oNPC); if (nWeapon == BASE_ITEM_DOUBLEAXE) oWeapon = CreateItemOnObject("NW_WDBAX001", oNPC); if (nWeapon == BASE_ITEM_KAMA) oWeapon = CreateItemOnObject("NW_WSPKA001", oNPC); if (nWeapon == BASE_ITEM_KATANA) oWeapon = CreateItemOnObject("NW_WSWKA001", oNPC); if (nWeapon == BASE_ITEM_KUKRI) oWeapon = CreateItemOnObject("NW_WSPKU001", oNPC); if (nWeapon == BASE_ITEM_SCYTHE) oWeapon = CreateItemOnObject("NW_WPLSC001", oNPC); if (nWeapon == BASE_ITEM_WHIP) oWeapon = CreateItemOnObject("X2_IT_WPWHIP", oNPC); if (nWeapon == BASE_ITEM_TWOBLADEDSWORD) oWeapon = CreateItemOnObject("NW_WDBSW001", oNPC); if (nWeapon == BASE_ITEM_DAGGER) oWeapon = CreateItemOnObject("NW_WSWDG001", oNPC); if (nWeapon == BASE_ITEM_HEAVYCROSSBOW) oWeapon = CreateItemOnObject("NW_WBWXH001", oNPC); if (nWeapon == BASE_ITEM_LIGHTCROSSBOW) oWeapon = CreateItemOnObject("NW_WBWXL001", oNPC); if (nWeapon == BASE_ITEM_LIGHTMACE) oWeapon = CreateItemOnObject("NW_WBLML001", oNPC); if (nWeapon == BASE_ITEM_SICKLE) oWeapon = CreateItemOnObject("NW_WSPSC001", oNPC); if (nWeapon == BASE_ITEM_MORNINGSTAR) oWeapon = CreateItemOnObject("NW_WBLMS001", oNPC); //Get the level of the NPC and use it to determine maximum possible enhancement int nLevel = GetHitDice(oNPC); int nMaxEnhancement; if (nLevel <= 3) nMaxEnhancement = 0; else if (nLevel <= 5) nMaxEnhancement = 1; else if (nLevel <= 7) nMaxEnhancement = 2; else if (nLevel <= 9) nMaxEnhancement = 3; else if (nLevel <= 11) nMaxEnhancement = 4; else if (nLevel <= 17) nMaxEnhancement = 5; else if (nLevel <= 19) nMaxEnhancement = 6; else nMaxEnhancement = 7; if (nWithShield) nMaxEnhancement = nMaxEnhancement -1; if (nOffhand) nMaxEnhancement = nMaxEnhancement - 2; if (nMaxEnhancement > 5) nMaxEnhancement = 5; if (nMaxEnhancement < 0) nMaxEnhancement = 0; if (nNewEq == FALSE && nOffhand == FALSE) nMaxEnhancement == GetLocalInt(oNPC, "nMaxEnhancement"); if (nNewEq == FALSE && nOffhand == TRUE) nMaxEnhancement == GetLocalInt(oNPC, "nMaxEnhancement_off"); //If we're only retrieving previous equipment... itemproperty iBonus1; itemproperty iBonus2; int nDamageType; string sBonusType; int nBonusValue; int nParameter; int nBonus1; string sBonus2; //These will be saved and stored on the NPC to be retrieved later if needed (i.e. to make sure the NPC keeps the same weapon if met again (respawned) ) if (nNewEq == FALSE) { if (nOffhand == FALSE) nBonus1 = GetLocalInt(oNPC, "nBonus1"); else nBonus1 = GetLocalInt(oNPC, "nBonus1_off"); if (nOffhand == FALSE) sBonus2 = GetLocalString(oNPC, "sBonus2"); else sBonus2 = GetLocalString(oNPC, "sBonus2_off"); if (sBonus2 == "pure") { iBonus1 = ItemPropertyEnhancementBonus(nMaxEnhancement); IPSafeAddItemProperty(oWeapon, iBonus1); } else { if (nOffhand == FALSE) nDamageType = GetLocalInt(oNPC, "nDamageType"); if (nOffhand == TRUE) nDamageType = GetLocalInt(oNPC, "nDamageType_off"); if (nBonus1 != 0) iBonus1 = ItemPropertyEnhancementBonus(nBonus1); //The Bonus2 parameter needs to be separated into type and value; we only need the last letter of the string as a bonus value, because it will be used for reg only sBonusType = GetStringLeft(sBonus2, 3); nBonusValue = StringToInt(GetStringRight(sBonus2, 1)); if (sBonus2 == "dmg3") nParameter = IP_CONST_DAMAGEBONUS_3; if (sBonus2 == "dmg4") nParameter = IP_CONST_DAMAGEBONUS_4; if (sBonus2 == "dmg5") nParameter = IP_CONST_DAMAGEBONUS_5; if (sBonus2 == "dmg6") nParameter = IP_CONST_DAMAGEBONUS_6; if (sBonus2 == "dmg7") nParameter = IP_CONST_DAMAGEBONUS_7; if (sBonus2 == "dmg8") nParameter = IP_CONST_DAMAGEBONUS_8; if (sBonus2 == "dmg9") nParameter = IP_CONST_DAMAGEBONUS_9; if (sBonus2 == "dmg10") nParameter = IP_CONST_DAMAGEBONUS_10; if (sBonus2 == "dmg12") nParameter = 22; if (sBonusType == "dmg") iBonus2 = ItemPropertyDamageBonus(nDamageType, nParameter); if (sBonusType == "reg") iBonus2 = ItemPropertyVampiricRegeneration(nBonusValue); if (nBonus1 != 0) IPSafeAddItemProperty(oWeapon, iBonus1); IPSafeAddItemProperty(oWeapon, iBonus2); } } else { //Add max enhancement (50% of the time), max damage of some elemental type, max vampiric regeneration or a mixture of enhancement and one of the latter properties if (d2() == 1 && nMaxEnhancement != 0) { sBonus2 = "pure"; iBonus1 = ItemPropertyEnhancementBonus(nMaxEnhancement); IPSafeAddItemProperty(oWeapon, iBonus1); } else { switch (Random(6)) { case 0: nDamageType = IP_CONST_DAMAGETYPE_FIRE; break; case 1: nDamageType = IP_CONST_DAMAGETYPE_ACID; break; case 2: nDamageType = IP_CONST_DAMAGETYPE_COLD; break; case 3: nDamageType = IP_CONST_DAMAGETYPE_DIVINE; break; case 4: nDamageType = IP_CONST_DAMAGETYPE_ELECTRICAL; break; case 5: nDamageType = IP_CONST_DAMAGETYPE_SONIC; break; } if (nMaxEnhancement == 5) { switch (Random(9)) { case 0: iBonus1 = ItemPropertyEnhancementBonus(4); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_4); nBonus1 = 4; sBonus2 = "dmg4"; break; case 1: iBonus1 = ItemPropertyEnhancementBonus(3); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_6); nBonus1 = 3; sBonus2 = "dmg6"; break; case 2: iBonus1 = ItemPropertyEnhancementBonus(2); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_8); nBonus1 = 2; sBonus2 = "dmg8"; break; case 3: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_10); nBonus1 = 1; sBonus2 = "dmg10"; break; case 4: iBonus2 = ItemPropertyDamageBonus(nDamageType, 22); nBonus1 = 0; sBonus2 = "dmg12"; break; //22 is the value of +12 damage bonus - it has no constant assigned case 5: iBonus1 = ItemPropertyEnhancementBonus(4); iBonus2 = ItemPropertyVampiricRegeneration(4); nBonus1 = 4; sBonus2 = "reg4"; break; case 6: iBonus1 = ItemPropertyEnhancementBonus(3); iBonus2 = ItemPropertyVampiricRegeneration(5); nBonus1 = 3; sBonus2 = "reg5"; break; case 7: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyVampiricRegeneration(6); nBonus1 = 1; sBonus2 = "reg6"; break; case 8: iBonus2 = ItemPropertyVampiricRegeneration(7); nBonus1 = 0; sBonus2 = "reg7"; break; } } if (nMaxEnhancement == 4) { switch (Random(7)) { case 0: iBonus1 = ItemPropertyEnhancementBonus(3); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_3); nBonus1 = 3; sBonus2 = "dmg3"; break; case 1: iBonus1 = ItemPropertyEnhancementBonus(2); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_5); nBonus1 = 2; sBonus2 = "dmg5"; break; case 2: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_7); nBonus1 = 1; sBonus2 = "dmg7"; break; case 3: iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_9); nBonus1 = 0; sBonus2 = "dmg9"; break; case 4: iBonus1 = ItemPropertyEnhancementBonus(3); iBonus2 = ItemPropertyVampiricRegeneration(2); nBonus1 = 3; sBonus2 = "reg2"; break; case 5: iBonus1 = ItemPropertyEnhancementBonus(2); iBonus2 = ItemPropertyVampiricRegeneration(4); nBonus1 = 2; sBonus2 = "reg4"; break; case 6: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyVampiricRegeneration(5); nBonus1 = 1; sBonus2 = "reg5"; break; } } if (nMaxEnhancement == 3) { switch (Random(6)) { case 0: iBonus1 = ItemPropertyEnhancementBonus(2); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_3); nBonus1 = 2; sBonus2 = "dmg3"; break; case 1: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_5); nBonus1 = 1; sBonus2 = "dmg5"; break; case 2: iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_7); nBonus1 = 0; sBonus2 = "dmg7"; break; case 3: iBonus1 = ItemPropertyEnhancementBonus(2); iBonus2 = ItemPropertyVampiricRegeneration(2); nBonus1 = 2; sBonus2 = "reg2"; break; case 4: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyVampiricRegeneration(4); nBonus1 = 1; sBonus2 = "reg4"; break; case 5: iBonus2 = ItemPropertyVampiricRegeneration(5); nBonus1 = 0; sBonus2 = "reg5"; break; } } if (nMaxEnhancement == 2) { switch (Random(4)) { case 0: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_3); nBonus1 = 1; sBonus2 = "dmg3"; break; case 1: iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_5); nBonus1 = 0; sBonus2 = "dmg5"; break; case 2: iBonus1 = ItemPropertyEnhancementBonus(1); iBonus2 = ItemPropertyVampiricRegeneration(2); nBonus1 = 1; sBonus2 = "reg2"; break; case 3: iBonus2 = ItemPropertyVampiricRegeneration(4); nBonus1 = 0; sBonus2 = "reg4"; break; } } if (nMaxEnhancement == 1) { switch (Random(2)) { case 0: iBonus2 = ItemPropertyDamageBonus(nDamageType, IP_CONST_DAMAGEBONUS_3); nBonus1 = 0; sBonus2 = "dmg3"; break; case 1: iBonus2 = ItemPropertyVampiricRegeneration(2); nBonus1 = 0; sBonus2 = "reg2"; break; } } if (nMaxEnhancement != 0) { if (nBonus1 != 0) IPSafeAddItemProperty(oWeapon, iBonus1); IPSafeAddItemProperty(oWeapon, iBonus2); } } } //Store weapon info on the NPC if (nNewEq) { if (nOffhand) { SetLocalInt(oNPC, "nBonus1_off", nBonus1); SetLocalString(oNPC, "sBonus2_off", sBonus2); SetLocalString(oNPC, "sWeapon_off", GetTag(oWeapon)); SetLocalInt(oNPC, "nMaxEnhancement_off", nMaxEnhancement); SetLocalInt(oNPC, "nDamageType_off", nDamageType); } else { SetLocalInt(oNPC, "nBonus1", nBonus1); SetLocalString(oNPC, "sBonus2", sBonus2); SetLocalString(oNPC, "sWeapon", GetTag(oWeapon)); SetLocalInt(oNPC, "nMaxEnhancement", nMaxEnhancement); SetLocalInt(oNPC, "nDamageType", nDamageType); } } return oWeapon; } //Generate suitable equipment for a given NPC and equip it void GenerateEquipmentForNPC(int nNewEq, object oNPC, string sArchetype, string sSubtype, string sEqType, int nSkin, int nCloakVisible, int nHelmetVisible=FALSE, int nWeapon=-1, int nOffhand=-1) { int nLevel = GetHitDice(oNPC); object oWeapon; object oOffhand; //needed to ensure oWeapon is equipped as a main weapon and oOffhand as an off-hand item object oCloak; //needed to turn the cloak invisible and store the cloak's resref string sReductionCloak = "null"; //needed to ensure the NPC won't switch cloaks when met for a second time (respawned) object oArmor; //needed to ensure the NPC won't switch armors when met for a second time (respawned) //Archetype and subtype specific equipment if (sArchetype == "fight") { if (sSubtype == "shield") { oWeapon = RandomWeapon(nNewEq, nWeapon, oNPC, FALSE, TRUE); //Main weapon if (nLevel <= 3) { CreateItemOnObject("NW_AARCL005", oNPC); //Banded mail if (GetCreatureSize(oNPC) == CREATURE_SIZE_SMALL) { oOffhand = CreateItemOnObject("NW_ASHLW001", oNPC); //Large shield } else oOffhand = CreateItemOnObject("NW_ASHTO001", oNPC); //...or a tower shield } else if (nLevel <= 7) { CreateItemOnObject("NW_AARCL007", oNPC); //Full plate if (GetCreatureSize(oNPC) == CREATURE_SIZE_SMALL) { oOffhand = CreateItemOnObject("NW_ASHLW001", oNPC); //Large shield } else oOffhand = CreateItemOnObject("NW_ASHTO001", oNPC); //...or a tower shield } else if (nLevel <= 13) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR036", oNPC); //Drow full plate +1 else CreateItemOnObject("NW_MAARCL053", oNPC); //Full plate +1 if (GetCreatureSize(oNPC) == CREATURE_SIZE_SMALL) { oOffhand = CreateItemOnObject("NW_ASHMLW002", oNPC); //Large shield +1 } else oOffhand = CreateItemOnObject("NW_ASHMTO002", oNPC); //...or a tower shield +1 } else if (nLevel <= 17) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR037", oNPC); //Drow full plate +2 else CreateItemOnObject("NW_MAARCL068", oNPC); //Full plate +2 if (GetCreatureSize(oNPC) == CREATURE_SIZE_SMALL) { oOffhand = CreateItemOnObject("NW_ASHMLW008", oNPC); //Large shield +2 } else oOffhand = CreateItemOnObject("NW_ASHMTO008", oNPC); //...or a tower shield +2 } else if (nLevel <= 19) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR037", oNPC); //Drow full plate +2 else CreateItemOnObject("NW_MAARCL068", oNPC); //Full plate +2 if (GetCreatureSize(oNPC) == CREATURE_SIZE_SMALL) { oOffhand = CreateItemOnObject("NW_ASHMLW009", oNPC); //Large shield +3 } else oOffhand = CreateItemOnObject("NW_ASHMTO009", oNPC); //...or a tower shield +3 } else { if (nSkin == 134) oArmor = CreateItemOnObject("anc_it_earmor5", oNPC); //Epic drow full plate else if (nSkin == 42) oArmor = CreateItemOnObject("anc_it_earmor6", oNPC); //Epic duergar full plate else if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else { switch (Random(4)) { case 0: oArmor = CreateItemOnObject("anc_it_earmor1", oNPC); break; //Epic full plate (rainbow metal) case 1: oArmor = CreateItemOnObject("anc_it_earmor2", oNPC); break; //Epic full plate (dark green) case 2: oArmor = CreateItemOnObject("anc_it_earmor3", oNPC); break; //Epic full plate (dark gold) case 3: oArmor = CreateItemOnObject("anc_it_earmor4", oNPC); break; //Epic full plate (dark violet/red) } } if (GetCreatureSize(oNPC) == CREATURE_SIZE_SMALL) { oOffhand = CreateItemOnObject("NW_ASHMLW009", oNPC); //Large shield +3 } else oOffhand = CreateItemOnObject("NW_ASHMTO009", oNPC); //...or tower shield +3 } } if (sSubtype == "large") { oWeapon = RandomWeapon(nNewEq, nWeapon, oNPC); //Main weapon if (nLevel <= 7) { CreateItemOnObject("NW_AARCL004", oNPC); //Chainmail } else if (nLevel <= 13) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR022", oNPC); //Drow chainmail +1 else CreateItemOnObject("NW_MAARCL035", oNPC); //Chainmail +1 } else if (nLevel <= 19) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR023", oNPC); //Drow chainmail +2 else CreateItemOnObject("NW_MAARCL066", oNPC); //Chainmail +2 } else { if (nSkin == 134) oArmor = CreateItemOnObject("anc_it_earmor23", oNPC); //Epic drow chainmail else if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else { switch (Random(2)) { case 0: oArmor = CreateItemOnObject("anc_it_earmor11", oNPC); break; //Epic chainmail (dark purple) case 1: oArmor = CreateItemOnObject("anc_it_earmor12", oNPC); break; //Epic chainmail (gold) } } } } if (sSubtype == "dual") { oWeapon = RandomWeapon(nNewEq, nWeapon, oNPC); //Main weapon oOffhand = RandomWeapon(nNewEq, nOffhand, oNPC, TRUE); //Offhand weapon if (nLevel <= 7) { CreateItemOnObject("NW_AARCL002", oNPC); //Padded Leather Armor } else if (nLevel <= 13) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR008", oNPC); //Drow padded armor +1 else CreateItemOnObject("NW_MAARCL045", oNPC); //Padded armor +1 } else if (nLevel <= 19) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR009", oNPC); //Drow padded armor +2 else CreateItemOnObject("NW_MAARCL075", oNPC); //Padded armor +2 } else { if (nSkin == 134) oArmor = CreateItemOnObject("anc_it_earmor21", oNPC); //Epic drow padded armor else if (nSkin == 42) oArmor = CreateItemOnObject("anc_it_earmor22", oNPC); //Epic duergar padded armor else if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else { switch (Random(2)) { case 0: oArmor = CreateItemOnObject("anc_it_earmor17", oNPC); break; //Epic padded armor (dark red/brown) case 1: oArmor = CreateItemOnObject("anc_it_earmor18", oNPC); break; //Epic padded armor (black/light brown) } } } } } if (sArchetype == "arche") { if (nLevel <= 7) { CreateItemOnObject("NW_AARCL002", oNPC); //Padded Leather Armor if (sSubtype == "bow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("NW_WBWSH001", oNPC); //Shortbow else oWeapon = CreateItemOnObject("NW_WBWLN001", oNPC); //Longbow } if (sSubtype == "xbow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("NW_WBWXL001", oNPC); //Light xbow else oWeapon = CreateItemOnObject("NW_WBWXH001", oNPC); //Heavy xbow } } else if (nLevel <= 13) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR008", oNPC); //Drow padded armor +1 else CreateItemOnObject("NW_MAARCL045", oNPC); //Padded armor +1 if (sSubtype == "bow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("NW_WBWMSH008", oNPC); //Shortbow +2 else oWeapon = CreateItemOnObject("NW_WBWMLN008", oNPC); //Longbow +2 } if (sSubtype == "xbow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("NW_WBWMXL008", oNPC); //Light xbow +2 else oWeapon = CreateItemOnObject("NW_WBWMXH008", oNPC); //Heavy xbow +2 } } else if (nLevel <= 19) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR009", oNPC); //Drow padded armor +2 else CreateItemOnObject("NW_MAARCL075", oNPC); //Padded armor +2 if (sSubtype == "bow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("NW_WBWMSH009", oNPC); //Shortbow +3 else oWeapon = CreateItemOnObject("NW_WBWMLN009", oNPC); //Longbow +3 } if (sSubtype == "xbow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("NW_WBWMXL009", oNPC); //Light xbow +3 else oWeapon = CreateItemOnObject("NW_WBWMXH009", oNPC); //Heavy xbow +3 } } else { if (nSkin == 134) oArmor = CreateItemOnObject("anc_it_earmor21", oNPC); //Epic drow padded armor else if (nSkin == 42) oArmor = CreateItemOnObject("anc_it_earmor22", oNPC); //Epic duergar padded armor else if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else { switch (Random(2)) { case 0: oArmor = CreateItemOnObject("anc_it_earmor17", oNPC); break; //Epic padded armor (dark red/brown) case 1: oArmor = CreateItemOnObject("anc_it_earmor18", oNPC); break; //Epic padded armor (black/light brown) } } if (sSubtype == "bow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("X0_WBWMSH002", oNPC); //Shortbow +5 else oWeapon = CreateItemOnObject("X0_WBWMLN002", oNPC); //Longbow +5 } if (sSubtype == "xbow") { if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) oWeapon = CreateItemOnObject("X0_WBWMXL002", oNPC); //Light xbow +5 else oWeapon = CreateItemOnObject("X0_WBWMXH002", oNPC); //Heavy xbow +5 } } } if (sArchetype == "rogue") { if (nLevel <= 7) { CreateItemOnObject("NW_AARCL002", oNPC); //Padded Leather Armor if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) { oWeapon = CreateItemOnObject("NW_WSWDG001", oNPC); //daggers oOffhand = CopyItem(oWeapon, oNPC); } else { oWeapon = CreateItemOnObject("NW_WSWSS001", oNPC); //shortswords oOffhand = CopyItem(oWeapon, oNPC); } } else if (nLevel <= 13) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR008", oNPC); //Drow padded armor +1 else CreateItemOnObject("NW_MAARCL045", oNPC); //Padded armor +1 if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) { oWeapon = CreateItemOnObject("NW_WSWMDG008", oNPC); //daggers +2 oOffhand = CopyItem(oWeapon, oNPC); } else { oWeapon = CreateItemOnObject("NW_WSWMSS009", oNPC); //shortswords +2 oOffhand = CopyItem(oWeapon, oNPC); } } else if (nLevel <= 19) { if (nSkin == 134) CreateItemOnObject("X2_MDROWAR009", oNPC); //Drow padded armor +2 else CreateItemOnObject("NW_MAARCL075", oNPC); //Padded armor +2 if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) { oWeapon = CreateItemOnObject("NW_WSWMDG009", oNPC); //daggers +3 oOffhand = CopyItem(oWeapon, oNPC); } else { oWeapon = CreateItemOnObject("NW_WSWMSS011", oNPC); //shortswords +3 oOffhand = CopyItem(oWeapon, oNPC); } } else { if (nSkin == 134) oArmor = CreateItemOnObject("anc_it_earmor21", oNPC); //Epic drow padded armor else if (nSkin == 42) oArmor = CreateItemOnObject("anc_it_earmor22", oNPC); //Epic duergar padded armor else if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else { switch (Random(2)) { case 0: oArmor = CreateItemOnObject("anc_it_earmor17", oNPC); break; //Epic padded armor (dark red/brown) case 1: oArmor = CreateItemOnObject("anc_it_earmor18", oNPC); break; //Epic padded armor (black/light brown) } } if (GetRacialType(oNPC) == RACIAL_TYPE_HALFLING || GetRacialType(oNPC) == RACIAL_TYPE_GNOME) { oWeapon = CreateItemOnObject("X0_WSWMDG002", oNPC); //daggers +5 oOffhand = CopyItem(oWeapon, oNPC); } else { oWeapon = CreateItemOnObject("X0_WSWMSS002", oNPC); //shortswords +5 oOffhand = CopyItem(oWeapon, oNPC); } } } if (sArchetype == "monk") { if (nLevel <= 7) { CreateItemOnObject("NW_CLOTH016", oNPC); //Regular cloth if (sSubtype == "kama") { oWeapon = CreateItemOnObject("NW_WSPKA001", oNPC); //kamas oOffhand = CopyItem(oWeapon, oNPC); } } else if (nLevel <= 13) { CreateItemOnObject("anc_it_armor1d", oNPC); //Cloth +1 if (sSubtype == "kama") { oWeapon = CreateItemOnObject("NW_WSPMKA008", oNPC); //kamas +2 oOffhand = CopyItem(oWeapon, oNPC); } } else if (nLevel <= 19) { CreateItemOnObject("anc_it_armor2d", oNPC); //Cloth +2 if (sSubtype == "kama") { oWeapon = CreateItemOnObject("NW_WSPMKA009", oNPC); //kamas +3 oOffhand = CopyItem(oWeapon, oNPC); } } else { if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else switch (Random(4)) { case 0: oArmor = CreateItemOnObject("anc_it_armor5d", oNPC); break; //Epic cloth case 1: oArmor = CreateItemOnObject("anc_it_armor8e", oNPC); break; case 2: oArmor = CreateItemOnObject("anc_it_armor8d", oNPC); break; case 3: oArmor = CreateItemOnObject("anc_it_armor4d", oNPC); break; } if (sSubtype == "kama") { oWeapon = CreateItemOnObject("X0_WSPMKA002", oNPC); //kamas +5 oOffhand = CopyItem(oWeapon, oNPC); } } } if (sArchetype == "mage") { if (nLevel <= 7) { CreateItemOnObject("anc_it_armor1c", oNPC); //Wizard robes +1 } else if (nLevel <= 13) { CreateItemOnObject("anc_it_armor3c", oNPC); //Wizard robes +3 } else if (nLevel <= 19) { CreateItemOnObject("anc_it_armor6c", oNPC); //Wizard robes +5 } else { if (sEqType == "melee") //Epic AC robes { if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else switch (Random(3)) { case 0: oArmor = CreateItemOnObject("anc_it_armor4d", oNPC); break; case 1: oArmor = CreateItemOnObject("anc_it_armor5e", oNPC); break; case 2: oArmor = CreateItemOnObject("anc_it_armor8d", oNPC); break; } } else oArmor = CreateItemOnObject("anc_it_armor8c", oNPC); //Wizard robes +7 } } if (sArchetype == "cleric") { if (nLevel <= 7) { CreateItemOnObject("anc_it_armor1b", oNPC); //Cleric robes +1 } else if (nLevel <= 13) { CreateItemOnObject("anc_it_armor3b", oNPC); //Cleric robes +3 } else if (nLevel <= 19) { CreateItemOnObject("anc_it_armor6b", oNPC); //Cleric robes +5 } else { if (sEqType == "melee") //Epic AC robes { if (nNewEq == FALSE) oArmor = CreateItemOnObject(GetLocalString(oNPC, "sArmor"), oNPC); else switch (Random(2)) { case 0: oArmor = CreateItemOnObject("anc_it_armor4d", oNPC); break; case 1: oArmor = CreateItemOnObject("anc_it_armor3d", oNPC); break; } } else oArmor = CreateItemOnObject("anc_it_armor8b", oNPC); //Cleric robes +7 } } //General equipment if (sEqType == "melee") { if (nLevel <= 3) { CreateItemOnObject("anc_it_ring1f", oNPC); //Ring of Discipline +5 } else if (nLevel <= 5) { CreateItemOnObject("anc_it_ring2f", oNPC); //Ring of Discipline +10 oCloak = CreateItemOnObject("anc_it_cloak1g", oNPC); //Cloak of Life +3 } else if (nLevel <= 7) { CreateItemOnObject("it_anc_boots1a", oNPC); //Boots of Dodging +1 CreateItemOnObject("anc_it_ring2f", oNPC); //Ring of Discipline +10 oCloak = CreateItemOnObject("anc_it_cloak1g", oNPC); //Cloak of Life +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove3b", oNPC); //Gloves of Strength +1 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove1a", oNPC); //Monk gloves +1 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove3c", oNPC); //Gloves of Dexterity +1 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove3g", oNPC); //Gloves of Wisdom +1 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove3f", oNPC); //Gloves of Intelligence +1 CreateItemOnObject("anc_it_belt3c", oNPC); //Belt of Heroes +2 } else if (nLevel <= 9) { CreateItemOnObject("it_anc_boots1a", oNPC); //Boots of Dodging +1 CreateItemOnObject("anc_it_ring2f", oNPC); //Ring of Discipline +10 oCloak = CreateItemOnObject("anc_it_cloak2g", oNPC); //Cloak of Life +5 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove3b", oNPC); //Gloves of Strength +1 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove1a", oNPC); //Monk gloves +1 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove3c", oNPC); //Gloves of Dexterity +1 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove3g", oNPC); //Gloves of Wisdom +1 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove3f", oNPC); //Gloves of Intelligence +1 CreateItemOnObject("anc_it_belt3c", oNPC); //Belt of Heroes +2 if (sArchetype == "arche") CreateItemOnObject("anc_it_amulet3c", oNPC); //Amulet of Dexterity +1 if (sArchetype == "cleric") CreateItemOnObject("anc_it_amulet3f", oNPC); //Amulet of Wisdom +1 if (sArchetype == "mage") CreateItemOnObject("anc_it_amulet3e", oNPC); //Amulet of Intelligence +1 else CreateItemOnObject("anc_it_amulet3b", oNPC); //Amulet of Strength +1 if (nHelmetVisible) CreateItemOnObject("it_anc_helm1b", oNPC); //Helmet +1 } else if (nLevel <= 11) { CreateItemOnObject("it_anc_boots1a", oNPC); //Boots of Dodging +1 CreateItemOnObject("anc_it_ring3f", oNPC); //Ring of Discipline +15 CreateItemOnObject("anc_it_ring1d", oNPC); //Ring of Heroes +1 oCloak = CreateItemOnObject("anc_it_cloak2g", oNPC); //Cloak of Life +5 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove3b", oNPC); //Gloves of Strength +1 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove2a", oNPC); //Monk gloves +2 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove3c", oNPC); //Gloves of Dexterity +1 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove3g", oNPC); //Gloves of Wisdom +1 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove3f", oNPC); //Gloves of Intelligence +1 CreateItemOnObject("anc_it_belt3c", oNPC); //Belt of Heroes +2 CreateItemOnObject("anc_it_amulet5h", oNPC); //Amulet of Protection +1 if (nHelmetVisible) CreateItemOnObject("it_anc_helm1b", oNPC); //Helmet +1 } else if (nLevel <= 13) { CreateItemOnObject("it_anc_boots1a", oNPC); //Boots of Dodging +1 CreateItemOnObject("anc_it_ring3f", oNPC); //Ring of Discipline +15 CreateItemOnObject("anc_it_ring1d", oNPC); //Ring of Heroes +1 oCloak = CreateItemOnObject("anc_it_cloak2g", oNPC); //Cloak of Life +5 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove5b", oNPC); //Gloves of Strength +2 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove4a", oNPC); //Monk gloves +3 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove5c", oNPC); //Gloves of Dexterity +2 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove5g", oNPC); //Gloves of Wisdom +2 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove5f", oNPC); //Gloves of Intelligence +2 CreateItemOnObject("anc_it_belt3c", oNPC); //Belt of Heroes +2 if (sArchetype == "arche") CreateItemOnObject("anc_it_amulet5c", oNPC); //Amulet of Dexterity +2 if (sArchetype == "cleric") CreateItemOnObject("anc_it_amulet5f", oNPC); //Amulet of Wisdom +2 if (sArchetype == "mage") CreateItemOnObject("anc_it_amulet5e", oNPC); //Amulet of Intelligence +2 else CreateItemOnObject("anc_it_amulet5b", oNPC); //Amulet of Strength +2 if (nHelmetVisible) CreateItemOnObject("it_anc_helm1b", oNPC); //Helmet +1 } else if (nLevel <= 15) { CreateItemOnObject("it_anc_boots2a", oNPC); //Boots of Dodging +2 CreateItemOnObject("anc_it_ring3f", oNPC); //Ring of Discipline +15 CreateItemOnObject("anc_it_ring3d", oNPC); //Ring of Heroes +2 oCloak = CreateItemOnObject("anc_it_cloak2g", oNPC); //Cloak of Life +5 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove5b", oNPC); //Gloves of Strength +2 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove4a", oNPC); //Monk gloves +3 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove5c", oNPC); //Gloves of Dexterity +2 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove5g", oNPC); //Gloves of Wisdom +2 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove5f", oNPC); //Gloves of Intelligence +2 CreateItemOnObject("anc_it_belt3c", oNPC); //Belt of Heroes +2 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 17) { CreateItemOnObject("it_anc_boots2a", oNPC); //Boots of Dodging +2 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 oCloak = CreateItemOnObject("anc_it_cloak4g", oNPC); //Cloak of Life +6 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 CreateItemOnObject("anc_it_belt5c", oNPC); //Belt of Heroes +3 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 19) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 oCloak = CreateItemOnObject("anc_it_cloak4g", oNPC); //Cloak of Life +6 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 CreateItemOnObject("anc_it_belt5c", oNPC); //Belt of Heroes +3 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 21) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 CreateItemOnObject("anc_it_belt5c", oNPC); //Belt of Heroes +3 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 23) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 CreateItemOnObject("anc_it_belt5c", oNPC); //Belt of Heroes +3 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 25) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 CreateItemOnObject("anc_it_belt5c", oNPC); //Belt of Heroes +3 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 27) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 CreateItemOnObject("anc_it_belt6c", oNPC); //Belt of Heroes +4 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 29) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 CreateItemOnObject("anc_it_belt7c", oNPC); //Belt of Heroes +5 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 31) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 CreateItemOnObject("anc_it_belt7c", oNPC); //Belt of Heroes +5 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 33) { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring5f", oNPC); //Ring of Discipline +20 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 CreateItemOnObject("anc_it_belt7c", oNPC); //Belt of Heroes +5 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else { CreateItemOnObject("it_anc_boots3a", oNPC); //Boots of Dodging +3 CreateItemOnObject("anc_it_ring6f", oNPC); //Ring of Discipline +25 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 CreateItemOnObject("anc_it_belt7c", oNPC); //Belt of Heroes +5 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (nNewEq == FALSE) oCloak = CreateItemOnObject(GetLocalString(oNPC, "sReductionCloak"), oNPC); else switch (Random(5)) { case 0: oCloak = CreateItemOnObject("anc_it_cloak7e", oNPC); sReductionCloak = "anc_it_cloak7e"; break; //Damage reduction +5 case 1: oCloak = CreateItemOnObject("anc_it_cloak8d", oNPC); sReductionCloak = "anc_it_cloak8d"; break; //Damage reduction +4 case 2: oCloak = CreateItemOnObject("anc_it_cloak8c", oNPC); sReductionCloak = "anc_it_cloak8c"; break; //Damage reduction +3 case 3: oCloak = CreateItemOnObject("anc_it_cloak8b", oNPC); sReductionCloak = "anc_it_cloak8b"; break; //Damage reduction +2 case 4: oCloak = CreateItemOnObject("anc_it_cloak8a", oNPC); sReductionCloak = "anc_it_cloak8a"; break; //Damage reduction +1 } if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } } if (sEqType == "magic") { if (nLevel <= 3) { CreateItemOnObject("anc_it_belt1a", oNPC); //Belt of Spell Resistance +10 CreateItemOnObject("it_anc_boots1b", oNPC); //Boots of Magical Resistance +10 } else if (nLevel <= 5) { CreateItemOnObject("anc_it_belt1a", oNPC); //Belt of Spell Resistance +10 CreateItemOnObject("it_anc_boots1b", oNPC); //Boots of Magical Resistance +10 CreateItemOnObject("anc_it_ring1a", oNPC); //Ring of Elements I +5 } else if (nLevel <= 7) { CreateItemOnObject("anc_it_belt2a", oNPC); //Belt of Spell Resistance +14 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring3a", oNPC); //Ring of Elements I +10 CreateItemOnObject("anc_it_ring3b", oNPC); //Ring of Elements II +10 oCloak = CreateItemOnObject("anc_it_cloak3f", oNPC); //Cloak of Heroes +2 } else if (nLevel <= 9) { CreateItemOnObject("anc_it_belt3a", oNPC); //Belt of Spell Resistance +18 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring4a", oNPC); //Ring of Elements I +15 CreateItemOnObject("anc_it_ring4b", oNPC); //Ring of Elements II +15 oCloak = CreateItemOnObject("anc_it_cloak3f", oNPC); //Cloak of Heroes +2 } else if (nLevel <= 11) { CreateItemOnObject("anc_it_belt5a", oNPC); //Belt of Spell Resistance +24 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring4a", oNPC); //Ring of Elements I +15 CreateItemOnObject("anc_it_ring4b", oNPC); //Ring of Elements II +15 oCloak = CreateItemOnObject("anc_it_cloak3f", oNPC); //Cloak of Heroes +2 } else if (nLevel <= 13) { CreateItemOnObject("anc_it_belt5a", oNPC); //Belt of Spell Resistance +24 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring4a", oNPC); //Ring of Elements I +15 CreateItemOnObject("anc_it_ring4b", oNPC); //Ring of Elements II +15 CreateItemOnObject("anc_it_amulet5h", oNPC); //Amulet of Protection +1 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) CreateItemOnObject("it_anc_helm1b", oNPC); //Helmet +1 } else if (nLevel <= 15) { CreateItemOnObject("anc_it_belt5a", oNPC); //Belt of Spell Resistance +24 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring4a", oNPC); //Ring of Elements I +15 CreateItemOnObject("anc_it_ring4b", oNPC); //Ring of Elements II +15 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 17) { CreateItemOnObject("anc_it_belt5a", oNPC); //Belt of Spell Resistance +24 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring6a", oNPC); //Ring of Elements I +20 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 19) { CreateItemOnObject("anc_it_belt6a", oNPC); //Belt of Spell Resistance +28 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring6a", oNPC); //Ring of Elements I +20 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 21) { CreateItemOnObject("anc_it_belt7a", oNPC); //Belt of Spell Resistance +32 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring6a", oNPC); //Ring of Elements I +20 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 23) { CreateItemOnObject("anc_it_belt7a", oNPC); //Belt of Spell Resistance +32 CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring6a", oNPC); //Ring of Elements I +20 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 25) { CreateItemOnObject("anc_it_belt8a", oNPC); //Epic belt of spell resistance CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring6a", oNPC); //Ring of Elements I +20 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 27) { CreateItemOnObject("anc_it_belt8a", oNPC); //Epic belt of spell resistance CreateItemOnObject("it_anc_boots3b", oNPC); //Boots of Magical Resistance +30 CreateItemOnObject("anc_it_ring6a", oNPC); //Ring of Elements I +20 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 29) { CreateItemOnObject("anc_it_belt8a", oNPC); //Epic belt of spell resistance CreateItemOnObject("it_anc_boots6b", oNPC); //Boots of Magical Resistance +40 CreateItemOnObject("anc_it_ring6a", oNPC); //Ring of Elements I +20 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 31) { CreateItemOnObject("anc_it_belt8a", oNPC); //Epic belt of spell resistance CreateItemOnObject("it_anc_boots6b", oNPC); //Boots of Magical Resistance +40 CreateItemOnObject("anc_it_ring8a", oNPC); //Ring of Elements I +25 CreateItemOnObject("anc_it_ring5b", oNPC); //Ring of Elements II +20 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 33) { CreateItemOnObject("anc_it_belt8a", oNPC); //Epic belt of spell resistance CreateItemOnObject("it_anc_boots6b", oNPC); //Boots of Magical Resistance +40 CreateItemOnObject("anc_it_ring8a", oNPC); //Ring of Elements I +25 CreateItemOnObject("anc_it_ring7b", oNPC); //Ring of Elements II +25 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 35) { CreateItemOnObject("anc_it_belt8a", oNPC); //Epic belt of spell resistance CreateItemOnObject("it_anc_boots6b", oNPC); //Boots of Magical Resistance +40 CreateItemOnObject("anc_it_ring8a", oNPC); //Ring of Elements I +25 CreateItemOnObject("anc_it_ring7b", oNPC); //Ring of Elements II +25 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else { CreateItemOnObject("anc_it_belt8a", oNPC); //Epic belt of spell resistance CreateItemOnObject("it_anc_boots6b", oNPC); //Boots of Magical Resistance +40 CreateItemOnObject("anc_it_ring8a", oNPC); //Ring of Elements I +25 CreateItemOnObject("anc_it_ring7b", oNPC); //Ring of Elements II +25 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } } if (sEqType == "mixed") { if (nLevel <= 3) { CreateItemOnObject("it_anc_boots1c", oNPC); //Boots of Energy +5 } else if (nLevel <= 5) { CreateItemOnObject("it_anc_boots2c", oNPC); //Boots of Energy +15 CreateItemOnObject("anc_it_belt1a", oNPC); //Belt of Spell Resistance +10 CreateItemOnObject("anc_it_ring1d", oNPC); //Ring of Heroes +1 } else if (nLevel <= 7) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt2a", oNPC); //Belt of Spell Resistance +14 CreateItemOnObject("anc_it_ring1d", oNPC); //Ring of Heroes +1 CreateItemOnObject("anc_it_ring1d", oNPC); //Ring of Heroes +1 oCloak = CreateItemOnObject("anc_it_cloak3f", oNPC); //Cloak of Heroes +2 } else if (nLevel <= 9) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt3a", oNPC); //Belt of Spell Resistance +18 CreateItemOnObject("anc_it_ring3d", oNPC); //Ring of Heroes +2 CreateItemOnObject("anc_it_ring3d", oNPC); //Ring of Heroes +2 oCloak = CreateItemOnObject("anc_it_cloak3f", oNPC); //Cloak of Heroes +2 if (nHelmetVisible) CreateItemOnObject("it_anc_helm1b", oNPC); //Helmet +1 } else if (nLevel <= 11) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt4a", oNPC); //Belt of Spell Resistance +20 CreateItemOnObject("anc_it_ring3d", oNPC); //Ring of Heroes +2 CreateItemOnObject("anc_it_ring3d", oNPC); //Ring of Heroes +2 CreateItemOnObject("anc_it_amulet5h", oNPC); //Amulet of Protection +1 oCloak = CreateItemOnObject("anc_it_cloak5f", oNPC); //Cloak of Heroes +3 if (nHelmetVisible) CreateItemOnObject("it_anc_helm1b", oNPC); //Helmet +1 } else if (nLevel <= 13) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt4a", oNPC); //Belt of Spell Resistance +20 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 CreateItemOnObject("anc_it_ring3d", oNPC); //Ring of Heroes +2 CreateItemOnObject("anc_it_amulet5h", oNPC); //Amulet of Protection +1 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) CreateItemOnObject("it_anc_helm1b", oNPC); //Helmet +1 } else if (nLevel <= 15) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt5a", oNPC); //Belt of Spell Resistance +24 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 CreateItemOnObject("anc_it_ring5d", oNPC); //Ring of Heroes +3 CreateItemOnObject("anc_it_amulet5h", oNPC); //Amulet of Protection +1 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 17) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt5a", oNPC); //Belt of Spell Resistance +24 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_amulet5h", oNPC); //Amulet of Protection +1 oCloak = CreateItemOnObject("anc_it_cloak6f", oNPC); //Cloak of Heroes +4 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 19) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt5a", oNPC); //Belt of Spell Resistance +24 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) CreateItemOnObject("it_anc_helm2a", oNPC); //Helmet +2 } else if (nLevel <= 21) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt6a", oNPC); //Belt of Spell Resistance +28 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove3b", oNPC); //Gloves of Strength +1 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove2a", oNPC); //Monk gloves +2 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove3c", oNPC); //Gloves of Dexterity +1 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove3g", oNPC); //Gloves of Wisdom +1 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove3f", oNPC); //Gloves of Intelligence +1 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 23) { CreateItemOnObject("it_anc_boots3c", oNPC); //Boots of Energy +25 CreateItemOnObject("anc_it_belt6a", oNPC); //Belt of Spell Resistance +28 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 25) { CreateItemOnObject("it_anc_boots4c", oNPC); //Boots of Energy +35 CreateItemOnObject("anc_it_belt7a", oNPC); //Belt of Spell Resistance +32 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 27) { CreateItemOnObject("it_anc_boots4c", oNPC); //Boots of Energy +35 CreateItemOnObject("anc_it_belt8a", oNPC); //Epic Belt of Spell Resistance CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_ring6d", oNPC); //Ring of Heroes +4 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 29) { CreateItemOnObject("it_anc_boots4c", oNPC); //Boots of Energy +35 CreateItemOnObject("anc_it_belt8a", oNPC); //Epic Belt of Spell Resistance CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_amulet6h", oNPC); //Amulet of Protection +2 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else if (nLevel <= 31) { CreateItemOnObject("it_anc_boots4c", oNPC); //Boots of Energy +35 CreateItemOnObject("anc_it_belt8a", oNPC); //Epic Belt of Spell Resistance CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove7b", oNPC); //Gloves of Strength +3 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove5a", oNPC); //Monk gloves +4 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove7c", oNPC); //Gloves of Dexterity +3 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove7g", oNPC); //Gloves of Wisdom +3 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove7f", oNPC); //Gloves of Intelligence +3 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } else { CreateItemOnObject("it_anc_boots4c", oNPC); //Boots of Energy +35 CreateItemOnObject("anc_it_belt8a", oNPC); //Epic Belt of Spell Resistance CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_ring7d", oNPC); //Ring of Heroes +5 CreateItemOnObject("anc_it_amulet8h", oNPC); //Amulet of Protection +3 if (sArchetype == "fight" || sSubtype == "kama") CreateItemOnObject("it_anc_glove8b", oNPC); //Gloves of Strength +4 if (sSubtype == "fist") CreateItemOnObject("it_anc_glove6a", oNPC); //Monk gloves +5 if (sArchetype == "arche" || sArchetype == "rogue") CreateItemOnObject("it_anc_glove8c", oNPC); //Gloves of Dexterity +4 if (sArchetype == "cleric") CreateItemOnObject("it_anc_glove8g", oNPC); //Gloves of Wisdom +4 if (sArchetype == "mage") CreateItemOnObject("it_anc_glove8f", oNPC); //Gloves of Intelligence +4 oCloak = CreateItemOnObject("anc_it_cloak7f", oNPC); //Cloak of Heroes +5 if (nHelmetVisible) { if (GetResRef(oArmor) == "anc_it_earmor1") CreateItemOnObject("it_anc_helm3a", oNPC); //Epic helmets (to match armor's color) if (GetResRef(oArmor) == "anc_it_earmor2") CreateItemOnObject("it_anc_helm5b", oNPC); if (GetResRef(oArmor) == "anc_it_earmor3") CreateItemOnObject("it_anc_helm4a", oNPC); if (GetResRef(oArmor) == "anc_it_earmor4") CreateItemOnObject("it_anc_helm8b", oNPC); } } } //} //Turn the cloak invisible if it should be so if (!nCloakVisible || sArchetype == "monk" || ((sArchetype == "mage" || sArchetype == "cleric") && (sSubtype != "melee" || nLevel<20))) { CopyItemAndModify(oCloak, ITEM_APPR_TYPE_SIMPLE_MODEL, 0, 99, TRUE); DestroyObject(oCloak); } //Equip all this shit SetIdentified(oOffhand, TRUE); SetIdentified(oWeapon, TRUE); AssignCommand(oNPC, ActionEquipItem(oWeapon, INVENTORY_SLOT_RIGHTHAND)); AssignCommand(oNPC, ActionEquipItem(oOffhand, INVENTORY_SLOT_LEFTHAND)); object oItem = GetFirstItemInInventory(oNPC); int nSlot; int nSecondRing = FALSE; while (oItem != OBJECT_INVALID) { SetIdentified(oItem, TRUE); SetDroppableFlag(oItem, FALSE); if (GetBaseItemType(oItem) == BASE_ITEM_BELT) nSlot = INVENTORY_SLOT_BELT; else if (GetBaseItemType(oItem) == BASE_ITEM_CLOAK) nSlot = INVENTORY_SLOT_CLOAK; else if (GetBaseItemType(oItem) == BASE_ITEM_RING && nSecondRing == FALSE) { nSlot = INVENTORY_SLOT_LEFTRING; nSecondRing = TRUE; } else if (GetBaseItemType(oItem) == BASE_ITEM_RING && nSecondRing == TRUE) nSlot = INVENTORY_SLOT_RIGHTRING; else if (GetBaseItemType(oItem) == BASE_ITEM_BOOTS) nSlot = INVENTORY_SLOT_BOOTS; else if (GetBaseItemType(oItem) == BASE_ITEM_GLOVES || GetBaseItemType(oItem) == BASE_ITEM_BRACER) nSlot = INVENTORY_SLOT_ARMS; else if (GetBaseItemType(oItem) == BASE_ITEM_HELMET) nSlot = INVENTORY_SLOT_HEAD; else if (GetBaseItemType(oItem) == BASE_ITEM_ARMOR) nSlot = INVENTORY_SLOT_CHEST; else if (GetBaseItemType(oItem) == BASE_ITEM_AMULET) nSlot = INVENTORY_SLOT_NECK; AssignCommand(oNPC, ActionEquipItem(oItem, nSlot)); oItem = GetNextItemInInventory(oNPC); } //Give mages spell scrolls string sScrollTag; if (sArchetype == "mage") { if (nLevel >= 2) { switch (Random(2)) { case 0: sScrollTag = "NW_IT_SPARSCR112"; break; //burning hands case 1: sScrollTag = "NW_IT_SPARSCR109"; break; //magic missile } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes } if (nLevel >= 4) { switch (Random(2)) { case 0: sScrollTag = "X2_IT_SPARSCR203"; break; //electric loop case 1: sScrollTag = "NW_IT_SPARSCR202"; break; //acid arrow } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("NW_IT_SPARSCR218", oNPC); //lesser dispel } if (nLevel >= 6) { switch (Random(2)) { case 0: sScrollTag = "NW_IT_SPARSCR309"; break; //fireball case 1: sScrollTag = "NW_IT_SPARSCR310"; break; //lightning bolt } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("NW_IT_SPARSCR301", oNPC); //dispel magic } if (nLevel >= 8) { switch (Random(2)) { case 0: sScrollTag = "X2_IT_SPARSCR401"; break; //ice storm case 1: sScrollTag = "X1_IT_SPARSCR401"; break; //lesser missile storm } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("NW_IT_SPARSCR417", oNPC); //lesser spell breach } if (nLevel >= 10) { switch (Random(2)) { case 0: sScrollTag = "X2_IT_SPARSCR302"; break; //ball lightning case 1: sScrollTag = "NW_IT_SPARSCR507"; break; //cone of cold } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("NW_IT_SPARSCR513", oNPC); //lesser spell mantle } if (nLevel >= 12) { switch (Random(2)) { case 0: sScrollTag = "NW_IT_SPARSCR607"; break; //chain lightning case 1: sScrollTag = "X1_IT_SPARSCR603"; break; //greater missile storm } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("NW_IT_SPARSCR602", oNPC); //greater dispelling } if (nLevel >= 14) { switch (Random(2)) { case 0: sScrollTag = "X2_IT_SPARSCR701"; break; //great thunderclap case 1: sScrollTag = "NW_IT_SPARSCR706"; break; //prismatic spray } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("NW_IT_SPARSCR701", oNPC); //spell mantle } if (nLevel >= 16) { switch (Random(2)) { case 0: sScrollTag = "NW_IT_SPARSCR809"; break; //horrid wilting case 1: sScrollTag = "NW_IT_SPARSCR807"; break; //mass blindness/deafness } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes } if (nLevel >= 18) { switch (Random(2)) { case 0: sScrollTag = "NW_IT_SPARSCR906"; break; //meteor swarm case 1: sScrollTag = "NW_IT_SPARSCR909"; break; //wail of the banshee } CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("NW_IT_SPARSCR901", oNPC); //mordenkainen's disjunction CreateItemOnObject("NW_IT_SPARSCR912", oNPC); //greater spell mantle } } //Give clerics spell scrolls if (sArchetype == "cleric") { if (nLevel >= 2) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("X2_IT_SPDVSCR605", oNPC); //heal } if (nLevel >= 4) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes } if (nLevel >= 6) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("X2_IT_SPDVSCR605", oNPC); //heal } if (nLevel >= 8) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes } if (nLevel >= 10) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("X2_IT_SPDVSCR605", oNPC); //heal } if (nLevel >= 12) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes } if (nLevel >= 14) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes } if (nLevel >= 16) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes CreateItemOnObject("X2_IT_SPDVSCR605", oNPC); //heal } if (nLevel >= 18) { sScrollTag = "X2_IT_SPDVSCR604"; //harm CreateItemOnObject(sScrollTag, oNPC); if (sEqType != "melee" || nLevel < 20) CreateItemOnObject(sScrollTag, oNPC); //bonus spell if the NPC has mage robes } } //Give archers ammunition string sAmmo; if (sSubtype == "bow") { if (nLevel <= 3) //arrow { CreateItemOnObject("NW_WAMAR001", oNPC, 99); CreateItemOnObject("NW_WAMAR001", oNPC, 99); CreateItemOnObject("NW_WAMAR001", oNPC, 99); CreateItemOnObject("NW_WAMAR001", oNPC, 99); CreateItemOnObject("NW_WAMAR001", oNPC, 99); } else if (nLevel <= 6) //arrow +1 { CreateItemOnObject("NW_WAMMAR009", oNPC, 99); CreateItemOnObject("NW_WAMMAR009", oNPC, 99); CreateItemOnObject("NW_WAMMAR009", oNPC, 99); CreateItemOnObject("NW_WAMMAR009", oNPC, 99); CreateItemOnObject("NW_WAMMAR009", oNPC, 99); } else if (nLevel <= 9) //arrow +2 { CreateItemOnObject("NW_WAMMAR010", oNPC, 99); CreateItemOnObject("NW_WAMMAR010", oNPC, 99); CreateItemOnObject("NW_WAMMAR010", oNPC, 99); CreateItemOnObject("NW_WAMMAR010", oNPC, 99); CreateItemOnObject("NW_WAMMAR010", oNPC, 99); } else if (nLevel <= 12) //arrow +3 { CreateItemOnObject("NW_WAMMAR011", oNPC, 99); CreateItemOnObject("NW_WAMMAR011", oNPC, 99); CreateItemOnObject("NW_WAMMAR011", oNPC, 99); CreateItemOnObject("NW_WAMMAR011", oNPC, 99); CreateItemOnObject("NW_WAMMAR011", oNPC, 99); } else if (nLevel <= 15) //arrow +4 { CreateItemOnObject("NW_WAMMAR012", oNPC, 99); CreateItemOnObject("NW_WAMMAR012", oNPC, 99); CreateItemOnObject("NW_WAMMAR012", oNPC, 99); CreateItemOnObject("NW_WAMMAR012", oNPC, 99); CreateItemOnObject("NW_WAMMAR012", oNPC, 99); } else { switch (Random(4)) { case 0: sAmmo = "X2_WAMMAR013"; break; //arrow +5 case 1: sAmmo = "anc_it_arrow8c"; break; //ice arrow case 2: sAmmo = "anc_it_arrow8a"; break; //fire arrow case 3: sAmmo = "anc_it_arrow8b"; break; //acid arrow } CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); } } if (sSubtype == "xbow") { if (nLevel <= 3) //bolt { CreateItemOnObject("NW_WAMBO001", oNPC, 99); CreateItemOnObject("NW_WAMBO001", oNPC, 99); CreateItemOnObject("NW_WAMBO001", oNPC, 99); CreateItemOnObject("NW_WAMBO001", oNPC, 99); CreateItemOnObject("NW_WAMBO001", oNPC, 99); } else if (nLevel <= 6) //bolt +1 { CreateItemOnObject("NW_WAMMBO008", oNPC, 99); CreateItemOnObject("NW_WAMMBO008", oNPC, 99); CreateItemOnObject("NW_WAMMBO008", oNPC, 99); CreateItemOnObject("NW_WAMMBO008", oNPC, 99); CreateItemOnObject("NW_WAMMBO008", oNPC, 99); } else if (nLevel <= 9) //bolt +2 { CreateItemOnObject("NW_WAMMBO009", oNPC, 99); CreateItemOnObject("NW_WAMMBO009", oNPC, 99); CreateItemOnObject("NW_WAMMBO009", oNPC, 99); CreateItemOnObject("NW_WAMMBO009", oNPC, 99); CreateItemOnObject("NW_WAMMBO009", oNPC, 99); } else if (nLevel <= 12) //bolt +3 { CreateItemOnObject("NW_WAMMBO010", oNPC, 99); CreateItemOnObject("NW_WAMMBO010", oNPC, 99); CreateItemOnObject("NW_WAMMBO010", oNPC, 99); CreateItemOnObject("NW_WAMMBO010", oNPC, 99); CreateItemOnObject("NW_WAMMBO010", oNPC, 99); } else if (nLevel <= 15) //bolt +4 { CreateItemOnObject("NW_WAMMBO011", oNPC, 99); CreateItemOnObject("NW_WAMMBO011", oNPC, 99); CreateItemOnObject("NW_WAMMBO011", oNPC, 99); CreateItemOnObject("NW_WAMMBO011", oNPC, 99); CreateItemOnObject("NW_WAMMBO011", oNPC, 99); } else { switch (Random(4)) { case 0: sAmmo = "NW_WAMMBO012"; break; //bolt +5 case 1: sAmmo = "anc_it_bolts8a"; break; //lightning bolt case 2: sAmmo = "anc_it_bolts8c"; break; //sonic bolt case 3: sAmmo = "anc_it_bolts8b"; break; //acid bolt } CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); CreateItemOnObject(sAmmo, oNPC, 99); } } //Make all the items undroppable oItem = GetFirstItemInInventory(oNPC); while (oItem != OBJECT_INVALID) { SetDroppableFlag(oItem, FALSE); SetIdentified(oItem, TRUE); oItem = GetNextItemInInventory(oNPC); } //Store generated equipment info on the NPC (weapon info is stored with the RandomWeapon function) if (nLevel >= 20) SetLocalString(oNPC, "sArmor", GetResRef(oArmor)); if (sReductionCloak != "null" && nNewEq == TRUE) SetLocalString(oNPC, "sReductionCloak", sReductionCloak); } //Save an adventurer NPC, to save all the remaining data (this is a private function that should only be used in the NPC generation process) void StoreAdventurerNPC(object oNPC, int nPosition, string sDB) { string sPosition = IntToString(nPosition); //Get all the variables from the NPC string sArmor = GetLocalString(oNPC, "sArmor"); string sReductionCloak = GetLocalString(oNPC, "sReductionCloak"); int nBonus1_off = GetLocalInt(oNPC, "nBonus1_off"); string sBonus2_off = GetLocalString(oNPC, "sBonus2_off"); string sWeapon_off = GetLocalString(oNPC, "sWeapon_off"); int nMaxEnhancement_off = GetLocalInt(oNPC, "nMaxEnhancement_off"); int nBonus1 = GetLocalInt(oNPC, "nBonus1"); string sBonus2 = GetLocalString(oNPC, "sBonus2"); string sWeapon = GetLocalString(oNPC, "sWeapon"); int nMaxEnhancement = GetLocalInt(oNPC, "nMaxEnhancement"); int nDamageType = GetLocalInt(oNPC, "nDamageType"); int nDamageType_off = GetLocalInt(oNPC, "nDamageType_off"); SetCampaignInt(sDB, sPosition+"_ADV_OCCUPIED", TRUE); if (sArmor != "") SetCampaignString(sDB, sPosition+"_ADV_ARMOR", sArmor); if (sReductionCloak != "") SetCampaignString(sDB, sPosition+"_ADV_CLOAK", sReductionCloak); if (nBonus1_off != 0) SetCampaignInt(sDB, sPosition+"_ADV_OFFBONUS1", nBonus1_off); if (sBonus2_off != "") SetCampaignString(sDB, sPosition+"_ADV_OFFBONUS2", sBonus2_off); if (sWeapon_off != "") SetCampaignString(sDB, sPosition+"_ADV_OFFWEAPON", sWeapon_off); if (nMaxEnhancement_off != 0) SetCampaignInt(sDB, sPosition+"_ADV_OFFMAXBONUS", nMaxEnhancement_off); if (nBonus1 != 0) SetCampaignInt(sDB, sPosition+"_ADV_BONUS1", nBonus1); if (sBonus2 != "") SetCampaignString(sDB, sPosition+"_ADV_BONUS2", sBonus2); if (sWeapon != "") SetCampaignString(sDB, sPosition+"_ADV_MWEAPON", sWeapon); if (nMaxEnhancement != 0) SetCampaignInt(sDB, sPosition+"_ADV_MAXBONUS", nMaxEnhancement); if (nDamageType != 0) SetCampaignInt(sDB, sPosition+"_ADV_DMGTYPE", nDamageType); if (nDamageType_off != 0) SetCampaignInt(sDB, sPosition+"_ADV_OFFDMGTYPE", nDamageType_off); } //Spawn an adventurer NPC for the first time (this is a private function, since it should only be used during the NPC generation process) object PrespawnAdventurerNPC(int nPosition, string sDB) { location lLocation = GetLocation(GetWaypointByTag("horse_unsummon")); //Get the string part that determines position string sPositionString = IntToString(nPosition) + "_ADV_"; //Get all the parameters of the NPC string sArchetype = GetCampaignString(sDB, sPositionString+"TYPE"); //fight, arche, mage, monk, rogue, cleric string sRace = GetCampaignString(sDB, sPositionString+"RACE"); //hu, ha, he, ho, gn, dw, el string sSubtype = GetCampaignString(sDB, sPositionString+"SUBTYPE"); //fight: shield, dual, large, arche: bow, xbow, monk: fist, kama string sEqType = GetCampaignString(sDB, sPositionString+"EQTYPE"); //melee, magic, mixed string sName = GetCampaignString(sDB, sPositionString+"NAME"); string sLastName = GetCampaignString(sDB, sPositionString+"LASTNAME"); int nLawAxis = GetCampaignInt(sDB, sPositionString+"LAWAXIS"); //ALIGNMENT_LAWFUL, ALIGNMENT_NEUTRAL, ALIGNMENT_CHAOTIC int nGoodAxis = GetCampaignInt(sDB, sPositionString+"GOODAXIS"); //ALIGNMENT_GOOD, ALIGNMENT_NEUTRAL, ALIGNMENT_EVIL string sSex = GetCampaignString(sDB, sPositionString+"SEX"); //m,f int nLevel = 40; int nHead = GetCampaignInt(sDB, sPositionString+"HEAD"); //1-10 int nHair = GetCampaignInt(sDB, sPositionString+"HAIR"); //2,7,11,15,16,135 int nSkin = GetCampaignInt(sDB, sPositionString+"SKIN"); // int nPheno = GetCampaignInt(sDB, sPositionString+"PHENO"); //PHENOTYPE_BIG, PHENOTYPE_NORMAL int nPersonality = GetCampaignInt(sDB, sPositionString+"ATTITUDE"); //0 - excited, 1 - malicious, 2 - polite int nVisibleCloak = GetCampaignInt(sDB, sPositionString+"VISCLOAK"); //0,1 int nVisibleHelmet; int nWeapon; int nOffhand; if (sArchetype == "fight") { nWeapon = GetCampaignInt(sDB, sPositionString+"WEAPON"); nOffhand = GetCampaignInt(sDB, sPositionString+"OFFHAND"); if (sSubtype == "shield") nVisibleHelmet = GetCampaignInt(sDB, sPositionString+"VISHELM"); } string sTrait1 = GetCampaignString(sDB, sPositionString+"TRAIT1"); string sTrait2 = GetCampaignString(sDB, sPositionString+"TRAIT2"); string sTrait3 = GetCampaignString(sDB, sPositionString+"TRAIT3"); int nDamage1a = GetCampaignInt(sDB, sPositionString+"DAMAGE1"); int nDamage1b = GetCampaignInt(sDB, sPositionString+"DAMAGE2"); int nDamage1c = GetCampaignInt(sDB, sPositionString+"DAMAGE3"); int nDamage2a = GetCampaignInt(sDB, sPositionString+"DAMAGE4"); int nDamage2b = GetCampaignInt(sDB, sPositionString+"DAMAGE5"); int nDamage2c = GetCampaignInt(sDB, sPositionString+"DAMAGE6"); int nDamage3a = GetCampaignInt(sDB, sPositionString+"DAMAGE7"); int nDamage3b = GetCampaignInt(sDB, sPositionString+"DAMAGE8"); int nDamage3c = GetCampaignInt(sDB, sPositionString+"DAMAGE9"); //Prepare the ResRef of the blueprint and spawn the NPC string sBlueprint = sArchetype + "_" + sRace + "_" + sSex + "_01"; object oNPC = CreateObject(OBJECT_TYPE_CREATURE, sBlueprint, lLocation); //Set alignment if (nLawAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nLawAxis, 50, FALSE); if (nGoodAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nGoodAxis, 50, FALSE); //Level-up the NPC LevelHenchmanUpTo(oNPC, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oNPC), PACKAGE_INVALID); //Restore the NPC's spells ForceRest(oNPC); //Give the NPC his or her equipment (based on archetype, subtype and equipment type) and equip it if (sSubtype == "shield") GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, nVisibleHelmet, nWeapon, nOffhand); //nVisibleHelmet else if (sSubtype == "dual") GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon, nOffhand); else if (sSubtype == "large") GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon); else GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak); //Return the NPC generated return oNPC; } //Generate a quest NPC int GenerateFreshQuestNPC(object oPC, int nRaceType=RACIAL_TYPE_ALL) { //Make sure the PC does not have a quest assigned already string sDB = CharacterDB(oPC); if (GetCampaignInt(sDB, "QUEST_ACTIVE") != 0) return FALSE; //Generate NPC's race string sRace; switch (Random(20)) { case 0: case 1: case 2: case 3: case 4: case 5: sRace = "hu"; break; // 6/20, 30% case 6: case 7: case 8: case 9: sRace = "el"; break; // 4/20, 20% case 10: case 11: case 12: case 13: sRace = "dw"; break; // 4/20, 20% case 14: case 15: sRace = "gn"; break; // 2/20, 10% case 16: case 17: sRace = "ha"; break; // 2/20, 10% case 18: sRace = "ho"; break; // 1/20, 5% case 19: sRace = "he"; break; // 1/20, 5% } if (nRaceType==RACIAL_TYPE_HUMAN) sRace = "hu"; if (nRaceType==RACIAL_TYPE_HALFORC) sRace = "ho"; if (nRaceType==RACIAL_TYPE_DWARF) sRace = "dw"; if (nRaceType==RACIAL_TYPE_ELF) sRace = "el"; if (nRaceType==RACIAL_TYPE_HALFELF) sRace = "he"; if (nRaceType==RACIAL_TYPE_HALFLING) sRace = "ha"; if (nRaceType==RACIAL_TYPE_GNOME) sRace = "gn"; //Generate NPC's archetype string sArchetype; switch (Random(6)) { case 0: sArchetype = "fight"; break; case 1: sArchetype = "arche"; break; case 2: sArchetype = "mage"; break; case 3: sArchetype = "rogue"; break; case 4: sArchetype = "monk"; break; case 5: sArchetype = "cleric"; break; } //Generate NPC's subtype string sSubtype; if (sArchetype == "fight") { switch (Random(3)) { case 0: sSubtype = "shield"; break; case 1: sSubtype = "dual"; break; case 2: sSubtype = "large"; break; } } if (sArchetype == "arche") { switch (Random(2)) { case 0: sSubtype = "bow"; break; case 1: sSubtype = "xbow"; break; } } if (sArchetype == "mage") sSubtype = "mage"; if (sArchetype == "rogue") sSubtype = "rogue"; if (sArchetype == "cleric") sSubtype = "cleric"; if (sArchetype == "monk") { switch (Random(2)) { case 0: sSubtype = "fist"; break; case 1: sSubtype = "kama"; break; } sSubtype = "fist"; //Need to fix kama version, since it unequips kamas at the start of a fight and fights unarmed } //Generate NPC's equipment type string sEqType; switch (Random(3)) { case 0: sEqType = "melee"; break; case 1: sEqType = "magic"; break; case 2: sEqType = "mixed"; break; } //Generate NPC's sex string sSex; if (Random(2) == 1) sSex = "m"; else sSex = "f"; //Generate NPC's name string sName = GenerateNPCName(sSex, sRace); //Generate NPC's last name string sLastName = GenerateNPCLastName(sRace); //Generate NPC's alignment - more likely to be evil for good/neutral PCs int nLawAxis; int nGoodAxis; if (GetAlignmentGoodEvil(oPC) == ALIGNMENT_GOOD || GetAlignmentGoodEvil(oPC) == ALIGNMENT_NEUTRAL) { if (Random(10) <= 5) nGoodAxis = ALIGNMENT_EVIL; //60% else if (Random(2) == 1) nGoodAxis = ALIGNMENT_GOOD; //20% else nGoodAxis = ALIGNMENT_NEUTRAL; //20% } else { switch (Random(3)) { case 0: nGoodAxis = ALIGNMENT_GOOD; break; //33% case 1: nGoodAxis = ALIGNMENT_EVIL; break; //33% case 2: nGoodAxis = ALIGNMENT_NEUTRAL; break; //33% } } switch (Random(3)) { case 0: nLawAxis = ALIGNMENT_LAWFUL; break; //33% case 1: nLawAxis = ALIGNMENT_CHAOTIC; break; //33% case 2: nLawAxis = ALIGNMENT_NEUTRAL; break; //33% } if (sArchetype == "monk") nLawAxis = ALIGNMENT_LAWFUL; //Randomize NPC's head int nHead = d10(); //Randomize NPC's hair color int nHair; switch (Random(6)) { case 0: nHair = 2; break; case 1: nHair = 7; break; case 2: nHair = 11; break; case 3: nHair = 15; break; case 4: nHair = 16; break; case 5: nHair = 135; break; } //Randomize NPC's skin color int nSkin; if (sRace == "el") { if ( nGoodAxis == ALIGNMENT_EVIL && Random(3) == 0) nSkin = 134; //Drow else nSkin = 1; //Wood elf } if (sRace == "hu") { if ( Random(100) < 16) nSkin = 7; //Black else nSkin = 2; //White } if (sRace == "dw") { if ( (nGoodAxis == ALIGNMENT_EVIL || nGoodAxis == ALIGNMENT_NEUTRAL) && nLawAxis == ALIGNMENT_CHAOTIC && Random(3) == 0) nSkin = 42; //Duergar else nSkin = 2; //Surface dwarf } else nSkin = 1; //Generate NPC's phenotype - make 5% of generated NPCs fat, unless they're elves int nPheno = PHENOTYPE_NORMAL; if (sRace != "el" && Random(20) == 0) nPheno = PHENOTYPE_BIG; //Generate NPC's personality int nPersonality = Random(3); //0 - excited, 1 - malicious, 2 - polite //Determine whether the NPC's cloak should be visible or not int nVisibleCloak = Random(2); //Determine whether the NPC's helmet should be visible or not (visible helmets are possible only for the shield subtype of a fighter archetype) int nVisibleHelmet = FALSE; if (sSubtype == "shield" && Random(3) != 0) nVisibleHelmet = TRUE; //Generate NPC's weapon type (and offhand weapon type if applicable) int nWeapon; int nOffhand; if (((sSubtype == "shield" || sSubtype == "dual") && (sRace != "ha" && sRace != "gn")) || (sSubtype == "large" && (sRace == "ha" || sRace == "gn"))) //medium weapon as nWeapon { switch (Random(10)) { case 0: nWeapon = BASE_ITEM_BATTLEAXE; break; case 1: nWeapon = BASE_ITEM_LIGHTFLAIL; break; case 2: nWeapon = BASE_ITEM_LONGSWORD; break; case 3: nWeapon = BASE_ITEM_RAPIER; break; case 4: nWeapon = BASE_ITEM_SCIMITAR; break; case 5: nWeapon = BASE_ITEM_WARHAMMER; break; case 6: nWeapon = BASE_ITEM_BASTARDSWORD; break; case 7: nWeapon = BASE_ITEM_DWARVENWARAXE; break; case 8: nWeapon = BASE_ITEM_KATANA; break; case 9: nWeapon = BASE_ITEM_MORNINGSTAR; break; } if (sRace == "dw" && Random(2) == 0) nWeapon == BASE_ITEM_DWARVENWARAXE; } if (sSubtype == "large" && (sRace != "ha" && sRace != "gn")) //large weapon as nWeapon { switch (Random(9)) { case 0: nWeapon = BASE_ITEM_GREATAXE; break; case 1: nWeapon = BASE_ITEM_GREATSWORD; break; case 2: nWeapon = BASE_ITEM_HALBERD; break; case 3: nWeapon = BASE_ITEM_HEAVYFLAIL; break; case 4: nWeapon = BASE_ITEM_TRIDENT; break; case 5: nWeapon = BASE_ITEM_DIREMACE; break; case 6: nWeapon = BASE_ITEM_DOUBLEAXE; break; case 7: nWeapon = BASE_ITEM_SCYTHE; break; case 8: nWeapon = BASE_ITEM_TWOBLADEDSWORD; break; } } if ((sSubtype == "shield" || sSubtype == "dual") && (sRace == "ha" || sRace == "gn")) //small weapon as nWeapon { switch (Random(6)) { case 0: nWeapon = BASE_ITEM_HANDAXE; break; case 1: nWeapon = BASE_ITEM_LIGHTHAMMER; break; case 2: nWeapon = BASE_ITEM_SHORTSWORD; break; case 3: nWeapon = BASE_ITEM_WHIP; break; case 4: nWeapon = BASE_ITEM_LIGHTMACE; break; case 5: nWeapon = BASE_ITEM_SICKLE; break; } } if ((sSubtype == "dual") && (sRace != "ha" && sRace != "gn")) //small weapon as nOffhand { switch (Random(5)) { case 0: nOffhand = BASE_ITEM_HANDAXE; break; case 1: nOffhand = BASE_ITEM_LIGHTHAMMER; break; case 2: nOffhand = BASE_ITEM_SHORTSWORD; break; case 3: nOffhand = BASE_ITEM_LIGHTMACE; break; case 4: nOffhand = BASE_ITEM_SICKLE; break; } } else if ((sSubtype == "dual") && (sRace == "ha" || sRace == "gn")) //tiny weapon as nOffhand { switch (Random(2)) { case 0: nOffhand = BASE_ITEM_DAGGER; break; case 1: nOffhand = BASE_ITEM_KUKRI; break; } } else nOffhand = -1; if (sSubtype == "bow" && (sRace == "ha" || sRace == "gn")) nWeapon = BASE_ITEM_SHORTBOW; //shortbow for short races using bows if (sSubtype == "xbow" && (sRace == "ha" || sRace == "gn")) nWeapon = BASE_ITEM_LIGHTCROSSBOW; //light crossbow for short races using crossbows if (sSubtype == "bow" && (sRace != "ha" || sRace != "gn")) nWeapon = BASE_ITEM_LONGBOW; //longbow for tall races using bows if (sSubtype == "xbow" && (sRace != "ha" || sRace != "gn")) nWeapon = BASE_ITEM_HEAVYCROSSBOW; //heavy crossbow for tall races using crossbows if (sSubtype == "kama") //double kamas for monks { nWeapon = BASE_ITEM_KAMA; nOffhand = BASE_ITEM_KAMA; } if (sArchetype != "fight" && sArchetype != "arche" && sSubtype != "kama") nWeapon = -1; //Generate NPC's special traits - two strengths, one weakness string sTrait1; //1st strength string sTrait2; //2nd strength string sTrait3; //weakness SetLocalInt(oPC, "nDamage1", 0); SetLocalInt(oPC, "nDamage2", 0); SetLocalInt(oPC, "nDamage3", 0); SetLocalInt(oPC, "nDamage4", 0); SetLocalInt(oPC, "nDamage5", 0); SetLocalInt(oPC, "nDamage6", 0); SetLocalInt(oPC, "nDamage7", 0); SetLocalInt(oPC, "nDamage8", 0); SetLocalInt(oPC, "nDamage9", 0); //This part creates a temporary pseudo-list which will be used to randomly select 9 damage types (to cover all three traits) without repetitions SetLocalInt(oPC, "nDamageType1", DAMAGE_TYPE_FIRE); SetLocalInt(oPC, "nDamageType2", DAMAGE_TYPE_COLD); SetLocalInt(oPC, "nDamageType3", DAMAGE_TYPE_ACID); SetLocalInt(oPC, "nDamageType4", DAMAGE_TYPE_ELECTRICAL); SetLocalInt(oPC, "nDamageType5", DAMAGE_TYPE_DIVINE); SetLocalInt(oPC, "nDamageType6", DAMAGE_TYPE_NEGATIVE); SetLocalInt(oPC, "nDamageType7", DAMAGE_TYPE_MAGICAL); SetLocalInt(oPC, "nDamageType8", DAMAGE_TYPE_SONIC); SetLocalInt(oPC, "nDamageType9", DAMAGE_TYPE_SLASHING); SetLocalInt(oPC, "nDamageType10", DAMAGE_TYPE_BLUDGEONING); SetLocalInt(oPC, "nDamageType11", DAMAGE_TYPE_PIERCING); int nIndex; int i; int nElements = 11; for (i=1; i<=9; i++) { nIndex = Random(nElements)+1; //choose a random damage type (1-11 in the first iteration) SetLocalInt(oPC, "nDamage"+IntToString(i), GetLocalInt(oPC, "nDamageType"+IntToString(nIndex))); //assign the damage type value to an nDamageX integer while (GetLocalInt(oPC, "nDamageType"+IntToString(nIndex+1)) != 0) { SetLocalInt(oPC, "nDamageType"+IntToString(nIndex), GetLocalInt(oPC, "nDamageType"+IntToString(nIndex+1))); //move value from nDamageType(X+1) to nDamageTypeX nIndex++; } nElements--; //the pool of damage type values decreases } i = 1; while (GetLocalInt(oPC, "nDamageType"+IntToString(i)) != 0) //delete all the nDamageTypeX variables on the PC { DeleteLocalInt(oPC, "nDamageType"+IntToString(i)); } //Trait 1 switch (Random(9)) { case 0: sTrait1 = "immunity"; break; //50% immunity to randomly selected damage types 1-3 case 1: sTrait1 = "saves"; break; //+5 to saves case 2: sTrait1 = "armor"; break; //+5 to armor class case 3: sTrait1 = "mind"; break; //immunity to mind-affecting spells case 4: sTrait1 = "critical"; break; //immunity to critical hits case 5: sTrait1 = "skills"; break; //skills +10 (+20 on lvl20+) case 6: sTrait1 = "regen"; break; //regeneration (level/2, max +10, min +1) case 7: sTrait1 = "attack"; break; //caster level +5 and attack +5 case 8: sTrait1 = "damage"; break; //spells cast are empowered and damage bonus (level/4, max +5, min +1) } //Trait 2 switch (Random(9)) { case 0: sTrait2 = "immunity"; break; //50% immunity to randomly selected damage types 4-6 case 1: sTrait2 = "saves"; break; //+5 to saves case 2: sTrait2 = "armor"; break; //+5 to armor class case 3: sTrait2 = "mind"; break; //immunity to mind-affecting spells case 4: sTrait2 = "critical"; break; //immunity to critical hits case 5: sTrait2 = "skills"; break; //skills +10 (+20 on lvl20+) case 6: sTrait2 = "regen"; break; //regeneration (level/2, max +10, min +1) case 7: sTrait2 = "attack"; break; //caster level +5 and attack +5 case 8: sTrait2 = "damage"; break; //spells cast are empowered and damage bonus (level/4, max +5, min +1) } if (sTrait1 == sTrait2) sTrait2 = "immunity"; //Trait 3 (weakness) switch (Random(4)) { case 0: sTrait3 = "saves"; break; case 1: sTrait3 = "armor"; break; case 2: sTrait3 = "skills"; break; case 3: sTrait3 = "immunity"; break; } if (sTrait3 == sTrait1 || sTrait3 == sTrait2) sTrait3 = "immunity"; //Save all the info in the database SetCampaignString(sDB, "QUEST_NPC_TYPE", sArchetype); SetCampaignString(sDB, "QUEST_NPC_RACE", sRace); SetCampaignString(sDB, "QUEST_NPC_SUBTYPE", sSubtype); SetCampaignString(sDB, "QUEST_NPC_EQTYPE", sEqType); SetCampaignString(sDB, "QUEST_NPC_NAME", sName); SetCampaignString(sDB, "QUEST_NPC_LASTNAME", sLastName); SetCampaignString(sDB, "QUEST_NPC_SEX", sSex); SetCampaignString(sDB, "QUEST_NPC_TRAIT1", sTrait1); SetCampaignString(sDB, "QUEST_NPC_TRAIT2", sTrait2); SetCampaignString(sDB, "QUEST_NPC_TRAIT3", sTrait3); SetCampaignInt(sDB, "QUEST_NPC_LAWAXIS", nLawAxis); SetCampaignInt(sDB, "QUEST_NPC_GOODAXIS", nGoodAxis); SetCampaignInt(sDB, "QUEST_NPC_HEAD", nHead); SetCampaignInt(sDB, "QUEST_NPC_HAIR", nHair); SetCampaignInt(sDB, "QUEST_NPC_SKIN", nSkin); SetCampaignInt(sDB, "QUEST_NPC_PHENO", nPheno); SetCampaignInt(sDB, "QUEST_NPC_ATTITUDE", nPersonality); SetCampaignInt(sDB, "QUEST_NPC_VISCLOAK", nVisibleCloak); SetCampaignInt(sDB, "QUEST_NPC_WEAPON", nWeapon); SetCampaignInt(sDB, "QUEST_NPC_OFFHAND", nOffhand); SetCampaignInt(sDB, "QUEST_NPC_VISHELM", nVisibleHelmet); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE1", GetLocalInt(oPC, "nDamage1")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE2", GetLocalInt(oPC, "nDamage2")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE3", GetLocalInt(oPC, "nDamage3")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE4", GetLocalInt(oPC, "nDamage4")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE5", GetLocalInt(oPC, "nDamage5")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE6", GetLocalInt(oPC, "nDamage6")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE7", GetLocalInt(oPC, "nDamage7")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE8", GetLocalInt(oPC, "nDamage8")); SetCampaignInt(sDB, "QUEST_NPC_DAMAGE9", GetLocalInt(oPC, "nDamage9")); //Function successful return TRUE; } //Generate an adventurer NPC int GenerateAdventurerNPC(int nPosition, int nRaceType=RACIAL_TYPE_ALL) { //Choose the database string sDB = GetLocalString(GetModule(), "DB"); //Generate NPC's race string sRace; switch (Random(20)) { case 0: case 1: case 2: case 3: case 4: case 5: sRace = "hu"; break; // 6/20, 30% case 6: case 7: case 8: case 9: sRace = "el"; break; // 4/20, 20% case 10: case 11: case 12: case 13: sRace = "dw"; break; // 4/20, 20% case 14: case 15: sRace = "gn"; break; // 2/20, 10% case 16: case 17: sRace = "ha"; break; // 2/20, 10% case 18: sRace = "ho"; break; // 1/20, 5% case 19: sRace = "he"; break; // 1/20, 5% } if (nRaceType==RACIAL_TYPE_HUMAN) sRace = "hu"; if (nRaceType==RACIAL_TYPE_HALFORC) sRace = "ho"; if (nRaceType==RACIAL_TYPE_DWARF) sRace = "dw"; if (nRaceType==RACIAL_TYPE_ELF) sRace = "el"; if (nRaceType==RACIAL_TYPE_HALFELF) sRace = "he"; if (nRaceType==RACIAL_TYPE_HALFLING) sRace = "ha"; if (nRaceType==RACIAL_TYPE_GNOME) sRace = "gn"; //Generate NPC's archetype string sArchetype; switch (Random(6)) { case 0: sArchetype = "fight"; break; case 1: sArchetype = "arche"; break; case 2: sArchetype = "mage"; break; case 3: sArchetype = "rogue"; break; case 4: sArchetype = "monk"; break; case 5: sArchetype = "cleric"; break; } //Generate NPC's subtype string sSubtype; if (sArchetype == "fight") { switch (Random(3)) { case 0: sSubtype = "shield"; break; case 1: sSubtype = "dual"; break; case 2: sSubtype = "large"; break; } } if (sArchetype == "arche") { switch (Random(2)) { case 0: sSubtype = "bow"; break; case 1: sSubtype = "xbow"; break; } } if (sArchetype == "mage") sSubtype = "mage"; if (sArchetype == "rogue") sSubtype = "rogue"; if (sArchetype == "cleric") sSubtype = "cleric"; if (sArchetype == "monk") { switch (Random(2)) { case 0: sSubtype = "fist"; break; case 1: sSubtype = "kama"; break; } } //Generate NPC's equipment type string sEqType; switch (Random(3)) { case 0: sEqType = "melee"; break; case 1: sEqType = "magic"; break; case 2: sEqType = "mixed"; break; } //Generate NPC's sex string sSex; if (Random(2) == 1) sSex = "m"; else sSex = "f"; //Generate NPC's name string sName = GenerateNPCName(sSex, sRace); //Generate NPC's last name string sLastName = GenerateNPCLastName(sRace); //Generate NPC's alignment int nLawAxis; int nGoodAxis; switch (Random(3)) { case 0: nGoodAxis = ALIGNMENT_GOOD; break; //33% case 1: nGoodAxis = ALIGNMENT_EVIL; break; //33% case 2: nGoodAxis = ALIGNMENT_NEUTRAL; break; //33% } switch (Random(3)) { case 0: nLawAxis = ALIGNMENT_LAWFUL; break; //33% case 1: nLawAxis = ALIGNMENT_CHAOTIC; break; //33% case 2: nLawAxis = ALIGNMENT_NEUTRAL; break; //33% } if (sArchetype == "monk") nLawAxis = ALIGNMENT_LAWFUL; //Randomize NPC's head int nHead = d10(); //Randomize NPC's hair color int nHair; switch (Random(6)) { case 0: nHair = 2; break; case 1: nHair = 7; break; case 2: nHair = 11; break; case 3: nHair = 15; break; case 4: nHair = 16; break; case 5: nHair = 135; break; } //Randomize NPC's skin color int nSkin; if (sRace == "el") { if ( nGoodAxis == ALIGNMENT_EVIL && Random(3) == 0) nSkin = 134; //Drow else nSkin = 1; //Wood elf } if (sRace == "hu") { if ( Random(100) < 16) nSkin = 7; //Black else nSkin = 2; //White } if (sRace == "dw") { if ( (nGoodAxis == ALIGNMENT_EVIL || nGoodAxis == ALIGNMENT_NEUTRAL) && nLawAxis == ALIGNMENT_CHAOTIC && Random(3) == 0) nSkin = 42; //Duergar else nSkin = 2; //Surface dwarf } else nSkin = 1; //Generate NPC's phenotype - make 5% of generated NPCs fat, unless they're elves int nPheno = PHENOTYPE_NORMAL; if (sRace != "el" && Random(20) == 0) nPheno = PHENOTYPE_BIG; //Generate NPC's personality int nPersonality = Random(3); //0 - excited, 1 - malicious, 2 - polite //Determine whether the NPC's cloak should be visible or not int nVisibleCloak = Random(2); //Determine whether the NPC's helmet should be visible or not (visible helmets are possible only for the shield subtype of a fighter archetype) int nVisibleHelmet = FALSE; if (sSubtype == "shield" && Random(3) != 0) nVisibleHelmet = TRUE; //Generate NPC's weapon type (and offhand weapon type if applicable) int nWeapon; int nOffhand; if (((sSubtype == "shield" || sSubtype == "dual") && (sRace != "ha" && sRace != "gn")) || (sSubtype == "large" && (sRace == "ha" || sRace == "gn"))) //medium weapon as nWeapon { switch (Random(10)) { case 0: nWeapon = BASE_ITEM_BATTLEAXE; break; case 1: nWeapon = BASE_ITEM_LIGHTFLAIL; break; case 2: nWeapon = BASE_ITEM_LONGSWORD; break; case 3: nWeapon = BASE_ITEM_RAPIER; break; case 4: nWeapon = BASE_ITEM_SCIMITAR; break; case 5: nWeapon = BASE_ITEM_WARHAMMER; break; case 6: nWeapon = BASE_ITEM_BASTARDSWORD; break; case 7: nWeapon = BASE_ITEM_DWARVENWARAXE; break; case 8: nWeapon = BASE_ITEM_KATANA; break; case 9: nWeapon = BASE_ITEM_MORNINGSTAR; break; } if (sRace == "dw" && Random(2) == 0) nWeapon == BASE_ITEM_DWARVENWARAXE; } if (sSubtype == "large" && (sRace != "ha" && sRace != "gn")) //large weapon as nWeapon { switch (Random(9)) { case 0: nWeapon = BASE_ITEM_GREATAXE; break; case 1: nWeapon = BASE_ITEM_GREATSWORD; break; case 2: nWeapon = BASE_ITEM_HALBERD; break; case 3: nWeapon = BASE_ITEM_HEAVYFLAIL; break; case 4: nWeapon = BASE_ITEM_TRIDENT; break; case 5: nWeapon = BASE_ITEM_DIREMACE; break; case 6: nWeapon = BASE_ITEM_DOUBLEAXE; break; case 7: nWeapon = BASE_ITEM_SCYTHE; break; case 8: nWeapon = BASE_ITEM_TWOBLADEDSWORD; break; } } if ((sSubtype == "shield" || sSubtype == "dual") && (sRace == "ha" || sRace == "gn")) //small weapon as nWeapon { switch (Random(6)) { case 0: nWeapon = BASE_ITEM_HANDAXE; break; case 1: nWeapon = BASE_ITEM_LIGHTHAMMER; break; case 2: nWeapon = BASE_ITEM_SHORTSWORD; break; case 3: nWeapon = BASE_ITEM_WHIP; break; case 4: nWeapon = BASE_ITEM_LIGHTMACE; break; case 5: nWeapon = BASE_ITEM_SICKLE; break; } } if ((sSubtype == "dual") && (sRace != "ha" && sRace != "gn")) //small weapon as nOffhand { switch (Random(5)) { case 0: nOffhand = BASE_ITEM_HANDAXE; break; case 1: nOffhand = BASE_ITEM_LIGHTHAMMER; break; case 2: nOffhand = BASE_ITEM_SHORTSWORD; break; case 3: nOffhand = BASE_ITEM_LIGHTMACE; break; case 4: nOffhand = BASE_ITEM_SICKLE; break; } } else if ((sSubtype == "dual") && (sRace == "ha" || sRace == "gn")) //tiny weapon as nOffhand { switch (Random(2)) { case 0: nOffhand = BASE_ITEM_DAGGER; break; case 1: nOffhand = BASE_ITEM_KUKRI; break; } } else nOffhand = -1; if (sSubtype == "bow" && (sRace == "ha" || sRace == "gn")) nWeapon = BASE_ITEM_SHORTBOW; //shortbow for short races using bows if (sSubtype == "xbow" && (sRace == "ha" || sRace == "gn")) nWeapon = BASE_ITEM_LIGHTCROSSBOW; //light crossbow for short races using crossbows if (sSubtype == "bow" && (sRace != "ha" || sRace != "gn")) nWeapon = BASE_ITEM_LONGBOW; //longbow for tall races using bows if (sSubtype == "xbow" && (sRace != "ha" || sRace != "gn")) nWeapon = BASE_ITEM_HEAVYCROSSBOW; //heavy crossbow for tall races using crossbows if (sSubtype == "kama") //double kamas for monks { nWeapon = BASE_ITEM_KAMA; nOffhand = BASE_ITEM_KAMA; } if (sArchetype != "fight" && sArchetype != "arche" && sSubtype != "kama") nWeapon = -1; //Generate NPC's special traits - two strengths, one weakness string sTrait1; //1st strength string sTrait2; //2nd strength string sTrait3; //weakness SetLocalInt(OBJECT_SELF, "nDamage1", 0); SetLocalInt(OBJECT_SELF, "nDamage2", 0); SetLocalInt(OBJECT_SELF, "nDamage3", 0); SetLocalInt(OBJECT_SELF, "nDamage4", 0); SetLocalInt(OBJECT_SELF, "nDamage5", 0); SetLocalInt(OBJECT_SELF, "nDamage6", 0); SetLocalInt(OBJECT_SELF, "nDamage7", 0); SetLocalInt(OBJECT_SELF, "nDamage8", 0); SetLocalInt(OBJECT_SELF, "nDamage9", 0); //This part creates a temporary pseudo-list which will be used to randomly select 9 damage types (to cover all three traits) without repetitions SetLocalInt(OBJECT_SELF, "nDamageType1", DAMAGE_TYPE_FIRE); SetLocalInt(OBJECT_SELF, "nDamageType2", DAMAGE_TYPE_COLD); SetLocalInt(OBJECT_SELF, "nDamageType3", DAMAGE_TYPE_ACID); SetLocalInt(OBJECT_SELF, "nDamageType4", DAMAGE_TYPE_ELECTRICAL); SetLocalInt(OBJECT_SELF, "nDamageType5", DAMAGE_TYPE_DIVINE); SetLocalInt(OBJECT_SELF, "nDamageType6", DAMAGE_TYPE_NEGATIVE); SetLocalInt(OBJECT_SELF, "nDamageType7", DAMAGE_TYPE_MAGICAL); SetLocalInt(OBJECT_SELF, "nDamageType8", DAMAGE_TYPE_SONIC); SetLocalInt(OBJECT_SELF, "nDamageType9", DAMAGE_TYPE_SLASHING); SetLocalInt(OBJECT_SELF, "nDamageType10", DAMAGE_TYPE_BLUDGEONING); SetLocalInt(OBJECT_SELF, "nDamageType11", DAMAGE_TYPE_PIERCING); int nIndex; int i; int nElements = 11; for (i=1; i<=9; i++) { nIndex = Random(nElements)+1; //choose a random damage type (1-11 in the first iteration) SetLocalInt(OBJECT_SELF, "nDamage"+IntToString(i), GetLocalInt(OBJECT_SELF, "nDamageType"+IntToString(nIndex))); //assign the damage type value to an nDamageX integer while (GetLocalInt(OBJECT_SELF, "nDamageType"+IntToString(nIndex+1)) != 0) { SetLocalInt(OBJECT_SELF, "nDamageType"+IntToString(nIndex), GetLocalInt(OBJECT_SELF, "nDamageType"+IntToString(nIndex+1))); //move value from nDamageType(X+1) to nDamageTypeX nIndex++; } nElements--; //the pool of damage type values decreases } i = 1; while (GetLocalInt(OBJECT_SELF, "nDamageType"+IntToString(i)) != 0) //delete all the nDamageTypeX variables on the PC { DeleteLocalInt(OBJECT_SELF, "nDamageType"+IntToString(i)); } //Trait 1 switch (Random(9)) { case 0: sTrait1 = "immunity"; break; //50% immunity to randomly selected damage types 1-3 case 1: sTrait1 = "saves"; break; //+5 to saves case 2: sTrait1 = "armor"; break; //+5 to armor class case 3: sTrait1 = "mind"; break; //immunity to mind-affecting spells case 4: sTrait1 = "critical"; break; //immunity to critical hits case 5: sTrait1 = "skills"; break; //skills +10 (+20 on lvl20+) case 6: sTrait1 = "regen"; break; //regeneration (level/2, max +10, min +1) case 7: sTrait1 = "attack"; break; //caster level +5 and attack +5 case 8: sTrait1 = "damage"; break; //spells cast are empowered and damage bonus (level/4, max +5, min +1) } //Trait 2 switch (Random(9)) { case 0: sTrait2 = "immunity"; break; //50% immunity to randomly selected damage types 4-6 case 1: sTrait2 = "saves"; break; //+5 to saves case 2: sTrait2 = "armor"; break; //+5 to armor class case 3: sTrait2 = "mind"; break; //immunity to mind-affecting spells case 4: sTrait2 = "critical"; break; //immunity to critical hits case 5: sTrait2 = "skills"; break; //skills +10 (+20 on lvl20+) case 6: sTrait2 = "regen"; break; //regeneration (level/2, max +10, min +1) case 7: sTrait2 = "attack"; break; //caster level +5 and attack +5 case 8: sTrait2 = "damage"; break; //spells cast are empowered and damage bonus (level/4, max +5, min +1) } if (sTrait1 == sTrait2) sTrait2 = "immunity"; //Trait 3 (weakness) switch (Random(4)) { case 0: sTrait3 = "saves"; break; case 1: sTrait3 = "armor"; break; case 2: sTrait3 = "skills"; break; case 3: sTrait3 = "immunity"; break; } if (sTrait3 == sTrait1 || sTrait3 == sTrait2) sTrait3 = "immunity"; //Get the string part that determines position string sPositionString = IntToString(nPosition) + "_ADV_"; //Determine how much information about the quest's target is known to the inn-keepers and how much gold they will demand for it int nIntel = Random(3)+2; //2 - target's weakness, 3 - target's strength, 4 - target's 2nd strength int nIntelCost = Random(3); //0 - free if (nIntelCost != 0) nIntelCost = Random(3000)+1000; //Save all the info in the database SetCampaignInt(sDB, sPositionString+"INTEL", nIntel); SetCampaignInt(sDB, sPositionString+"INTELCOST", nIntelCost); SetCampaignString(sDB, sPositionString+"TYPE", sArchetype); SetCampaignString(sDB, sPositionString+"RACE", sRace); SetCampaignString(sDB, sPositionString+"SUBTYPE", sSubtype); SetCampaignString(sDB, sPositionString+"EQTYPE", sEqType); SetCampaignString(sDB, sPositionString+"NAME", sName); SetCampaignString(sDB, sPositionString+"LASTNAME", sLastName); SetCampaignString(sDB, sPositionString+"SEX", sSex); SetCampaignString(sDB, sPositionString+"TRAIT1", sTrait1); SetCampaignString(sDB, sPositionString+"TRAIT2", sTrait2); SetCampaignString(sDB, sPositionString+"TRAIT3", sTrait3); SetCampaignInt(sDB, sPositionString+"LAWAXIS", nLawAxis); SetCampaignInt(sDB, sPositionString+"GOODAXIS", nGoodAxis); SetCampaignInt(sDB, sPositionString+"HEAD", nHead); SetCampaignInt(sDB, sPositionString+"HAIR", nHair); SetCampaignInt(sDB, sPositionString+"SKIN", nSkin); SetCampaignInt(sDB, sPositionString+"PHENO", nPheno); SetCampaignInt(sDB, sPositionString+"ATTITUDE", nPersonality); SetCampaignInt(sDB, sPositionString+"VISCLOAK", nVisibleCloak); SetCampaignInt(sDB, sPositionString+"WEAPON", nWeapon); SetCampaignInt(sDB, sPositionString+"OFFHAND", nOffhand); SetCampaignInt(sDB, sPositionString+"VISHELM", nVisibleHelmet); SetCampaignInt(sDB, sPositionString+"DAMAGE1", GetLocalInt(OBJECT_SELF, "nDamage1")); SetCampaignInt(sDB, sPositionString+"DAMAGE2", GetLocalInt(OBJECT_SELF, "nDamage2")); SetCampaignInt(sDB, sPositionString+"DAMAGE3", GetLocalInt(OBJECT_SELF, "nDamage3")); SetCampaignInt(sDB, sPositionString+"DAMAGE4", GetLocalInt(OBJECT_SELF, "nDamage4")); SetCampaignInt(sDB, sPositionString+"DAMAGE5", GetLocalInt(OBJECT_SELF, "nDamage5")); SetCampaignInt(sDB, sPositionString+"DAMAGE6", GetLocalInt(OBJECT_SELF, "nDamage6")); SetCampaignInt(sDB, sPositionString+"DAMAGE7", GetLocalInt(OBJECT_SELF, "nDamage7")); SetCampaignInt(sDB, sPositionString+"DAMAGE8", GetLocalInt(OBJECT_SELF, "nDamage8")); SetCampaignInt(sDB, sPositionString+"DAMAGE9", GetLocalInt(OBJECT_SELF, "nDamage9")); //Delete Damage variables DeleteLocalInt(OBJECT_SELF, "nDamage1"); DeleteLocalInt(OBJECT_SELF, "nDamage2"); DeleteLocalInt(OBJECT_SELF, "nDamage3"); DeleteLocalInt(OBJECT_SELF, "nDamage4"); DeleteLocalInt(OBJECT_SELF, "nDamage5"); DeleteLocalInt(OBJECT_SELF, "nDamage6"); DeleteLocalInt(OBJECT_SELF, "nDamage7"); DeleteLocalInt(OBJECT_SELF, "nDamage8"); DeleteLocalInt(OBJECT_SELF, "nDamage9"); object oNPC = PrespawnAdventurerNPC(nPosition, sDB); StoreAdventurerNPC(oNPC, nPosition, sDB); DestroyObject(oNPC, 5.0); //Function successful return TRUE; } //Spawn a quest NPC object SpawnFreshQuestNPC(object oPC, location lLocation) { //Get all the parameters of the NPC string sDB = CharacterDB(oPC); string sArchetype = GetCampaignString(sDB, "QUEST_NPC_TYPE"); //fight, arche, mage, monk, rogue, cleric string sRace = GetCampaignString(sDB, "QUEST_NPC_RACE"); //hu, ha, he, ho, gn, dw, el string sSubtype = GetCampaignString(sDB, "QUEST_NPC_SUBTYPE"); //fight: shield, dual, large, arche: bow, xbow, monk: fist, kama string sEqType = GetCampaignString(sDB, "QUEST_NPC_EQTYPE"); //melee, magic, mixed string sName = GetCampaignString(sDB, "QUEST_NPC_NAME"); string sLastName = GetCampaignString(sDB, "QUEST_NPC_LASTNAME"); int nLawAxis = GetCampaignInt(sDB, "QUEST_NPC_LAWAXIS"); //ALIGNMENT_LAWFUL, ALIGNMENT_NEUTRAL, ALIGNMENT_CHAOTIC int nGoodAxis = GetCampaignInt(sDB, "QUEST_NPC_GOODAXIS"); //ALIGNMENT_GOOD, ALIGNMENT_NEUTRAL, ALIGNMENT_EVIL string sSex = GetCampaignString(sDB, "QUEST_NPC_SEX"); //m,f int nLevel = GetHitDice(oPC); int nHead = GetCampaignInt(sDB, "QUEST_NPC_HEAD"); //1-10 int nHair = GetCampaignInt(sDB, "QUEST_NPC_HAIR"); //2,7,11,15,16,135 int nSkin = GetCampaignInt(sDB, "QUEST_NPC_SKIN"); // int nPheno = GetCampaignInt(sDB, "QUEST_NPC_PHENO"); //PHENOTYPE_BIG, PHENOTYPE_NORMAL int nPersonality = GetCampaignInt(sDB, "QUEST_NPC_ATTITUDE"); //0 - excited, 1 - malicious, 2 - polite int nVisibleCloak = GetCampaignInt(sDB, "QUEST_NPC_VISCLOAK"); //0,1 int nVisibleHelmet; int nWeapon; int nOffhand; if (sArchetype == "fight") { nWeapon = GetCampaignInt(sDB, "QUEST_NPC_WEAPON"); nOffhand = GetCampaignInt(sDB, "QUEST_NPC_OFFHAND"); if (sSubtype == "shield") nVisibleHelmet = GetCampaignInt(sDB, "QUEST_NPC_VISHELM"); } string sTrait1 = GetCampaignString(sDB, "QUEST_NPC_TRAIT1"); string sTrait2 = GetCampaignString(sDB, "QUEST_NPC_TRAIT2"); string sTrait3 = GetCampaignString(sDB, "QUEST_NPC_TRAIT3"); int nDamage1a = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE1"); int nDamage1b = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE2"); int nDamage1c = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE3"); int nDamage2a = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE4"); int nDamage2b = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE5"); int nDamage2c = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE6"); int nDamage3a = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE7"); int nDamage3b = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE8"); int nDamage3c = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE9"); //Prepare the ResRef of the blueprint and spawn the NPC string sBlueprint = sArchetype + "_" + sRace + "_" + sSex; if (sArchetype != "cleric") sBlueprint += "_01"; else { if (nLevel <= 9) { if (nLevel % 2 == 0) sBlueprint += "_0"+IntToString(nLevel); else sBlueprint += "_0"+IntToString(nLevel+1); //we can't spawn clerics on uneven levels, so we add one } else { if (nLevel % 2 == 0) sBlueprint += "_"+IntToString(nLevel); else sBlueprint += "_"+IntToString(nLevel+1); //we can't spawn clerics on uneven levels, so we add one } } object oNPC = CreateObject(OBJECT_TYPE_CREATURE, sBlueprint, lLocation); //Set alignment if (nLawAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nLawAxis, 50, FALSE); if (nGoodAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nGoodAxis, 50, FALSE); //Level-up the NPC if (sArchetype != "cleric") LevelHenchmanUpTo(oNPC, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oNPC), PACKAGE_INVALID); //Restore the NPC's spells ForceRest(oNPC); //Give the NPC his or her equipment (based on archetype, subtype and equipment type) and equip it if (sSubtype == "shield") GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, nVisibleHelmet, nWeapon, nOffhand); //nVisibleHelmet else if (sSubtype == "dual") GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon, nOffhand); else if (sSubtype == "large") GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon); else GenerateEquipmentForNPC(TRUE, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak); WriteTimestampedLogEntry("5. Equipment created"); //TEST //Rogues and some fighters and monks are dual-wielders if (sArchetype == "rogue" || sSubtype == "dual" || sSubtype == "kama") SetLocalInt(oNPC, "DualWieldState", TRUE); WriteTimestampedLogEntry("6. Wielding mode set"); //TEST //Buff the fighter archetype (to make up for the lack of weapon feats like weapon focus, specialization, etc) effect eWarriorBuff; itemproperty iKeen; itemproperty iMassive; if (sArchetype == "fight") { eWarriorBuff = EffectAttackIncrease(1); if (GetHitDice(oNPC) >= 4) eWarriorBuff = EffectLinkEffects(EffectDamageIncrease(DAMAGE_BONUS_2, DAMAGE_TYPE_BLUDGEONING), eWarriorBuff); if (GetHitDice(oNPC) >= 8) iKeen = ItemPropertyKeen(); if (GetHitDice(oNPC) >= 21) eWarriorBuff = EffectLinkEffects(EffectAttackIncrease(2), eWarriorBuff); if (GetHitDice(oNPC) >= 24) eWarriorBuff = EffectLinkEffects(EffectDamageIncrease(DAMAGE_BONUS_4, DAMAGE_TYPE_BLUDGEONING), eWarriorBuff); if (GetHitDice(oNPC) >= 28) iMassive = ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_2d6); eWarriorBuff = SupernaturalEffect(eWarriorBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eWarriorBuff, oNPC); } //Make spellcasters "cheat" a bit - let them cast spells from items with their own caster level, not the item's (achieved via spellhooking) SetLocalInt(oNPC, "anc_castercheat", TRUE); //Buff rogues a bit, since their attack is pretty low if (sArchetype == "rogue") ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(nLevel/4)), oNPC); //Mark clerics as healers if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_HEALER", TRUE); if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_CASTER_CLERIC", TRUE); //if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_VANILLA_AI", TRUE); //Buff monks' strength (and attack), since the package they use dump it, and give them some better spell resistance, since their AC is useless against spellcasters if (sArchetype == "monk") ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAbilityIncrease(ABILITY_STRENGTH, nLevel/3)), oNPC); if (sArchetype == "monk" && nLevel > 25) DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectSpellResistanceIncrease(GetSpellResistance(oNPC)+8)), oNPC)); if (sArchetype == "monk" && nLevel >= 40) ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(4)), oNPC); if (sArchetype == "monk" && nLevel < 40) ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(3)), oNPC); //Buff the archer archetype (to make up for the lack of weapon focus) effect eArcherBuff; if (sArchetype == "arche") { eArcherBuff = EffectAttackIncrease(1); if (GetHitDice(oNPC) >= 21) eArcherBuff = EffectLinkEffects(EffectAttackIncrease(2), eArcherBuff); eArcherBuff = SupernaturalEffect(eArcherBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eArcherBuff, oNPC); } //Simulate the helmet (if it's supposed to be invisible) by granting the NPC an armor class buff - this can be done even if the NPC has a helmet, since the bonus won't stack effect eHelmetBuff; int nAC = 0; if ((sEqType == "melee" || sEqType == "mixed") && nLevel >= 8) nAC++; //melee and mixed-type eq gets a first helmet at level 8 if (sEqType == "magic" && nLevel >= 12) nAC++; //magic-type eq gets a first helmet at level 12 if (nLevel >= 14) nAC++; //everyone gets a helmet +2 at level 14 if (nLevel >= 20) { switch (nLevel) { case 40: nAC = 12; break; case 39: nAC = 12; break; case 38: nAC = 11; break; case 37: nAC = 11; break; case 36: nAC = 11; break; case 35: nAC = 10; break; case 34: nAC = 9; break; case 33: nAC = 8; break; case 32: nAC = 8; break; case 31: nAC = 7; break; case 30: nAC = 7; break; case 29: nAC = 7; break; case 28: nAC = 7; break; case 27: nAC = 6; break; case 26: nAC = 6; break; case 25: nAC = 5; break; case 24: nAC = 5; break; case 23: nAC = 4; break; case 22: nAC = 4; break; default: nAC = 3; break; } } eHelmetBuff = EffectACIncrease(nAC, AC_DEFLECTION_BONUS); eHelmetBuff = SupernaturalEffect(eHelmetBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHelmetBuff, oNPC); WriteTimestampedLogEntry("7. Buffs applied"); //TEST //Set name SetName(oNPC, sName+" "+sLastName); //Set hair and skin color, phenotype, head SetColor(oNPC, COLOR_CHANNEL_HAIR, nHair); SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkin); SetPhenoType(nPheno, oNPC); SetCreatureBodyPart(CREATURE_PART_HEAD, nHead, oNPC); //Set all the trait bonuses effect eTrait1; effect eTrait2; effect eTrait3; int nRegen; int nDamage; //Trait1 if(sTrait1 == "immunity") { eTrait1 = EffectDamageImmunityIncrease(nDamage1a, 50); eTrait1 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage1b, 50), eTrait1); eTrait1 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage1c, 50), eTrait1); eTrait1 = SupernaturalEffect(eTrait1); } if(sTrait1 == "saves") eTrait1 = SupernaturalEffect(EffectSavingThrowIncrease(SAVING_THROW_ALL, 5)); if(sTrait1 == "armor") eTrait1 = SupernaturalEffect(EffectACIncrease(nAC+5, AC_DEFLECTION_BONUS)); if(sTrait1 == "mind") eTrait1 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS)); if(sTrait1 == "critical") eTrait1 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT)); if(sTrait1 == "skills") eTrait1 = SupernaturalEffect(EffectSkillIncrease(SKILL_ALL_SKILLS, 20)); if(sTrait1 == "regen") { nRegen = nLevel/2; if(nRegen<1) nRegen = 1; if(nRegen>10) nRegen = 10; eTrait1 = SupernaturalEffect(EffectRegenerate(nRegen, 6.0)); } if(sTrait1 == "attack") eTrait1 = SupernaturalEffect(EffectAttackIncrease(5)); if(sTrait1 == "damage") { nDamage = nLevel/2; if(nDamage<1) nDamage = 1; if(nDamage>5) nDamage = 5; eTrait1 = SupernaturalEffect(EffectDamageIncrease(nDamage, DAMAGE_TYPE_BLUDGEONING)); } //Trait 2 if(sTrait2 == "immunity") { eTrait2 = EffectDamageImmunityIncrease(nDamage2a, 50); eTrait2 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage2b, 50), eTrait2); eTrait2 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage2c, 50), eTrait2); eTrait2 = SupernaturalEffect(eTrait2); } if(sTrait2 == "saves") eTrait2 = SupernaturalEffect(EffectSavingThrowIncrease(SAVING_THROW_ALL, 5)); if(sTrait2 == "armor") eTrait2 = SupernaturalEffect(EffectACIncrease(nAC+5, AC_DEFLECTION_BONUS)); if(sTrait2 == "mind") eTrait2 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS)); if(sTrait2 == "critical") eTrait2 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT)); if(sTrait2 == "skills") eTrait2 = SupernaturalEffect(EffectSkillIncrease(SKILL_ALL_SKILLS, 20)); if(sTrait2 == "regen") { nRegen = nLevel/2; if(nRegen<1) nRegen = 1; if(nRegen>10) nRegen = 10; eTrait2 = SupernaturalEffect(EffectRegenerate(nRegen, 6.0)); } if(sTrait2 == "attack") eTrait2 = SupernaturalEffect(EffectAttackIncrease(5)); if(sTrait2 == "damage") { nDamage = nLevel/2; if(nDamage<1) nDamage = 1; if(nDamage>5) nDamage = 5; eTrait2 = SupernaturalEffect(EffectDamageIncrease(nDamage, DAMAGE_TYPE_BLUDGEONING)); } //Trait 3 (weakness) if(sTrait3 == "immunity") { eTrait3 = EffectDamageImmunityDecrease(nDamage3a, 50); eTrait3 = EffectLinkEffects(EffectDamageImmunityDecrease(nDamage3b, 50), eTrait3); eTrait3 = EffectLinkEffects(EffectDamageImmunityDecrease(nDamage3c, 50), eTrait3); eTrait3 = SupernaturalEffect(eTrait3); } if(sTrait3 == "saves") eTrait3 = SupernaturalEffect(EffectSavingThrowDecrease(SAVING_THROW_ALL, 5)); if(sTrait3 == "armor") eTrait3 = SupernaturalEffect(EffectACDecrease(5, AC_DODGE_BONUS)); if(sTrait3 == "skills") eTrait3 = SupernaturalEffect(EffectSkillDecrease(SKILL_ALL_SKILLS, 15)); //Apply effects ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait1, oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait2, oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait3, oNPC); //Save all the variables on the NPC SetLocalString(oNPC, "sArchetype", sArchetype); SetLocalString(oNPC, "sRace", sRace); SetLocalString(oNPC, "sSubtype", sSubtype); SetLocalString(oNPC, "sEqType", sEqType); SetLocalString(oNPC, "sName", sName); SetLocalString(oNPC, "sLastName", sLastName); SetLocalString(oNPC, "sSex", sSex); SetLocalString(oNPC, "sTrait1", sTrait1); SetLocalString(oNPC, "sTrait2", sTrait2); SetLocalString(oNPC, "sTrait3", sTrait3); SetLocalInt(oNPC, "nLawAxis", nLawAxis); SetLocalInt(oNPC, "nGoodAxis", nGoodAxis); SetLocalInt(oNPC, "nLevel", nLevel); SetLocalInt(oNPC, "nHead", nHead); SetLocalInt(oNPC, "nHair", nHair); SetLocalInt(oNPC, "nSkin", nSkin); SetLocalInt(oNPC, "nPheno", nPheno); SetLocalInt(oNPC, "nPersonality", nPersonality); SetLocalInt(oNPC, "nVisibleCloak", nVisibleCloak); SetLocalInt(oNPC, "nDamage1a", nDamage1a); SetLocalInt(oNPC, "nDamage1b", nDamage1b); SetLocalInt(oNPC, "nDamage1c", nDamage1c); SetLocalInt(oNPC, "nDamage2a", nDamage2a); SetLocalInt(oNPC, "nDamage2b", nDamage2b); SetLocalInt(oNPC, "nDamage2c", nDamage2c); SetLocalInt(oNPC, "nDamage3a", nDamage3a); SetLocalInt(oNPC, "nDamage3b", nDamage3b); SetLocalInt(oNPC, "nDamage3c", nDamage3c); SetLocalString(oNPC, "sPC", sDB); SetLocalObject(oNPC, "oPC", oPC); if (sArchetype == "fight") { if (sSubtype == "shield") SetLocalInt(oNPC, "nVisibleHelmet", nVisibleHelmet); SetLocalInt(oNPC, "nWeapon", nWeapon); SetLocalInt(oNPC, "nOffhand", nOffhand); } //Return the NPC generated return oNPC; } //Save the NPC to be restored later from a PC's database (for example if the NPC runs away and becomes available as an event encounter) void StoreQuestNPC(object oNPC) { string sDB = GetLocalString(oNPC, "sPC"); int nPosition; if (GetCampaignInt(sDB, "1_NPC_OCCUPIED") == FALSE) nPosition = 1; else if (GetCampaignInt(sDB, "2_NPC_OCCUPIED") == FALSE) nPosition = 2; else if (GetCampaignInt(sDB, "3_NPC_OCCUPIED") == FALSE) nPosition = 3; else return; //if all NPC slots in the database are occuppied, the NPC can't be stored; this function probably shouldn't have been called in the first place string sPosition = IntToString(nPosition); //Get all the variables from the NPC string sArchetype = GetLocalString(oNPC, "sArchetype"); string sRace = GetLocalString(oNPC, "sRace"); string sSubtype = GetLocalString(oNPC, "sSubtype"); string sEqType = GetLocalString(oNPC, "sEqType"); string sName = GetLocalString(oNPC, "sName"); string sLastName = GetLocalString(oNPC, "sLastName"); string sSex = GetLocalString(oNPC, "sSex"); string sTrait1 = GetLocalString(oNPC, "sTrait1"); string sTrait2 = GetLocalString(oNPC, "sTrait2"); string sTrait3 = GetLocalString(oNPC, "sTrait3"); int nIntel = GetCampaignInt(sDB, "QUEST_INTEL"); int nIntelCost = GetCampaignInt(sDB, "QUEST_INTELCOST"); int nLawAxis = GetLocalInt(oNPC, "nLawAxis"); int nGoodAxis = GetLocalInt(oNPC, "nGoodAxis"); int nHead = GetLocalInt(oNPC, "nHead"); int nHair = GetLocalInt(oNPC, "nHair"); int nSkin = GetLocalInt(oNPC, "nSkin"); int nPheno = GetLocalInt(oNPC, "nPheno"); int nPersonality = GetLocalInt(oNPC, "nPersonality"); int nVisibleCloak = GetLocalInt(oNPC, "nVisibleCloak"); int nWeapon = GetLocalInt(oNPC, "nWeapon"); int nOffhand = GetLocalInt(oNPC, "nOffhand"); int nVisibleHelmet = GetLocalInt(oNPC, "nVisibleHelmet"); int nDamage1a = GetLocalInt(oNPC, "nDamage1a"); int nDamage1b = GetLocalInt(oNPC, "nDamage1b"); int nDamage1c = GetLocalInt(oNPC, "nDamage1c"); int nDamage2a = GetLocalInt(oNPC, "nDamage2a"); int nDamage2b = GetLocalInt(oNPC, "nDamage2b"); int nDamage2c = GetLocalInt(oNPC, "nDamage2c"); int nDamage3a = GetLocalInt(oNPC, "nDamage3a"); int nDamage3b = GetLocalInt(oNPC, "nDamage3b"); int nDamage3c = GetLocalInt(oNPC, "nDamage3c"); int nLevel = GetHitDice(oNPC); string sArmor = GetLocalString(oNPC, "sArmor"); string sReductionCloak = GetLocalString(oNPC, "sReductionCloak"); int nBonus1_off = GetLocalInt(oNPC, "nBonus1_off"); string sBonus2_off = GetLocalString(oNPC, "sBonus2_off"); string sWeapon_off = GetLocalString(oNPC, "sWeapon_off"); int nMaxEnhancement_off = GetLocalInt(oNPC, "nMaxEnhancement_off"); int nBonus1 = GetLocalInt(oNPC, "nBonus1"); string sBonus2 = GetLocalString(oNPC, "sBonus2"); string sWeapon = GetLocalString(oNPC, "sWeapon"); int nMaxEnhancement = GetLocalInt(oNPC, "nMaxEnhancement"); int nDamageType = GetLocalInt(oNPC, "nDamageType"); int nDamageType_off = GetLocalInt(oNPC, "nDamageType_off"); SetCampaignInt(sDB, sPosition+"_NPC_INTEL", nIntel); SetCampaignInt(sDB, sPosition+"_NPC_INTELCOST", nIntelCost); SetCampaignString(sDB, sPosition+"_NPC_TYPE", sArchetype); SetCampaignString(sDB, sPosition+"_NPC_RACE", sRace); SetCampaignString(sDB, sPosition+"_NPC_SUBTYPE", sSubtype); SetCampaignString(sDB, sPosition+"_NPC_EQTYPE", sEqType); SetCampaignString(sDB, sPosition+"_NPC_NAME", sName); SetCampaignString(sDB, sPosition+"_NPC_LASTNAME", sLastName); SetCampaignString(sDB, sPosition+"_NPC_SEX", sSex); SetCampaignString(sDB, sPosition+"_NPC_TRAIT1", sTrait1); SetCampaignString(sDB, sPosition+"_NPC_TRAIT2", sTrait2); SetCampaignString(sDB, sPosition+"_NPC_TRAIT3", sTrait3); SetCampaignInt(sDB, sPosition+"_NPC_LAWAXIS", nLawAxis); SetCampaignInt(sDB, sPosition+"_NPC_GOODAXIS", nGoodAxis); SetCampaignInt(sDB, sPosition+"_NPC_HEAD", nHead); SetCampaignInt(sDB, sPosition+"_NPC_HAIR", nHair); SetCampaignInt(sDB, sPosition+"_NPC_SKIN", nSkin); SetCampaignInt(sDB, sPosition+"_NPC_PHENO", nPheno); SetCampaignInt(sDB, sPosition+"_NPC_ATTITUDE", nPersonality); SetCampaignInt(sDB, sPosition+"_NPC_VISCLOAK", nVisibleCloak); SetCampaignInt(sDB, sPosition+"_NPC_WEAPON", nWeapon); SetCampaignInt(sDB, sPosition+"_NPC_OFFHAND", nOffhand); SetCampaignInt(sDB, sPosition+"_NPC_VISHELM", nVisibleHelmet); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE1", nDamage1a); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE2", nDamage1b); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE3", nDamage1c); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE4", nDamage2a); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE5", nDamage2b); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE6", nDamage2c); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE7", nDamage3a); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE8", nDamage3b); SetCampaignInt(sDB, sPosition+"_NPC_DAMAGE9", nDamage3c); SetCampaignInt(sDB, sPosition+"_NPC_LEVEL", nLevel); SetCampaignInt(sDB, sPosition+"_NPC_OCCUPIED", TRUE); if (sArmor != "") SetCampaignString(sDB, sPosition+"_NPC_ARMOR", sArmor); if (sReductionCloak != "") SetCampaignString(sDB, sPosition+"_NPC_CLOAK", sReductionCloak); if (nBonus1_off != 0) SetCampaignInt(sDB, sPosition+"_NPC_OFFBONUS1", nBonus1_off); if (sBonus2_off != "") SetCampaignString(sDB, sPosition+"_NPC_OFFBONUS2", sBonus2_off); if (sWeapon_off != "") SetCampaignString(sDB, sPosition+"_NPC_OFFWEAPON", sWeapon_off); if (nMaxEnhancement_off != 0) SetCampaignInt(sDB, sPosition+"_NPC_OFFMAXBONUS", nMaxEnhancement_off); if (nBonus1 != 0) SetCampaignInt(sDB, sPosition+"_NPC_BONUS1", nBonus1); if (sBonus2 != "") SetCampaignString(sDB, sPosition+"_NPC_BONUS2", sBonus2); if (sWeapon != "") SetCampaignString(sDB, sPosition+"_NPC_MWEAPON", sWeapon); if (nMaxEnhancement != 0) SetCampaignInt(sDB, sPosition+"_NPC_MAXBONUS", nMaxEnhancement); if (nDamageType != 0) SetCampaignInt(sDB, sPosition+"_NPC_DMGTYPE", nDamageType); if (nDamageType_off != 0) SetCampaignInt(sDB, sPosition+"_NPC_OFFDMGTYPE", nDamageType_off); } //Spawn a stored NPC from a database object SpawnStoredNPC(object oPC, int nPosition, location lLocation) { //Get all the parameters of the NPC string sDB = CharacterDB(oPC); string sPosition = IntToString(nPosition); string sArchetype = GetCampaignString(sDB, sPosition+"_NPC_TYPE"); string sRace = GetCampaignString(sDB, sPosition+"_NPC_RACE"); string sSubtype = GetCampaignString(sDB, sPosition+"_NPC_SUBTYPE"); string sEqType = GetCampaignString(sDB, sPosition+"_NPC_EQTYPE"); string sName = GetCampaignString(sDB, sPosition+"_NPC_NAME"); string sLastName = GetCampaignString(sDB, sPosition+"_NPC_LASTNAME"); int nLawAxis = GetCampaignInt(sDB, sPosition+"_NPC_LAWAXIS"); int nGoodAxis = GetCampaignInt(sDB, sPosition+"_NPC_GOODAXIS"); string sSex = GetCampaignString(sDB, sPosition+"_NPC_SEX"); int nLevel = GetHitDice(oPC); int nPreviousLevel = GetCampaignInt(sDB, sPosition+"_NPC_LEVEL"); int nHead = GetCampaignInt(sDB, sPosition+"_NPC_HEAD"); int nHair = GetCampaignInt(sDB, sPosition+"_NPC_HAIR"); int nSkin = GetCampaignInt(sDB, sPosition+"_NPC_SKIN"); int nPheno = GetCampaignInt(sDB, sPosition+"_NPC_PHENO"); int nPersonality = GetCampaignInt(sDB, sPosition+"_NPC_ATTITUDE"); int nVisibleCloak = GetCampaignInt(sDB, sPosition+"_NPC_VISCLOAK"); int nVisibleHelmet; int nWeapon; int nOffhand; if (sArchetype == "fight") { nWeapon = GetCampaignInt(sDB, sPosition+"_NPC_WEAPON"); nOffhand = GetCampaignInt(sDB, sPosition+"_NPC_OFFHAND"); if (sSubtype == "shield") nVisibleHelmet = GetCampaignInt(sDB, sPosition+"_NPC_VISHELM"); } string sTrait1 = GetCampaignString(sDB, sPosition+"_NPC_TRAIT1"); string sTrait2 = GetCampaignString(sDB, sPosition+"_NPC_TRAIT2"); string sTrait3 = GetCampaignString(sDB, sPosition+"_NPC_TRAIT3"); int nDamage1a = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE1"); int nDamage1b = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE2"); int nDamage1c = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE3"); int nDamage2a = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE4"); int nDamage2b = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE5"); int nDamage2c = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE6"); int nDamage3a = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE7"); int nDamage3b = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE8"); int nDamage3c = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE9"); string sArmor = GetCampaignString(sDB, sPosition+"_NPC_ARMOR"); string sReductionCloak = GetCampaignString(sDB, sPosition+"_NPC_CLOAK"); int nBonus1_off = GetCampaignInt(sDB, sPosition+"_NPC_OFFBONUS1"); string sBonus2_off = GetCampaignString(sDB, sPosition+"_NPC_OFFBONUS2"); string sWeapon_off = GetCampaignString(sDB, sPosition+"_NPC_OFFWEAPON"); int nMaxEnhancement_off = GetCampaignInt(sDB, sPosition+"_NPC_OFFMAXBONUS"); int nBonus1 = GetCampaignInt(sDB, sPosition+"_NPC_BONUS1"); string sBonus2 = GetCampaignString(sDB, sPosition+"_NPC_BONUS2"); string sWeapon = GetCampaignString(sDB, sPosition+"_NPC_MWEAPON"); int nMaxEnhancement = GetCampaignInt(sDB, sPosition+"_NPC_MAXBONUS"); int nDamageType = GetCampaignInt(sDB, sPosition+"_NPC_DMGTYPE"); int nDamageType_off = GetCampaignInt(sDB, sPosition+"_NPC_OFFDMGTYPE"); //Prepare the ResRef of the blueprint and spawn the NPC string sBlueprint = sArchetype + "_" + sRace + "_" + sSex; if (sArchetype != "cleric") sBlueprint += "_01"; else { if (nLevel <= 9) { if (nLevel % 2 == 0) sBlueprint += "_0"+IntToString(nLevel); else sBlueprint += "_0"+IntToString(nLevel+1); //we can't spawn clerics on uneven levels, so we add one } else sBlueprint += "_"+IntToString(nLevel); } object oNPC = CreateObject(OBJECT_TYPE_CREATURE, sBlueprint, lLocation); //Store variables required for equipment retrieval on the NPC SetLocalString(oNPC, "sArmor", sArmor); SetLocalString(oNPC, "sReductionCloak", sReductionCloak); SetLocalInt(oNPC, "nBonus1_off", nBonus1_off); SetLocalString(oNPC, "sBonus2_off", sBonus2_off); SetLocalString(oNPC, "sWeapon_off", sWeapon_off); SetLocalInt(oNPC, "nMaxEnhancement_off", nMaxEnhancement_off); SetLocalInt(oNPC, "nBonus1", nBonus1); SetLocalString(oNPC, "sBonus2", sBonus2); SetLocalString(oNPC, "sWeapon", sWeapon); SetLocalInt(oNPC, "nMaxEnhancement", nMaxEnhancement); SetLocalInt(oNPC, "nDamageType", nDamageType); SetLocalInt(oNPC, "nDamageType_off", nDamageType_off); //Set alignment if (nLawAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nLawAxis, 50, FALSE); if (nGoodAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nGoodAxis, 50, FALSE); //Level-up the NPC if (sArchetype != "cleric") LevelHenchmanUpTo(oNPC, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oNPC), PACKAGE_INVALID); //Restore the NPC's spells ForceRest(oNPC); //Check if the previous level of the NPC corresponds to its current level - if it levelled up since then, generate new equipment, otherwise retrieve his old inventory int nNewEq; if (nLevel > nPreviousLevel) nNewEq = TRUE; if (sSubtype == "shield") GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, nVisibleHelmet, nWeapon, nOffhand); //nVisibleHelmet else if (sSubtype == "dual") GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon, nOffhand); else if (sSubtype == "large") GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon); else GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak); //Rogues and some fighters and monks are dual-wielders if (sArchetype == "rogue" || sSubtype == "dual" || sSubtype == "kama") SetLocalInt(oNPC, "DualWieldState", TRUE); //Buff the fighter archetype (to make up for the lack of weapon feats like weapon focus, specialization, etc) effect eWarriorBuff; itemproperty iKeen; itemproperty iMassive; if (sArchetype == "fight") { eWarriorBuff = EffectAttackIncrease(1); if (GetHitDice(oNPC) >= 4) eWarriorBuff = EffectLinkEffects(EffectDamageIncrease(DAMAGE_BONUS_2, DAMAGE_TYPE_BLUDGEONING), eWarriorBuff); if (GetHitDice(oNPC) >= 8) iKeen = ItemPropertyKeen(); if (GetHitDice(oNPC) >= 21) eWarriorBuff = EffectLinkEffects(EffectAttackIncrease(2), eWarriorBuff); if (GetHitDice(oNPC) >= 24) eWarriorBuff = EffectLinkEffects(EffectDamageIncrease(DAMAGE_BONUS_4, DAMAGE_TYPE_BLUDGEONING), eWarriorBuff); if (GetHitDice(oNPC) >= 28) iMassive = ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_2d6); eWarriorBuff = SupernaturalEffect(eWarriorBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eWarriorBuff, oNPC); } //Make spellcasters "cheat" a bit - let them cast spells from items with their own caster level, not the item's (achieved via spellhooking) SetLocalInt(oNPC, "anc_castercheat", TRUE); //Buff rogues a bit, since their attack is pretty low if (sArchetype == "rogue") ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(nLevel/4)), oNPC); //Mark clerics as healers if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_HEALER", TRUE); if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_CASTER_CLERIC", TRUE); //if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_VANILLA_AI", TRUE); //Buff monks' strength, since the package they use dump it, and give them some better spell resistance, since their AC is useless against spellcasters if (sArchetype == "monk") ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAbilityIncrease(ABILITY_STRENGTH, nLevel/3)), oNPC); if (sArchetype == "monk" && nLevel > 25) DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectSpellResistanceIncrease(GetSpellResistance(oNPC)+8)), oNPC)); if (sArchetype == "monk" && nLevel >= 40) ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(4)), oNPC); if (sArchetype == "monk" && nLevel < 40) ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(3)), oNPC); //Buff the archer archetype (to make up for the lack of weapon focus) effect eArcherBuff; if (sArchetype == "arche") { eArcherBuff = EffectAttackIncrease(1); if (GetHitDice(oNPC) >= 21) eArcherBuff = EffectLinkEffects(EffectAttackIncrease(2), eArcherBuff); eArcherBuff = SupernaturalEffect(eArcherBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eArcherBuff, oNPC); } //Simulate the helmet (if it's supposed to be invisible) by granting the NPC an armor class buff - this can be done even if the NPC has a helmet, since the bonus won't stack effect eHelmetBuff; int nAC = 0; if ((sEqType == "melee" || sEqType == "mixed") && nLevel >= 8) nAC++; //melee and mixed-type eq gets a first helmet at level 8 if (sEqType == "magic" && nLevel >= 12) nAC++; //magic-type eq gets a first helmet at level 12 if (nLevel >= 14) nAC++; //everyone gets a helmet +2 at level 14 if (nLevel >= 20) { switch (nLevel) { case 40: nAC = 12; break; case 39: nAC = 12; break; case 38: nAC = 11; break; case 37: nAC = 11; break; case 36: nAC = 11; break; case 35: nAC = 10; break; case 34: nAC = 9; break; case 33: nAC = 8; break; case 32: nAC = 8; break; case 31: nAC = 7; break; case 30: nAC = 7; break; case 29: nAC = 7; break; case 28: nAC = 7; break; case 27: nAC = 6; break; case 26: nAC = 6; break; case 25: nAC = 5; break; case 24: nAC = 5; break; case 23: nAC = 4; break; case 22: nAC = 4; break; default: nAC = 3; break; } } eHelmetBuff = EffectACIncrease(nAC, AC_DEFLECTION_BONUS); eHelmetBuff = SupernaturalEffect(eHelmetBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHelmetBuff, oNPC); //Set name SetName(oNPC, sName+" "+sLastName); //Set hair and skin color, phenotype, head SetColor(oNPC, COLOR_CHANNEL_HAIR, nHair); SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkin); SetPhenoType(nPheno, oNPC); SetCreatureBodyPart(CREATURE_PART_HEAD, nHead, oNPC); //Set all the trait bonuses effect eTrait1; effect eTrait2; effect eTrait3; int nRegen; int nDamage; //Trait1 if(sTrait1 == "immunity") { eTrait1 = EffectDamageImmunityIncrease(nDamage1a, 50); eTrait1 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage1b, 50), eTrait1); eTrait1 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage1c, 50), eTrait1); eTrait1 = SupernaturalEffect(eTrait1); } if(sTrait1 == "saves") eTrait1 = SupernaturalEffect(EffectSavingThrowIncrease(SAVING_THROW_ALL, 5)); if(sTrait1 == "armor") eTrait1 = SupernaturalEffect(EffectACIncrease(nAC+5, AC_DEFLECTION_BONUS)); if(sTrait1 == "mind") eTrait1 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS)); if(sTrait1 == "critical") eTrait1 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT)); if(sTrait1 == "skills") eTrait1 = SupernaturalEffect(EffectSkillIncrease(SKILL_ALL_SKILLS, 20)); if(sTrait1 == "regen") { nRegen = nLevel/2; if(nRegen<1) nRegen = 1; if(nRegen>10) nRegen = 10; eTrait1 = SupernaturalEffect(EffectRegenerate(nRegen, 6.0)); } if(sTrait1 == "attack") eTrait1 = SupernaturalEffect(EffectAttackIncrease(5)); if(sTrait1 == "damage") { nDamage = nLevel/2; if(nDamage<1) nDamage = 1; if(nDamage>5) nDamage = 5; eTrait1 = SupernaturalEffect(EffectDamageIncrease(nDamage, DAMAGE_TYPE_BLUDGEONING)); } //Trait 2 if(sTrait2 == "immunity") { eTrait2 = EffectDamageImmunityIncrease(nDamage2a, 50); eTrait2 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage2b, 50), eTrait2); eTrait2 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage2c, 50), eTrait2); eTrait2 = SupernaturalEffect(eTrait2); } if(sTrait2 == "saves") eTrait2 = SupernaturalEffect(EffectSavingThrowIncrease(SAVING_THROW_ALL, 5)); if(sTrait2 == "armor") eTrait2 = SupernaturalEffect(EffectACIncrease(nAC+5, AC_DEFLECTION_BONUS)); if(sTrait2 == "mind") eTrait2 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS)); if(sTrait2 == "critical") eTrait2 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT)); if(sTrait2 == "skills") eTrait2 = SupernaturalEffect(EffectSkillIncrease(SKILL_ALL_SKILLS, 20)); if(sTrait2 == "regen") { nRegen = nLevel/2; if(nRegen<1) nRegen = 1; if(nRegen>10) nRegen = 10; eTrait2 = SupernaturalEffect(EffectRegenerate(nRegen, 6.0)); } if(sTrait2 == "attack") eTrait2 = SupernaturalEffect(EffectAttackIncrease(5)); if(sTrait2 == "damage") { nDamage = nLevel/2; if(nDamage<1) nDamage = 1; if(nDamage>5) nDamage = 5; eTrait2 = SupernaturalEffect(EffectDamageIncrease(nDamage, DAMAGE_TYPE_BLUDGEONING)); } //Trait 3 (weakness) if(sTrait3 == "immunity") { eTrait3 = EffectDamageImmunityDecrease(nDamage3a, 50); eTrait3 = EffectLinkEffects(EffectDamageImmunityDecrease(nDamage3b, 50), eTrait3); eTrait3 = EffectLinkEffects(EffectDamageImmunityDecrease(nDamage3c, 50), eTrait3); eTrait3 = SupernaturalEffect(eTrait3); } if(sTrait3 == "saves") eTrait3 = SupernaturalEffect(EffectSavingThrowDecrease(SAVING_THROW_ALL, 5)); if(sTrait3 == "armor") eTrait3 = SupernaturalEffect(EffectACDecrease(5, AC_DODGE_BONUS)); if(sTrait3 == "skills") eTrait3 = SupernaturalEffect(EffectSkillDecrease(SKILL_ALL_SKILLS, 15)); //Apply effects ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait1, oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait2, oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait3, oNPC); //Save all the variables on the NPC - the only variable that could change is the NPC's level SetLocalInt(oNPC, "nLevel", nLevel); SetLocalInt(oNPC, "nPosition", nPosition); SetLocalString(oNPC, "sName", sName); SetLocalString(oNPC, "sLastName", sLastName); SetLocalString(oNPC, "sOwner", sDB); //Return the NPC generated return oNPC; } //Spawn an adventurer NPC from a database object SpawnAdventurerNPC(int nPosition, location lLocation) { //Get all the parameters of the NPC string sDB = GetLocalString(GetModule(), "DB"); string sPosition = IntToString(nPosition); string sArchetype = GetCampaignString(sDB, sPosition+"_ADV_TYPE"); string sRace = GetCampaignString(sDB, sPosition+"_ADV_RACE"); string sSubtype = GetCampaignString(sDB, sPosition+"_ADV_SUBTYPE"); string sEqType = GetCampaignString(sDB, sPosition+"_ADV_EQTYPE"); string sName = GetCampaignString(sDB, sPosition+"_ADV_NAME"); string sLastName = GetCampaignString(sDB, sPosition+"_ADV_LASTNAME"); int nLawAxis = GetCampaignInt(sDB, sPosition+"_ADV_LAWAXIS"); int nGoodAxis = GetCampaignInt(sDB, sPosition+"_ADV_GOODAXIS"); string sSex = GetCampaignString(sDB, sPosition+"_ADV_SEX"); int nLevel = 40; int nPreviousLevel = GetCampaignInt(sDB, sPosition+"_ADV_LEVEL"); int nHead = GetCampaignInt(sDB, sPosition+"_ADV_HEAD"); int nHair = GetCampaignInt(sDB, sPosition+"_ADV_HAIR"); int nSkin = GetCampaignInt(sDB, sPosition+"_ADV_SKIN"); int nPheno = GetCampaignInt(sDB, sPosition+"_ADV_PHENO"); int nPersonality = GetCampaignInt(sDB, sPosition+"_ADV_ATTITUDE"); int nVisibleCloak = GetCampaignInt(sDB, sPosition+"_ADV_VISCLOAK"); int nVisibleHelmet; int nWeapon; int nOffhand; if (sArchetype == "fight") { nWeapon = GetCampaignInt(sDB, sPosition+"_ADV_WEAPON"); nOffhand = GetCampaignInt(sDB, sPosition+"_ADV_OFFHAND"); if (sSubtype == "shield") nVisibleHelmet = GetCampaignInt(sDB, sPosition+"_ADV_VISHELM"); } string sTrait1 = GetCampaignString(sDB, sPosition+"_ADV_TRAIT1"); string sTrait2 = GetCampaignString(sDB, sPosition+"_ADV_TRAIT2"); string sTrait3 = GetCampaignString(sDB, sPosition+"_ADV_TRAIT3"); int nDamage1a = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE1"); int nDamage1b = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE2"); int nDamage1c = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE3"); int nDamage2a = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE4"); int nDamage2b = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE5"); int nDamage2c = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE6"); int nDamage3a = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE7"); int nDamage3b = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE8"); int nDamage3c = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE9"); string sArmor = GetCampaignString(sDB, sPosition+"_ADV_ARMOR"); string sReductionCloak = GetCampaignString(sDB, sPosition+"_ADV_CLOAK"); int nBonus1_off = GetCampaignInt(sDB, sPosition+"_ADV_OFFBONUS1"); string sBonus2_off = GetCampaignString(sDB, sPosition+"_ADV_OFFBONUS2"); string sWeapon_off = GetCampaignString(sDB, sPosition+"_ADV_OFFWEAPON"); int nMaxEnhancement_off = GetCampaignInt(sDB, sPosition+"_ADV_OFFMAXBONUS"); int nBonus1 = GetCampaignInt(sDB, sPosition+"_ADV_BONUS1"); string sBonus2 = GetCampaignString(sDB, sPosition+"_ADV_BONUS2"); string sWeapon = GetCampaignString(sDB, sPosition+"_ADV_MWEAPON"); int nMaxEnhancement = GetCampaignInt(sDB, sPosition+"_ADV_MAXBONUS"); int nDamageType = GetCampaignInt(sDB, sPosition+"_ADV_DMGTYPE"); int nDamageType_off = GetCampaignInt(sDB, sPosition+"_ADV_OFFDMGTYPE"); //Prepare the ResRef of the blueprint and spawn the NPC string sBlueprint = sArchetype + "_" + sRace + "_" + sSex; if (sArchetype != "cleric") sBlueprint += "_01"; else { if (nLevel <= 9) sBlueprint += "_0"+IntToString(nLevel); else sBlueprint += "_"+IntToString(nLevel); } object oNPC = CreateObject(OBJECT_TYPE_CREATURE, sBlueprint, lLocation); //Store variables required for equipment retrieval on the NPC SetLocalString(oNPC, "sArmor", sArmor); SetLocalString(oNPC, "sReductionCloak", sReductionCloak); SetLocalInt(oNPC, "nBonus1_off", nBonus1_off); SetLocalString(oNPC, "sBonus2_off", sBonus2_off); SetLocalString(oNPC, "sWeapon_off", sWeapon_off); SetLocalInt(oNPC, "nMaxEnhancement_off", nMaxEnhancement_off); SetLocalInt(oNPC, "nBonus1", nBonus1); SetLocalString(oNPC, "sBonus2", sBonus2); SetLocalString(oNPC, "sWeapon", sWeapon); SetLocalInt(oNPC, "nMaxEnhancement", nMaxEnhancement); SetLocalInt(oNPC, "nDamageType", nDamageType); SetLocalInt(oNPC, "nDamageType_off", nDamageType_off); //Store variables required in a conversation SetLocalInt(oNPC, "nPersonality", nPersonality); SetLocalInt(oNPC, "nGoodAxis", nGoodAxis); SetLocalString(oNPC, "sName", sName); SetLocalString(oNPC, "sLastName", sLastName); //Set alignment if (nLawAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nLawAxis, 50, FALSE); if (nGoodAxis != ALIGNMENT_NEUTRAL) AdjustAlignment(oNPC, nGoodAxis, 50, FALSE); //Level-up the NPC if (sArchetype != "cleric") LevelHenchmanUpTo(oNPC, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oNPC), PACKAGE_INVALID); //Restore the NPC's spells ForceRest(oNPC); //Retrieve the NPC's old inventory int nNewEq = FALSE; if (sSubtype == "shield") GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, nVisibleHelmet, nWeapon, nOffhand); //nVisibleHelmet else if (sSubtype == "dual") GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon, nOffhand); else if (sSubtype == "large") GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak, FALSE, nWeapon); else GenerateEquipmentForNPC(nNewEq, oNPC, sArchetype, sSubtype, sEqType, nSkin, nVisibleCloak); //Rogues and some fighters and monks are dual-wielders if (sArchetype == "rogue" || sSubtype == "dual" || sSubtype == "kama") SetLocalInt(oNPC, "DualWieldState", TRUE); //Buff the fighter archetype (to make up for the lack of weapon feats like weapon focus, specialization, etc) effect eWarriorBuff; itemproperty iKeen; itemproperty iMassive; if (sArchetype == "fight") { eWarriorBuff = EffectAttackIncrease(1); if (GetHitDice(oNPC) >= 4) eWarriorBuff = EffectLinkEffects(EffectDamageIncrease(DAMAGE_BONUS_2, DAMAGE_TYPE_BLUDGEONING), eWarriorBuff); if (GetHitDice(oNPC) >= 8) iKeen = ItemPropertyKeen(); if (GetHitDice(oNPC) >= 21) eWarriorBuff = EffectLinkEffects(EffectAttackIncrease(2), eWarriorBuff); if (GetHitDice(oNPC) >= 24) eWarriorBuff = EffectLinkEffects(EffectDamageIncrease(DAMAGE_BONUS_4, DAMAGE_TYPE_BLUDGEONING), eWarriorBuff); if (GetHitDice(oNPC) >= 28) iMassive = ItemPropertyMassiveCritical(IP_CONST_DAMAGEBONUS_2d6); eWarriorBuff = SupernaturalEffect(eWarriorBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eWarriorBuff, oNPC); } //Make spellcasters "cheat" a bit - let them cast spells from items with their own caster level, not the item's (achieved via spellhooking) SetLocalInt(oNPC, "anc_castercheat", TRUE); //Buff rogues a bit, since their attack is pretty low if (sArchetype == "rogue") ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(nLevel/4)), oNPC); //Mark clerics as healers if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_HEALER", TRUE); if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_CASTER_CLERIC", TRUE); //if (sArchetype == "cleric") SetLocalInt(oNPC, "X4_VANILLA_AI", TRUE); //Buff monks' strength, since the package they use dump it, and give them some better spell resistance, since their AC is useless against spellcasters if (sArchetype == "monk") ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAbilityIncrease(ABILITY_STRENGTH, nLevel/3)), oNPC); if (sArchetype == "monk" && nLevel > 25) DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectSpellResistanceIncrease(GetSpellResistance(oNPC)+8)), oNPC)); if (sArchetype == "monk" && nLevel >= 40) ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(4)), oNPC); if (sArchetype == "monk" && nLevel < 40) ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectAttackIncrease(3)), oNPC); //Buff the archer archetype (to make up for the lack of weapon focus) effect eArcherBuff; if (sArchetype == "arche") { eArcherBuff = EffectAttackIncrease(1); if (GetHitDice(oNPC) >= 21) eArcherBuff = EffectLinkEffects(EffectAttackIncrease(2), eArcherBuff); eArcherBuff = SupernaturalEffect(eArcherBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eArcherBuff, oNPC); } //Simulate the helmet (if it's supposed to be invisible) by granting the NPC an armor class buff - this can be done even if the NPC has a helmet, since the bonus won't stack effect eHelmetBuff; int nAC = 0; if ((sEqType == "melee" || sEqType == "mixed") && nLevel >= 8) nAC++; //melee and mixed-type eq gets a first helmet at level 8 if (sEqType == "magic" && nLevel >= 12) nAC++; //magic-type eq gets a first helmet at level 12 if (nLevel >= 14) nAC++; //everyone gets a helmet +2 at level 14 if (nLevel >= 20) { switch (nLevel) { case 40: nAC = 12; break; case 39: nAC = 12; break; case 38: nAC = 11; break; case 37: nAC = 11; break; case 36: nAC = 11; break; case 35: nAC = 10; break; case 34: nAC = 9; break; case 33: nAC = 8; break; case 32: nAC = 8; break; case 31: nAC = 7; break; case 30: nAC = 7; break; case 29: nAC = 7; break; case 28: nAC = 7; break; case 27: nAC = 6; break; case 26: nAC = 6; break; case 25: nAC = 5; break; case 24: nAC = 5; break; case 23: nAC = 4; break; case 22: nAC = 4; break; default: nAC = 3; break; } } eHelmetBuff = EffectACIncrease(nAC, AC_DEFLECTION_BONUS); eHelmetBuff = SupernaturalEffect(eHelmetBuff); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eHelmetBuff, oNPC); //Set name SetName(oNPC, sName+" "+sLastName); //Set hair and skin color, phenotype, head SetColor(oNPC, COLOR_CHANNEL_HAIR, nHair); SetColor(oNPC, COLOR_CHANNEL_SKIN, nSkin); SetPhenoType(nPheno, oNPC); SetCreatureBodyPart(CREATURE_PART_HEAD, nHead, oNPC); //Set all the trait bonuses effect eTrait1; effect eTrait2; effect eTrait3; int nRegen; int nDamage; //Trait1 if(sTrait1 == "immunity") { eTrait1 = EffectDamageImmunityIncrease(nDamage1a, 50); eTrait1 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage1b, 50), eTrait1); eTrait1 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage1c, 50), eTrait1); eTrait1 = SupernaturalEffect(eTrait1); } if(sTrait1 == "saves") eTrait1 = SupernaturalEffect(EffectSavingThrowIncrease(SAVING_THROW_ALL, 5)); if(sTrait1 == "armor") eTrait1 = SupernaturalEffect(EffectACIncrease(nAC+5, AC_DEFLECTION_BONUS)); if(sTrait1 == "mind") eTrait1 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS)); if(sTrait1 == "critical") eTrait1 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT)); if(sTrait1 == "skills") eTrait1 = SupernaturalEffect(EffectSkillIncrease(SKILL_ALL_SKILLS, 20)); if(sTrait1 == "regen") { nRegen = nLevel/2; if(nRegen<1) nRegen = 1; if(nRegen>10) nRegen = 10; eTrait1 = SupernaturalEffect(EffectRegenerate(nRegen, 6.0)); } if(sTrait1 == "attack") eTrait1 = SupernaturalEffect(EffectAttackIncrease(5)); if(sTrait1 == "damage") { nDamage = nLevel/2; if(nDamage<1) nDamage = 1; if(nDamage>5) nDamage = 5; eTrait1 = SupernaturalEffect(EffectDamageIncrease(nDamage, DAMAGE_TYPE_BLUDGEONING)); } //Trait 2 if(sTrait2 == "immunity") { eTrait2 = EffectDamageImmunityIncrease(nDamage2a, 50); eTrait2 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage2b, 50), eTrait2); eTrait2 = EffectLinkEffects(EffectDamageImmunityIncrease(nDamage2c, 50), eTrait2); eTrait2 = SupernaturalEffect(eTrait2); } if(sTrait2 == "saves") eTrait2 = SupernaturalEffect(EffectSavingThrowIncrease(SAVING_THROW_ALL, 5)); if(sTrait2 == "armor") eTrait2 = SupernaturalEffect(EffectACIncrease(nAC+5, AC_DEFLECTION_BONUS)); if(sTrait2 == "mind") eTrait2 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_MIND_SPELLS)); if(sTrait2 == "critical") eTrait2 = SupernaturalEffect(EffectImmunity(IMMUNITY_TYPE_CRITICAL_HIT)); if(sTrait2 == "skills") eTrait2 = SupernaturalEffect(EffectSkillIncrease(SKILL_ALL_SKILLS, 20)); if(sTrait2 == "regen") { nRegen = nLevel/2; if(nRegen<1) nRegen = 1; if(nRegen>10) nRegen = 10; eTrait2 = SupernaturalEffect(EffectRegenerate(nRegen, 6.0)); } if(sTrait2 == "attack") eTrait2 = SupernaturalEffect(EffectAttackIncrease(5)); if(sTrait2 == "damage") { nDamage = nLevel/2; if(nDamage<1) nDamage = 1; if(nDamage>5) nDamage = 5; eTrait2 = SupernaturalEffect(EffectDamageIncrease(nDamage, DAMAGE_TYPE_BLUDGEONING)); } //Trait 3 (weakness) if(sTrait3 == "immunity") { eTrait3 = EffectDamageImmunityDecrease(nDamage3a, 50); eTrait3 = EffectLinkEffects(EffectDamageImmunityDecrease(nDamage3b, 50), eTrait3); eTrait3 = EffectLinkEffects(EffectDamageImmunityDecrease(nDamage3c, 50), eTrait3); eTrait3 = SupernaturalEffect(eTrait3); } if(sTrait3 == "saves") eTrait3 = SupernaturalEffect(EffectSavingThrowDecrease(SAVING_THROW_ALL, 5)); if(sTrait3 == "armor") eTrait3 = SupernaturalEffect(EffectACDecrease(5, AC_DODGE_BONUS)); if(sTrait3 == "skills") eTrait3 = SupernaturalEffect(EffectSkillDecrease(SKILL_ALL_SKILLS, 15)); //Apply effects ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait1, oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait2, oNPC); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eTrait3, oNPC); //Save all the variables on the NPC - the only variable that could change is the NPC's level SetLocalInt(oNPC, "nPosition", nPosition); SetLocalString(oNPC, "sName", sName); SetLocalString(oNPC, "sLastName", sLastName); SetLocalInt(oNPC, "nPersonality", nPersonality); //Return the NPC generated return oNPC; } //Deletes all the NPC data in a given slot of a PC's database void DeleteStoredNPC(string sDB, int nPosition) { if (nPosition == 0) return; string sPosition = IntToString(nPosition); DeleteCampaignVariable(sDB, sPosition+"_NPC_TYPE"); DeleteCampaignVariable(sDB, sPosition+"_NPC_RACE"); DeleteCampaignVariable(sDB, sPosition+"_NPC_SUBTYPE"); DeleteCampaignVariable(sDB, sPosition+"_NPC_EQTYPE"); DeleteCampaignVariable(sDB, sPosition+"_NPC_NAME"); DeleteCampaignVariable(sDB, sPosition+"_NPC_LASTNAME"); DeleteCampaignVariable(sDB, sPosition+"_NPC_SEX"); DeleteCampaignVariable(sDB, sPosition+"_NPC_TRAIT1"); DeleteCampaignVariable(sDB, sPosition+"_NPC_TRAIT2"); DeleteCampaignVariable(sDB, sPosition+"_NPC_TRAIT3"); DeleteCampaignVariable(sDB, sPosition+"_NPC_LAWAXIS"); DeleteCampaignVariable(sDB, sPosition+"_NPC_GOODAXIS"); DeleteCampaignVariable(sDB, sPosition+"_NPC_HEAD"); DeleteCampaignVariable(sDB, sPosition+"_NPC_HAIR"); DeleteCampaignVariable(sDB, sPosition+"_NPC_SKIN"); DeleteCampaignVariable(sDB, sPosition+"_NPC_PHENO"); DeleteCampaignVariable(sDB, sPosition+"_NPC_ATTITUDE"); DeleteCampaignVariable(sDB, sPosition+"_NPC_VISCLOAK"); DeleteCampaignVariable(sDB, sPosition+"_NPC_WEAPON"); DeleteCampaignVariable(sDB, sPosition+"_NPC_OFFHAND"); DeleteCampaignVariable(sDB, sPosition+"_NPC_VISHELM"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE1"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE2"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE3"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE4"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE5"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE6"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE7"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE8"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DAMAGE9"); DeleteCampaignVariable(sDB, sPosition+"_NPC_LEVEL"); DeleteCampaignVariable(sDB, sPosition+"_NPC_OCCUPIED"); DeleteCampaignVariable(sDB, sPosition+"_NPC_ARMOR"); DeleteCampaignVariable(sDB, sPosition+"_NPC_CLOAK"); DeleteCampaignVariable(sDB, sPosition+"_NPC_OFFBONUS1"); DeleteCampaignVariable(sDB, sPosition+"_NPC_OFFBONUS2"); DeleteCampaignVariable(sDB, sPosition+"_NPC_OFFWEAPON"); DeleteCampaignVariable(sDB, sPosition+"_NPC_OFFMAXBONUS"); DeleteCampaignVariable(sDB, sPosition+"_NPC_BONUS1"); DeleteCampaignVariable(sDB, sPosition+"_NPC_BONUS2"); DeleteCampaignVariable(sDB, sPosition+"_NPC_MWEAPON"); DeleteCampaignVariable(sDB, sPosition+"_NPC_MAXBONUS"); DeleteCampaignVariable(sDB, sPosition+"_NPC_DMGTYPE"); DeleteCampaignVariable(sDB, sPosition+"_NPC_OFFDMGTYPE"); } //Deletes all the adventurer NPC data in a given slot of a the module's database void DeleteAdventurerNPC(int nPosition) { if (nPosition == 0) return; string sDB = GetLocalString(GetModule(), "DB"); string sPosition = IntToString(nPosition); DeleteCampaignVariable(sDB, sPosition+"_ADV_TYPE"); DeleteCampaignVariable(sDB, sPosition+"_ADV_RACE"); DeleteCampaignVariable(sDB, sPosition+"_ADV_SUBTYPE"); DeleteCampaignVariable(sDB, sPosition+"_ADV_EQTYPE"); DeleteCampaignVariable(sDB, sPosition+"_ADV_NAME"); DeleteCampaignVariable(sDB, sPosition+"_ADV_LASTNAME"); DeleteCampaignVariable(sDB, sPosition+"_ADV_SEX"); DeleteCampaignVariable(sDB, sPosition+"_ADV_TRAIT1"); DeleteCampaignVariable(sDB, sPosition+"_ADV_TRAIT2"); DeleteCampaignVariable(sDB, sPosition+"_ADV_TRAIT3"); DeleteCampaignVariable(sDB, sPosition+"_ADV_LAWAXIS"); DeleteCampaignVariable(sDB, sPosition+"_ADV_GOODAXIS"); DeleteCampaignVariable(sDB, sPosition+"_ADV_HEAD"); DeleteCampaignVariable(sDB, sPosition+"_ADV_HAIR"); DeleteCampaignVariable(sDB, sPosition+"_ADV_SKIN"); DeleteCampaignVariable(sDB, sPosition+"_ADV_PHENO"); DeleteCampaignVariable(sDB, sPosition+"_ADV_ATTITUDE"); DeleteCampaignVariable(sDB, sPosition+"_ADV_VISCLOAK"); DeleteCampaignVariable(sDB, sPosition+"_ADV_WEAPON"); DeleteCampaignVariable(sDB, sPosition+"_ADV_OFFHAND"); DeleteCampaignVariable(sDB, sPosition+"_ADV_VISHELM"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE1"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE2"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE3"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE4"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE5"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE6"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE7"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE8"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DAMAGE9"); DeleteCampaignVariable(sDB, sPosition+"_ADV_LEVEL"); DeleteCampaignVariable(sDB, sPosition+"_ADV_OCCUPIED"); DeleteCampaignVariable(sDB, sPosition+"_ADV_ARMOR"); DeleteCampaignVariable(sDB, sPosition+"_ADV_CLOAK"); DeleteCampaignVariable(sDB, sPosition+"_ADV_OFFBONUS1"); DeleteCampaignVariable(sDB, sPosition+"_ADV_OFFBONUS2"); DeleteCampaignVariable(sDB, sPosition+"_ADV_OFFWEAPON"); DeleteCampaignVariable(sDB, sPosition+"_ADV_OFFMAXBONUS"); DeleteCampaignVariable(sDB, sPosition+"_ADV_BONUS1"); DeleteCampaignVariable(sDB, sPosition+"_ADV_BONUS2"); DeleteCampaignVariable(sDB, sPosition+"_ADV_MWEAPON"); DeleteCampaignVariable(sDB, sPosition+"_ADV_MAXBONUS"); DeleteCampaignVariable(sDB, sPosition+"_ADV_DMGTYPE"); DeleteCampaignVariable(sDB, sPosition+"_ADV_OFFDMGTYPE"); } //Randomly select an item for a PC other than ammo and throwing weapons, taking their level into account string GenerateRandomItem(object oPC) { string sTemplate; int nLevel = GetHitDice(oPC); int nRandom; if (nLevel < 3) { nRandom = Random(7); if (nRandom == 0) //chest items { switch (Random(11)) { case 0: sTemplate = "NW_AARCL005"; break; case 1: sTemplate = "NW_AARCL011"; break; case 2: sTemplate = "NW_AARCL006"; break; case 3: sTemplate = "NW_AARCL004"; break; case 4: sTemplate = "NW_AARCL010"; break; case 5: sTemplate = "NW_AARCL008"; break; case 6: sTemplate = "NW_AARCL003"; break; case 7: sTemplate = "NW_AARCL002"; break; case 8: sTemplate = "NW_AARCL012"; break; case 9: sTemplate = "NW_AARCL009"; break; case 10: sTemplate = "NW_AARCL001"; break; } } if (nRandom == 1) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHLW001"; break; case 1: sTemplate = "NW_ASHSW001"; break; case 2: sTemplate = "NW_ASHTO001"; break; } } if (nRandom == 2) //boots { switch (Random(2)) { case 0: sTemplate = "it_anc_boots1c"; break; case 1: sTemplate = "it_anc_boots1b"; break; } } if (nRandom == 2) //boots { switch (Random(2)) { case 0: sTemplate = "it_anc_boots1c"; break; case 1: sTemplate = "it_anc_boots1b"; break; } } if (nRandom == 3) sTemplate = "anc_it_belt1a"; //belts if (nRandom == 4) sTemplate = "it_anc_glove1a"; //bracers or gloves if (nRandom == 5) //rings { switch (Random(2)) { case 0: sTemplate = "anc_it_ring1e"; break; case 1: sTemplate = "anc_it_ring1f"; break; } } if (nRandom == 6) //weapons { switch (Random(36)) { case 0: sTemplate = "NW_WSWLS001"; break; case 1: sTemplate = "NW_WSWKA001"; break; case 2: sTemplate = "NW_WSWRP001"; break; case 3: sTemplate = "NW_WSWSC001"; break; case 4: sTemplate = "NW_WSWSS001"; break; case 5: sTemplate = "NW_WSWBS001"; break; case 6: sTemplate = "NW_WSWDG001"; break; case 7: sTemplate = "NW_WSWGS001"; break; case 8: sTemplate = "NW_WAXBT001"; break; case 9: sTemplate = "NW_WAXHN001"; break; case 10: sTemplate = "X2_WDWRAXE001"; break; case 11: sTemplate = "NW_WAXGR001"; break; case 12: sTemplate = "NW_WDBQS001"; break; case 13: sTemplate = "NW_WDBSW001"; break; case 14: sTemplate = "NW_WDBAX001"; break; case 15: sTemplate = "NW_WDBMA001"; break; case 16: sTemplate = "NW_WBLML001"; break; case 17: sTemplate = "NW_WBLFH001"; break; case 18: sTemplate = "NW_WBLFL001"; break; case 19: sTemplate = "NW_WBLCL001"; break; case 20: sTemplate = "NW_WBLHL001"; break; case 21: sTemplate = "NW_WBLHW001"; break; case 22: sTemplate = "NW_WBLMS001"; break; case 23: sTemplate = "X2_IT_WPWHIP"; break; case 24: sTemplate = "NW_WSPKA001"; break; case 25: sTemplate = "NW_WSPKU001"; break; case 26: sTemplate = "NW_WSPSC001"; break; case 27: sTemplate = "NW_WPLHB001"; break; case 28: sTemplate = "NW_WPLSC001"; break; case 29: sTemplate = "nw_wpltr001"; break; case 30: sTemplate = "NW_WPLSS001"; break; case 31: sTemplate = "NW_WBWLN001"; break; case 32: sTemplate = "NW_WBWSH001"; break; case 33: sTemplate = "NW_WBWXL001"; break; case 34: sTemplate = "NW_WBWXH001"; break; case 35: sTemplate = "NW_WBWSL001"; break; } } } if (nLevel == 3 || nLevel == 4) { nRandom = Random(8); if (nRandom == 0) sTemplate = "anc_it_cloak1f"; //cloaks if (nRandom == 1) //chest items { switch (Random(15)) { case 0: sTemplate = "NW_AARCL007"; break; case 1: sTemplate = "NW_AARCL005"; break; case 2: sTemplate = "NW_AARCL011"; break; case 3: sTemplate = "NW_AARCL006"; break; case 4: sTemplate = "NW_AARCL004"; break; case 5: sTemplate = "NW_AARCL010"; break; case 6: sTemplate = "NW_AARCL008"; break; case 7: sTemplate = "NW_AARCL003"; break; case 8: sTemplate = "NW_AARCL002"; break; case 9: sTemplate = "NW_AARCL012"; break; case 10: sTemplate = "NW_AARCL009"; break; case 11: sTemplate = "NW_AARCL001"; break; case 12: sTemplate = "anc_it_armor1a"; break; case 13: sTemplate = "anc_it_armor1b"; break; case 14: sTemplate = "anc_it_armor1c"; break; } } if (nRandom == 2) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHLW001"; break; case 1: sTemplate = "NW_ASHSW001"; break; case 2: sTemplate = "NW_ASHTO001"; break; } } if (nRandom == 3) //boots { switch (Random(2)) { case 0: sTemplate = "it_anc_boots2c"; break; case 1: sTemplate = "it_anc_boots1b"; break; } } if (nRandom == 4) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt1c"; break; case 1: sTemplate = "anc_it_belt1a"; break; } } if (nRandom == 5) sTemplate = "it_anc_glove1a"; //gloves or bracers if (nRandom == 6) //rings { switch (Random(4)) { case 0: sTemplate = "anc_it_ring1e"; break; case 1: sTemplate = "anc_it_ring1f"; break; case 2: sTemplate = "anc_it_ring1a"; break; case 3: sTemplate = "anc_it_ring1b"; break; } } if (nRandom == 7) //weapons { switch (Random(36)) { case 0: sTemplate = "NW_WSWLS001"; break; case 1: sTemplate = "NW_WSWKA001"; break; case 2: sTemplate = "NW_WSWRP001"; break; case 3: sTemplate = "NW_WSWSC001"; break; case 4: sTemplate = "NW_WSWSS001"; break; case 5: sTemplate = "NW_WSWBS001"; break; case 6: sTemplate = "NW_WSWDG001"; break; case 7: sTemplate = "NW_WSWGS001"; break; case 8: sTemplate = "NW_WAXBT001"; break; case 9: sTemplate = "NW_WAXHN001"; break; case 10: sTemplate = "X2_WDWRAXE001"; break; case 11: sTemplate = "NW_WAXGR001"; break; case 12: sTemplate = "NW_WDBQS001"; break; case 13: sTemplate = "NW_WDBSW001"; break; case 14: sTemplate = "NW_WDBAX001"; break; case 15: sTemplate = "NW_WDBMA001"; break; case 16: sTemplate = "NW_WBLML001"; break; case 17: sTemplate = "NW_WBLFH001"; break; case 18: sTemplate = "NW_WBLFL001"; break; case 19: sTemplate = "NW_WBLCL001"; break; case 20: sTemplate = "NW_WBLHL001"; break; case 21: sTemplate = "NW_WBLHW001"; break; case 22: sTemplate = "NW_WBLMS001"; break; case 23: sTemplate = "X2_IT_WPWHIP"; break; case 24: sTemplate = "NW_WSPKA001"; break; case 25: sTemplate = "NW_WSPKU001"; break; case 26: sTemplate = "NW_WSPSC001"; break; case 27: sTemplate = "NW_WPLHB001"; break; case 28: sTemplate = "NW_WPLSC001"; break; case 29: sTemplate = "nw_wpltr001"; break; case 30: sTemplate = "NW_WPLSS001"; break; case 31: sTemplate = "NW_WBWLN001"; break; case 32: sTemplate = "NW_WBWSH001"; break; case 33: sTemplate = "NW_WBWXL001"; break; case 34: sTemplate = "NW_WBWXH001"; break; case 35: sTemplate = "NW_WBWSL001"; break; } } } if (nLevel == 5 || nLevel == 6) { nRandom = Random(9); if (nRandom == 0) sTemplate = "anc_it_cloak1f"; //cloaks if (nRandom == 1) //chest items { switch (Random(15)) { case 0: sTemplate = "NW_AARCL007"; break; case 1: sTemplate = "NW_AARCL005"; break; case 2: sTemplate = "NW_AARCL011"; break; case 3: sTemplate = "NW_AARCL006"; break; case 4: sTemplate = "NW_AARCL004"; break; case 5: sTemplate = "NW_AARCL010"; break; case 6: sTemplate = "NW_AARCL008"; break; case 7: sTemplate = "NW_AARCL003"; break; case 8: sTemplate = "NW_AARCL002"; break; case 9: sTemplate = "NW_AARCL012"; break; case 10: sTemplate = "NW_AARCL009"; break; case 11: sTemplate = "NW_AARCL001"; break; case 12: sTemplate = "anc_it_armor2a"; break; case 13: sTemplate = "anc_it_armor2b"; break; case 14: sTemplate = "anc_it_armor1c"; break; } } if (nRandom == 2) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHLW001"; break; case 1: sTemplate = "NW_ASHSW001"; break; case 2: sTemplate = "NW_ASHTO001"; break; } } if (nRandom == 3) //boots { switch (Random(2)) { case 0: sTemplate = "it_anc_boots2c"; break; case 1: sTemplate = "it_anc_boots2b"; break; } } if (nRandom == 4) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt1c"; break; case 1: sTemplate = "anc_it_belt2a"; break; } } if (nRandom == 5) sTemplate = "it_anc_glove1a"; //gloves or bracers if (nRandom == 6) sTemplate = "anc_it_amulet2a"; //amulets if (nRandom == 7) //rings { switch (Random(5)) { case 0: sTemplate = "anc_it_ring2e"; break; case 1: sTemplate = "anc_it_ring2f"; break; case 2: sTemplate = "anc_it_ring1d"; break; case 3: sTemplate = "anc_it_ring1a"; break; case 4: sTemplate = "anc_it_ring1b"; break; } } if (nRandom == 8) //weapons { switch (Random(36)) { case 0: sTemplate = "NW_WSWMLS002"; break; case 1: sTemplate = "NW_WSWMKA002"; break; case 2: sTemplate = "NW_WSWMRP002"; break; case 3: sTemplate = "NW_WSWMSC002"; break; case 4: sTemplate = "NW_WSWMSS002"; break; case 5: sTemplate = "NW_WSWMBS002"; break; case 6: sTemplate = "NW_WSWMDG002"; break; case 7: sTemplate = "NW_WSWMGS002"; break; case 8: sTemplate = "NW_WAXMBT002"; break; case 9: sTemplate = "NW_WAXMHN002"; break; case 10: sTemplate = "X2_WMDWRAXE002"; break; case 11: sTemplate = "NW_WAXMGR002"; break; case 12: sTemplate = "NW_WDBMQS002"; break; case 13: sTemplate = "NW_WDBMSW002"; break; case 14: sTemplate = "NW_WDBMAX002"; break; case 15: sTemplate = "NW_WDBMMA002"; break; case 16: sTemplate = "NW_WBLMML002"; break; case 17: sTemplate = "NW_WBLMFH002"; break; case 18: sTemplate = "NW_WBLMFL002"; break; case 19: sTemplate = "NW_WBLMCL002"; break; case 20: sTemplate = "NW_WBLMHL002"; break; case 21: sTemplate = "NW_WBLMHW002"; break; case 22: sTemplate = "NW_WBLMMS002"; break; case 23: sTemplate = "X2_IT_WPMWHIP1"; break; case 24: sTemplate = "NW_WSPMKA002"; break; case 25: sTemplate = "NW_WSPMKU002"; break; case 26: sTemplate = "NW_WSPMSC002"; break; case 27: sTemplate = "NW_WPLMHB002"; break; case 28: sTemplate = "NW_WPLMSC002"; break; case 29: sTemplate = "nw_wpltr002"; break; case 30: sTemplate = "NW_WPLMSS002"; break; case 31: sTemplate = "NW_WBWMLN002"; break; case 32: sTemplate = "NW_WBWMSH002"; break; case 33: sTemplate = "NW_WBWMXL002"; break; case 34: sTemplate = "NW_WBWMXH002"; break; case 35: sTemplate = "NW_WBWMSL001"; break; } } } if (nLevel == 7 || nLevel == 8) { nRandom = Random(10); if (nRandom == 0) //cloaks { switch (Random(2)) { case 0: sTemplate = "anc_it_cloak3f"; break; case 1: sTemplate = "anc_it_cloak3a"; break; } } if (nRandom == 1) //chest items { switch (Random(16)) { case 0: sTemplate = "NW_MAARCL053"; break; case 1: sTemplate = "NW_MAARCL050"; break; case 2: sTemplate = "NW_MAARCL051"; break; case 3: sTemplate = "NW_MAARCL052"; break; case 4: sTemplate = "NW_MAARCL035"; break; case 5: sTemplate = "NW_MAARCL049"; break; case 6: sTemplate = "NW_MAARCL047"; break; case 7: sTemplate = "NW_MAARCL048"; break; case 8: sTemplate = "NW_MAARCL045"; break; case 9: sTemplate = "NW_MAARCL046"; break; case 10: sTemplate = "NW_MAARCL043"; break; case 11: sTemplate = "NW_MAARCL044"; break; case 12: sTemplate = "anc_it_armor3a"; break; case 13: sTemplate = "anc_it_armor3b"; break; case 14: sTemplate = "anc_it_armor3c"; break; case 15: sTemplate = "anc_it_armor1d"; break; } } if (nRandom == 2) //helmets { switch (Random(2)) { case 0: sTemplate = "it_anc_helm1a"; break; case 1: sTemplate = "it_anc_helm1b"; break; } } if (nRandom == 3) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHMLW002"; break; case 1: sTemplate = "NW_ASHMSW002"; break; case 2: sTemplate = "NW_ASHMTO002"; break; } } if (nRandom == 4) //boots { switch (Random(3)) { case 0: sTemplate = "it_anc_boots3c"; break; case 1: sTemplate = "it_anc_boots3b"; break; case 2: sTemplate = "it_anc_boots1a"; break; } } if (nRandom == 5) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt3c"; break; case 1: sTemplate = "anc_it_belt3a"; break; } } if (nRandom == 6) //gloves or bracers { switch (Random(8)) { case 0: sTemplate = "it_anc_glove2a"; break; case 1: sTemplate = "it_anc_bracer1b"; break; case 2: sTemplate = "it_anc_glove3e"; break; case 3: sTemplate = "it_anc_glove3f"; break; case 4: sTemplate = "it_anc_glove3d"; break; case 5: sTemplate = "it_anc_glove3g"; break; case 6: sTemplate = "it_anc_glove3b"; break; case 7: sTemplate = "it_anc_glove3c"; break; } } if (nRandom == 7) //amulets { switch (Random(8)) { case 0: sTemplate = "anc_it_amulet2a"; break; case 1: sTemplate = "anc_it_amulet5h"; break; case 2: sTemplate = "anc_it_amulet3g"; break; case 3: sTemplate = "anc_it_amulet3e"; break; case 4: sTemplate = "anc_it_amulet3d"; break; case 5: sTemplate = "anc_it_amulet3f"; break; case 6: sTemplate = "anc_it_amulet3b"; break; case 7: sTemplate = "anc_it_amulet3c"; break; } } if (nRandom == 8) //rings { switch (Random(5)) { case 0: sTemplate = "anc_it_ring3e"; break; case 1: sTemplate = "anc_it_ring3f"; break; case 2: sTemplate = "anc_it_ring3d"; break; case 3: sTemplate = "anc_it_ring3a"; break; case 4: sTemplate = "anc_it_ring3b"; break; } } if (nRandom == 9) //weapons { switch (Random(41)) { case 0: sTemplate = "NW_WSWMLS010"; break; case 1: sTemplate = "NW_WSWMKA010"; break; case 2: sTemplate = "NW_WSWMRP010"; break; case 3: sTemplate = "NW_WSWMSC010"; break; case 4: sTemplate = "NW_WSWMSS009"; break; case 5: sTemplate = "NW_WSWMBS009"; break; case 6: sTemplate = "NW_WSWMDG008"; break; case 7: sTemplate = "NW_WSWMGS011"; break; case 8: sTemplate = "NW_WAXMBT010"; break; case 9: sTemplate = "NW_WAXMHN010"; break; case 10: sTemplate = "X2_WMDWRAXE003"; break; case 11: sTemplate = "NW_WAXMGR009"; break; case 12: sTemplate = "NW_WDBMQS008"; break; case 13: sTemplate = "NW_WDBMSW010"; break; case 14: sTemplate = "NW_WDBMAX010"; break; case 15: sTemplate = "NW_WDBMMA010"; break; case 16: sTemplate = "NW_WBLMML011"; break; case 17: sTemplate = "NW_WBLMFH010"; break; case 18: sTemplate = "NW_WBLMFL010"; break; case 19: sTemplate = "NW_WBLMCL010"; break; case 20: sTemplate = "NW_WBLMHL010"; break; case 21: sTemplate = "NW_WBLMHW011"; break; case 22: sTemplate = "NW_WBLMMS010"; break; case 23: sTemplate = "X2_IT_WPMWHIP2"; break; case 24: sTemplate = "NW_WSPMKA008"; break; case 25: sTemplate = "NW_WSPMKU008"; break; case 26: sTemplate = "NW_WSPMSC010"; break; case 27: sTemplate = "NW_WPLMHB010"; break; case 28: sTemplate = "NW_WPLMSC010"; break; case 29: sTemplate = "nw_wpltr003"; break; case 30: sTemplate = "NW_WPLMSS010"; break; case 31: sTemplate = "NW_WBWMLN008"; break; case 32: sTemplate = "anc_it_lbow2b"; break; case 33: sTemplate = "NW_WBWMSH008"; break; case 34: sTemplate = "anc_it_sbow2b"; break; case 35: sTemplate = "NW_WBWMXL008"; break; case 36: sTemplate = "NW_WBWMXH008"; break; case 37: sTemplate = "NW_WBWMSL009"; break; case 38: sTemplate = "anc_it_staff1b"; break; case 39: sTemplate = "anc_it_staff1a"; break; case 40: sTemplate = "anc_it_staff1c"; break; } } } if (nLevel == 9 || nLevel == 10) { nRandom = Random(10); if (nRandom == 0) //cloaks { switch (Random(2)) { case 0: sTemplate = "anc_it_cloak5f"; break; case 1: sTemplate = "anc_it_cloak4a"; break; } } if (nRandom == 1) //chest items { switch (Random(16)) { case 0: sTemplate = "NW_MAARCL053"; break; case 1: sTemplate = "NW_MAARCL050"; break; case 2: sTemplate = "NW_MAARCL051"; break; case 3: sTemplate = "NW_MAARCL052"; break; case 4: sTemplate = "NW_MAARCL035"; break; case 5: sTemplate = "NW_MAARCL049"; break; case 6: sTemplate = "NW_MAARCL047"; break; case 7: sTemplate = "NW_MAARCL048"; break; case 8: sTemplate = "NW_MAARCL045"; break; case 9: sTemplate = "NW_MAARCL046"; break; case 10: sTemplate = "NW_MAARCL043"; break; case 11: sTemplate = "NW_MAARCL044"; break; case 12: sTemplate = "anc_it_armor4a"; break; case 13: sTemplate = "anc_it_armor4b"; break; case 14: sTemplate = "anc_it_armor4c"; break; case 15: sTemplate = "anc_it_armor1d"; break; } } if (nRandom == 2) //helmets { switch (Random(2)) { case 0: sTemplate = "it_anc_helm1a"; break; case 1: sTemplate = "it_anc_helm1b"; break; } } if (nRandom == 3) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHMLW002"; break; case 1: sTemplate = "NW_ASHMSW002"; break; case 2: sTemplate = "NW_ASHMTO002"; break; } } if (nRandom == 4) //boots { switch (Random(3)) { case 0: sTemplate = "it_anc_boots3c"; break; case 1: sTemplate = "it_anc_boots3b"; break; case 2: sTemplate = "it_anc_boots1a"; break; } } if (nRandom == 5) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt5c"; break; case 1: sTemplate = "anc_it_belt4a"; break; } } if (nRandom == 6) //gloves or bracers { switch (Random(8)) { case 0: sTemplate = "it_anc_glove4a"; break; case 1: sTemplate = "it_anc_bracer1b"; break; case 2: sTemplate = "it_anc_glove3e"; break; case 3: sTemplate = "it_anc_glove3f"; break; case 4: sTemplate = "it_anc_glove3d"; break; case 5: sTemplate = "it_anc_glove3g"; break; case 6: sTemplate = "it_anc_glove3b"; break; case 7: sTemplate = "it_anc_glove3c"; break; } } if (nRandom == 7) //amulets { switch (Random(8)) { case 0: sTemplate = "anc_it_amulet5a"; break; case 1: sTemplate = "anc_it_amulet5h"; break; case 2: sTemplate = "anc_it_amulet3g"; break; case 3: sTemplate = "anc_it_amulet3e"; break; case 4: sTemplate = "anc_it_amulet3d"; break; case 5: sTemplate = "anc_it_amulet3f"; break; case 6: sTemplate = "anc_it_amulet3b"; break; case 7: sTemplate = "anc_it_amulet3c"; break; } } if (nRandom == 8) //rings { switch (Random(5)) { case 0: sTemplate = "anc_it_ring3e"; break; case 1: sTemplate = "anc_it_ring3f"; break; case 2: sTemplate = "anc_it_ring3d"; break; case 3: sTemplate = "anc_it_ring4a"; break; case 4: sTemplate = "anc_it_ring4b"; break; } } if (nRandom == 9) //weapons { switch (Random(41)) { case 0: sTemplate = "NW_WSWMLS010"; break; case 1: sTemplate = "NW_WSWMKA010"; break; case 2: sTemplate = "NW_WSWMRP010"; break; case 3: sTemplate = "NW_WSWMSC010"; break; case 4: sTemplate = "NW_WSWMSS009"; break; case 5: sTemplate = "NW_WSWMBS009"; break; case 6: sTemplate = "NW_WSWMDG008"; break; case 7: sTemplate = "NW_WSWMGS011"; break; case 8: sTemplate = "NW_WAXMBT010"; break; case 9: sTemplate = "NW_WAXMHN010"; break; case 10: sTemplate = "X2_WMDWRAXE003"; break; case 11: sTemplate = "NW_WAXMGR009"; break; case 12: sTemplate = "NW_WDBMQS008"; break; case 13: sTemplate = "NW_WDBMSW010"; break; case 14: sTemplate = "NW_WDBMAX010"; break; case 15: sTemplate = "NW_WDBMMA010"; break; case 16: sTemplate = "NW_WBLMML011"; break; case 17: sTemplate = "NW_WBLMFH010"; break; case 18: sTemplate = "NW_WBLMFL010"; break; case 19: sTemplate = "NW_WBLMCL010"; break; case 20: sTemplate = "NW_WBLMHL010"; break; case 21: sTemplate = "NW_WBLMHW011"; break; case 22: sTemplate = "NW_WBLMMS010"; break; case 23: sTemplate = "X2_IT_WPMWHIP2"; break; case 24: sTemplate = "NW_WSPMKA008"; break; case 25: sTemplate = "NW_WSPMKU008"; break; case 26: sTemplate = "NW_WSPMSC010"; break; case 27: sTemplate = "NW_WPLMHB010"; break; case 28: sTemplate = "NW_WPLMSC010"; break; case 29: sTemplate = "nw_wpltr003"; break; case 30: sTemplate = "NW_WPLMSS010"; break; case 31: sTemplate = "NW_WBWMLN008"; break; case 32: sTemplate = "anc_it_lbow2b"; break; case 33: sTemplate = "NW_WBWMSH008"; break; case 34: sTemplate = "anc_it_sbow2b"; break; case 35: sTemplate = "NW_WBWMXL008"; break; case 36: sTemplate = "NW_WBWMXH008"; break; case 37: sTemplate = "NW_WBWMSL009"; break; case 38: sTemplate = "anc_it_staff2b"; break; case 39: sTemplate = "anc_it_staff2a"; break; case 40: sTemplate = "anc_it_staff2c"; break; } } } if (nLevel == 11 || nLevel == 12) { nRandom = Random(10); if (nRandom == 0) //cloaks { switch (Random(4)) { case 0: sTemplate = "anc_it_cloak6f"; break; case 1: sTemplate = "anc_it_cloak5b"; break; case 2: sTemplate = "anc_it_cloak6b"; break; case 3: sTemplate = "anc_it_cloak5a"; break; } } if (nRandom == 1) //chest items { switch (Random(16)) { case 0: sTemplate = "NW_MAARCL053"; break; case 1: sTemplate = "NW_MAARCL050"; break; case 2: sTemplate = "NW_MAARCL051"; break; case 3: sTemplate = "NW_MAARCL052"; break; case 4: sTemplate = "NW_MAARCL035"; break; case 5: sTemplate = "NW_MAARCL049"; break; case 6: sTemplate = "NW_MAARCL047"; break; case 7: sTemplate = "NW_MAARCL048"; break; case 8: sTemplate = "NW_MAARCL045"; break; case 9: sTemplate = "NW_MAARCL046"; break; case 10: sTemplate = "NW_MAARCL043"; break; case 11: sTemplate = "NW_MAARCL044"; break; case 12: sTemplate = "anc_it_armor6a"; break; case 13: sTemplate = "anc_it_armor6b"; break; case 14: sTemplate = "anc_it_armor6c"; break; case 15: sTemplate = "anc_it_armor1d"; break; } } if (nRandom == 2) //helmets { switch (Random(2)) { case 0: sTemplate = "it_anc_helm1a"; break; case 1: sTemplate = "it_anc_helm1b"; break; } } if (nRandom == 3) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHMLW002"; break; case 1: sTemplate = "NW_ASHMSW002"; break; case 2: sTemplate = "NW_ASHMTO002"; break; } } if (nRandom == 4) //boots { switch (Random(3)) { case 0: sTemplate = "it_anc_boots4c"; break; case 1: sTemplate = "it_anc_boots6b"; break; case 2: sTemplate = "it_anc_boots1a"; break; } } if (nRandom == 5) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt6c"; break; case 1: sTemplate = "anc_it_belt5a"; break; } } if (nRandom == 6) //gloves or bracers { switch (Random(8)) { case 0: sTemplate = "it_anc_glove6a"; break; case 1: sTemplate = "it_anc_bracer1b"; break; case 2: sTemplate = "it_anc_glove5e"; break; case 3: sTemplate = "it_anc_glove5f"; break; case 4: sTemplate = "it_anc_glove5d"; break; case 5: sTemplate = "it_anc_glove5g"; break; case 6: sTemplate = "it_anc_glove5b"; break; case 7: sTemplate = "it_anc_glove5c"; break; } } if (nRandom == 7) //amulets { switch (Random(8)) { case 0: sTemplate = "anc_it_amulet5a"; break; case 1: sTemplate = "anc_it_amulet5h"; break; case 2: sTemplate = "anc_it_amulet5g"; break; case 3: sTemplate = "anc_it_amulet5e"; break; case 4: sTemplate = "anc_it_amulet5d"; break; case 5: sTemplate = "anc_it_amulet5f"; break; case 6: sTemplate = "anc_it_amulet5b"; break; case 7: sTemplate = "anc_it_amulet5c"; break; } } if (nRandom == 8) //rings { switch (Random(5)) { case 0: sTemplate = "anc_it_ring5e"; break; case 1: sTemplate = "anc_it_ring5f"; break; case 2: sTemplate = "anc_it_ring5d"; break; case 3: sTemplate = "anc_it_ring4a"; break; case 4: sTemplate = "anc_it_ring4b"; break; } } if (nRandom == 9) //weapons { switch (Random(41)) { case 0: sTemplate = "NW_WSWMLS012"; break; case 1: sTemplate = "NW_WSWMKA011"; break; case 2: sTemplate = "NW_WSWMRP011"; break; case 3: sTemplate = "NW_WSWMSC011"; break; case 4: sTemplate = "NW_WSWMSS011"; break; case 5: sTemplate = "NW_WSWMBS010"; break; case 6: sTemplate = "NW_WSWMDG009"; break; case 7: sTemplate = "NW_WSWMGS012"; break; case 8: sTemplate = "NW_WAXMBT011"; break; case 9: sTemplate = "NW_WAXMHN011"; break; case 10: sTemplate = "X2_WMDWRAXE004"; break; case 11: sTemplate = "NW_WAXMGR011"; break; case 12: sTemplate = "NW_WDBMQS009"; break; case 13: sTemplate = "NW_WDBMSW011"; break; case 14: sTemplate = "NW_WDBMAX011"; break; case 15: sTemplate = "NW_WDBMMA011"; break; case 16: sTemplate = "NW_WBLMML012"; break; case 17: sTemplate = "NW_WBLMFH011"; break; case 18: sTemplate = "NW_WBLMFL011"; break; case 19: sTemplate = "NW_WBLMCL011"; break; case 20: sTemplate = "NW_WBLMHL011"; break; case 21: sTemplate = "NW_WBLMHW012"; break; case 22: sTemplate = "NW_WBLMMS011"; break; case 23: sTemplate = "X2_IT_WPMWHIP3"; break; case 24: sTemplate = "NW_WSPMKA009"; break; case 25: sTemplate = "NW_WSPMKU009"; break; case 26: sTemplate = "NW_WSPMSC011"; break; case 27: sTemplate = "NW_WPLMHB011"; break; case 28: sTemplate = "NW_WPLMSC011"; break; case 29: sTemplate = "nw_wpltr004"; break; case 30: sTemplate = "NW_WPLMSS011"; break; case 31: sTemplate = "NW_WBWMLN009"; break; case 32: sTemplate = "anc_it_lbow4b"; break; case 33: sTemplate = "NW_WBWMSH009"; break; case 34: sTemplate = "anc_it_sbow4b"; break; case 35: sTemplate = "NW_WBWMXL009"; break; case 36: sTemplate = "NW_WBWMXH009"; break; case 37: sTemplate = "NW_WBWMSL010"; break; case 38: sTemplate = "anc_it_staff3b"; break; case 39: sTemplate = "anc_it_staff3a"; break; case 40: sTemplate = "anc_it_staff3c"; break; } } } if (nLevel == 13 || nLevel == 14) { nRandom = Random(10); if (nRandom == 0) //cloaks { switch (Random(5)) { case 0: sTemplate = "anc_it_cloak6c"; break; case 1: sTemplate = "anc_it_cloak6a"; break; case 2: sTemplate = "anc_it_cloak6d"; break; case 3: sTemplate = "anc_it_cloak7e"; break; case 4: sTemplate = "anc_it_cloak6f"; break; } } if (nRandom == 1) //chest items { switch (Random(17)) { case 0: sTemplate = "NW_MAARCL068"; break; case 1: sTemplate = "NW_MAARCL064"; break; case 2: sTemplate = "NW_MAARCL074"; break; case 3: sTemplate = "NW_MAARCL069"; break; case 4: sTemplate = "NW_MAARCL066"; break; case 5: sTemplate = "NW_MAARCL065"; break; case 6: sTemplate = "NW_MAARCL070"; break; case 7: sTemplate = "NW_MAARCL073"; break; case 8: sTemplate = "NW_MAARCL075"; break; case 9: sTemplate = "NW_MAARCL067"; break; case 10: sTemplate = "NW_MAARCL072"; break; case 11: sTemplate = "NW_MAARCL071"; break; case 12: sTemplate = "anc_it_armor6a"; break; case 13: sTemplate = "anc_it_armor6b"; break; case 14: sTemplate = "anc_it_armor6c"; break; case 15: sTemplate = "anc_it_armor2d"; break; case 16: sTemplate = "anc_it_armor2e"; break; } } if (nRandom == 2) //helmets { switch (Random(2)) { case 0: sTemplate = "it_anc_helm2a"; break; case 1: sTemplate = "it_anc_helm2b"; break; } } if (nRandom == 3) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHMTO008"; break; case 1: sTemplate = "NW_ASHMSW008"; break; case 2: sTemplate = "NW_ASHMLW008"; break; } } if (nRandom == 4) //boots { switch (Random(3)) { case 0: sTemplate = "it_anc_boots4c"; break; case 1: sTemplate = "it_anc_boots6b"; break; case 2: sTemplate = "it_anc_boots2a"; break; } } if (nRandom == 5) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt6c"; break; case 1: sTemplate = "anc_it_belt6a"; break; } } if (nRandom == 6) //gloves or bracers { switch (Random(8)) { case 0: sTemplate = "it_anc_glove6a"; break; case 1: sTemplate = "it_anc_bracer2b"; break; case 2: sTemplate = "it_anc_glove5e"; break; case 3: sTemplate = "it_anc_glove5f"; break; case 4: sTemplate = "it_anc_glove5d"; break; case 5: sTemplate = "it_anc_glove5g"; break; case 6: sTemplate = "it_anc_glove5b"; break; case 7: sTemplate = "it_anc_glove5c"; break; } } if (nRandom == 7) //amulets { switch (Random(8)) { case 0: sTemplate = "anc_it_amulet7a"; break; case 1: sTemplate = "anc_it_amulet6h"; break; case 2: sTemplate = "anc_it_amulet5g"; break; case 3: sTemplate = "anc_it_amulet5e"; break; case 4: sTemplate = "anc_it_amulet5d"; break; case 5: sTemplate = "anc_it_amulet5f"; break; case 6: sTemplate = "anc_it_amulet5b"; break; case 7: sTemplate = "anc_it_amulet5c"; break; } } if (nRandom == 8) //rings { switch (Random(5)) { case 0: sTemplate = "anc_it_ring6e"; break; case 1: sTemplate = "anc_it_ring6f"; break; case 2: sTemplate = "anc_it_ring6d"; break; case 3: sTemplate = "anc_it_ring6a"; break; case 4: sTemplate = "anc_it_ring5b"; break; } } if (nRandom == 9) //weapons { switch (Random(41)) { case 0: sTemplate = "X0_WSWMLS001"; break; case 1: sTemplate = "X0_WSWMKA001"; break; case 2: sTemplate = "X0_WSWMRP001"; break; case 3: sTemplate = "X0_WSWMSC001"; break; case 4: sTemplate = "X0_WSWMSS001"; break; case 5: sTemplate = "X0_WSWMBS001"; break; case 6: sTemplate = "X0_WSWMDG001"; break; case 7: sTemplate = "X0_WSWMGS001"; break; case 8: sTemplate = "X0_WAXMBT001"; break; case 9: sTemplate = "X0_WAXMHN001"; break; case 10: sTemplate = "X2_WMDWRAXE005"; break; case 11: sTemplate = "X0_WAXMGR001"; break; case 12: sTemplate = "X0_WDBMQS001"; break; case 13: sTemplate = "X0_WDBMSW001"; break; case 14: sTemplate = "X0_WDBMAX001"; break; case 15: sTemplate = "X0_WDBMMA001"; break; case 16: sTemplate = "X0_WBLMML001"; break; case 17: sTemplate = "X0_WBLMFH001"; break; case 18: sTemplate = "X0_WBLMFL001"; break; case 19: sTemplate = "X0_WBLMCL001"; break; case 20: sTemplate = "X0_WBLMHL001"; break; case 21: sTemplate = "X0_WBLMHW001"; break; case 22: sTemplate = "X0_WBLMMS001"; break; case 23: sTemplate = "X2_IT_WPMWHIP4"; break; case 24: sTemplate = "X0_WSPMKA001"; break; case 25: sTemplate = "X0_WSPMKU001"; break; case 26: sTemplate = "X0_WSPMSC001"; break; case 27: sTemplate = "X0_WPLMHB001"; break; case 28: sTemplate = "X0_WPLMSC001"; break; case 29: sTemplate = "nw_wpltr005"; break; case 30: sTemplate = "X0_WPLMSS001"; break; case 31: sTemplate = "X0_WBWMLN001"; break; case 32: sTemplate = "anc_it_lbow5b"; break; case 33: sTemplate = "X0_WBWMSH001"; break; case 34: sTemplate = "anc_it_sbow5b"; break; case 35: sTemplate = "X0_WBWMXL001"; break; case 36: sTemplate = "X0_WBWMXH001"; break; case 37: sTemplate = "X0_WBWMSL001"; break; case 38: sTemplate = "anc_it_staff3b"; break; case 39: sTemplate = "anc_it_staff3a"; break; case 40: sTemplate = "anc_it_staff3c"; break; } } } if (nLevel == 15 || nLevel == 16) { nRandom = Random(10); if (nRandom == 0) //cloaks { switch (Random(7)) { case 0: sTemplate = "anc_it_cloak7f"; break; case 1: sTemplate = "anc_it_cloak7d"; break; case 2: sTemplate = "anc_it_cloak7c"; break; case 3: sTemplate = "anc_it_cloak8d"; break; case 4: sTemplate = "anc_it_cloak7b"; break; case 5: sTemplate = "anc_it_cloak8b"; break; case 6: sTemplate = "anc_it_cloak7a"; break; } } if (nRandom == 1) //chest items { switch (Random(17)) { case 0: sTemplate = "NW_MAARCL068"; break; case 1: sTemplate = "NW_MAARCL064"; break; case 2: sTemplate = "NW_MAARCL074"; break; case 3: sTemplate = "NW_MAARCL069"; break; case 4: sTemplate = "NW_MAARCL066"; break; case 5: sTemplate = "NW_MAARCL065"; break; case 6: sTemplate = "NW_MAARCL070"; break; case 7: sTemplate = "NW_MAARCL073"; break; case 8: sTemplate = "NW_MAARCL075"; break; case 9: sTemplate = "NW_MAARCL067"; break; case 10: sTemplate = "NW_MAARCL072"; break; case 11: sTemplate = "NW_MAARCL071"; break; case 12: sTemplate = "anc_it_armor7a"; break; case 13: sTemplate = "anc_it_armor7b"; break; case 14: sTemplate = "anc_it_armor7c"; break; case 15: sTemplate = "anc_it_armor2d"; break; case 16: sTemplate = "anc_it_armor2e"; break; } } if (nRandom == 2) //helmets { switch (Random(2)) { case 0: sTemplate = "it_anc_helm2a"; break; case 1: sTemplate = "it_anc_helm2b"; break; } } if (nRandom == 3) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHMTO008"; break; case 1: sTemplate = "NW_ASHMSW008"; break; case 2: sTemplate = "NW_ASHMLW008"; break; } } if (nRandom == 4) //boots { switch (Random(3)) { case 0: sTemplate = "it_anc_boots4c"; break; case 1: sTemplate = "it_anc_boots6b"; break; case 2: sTemplate = "it_anc_boots2a"; break; } } if (nRandom == 5) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt7c"; break; case 1: sTemplate = "anc_it_belt7a"; break; } } if (nRandom == 6) //gloves or bracers { switch (Random(8)) { case 0: sTemplate = "it_anc_glove6a"; break; case 1: sTemplate = "it_anc_bracer2b"; break; case 2: sTemplate = "it_anc_glove7e"; break; case 3: sTemplate = "it_anc_glove7f"; break; case 4: sTemplate = "it_anc_glove7d"; break; case 5: sTemplate = "it_anc_glove7g"; break; case 6: sTemplate = "it_anc_glove7b"; break; case 7: sTemplate = "it_anc_glove7c"; break; } } if (nRandom == 7) //amulets { switch (Random(8)) { case 0: sTemplate = "anc_it_amulet7a"; break; case 1: sTemplate = "anc_it_amulet6h"; break; case 2: sTemplate = "anc_it_amulet7g"; break; case 3: sTemplate = "anc_it_amulet7e"; break; case 4: sTemplate = "anc_it_amulet7d"; break; case 5: sTemplate = "anc_it_amulet7f"; break; case 6: sTemplate = "anc_it_amulet7b"; break; case 7: sTemplate = "anc_it_amulet7c"; break; } } if (nRandom == 8) //rings { switch (Random(5)) { case 0: sTemplate = "anc_it_ring6e"; break; case 1: sTemplate = "anc_it_ring7f"; break; case 2: sTemplate = "anc_it_ring7d"; break; case 3: sTemplate = "anc_it_ring6a"; break; case 4: sTemplate = "anc_it_ring7b"; break; } } if (nRandom == 9) //weapons { switch (Random(41)) { case 1: sTemplate = "X0_WSWMLS002"; break; case 2: sTemplate = "X0_WSWMKA002"; break; case 3: sTemplate = "X0_WSWMRP002"; break; case 4: sTemplate = "X0_WSWMSC002"; break; case 5: sTemplate = "X0_WSWMSS002"; break; case 6: sTemplate = "X0_WSWMBS002"; break; case 7: sTemplate = "X0_WSWMDG002"; break; case 8: sTemplate = "X0_WSWMGS002"; break; case 9: sTemplate = "X0_WAXMBT002"; break; case 10: sTemplate = "X0_WAXMHN002"; break; case 11: sTemplate = "X2_WMDWRAXE006"; break; case 12: sTemplate = "X0_WAXMGR002"; break; case 13: sTemplate = "X0_WDBMQS002"; break; case 14: sTemplate = "X0_WDBMSW002"; break; case 15: sTemplate = "X0_WDBMAX002"; break; case 16: sTemplate = "X0_WDBMMA002"; break; case 17: sTemplate = "X0_WBLMML002"; break; case 18: sTemplate = "X0_WBLMFH002"; break; case 19: sTemplate = "X0_WBLMFL002"; break; case 20: sTemplate = "X0_WBLMCL002"; break; case 21: sTemplate = "X0_WBLMHL002"; break; case 22: sTemplate = "X0_WBLMHW002"; break; case 23: sTemplate = "X0_WBLMMS002"; break; case 24: sTemplate = "X2_IT_WPMWHIP5"; break; case 25: sTemplate = "X0_WSPMKA002"; break; case 26: sTemplate = "X0_WSPMKU002"; break; case 27: sTemplate = "X0_WSPMSC002"; break; case 28: sTemplate = "X0_WPLMHB002"; break; case 29: sTemplate = "X0_WPLMSC002"; break; case 30: sTemplate = "nw_wpltr006"; break; case 31: sTemplate = "X0_WPLMSS002"; break; case 32: sTemplate = "X0_WBWMLN002"; break; case 33: sTemplate = "anc_it_lbow6b"; break; case 34: sTemplate = "X0_WBWMSH002"; break; case 35: sTemplate = "anc_it_sbow6b"; break; case 36: sTemplate = "X0_WBWMXL002"; break; case 37: sTemplate = "X0_WBWMXH002"; break; case 38: sTemplate = "X0_WBWMSL002"; break; case 39: sTemplate = "anc_it_staff3b"; break; case 40: sTemplate = "anc_it_staff3a"; break; case 0: sTemplate = "anc_it_staff3c"; break; } } } if (nLevel > 16) { nRandom = Random(10); if (nRandom == 0) //cloaks { switch (Random(5)) { case 0: sTemplate = "anc_it_cloak8e"; break; case 1: sTemplate = "anc_it_cloak8c"; break; case 2: sTemplate = "anc_it_cloak8a"; break; case 3: sTemplate = "anc_it_cloak7f"; break; case 4: sTemplate = "anc_it_cloak8b"; break; } } if (nRandom == 1) //chest items { switch (Random(31)) { case 0: sTemplate = "anc_it_armor8a"; break; case 1: sTemplate = "anc_it_armor8b"; break; case 2: sTemplate = "anc_it_armor8c"; break; case 3: sTemplate = "anc_it_armor8a"; break; case 4: sTemplate = "anc_it_armor8b"; break; case 5: sTemplate = "anc_it_armor8c"; break; case 6: sTemplate = "anc_it_armor3d"; break; case 7: sTemplate = "anc_it_armor4d"; break; case 8: sTemplate = "anc_it_armor5d"; break; case 9: sTemplate = "anc_it_armor5e"; break; case 10: sTemplate = "anc_it_armor8d"; break; case 11: sTemplate = "anc_it_armor8e"; break; case 12: sTemplate = "anc_it_earmor1"; break; case 13: sTemplate = "anc_it_earmor2"; break; case 14: sTemplate = "anc_it_earmor3"; break; case 15: sTemplate = "anc_it_earmor4"; break; case 16: sTemplate = "anc_it_earmor10"; break; case 17: sTemplate = "anc_it_earmor9"; break; case 18: sTemplate = "anc_it_earmor7"; break; case 19: sTemplate = "anc_it_earmor17"; break; case 20: sTemplate = "anc_it_earmor18"; break; case 21: sTemplate = "anc_it_earmor28"; break; case 22: sTemplate = "anc_it_earmor26"; break; case 23: sTemplate = "anc_it_earmor19"; break; case 24: sTemplate = "anc_it_earmor20"; break; case 25: sTemplate = "anc_it_earmor11"; break; case 26: sTemplate = "anc_it_earmor12"; break; case 27: sTemplate = "anc_it_earmor16"; break; case 28: sTemplate = "anc_it_earmor15"; break; case 29: sTemplate = "anc_it_earmor13"; break; case 30: sTemplate = "anc_it_earmor14"; break; } } if (nRandom == 2) //helmets { switch (Random(9)) { case 0: sTemplate = "it_anc_helm3a"; break; case 1: sTemplate = "it_anc_helm3b"; break; case 2: sTemplate = "it_anc_helm4a"; break; case 3: sTemplate = "it_anc_helm4b"; break; case 4: sTemplate = "it_anc_helm5a"; break; case 5: sTemplate = "it_anc_helm5b"; break; case 6: sTemplate = "it_anc_helm8a"; break; case 7: sTemplate = "it_anc_helm8b"; break; case 8: sTemplate = "anc_it_actrinket"; break; } } if (nRandom == 3) //shields { switch (Random(3)) { case 0: sTemplate = "NW_ASHMLW009"; break; case 1: sTemplate = "NW_ASHMSW009"; break; case 2: sTemplate = "NW_ASHMTO009"; break; } } if (nRandom == 4) //boots { switch (Random(3)) { case 0: sTemplate = "it_anc_boots4c"; break; case 1: sTemplate = "it_anc_boots6b"; break; case 2: sTemplate = "it_anc_boots3a"; break; } } if (nRandom == 5) //belts { switch (Random(2)) { case 0: sTemplate = "anc_it_belt7c"; break; case 1: sTemplate = "anc_it_belt8a"; break; } } if (nRandom == 6) //gloves or bracers { switch (Random(8)) { case 0: sTemplate = "it_anc_glove6a"; break; case 1: sTemplate = "it_anc_bracer3b"; break; case 2: sTemplate = "it_anc_glove8e"; break; case 3: sTemplate = "it_anc_glove8f"; break; case 4: sTemplate = "it_anc_glove8d"; break; case 5: sTemplate = "it_anc_glove8g"; break; case 6: sTemplate = "it_anc_glove8b"; break; case 7: sTemplate = "it_anc_glove8c"; break; } } if (nRandom == 7) //amulets { switch (Random(8)) { case 0: sTemplate = "anc_it_amulet8a"; break; case 1: sTemplate = "anc_it_amulet8h"; break; case 2: sTemplate = "anc_it_amulet8g"; break; case 3: sTemplate = "anc_it_amulet8e"; break; case 4: sTemplate = "anc_it_amulet8d"; break; case 5: sTemplate = "anc_it_amulet8f"; break; case 6: sTemplate = "anc_it_amulet8b"; break; case 7: sTemplate = "anc_it_amulet8c"; break; } } if (nRandom == 8) //rings { switch (Random(5)) { case 0: sTemplate = "anc_it_ring6e"; break; case 1: sTemplate = "anc_it_ring8f"; break; case 2: sTemplate = "anc_it_ring7d"; break; case 3: sTemplate = "anc_it_ring8a"; break; case 4: sTemplate = "anc_it_ring7b"; break; } } if (nRandom == 9) //weapons { switch (Random(76)) { case 1: sTemplate = "X0_WSWMLS002"; break; case 2: sTemplate = "X0_WSWMKA002"; break; case 3: sTemplate = "X0_WSWMRP002"; break; case 4: sTemplate = "X0_WSWMSC002"; break; case 5: sTemplate = "X0_WSWMSS002"; break; case 6: sTemplate = "X0_WSWMBS002"; break; case 7: sTemplate = "X0_WSWMDG002"; break; case 8: sTemplate = "X0_WSWMGS002"; break; case 9: sTemplate = "X0_WAXMBT002"; break; case 10: sTemplate = "X0_WAXMHN002"; break; case 11: sTemplate = "X2_WMDWRAXE006"; break; case 12: sTemplate = "X0_WAXMGR002"; break; case 13: sTemplate = "X0_WDBMQS002"; break; case 14: sTemplate = "X0_WDBMSW002"; break; case 15: sTemplate = "X0_WDBMAX002"; break; case 16: sTemplate = "X0_WDBMMA002"; break; case 17: sTemplate = "X0_WBLMML002"; break; case 18: sTemplate = "X0_WBLMFH002"; break; case 19: sTemplate = "X0_WBLMFL002"; break; case 20: sTemplate = "X0_WBLMCL002"; break; case 21: sTemplate = "X0_WBLMHL002"; break; case 22: sTemplate = "X0_WBLMHW002"; break; case 23: sTemplate = "X0_WBLMMS002"; break; case 24: sTemplate = "X2_IT_WPMWHIP5"; break; case 25: sTemplate = "X0_WSPMKA002"; break; case 26: sTemplate = "X0_WSPMKU002"; break; case 27: sTemplate = "X0_WSPMSC002"; break; case 28: sTemplate = "X0_WPLMHB002"; break; case 29: sTemplate = "X0_WPLMSC002"; break; case 30: sTemplate = "nw_wpltr006"; break; case 31: sTemplate = "X0_WPLMSS002"; break; case 32: sTemplate = "X0_WBWMLN002"; break; case 33: sTemplate = "anc_it_lbow6b"; break; case 34: sTemplate = "X0_WBWMSH002"; break; case 35: sTemplate = "anc_it_sbow6b"; break; case 36: sTemplate = "X0_WBWMXL002"; break; case 37: sTemplate = "X0_WBWMXH002"; break; case 38: sTemplate = "X0_WBWMSL002"; break; case 39: sTemplate = "anc_it_staff3b"; break; case 40: sTemplate = "anc_it_staff3a"; break; case 0: sTemplate = "anc_it_staff3c"; break; case 41: sTemplate = "anc_it_scythe8a"; break; case 42: sTemplate = "anc_it_halber8a"; break; case 43: sTemplate = "anc_it_spear8a"; break; case 44: sTemplate = "anc_it_whip8a"; break; case 45: sTemplate = "anc_it_kama8a"; break; case 46: sTemplate = "anc_it_kukri8a"; break; case 47: sTemplate = "anc_it_sickle8a"; break; case 48: sTemplate = "anc_it_mace8a"; break; case 49: sTemplate = "anc_it_hflail8a"; break; case 50: sTemplate = "anc_it_lflail8a"; break; case 51: sTemplate = "anc_it_club8a"; break; case 52: sTemplate = "anc_it_bhamm8a"; break; case 53: sTemplate = "anc_it_lhamm8a"; break; case 54: sTemplate = "anc_it_mstar8a"; break; case 55: sTemplate = "anc_it_qstaff8a"; break; case 56: sTemplate = "anc_it_dsword8a"; break; case 57: sTemplate = "anc_it_daxe8a"; break; case 58: sTemplate = "anc_it_lsword8a"; break; case 59: sTemplate = "anc_it_rapier8a"; break; case 60: sTemplate = "anc_it_katana8a"; break; case 61: sTemplate = "anc_it_scimit8a"; break; case 62: sTemplate = "anc_it_ssword8a"; break; case 63: sTemplate = "anc_it_bsword8a"; break; case 64: sTemplate = "anc_it_dagger8a"; break; case 65: sTemplate = "anc_it_gsword8a"; break; case 66: sTemplate = "anc_it_thaxe8a"; break; case 67: sTemplate = "anc_it_haxe8a"; break; case 68: sTemplate = "anc_it_gaxe8a"; break; case 69: sTemplate = "anc_it_lbow8c"; break; case 70: sTemplate = "anc_it_sbow8c"; break; case 71: sTemplate = "anc_it_xbow8b"; break; case 72: sTemplate = "anc_it_xbow8c"; break; case 73: sTemplate = "anc_it_sling8a"; break; case 74: sTemplate = "anc_it_gmace8a"; break; case 75: sTemplate = "anc_it_dwaxe8a"; break; } } } return sTemplate; } //Randomly select a gem based on the creature's level string GenerateRandomGem(object oCreature) { string sGem; int nLevel = GetHitDice(oCreature); int nRandom = Random(100)+1; if (nLevel <= 3) { if (nRandom <= 10) sGem = "anc_it_gem1000"; else if (nRandom <= 30) sGem = "anc_it_gem500"; else if (nRandom <= 60) sGem = "anc_it_gem200"; else sGem = "anc_it_gem100"; } else if (nLevel <= 6) { if (nRandom <= 10) sGem = "anc_it_gem1500"; else if (nRandom <= 30) sGem = "anc_it_gem1000"; else if (nRandom <= 60) sGem = "anc_it_gem500"; else { switch (Random(2)) { case 0: sGem = "anc_it_gem100"; break; case 1: sGem = "anc_it_gem200"; break; } } } else if (nLevel <= 10) { if (nRandom <= 10) sGem = "anc_it_gem2000"; else if (nRandom <= 30) sGem = "anc_it_gem1500"; else if (nRandom <= 60) sGem = "anc_it_gem1000"; else { switch (Random(3)) { case 0: sGem = "anc_it_gem100"; break; case 1: sGem = "anc_it_gem200"; break; case 2: sGem = "anc_it_gem500"; break; } } } else if (nLevel <= 15) { if (nRandom <= 10) sGem = "anc_it_gem2500"; else if (nRandom <= 30) sGem = "anc_it_gem2000"; else if (nRandom <= 60) sGem = "anc_it_gem1500"; else { switch (Random(4)) { case 0: sGem = "anc_it_gem100"; break; case 1: sGem = "anc_it_gem200"; break; case 2: sGem = "anc_it_gem500"; break; case 3: sGem = "anc_it_gem1000"; break; } } } else if (nLevel <= 20) { if (nRandom <= 10) sGem = "anc_it_gem3500"; else if (nRandom <= 30) sGem = "anc_it_gem2500"; else if (nRandom <= 60) sGem = "anc_it_gem2000"; else { switch (Random(5)) { case 0: sGem = "anc_it_gem100"; break; case 1: sGem = "anc_it_gem200"; break; case 2: sGem = "anc_it_gem500"; break; case 3: sGem = "anc_it_gem1000"; break; case 4: sGem = "anc_it_gem1500"; break; } } } else { if (nRandom <= 10) sGem = "anc_it_gem5000"; else if (nRandom <= 30) sGem = "anc_it_gem3500"; else if (nRandom <= 60) sGem = "anc_it_gem2500"; else { switch (Random(5)) { case 0: sGem = "anc_it_gem100"; break; case 1: sGem = "anc_it_gem200"; break; case 2: sGem = "anc_it_gem500"; break; case 3: sGem = "anc_it_gem1000"; break; case 4: sGem = "anc_it_gem1500"; break; case 5: sGem = "anc_it_gem2000"; break; } } } return sGem; } //Select a random potion based on a creature's level string GenerateRandomPotion(object oCreature) { int nLevel = GetHitDice(oCreature); string sPotion; //Select a potion switch (Random(12)) { case 0: sPotion = "nw_it_mpotion016"; break; //Aid case 1: sPotion = "nw_it_mpotion005"; break; //Barkskin case 2: sPotion = "nw_it_mpotion009"; break; //Bless case 3: sPotion = "nw_it_mpotion015"; break; //Bull's strength case 4: sPotion = "nw_it_mpotion014"; break; //Cat's grace case 5: sPotion = "x2_it_mpotion002"; break; //Death armor case 6: sPotion = "nw_it_mpotion010"; break; //Eagle's splendor case 7: sPotion = "nw_it_mpotion017"; break; //Fox's cunning case 8: sPotion = "nw_it_mpotion008"; break; //Invisibility case 9: sPotion = "nw_it_mpotion011"; break; //Lesser restoration case 10: sPotion = "nw_it_mpotion018"; break; //Owl's wisdom case 11: sPotion = "nw_it_mpotion004"; break; //Speed } //But there's actually 50% chance that the potion will be a healing one if (Random(2) == 0) { if (nLevel <= 2) sPotion = "nw_it_mpotion001"; //Light wounds else if (nLevel <= 4) sPotion = "nw_it_mpotion020"; //Moderate wounds else if (nLevel <= 7) sPotion = "nw_it_mpotion002"; //Serious wounds else if (nLevel <= 10) sPotion = "nw_it_mpotion003"; //Critical wounds else sPotion = "nw_it_mpotion012"; //Heal } return sPotion; } //Randomly select a rune based on the creature's level string GenerateRandomRune(object oCreature) { string sItem = "run_"; string sRuneType; string sType; string sDamage; string sDuration; if (GetHitDice(oCreature) <= 10 || Random(10) <= 7) { if (Random(4) == 0) sRuneType = "temporary"; else sRuneType = "permanent"; } else { sRuneType = "visual"; } //for visual runes if (sRuneType == "visual") { switch (Random(19)) { case 0: sType = "dark"; break; case 1: sType = "blfi"; break; case 2: sType = "blgl"; break; case 3: sType = "blsh"; break; case 4: sType = "grfi"; break; case 5: sType = "grgl"; break; case 6: sType = "grsh"; break; case 7: sType = "orfi"; break; case 8: sType = "orgl"; break; case 9: sType = "orsh"; break; case 10: sType = "pufi"; break; case 11: sType = "pugl"; break; case 12: sType = "push"; break; case 13: sType = "whfi"; break; case 14: sType = "whgl"; break; case 15: sType = "whsh"; break; case 16: sType = "yefi"; break; case 17: sType = "yegl"; break; case 18: sType = "yesh"; break; } sDuration = "e"; sDamage = "00"; } //for temporary runes if (sRuneType == "temporary") { switch (Random(6)) { case 0: sType = "divi"; break; case 1: sType = "acid"; break; case 2: sType = "fros"; break; case 3: sType = "flam"; break; case 4: sType = "vibr"; break; case 5: sType = "thun"; break; } sDuration = "t"; sDamage = "04"; } //for permanent runes if (sRuneType == "permanent") { switch (Random(6)) { case 0: sType = "divi"; break; case 1: sType = "acid"; break; case 2: sType = "fros"; break; case 3: sType = "flam"; break; case 4: sType = "vibr"; break; case 5: sType = "thun"; break; } sDuration = "e"; switch (GetHitDice(oCreature)) { case 1: case 2: case 3: sDamage = "02"; break; case 4: case 5: case 6: case 7: sDamage = "04"; break; case 8: case 9: case 10: case 11: sDamage = "06"; break; case 12: case 13: case 14: case 15: sDamage = "08"; break; default: sDamage = "10"; break; } } //Create the resref sItem = sItem + sDuration + sType + sDamage; return sItem; } //Randomly select a miscellaneous item string GenerateRandomMiscItem() { string sItem; string sItemType; int nRandom = Random(100)+1; if (nRandom == 1) sItemType = "goldhorses"; else if (nRandom <= 3) sItemType = "silverhorses"; else if (nRandom <= 6) sItemType = "steelhorses"; else if (nRandom <= 10) sItemType = "bronzehorses"; //10% chances for a horse else if (nRandom <= 15) sItemType = "iounstone"; //5% chances for an ioun stone else if (nRandom <= 35) sItemType = "NW_IT_MEDKIT004"; //20% chances for a medkit else if (nRandom <= 45) sItemType = "anc_it_immo"; //10% chances for an immobilizer else if (nRandom <= 55) sItemType = "poison"; //10% chances for a poison else if (nRandom <= 70) sItemType = "tool"; //15% chances for thieves' tool else sItemType = "component"; //30% chances for a component/grenade if (sItemType == "goldhorses") { switch (Random(2)) { case 0: sItem = "horgr_unicorn"; break; //Unicorn case 1: sItem = "horgr_nightmare"; break; //Nightmare } } if (sItemType == "silverhorses") { switch (Random(4)) { case 0: sItem = "horgr_whheavy"; break; //White heavy case 1: sItem = "horgr_brheavy"; break; //Brown heavy case 2: sItem = "horgr_blheavy"; break; //Black heavy case 3: sItem = "horgr_spheavy"; break; //Spotted heavy } } if (sItemType == "steelhorses") { switch (Random(4)) { case 0: sItem = "horgr_wharmor"; break; //White armor case 1: sItem = "horgr_brarmor"; break; //Brown armor case 2: sItem = "horgr_blarmor"; break; //Black armor case 3: sItem = "horgr_sparmor"; break; //Spotted armor } } if (sItemType == "bronzehorses") { switch (Random(4)) { case 0: sItem = "horgr_whsaddle"; break; //White saddle case 1: sItem = "horgr_brsaddle"; break; //Brown saddle case 2: sItem = "horgr_blsaddle"; break; //Black saddle case 3: sItem = "horgr_spsaddle"; break; //Spotted saddle } } if (sItemType == "iounstone") { switch (Random(7)) { case 0: sItem = "x2_is_deepred"; break; case 1: sItem = "x2_is_paleblue"; break; case 2: sItem = "x2_is_blue"; break; case 3: sItem = "x2_is_pandgreen"; break; case 4: sItem = "x2_is_pink"; break; case 5: sItem = "x2_is_drose"; break; case 6: sItem = "x2_is_sandblue"; break; } } if (sItemType == "NW_IT_MEDKIT004" || sItemType == "anc_it_immo") sItem = sItemType; if (sItemType == "poison") { switch (Random(9)) { case 0: sItem = "x2_it_poison033"; break; case 1: sItem = "x2_it_poison039"; break; case 2: sItem = "anc_poison_con"; break; case 3: sItem = "x2_it_poison031"; break; case 4: sItem = "x2_it_poison037"; break; case 5: sItem = "anc_poison_str"; break; case 6: sItem = "x2_it_poison032"; break; case 7: sItem = "x2_it_poison038"; break; case 8: sItem = "anc_poison_dex"; break; } } if (sItemType == "tool") { switch (Random(3)) { case 0: sItem = "X2_IT_PICKS001"; break; //thieves' tools +8 case 1: sItem = "NW_IT_PICKS004"; break; //thieves' tools +10 case 2: sItem = "X2_IT_PICKS002"; break; //thieves' tools +12 } } if (sItemType == "component") { switch (Random(12)) { case 0: sItem = "X1_WMGRENADE003"; break; //spikes case 1: sItem = "X1_WMGRENADE001"; break; //acid bottle case 2: sItem = "NW_IT_MSMLMISC11"; break; //crystal of quartz case 3: sItem = "X1_IT_MSMLMISC01"; break; //cold stone case 4: sItem = "X1_WMGRENADE004"; break; //choking powder case 5: sItem = "X1_WMGRENADE005"; break; //holy water case 6: sItem = "NW_IT_MSMLMISC13"; break; //skeletal knuckles case 7: sItem = "X1_WMGRENADE007"; break; //thunder stone case 8: sItem = "X1_WMGRENADE006"; break; //tanglefoot bag case 9: sItem = "X0_IT_MTHNMISC05"; break; //dust of appearance case 10: sItem = "X0_IT_MTHNMISC06"; break; //dust of disappearance case 11: sItem = "NW_IT_CONTAIN005"; break; //greater magical bag } } return sItem; } //Randomly spawn item(s) on creature to be looted/stolen from generated mobs void SpawnRandomNPCLoot(object oCreature) { //50% chance of a small pick-pocketable item int nMisc = FALSE; object oItem; string sPickpocketItem; if (Random(2) == 0) { switch (Random(5)) { case 0: case 1: case 2: sPickpocketItem = GenerateRandomGem(oCreature); break; case 3: case 4: sPickpocketItem = GenerateRandomMiscItem(); nMisc = TRUE; break; } if (nMisc == FALSE || GetLocalInt(GetArea(oCreature), "NoMisc") == FALSE) //we don't want miscellaneous items in some areas { oItem = CreateItemOnObject(sPickpocketItem, oCreature); } SetDroppableFlag(oItem, FALSE); SetPickpocketableFlag(oItem, TRUE); } //5% of a droppable item nMisc = FALSE; string sDropItem; if (Random(20) == 0) { switch (Random(7)) { case 0: case 1: case 2: sPickpocketItem = GenerateRandomGem(oCreature); break; case 3: case 4: sPickpocketItem = GenerateRandomMiscItem(); nMisc = TRUE; break; case 5: sPickpocketItem = GenerateRandomRune(oCreature); break; case 6: sPickpocketItem = GenerateRandomItem(oCreature); break; } if (nMisc == FALSE || GetLocalInt(GetArea(oCreature), "NoMisc") == FALSE) //we don't want miscellaneous items in some areas { oItem = CreateItemOnObject(sPickpocketItem, oCreature); } SetDroppableFlag(oItem, TRUE); SetPickpocketableFlag(oItem, FALSE); } } //Generate a quest for a PC void GenerateQuest(object oPC, object oClient, string sRegion, string sTown="") { //Choose the quest template - different quests should be available at different levels string sDB = CharacterDB(oPC); int nLevel = GetHitDice(oPC); string sTemplate; switch (Random(8)) { case 0: sTemplate = "kill"; break; case 1: sTemplate = "interrogate"; break; case 2: sTemplate = "item"; break; case 3: sTemplate = "lost"; break; case 4: sTemplate = "escort"; break; case 5: sTemplate = "ransom"; break; case 6: sTemplate = "kidnap"; break; case 7: sTemplate = "monsters"; break; } //no monster killing quest on early levels if (nLevel <= 5) { switch (Random(7)) { case 0: sTemplate = "kill"; break; case 1: sTemplate = "interrogate"; break; case 2: sTemplate = "item"; break; case 3: sTemplate = "lost"; break; case 4: sTemplate = "escort"; break; case 5: sTemplate = "ransom"; break; case 6: sTemplate = "kidnap"; break; } } //Define quest variables int nBackground; int nTwist = 0; int nComplication = 0; int nLuck = FALSE; string sExtra = "null"; string sExtra2 = "null"; int nReward = 0; string sItem = "null"; string sClientName; string sClientLastName; string sClientCloth; int nClientHead; int nClientHair; int nClientSkin; string sClientRef; int nClientLaw; int nClientGood; int nClientPheno; string sRace; string sSex; string sTargetName; string sTargetLastName; string sTargetCloth; int nTargetHead; int nTargetHair; int nTargetSkin; string sTargetRef; int nTargetLaw; int nTargetGood; int nTargetPheno; int nTavernNumber; int nExp; int nIntel = 0; int nIntelCost = 0; int nEvil = FALSE; int nCommoner = FALSE; //Save data related to the client sClientRef = GetResRef(oClient); nClientHead = GetCreatureBodyPart(CREATURE_PART_HEAD, oClient); nClientPheno = GetPhenoType(oClient); nClientHair = GetColor(oClient, COLOR_CHANNEL_HAIR); nClientSkin = GetColor(oClient, COLOR_CHANNEL_SKIN); sClientCloth = GetTag(GetItemInSlot(INVENTORY_SLOT_CHEST, oClient)); nClientLaw = GetLawChaosValue(oClient); nClientGood = GetGoodEvilValue(oClient); sClientName = GetLocalString(oClient, "Name"); sClientLastName = GetLocalString(oClient, "LastName"); nTavernNumber = GetLocalInt(GetArea(oClient), "TavernNumber"); //If "kill" is the mission if (sTemplate == "kill") { //Select background nBackground = Random(6)+1; //6 possible backgrounds //Check whether a plot twist applies if (nBackground != 6 && Random(10) == 0) nTwist = TRUE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = Random(2)+1; //Generate a commoner target if applicable // //Generate an adventurer target if applicable and make modifications to it according to the background requirements GenerateFreshQuestNPC(oPC); //Check whether any extra data should be saved and save it if (nBackground == 1) { switch (Random(4)) { case 0: sExtra = "kid"; break; case 1: sExtra = "brother"; break; case 2: sExtra = "sister"; break; case 3: sExtra = "all"; break; } } if (nBackground == 2) { switch (Random(3)) { case 0: sExtra = "murderer"; break; case 1: sExtra = "bandit"; break; case 2: sExtra = "fugitive"; break; } } if (nBackground == 4) { switch (Random(2)) { case 0: sExtra = "male"; break; case 1: sExtra = "female"; break; } } if (nBackground == 5) nEvil = TRUE; switch (Random(2)) { case 0: sExtra2 = "ring"; break; case 1: sExtra2 = "head"; break; } } //If "interrogate" is the mission if (sTemplate == "interrogate") { //Select background nBackground = Random(6)+1; //6 possible backgrounds //Check whether a plot twist applies nTwist = FALSE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = Random(2)+1; //Generate a commoner target if applicable // //Generate an adventurer target if applicable and make modifications to it according to the background requirements GenerateFreshQuestNPC(oPC); //Check whether any extra data should be saved and save it if (nBackground == 6) { switch (Random(2)) { case 0: sExtra = "cards"; break; case 1: sExtra = "dice"; break; } } if (nBackground == 1 || nBackground == 2 || nBackground == 4) sExtra2 = "cankill"; if (nBackground == 3) sExtra2 = "mustkill"; if (nBackground == 5 || nBackground == 6) sExtra2 = "cantkill"; if (nBackground == 4) nEvil = TRUE; } //If "item" is the mission if (sTemplate == "item") { //Select background nBackground = Random(5)+1; //5 possible backgrounds //Check whether a plot twist applies if (nBackground != 1 && nBackground != 3 && nBackground != 4 && Random(10) == 0) nTwist = TRUE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = Random(2)+1; //Generate a commoner target if applicable // //Generate an adventurer target if applicable and make modifications to it according to the background requirements GenerateFreshQuestNPC(oPC); //Check whether any extra data should be saved and save it if (nBackground == 1 || nBackground == 2 || nBackground == 3) { switch (Random(2)) { case 0: sExtra = "stealamulet"; break; case 1: sExtra = "stealring"; break; } } if (nBackground == 5) { switch (Random(3)) { case 0: sExtra = "stealsphere"; break; case 1: sExtra = "stealhand"; break; case 2: sExtra = "stealdisc"; break; } } if (nBackground == 1) sExtra2 = "cantkill"; if (nBackground == 2 || nBackground == 3 || nBackground == 5) sExtra2 = "cankill"; if (nBackground == 4) sExtra2 = "cantnotice"; if (nBackground == 1 || nBackground == 3) nEvil = TRUE; } //If "lost" is the mission if (sTemplate == "lost") { //Select background nBackground = Random(3)+1; //3 possible backgrounds //Check whether a plot twist applies if (nBackground == 2 && Random(10) == 0) nTwist = 2; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = 1; //Generate a commoner target if applicable nCommoner = TRUE; if (nBackground == 1 || nBackground == 3) sTargetLastName = sClientLastName; if (nBackground == 1) nTargetSkin = nClientSkin; //Generate an adventurer target if applicable and make modifications to it according to the background requirements // //Check whether any extra data should be saved and save it if (nBackground == 1) { switch (Random(2)) { case 0: sExtra = "lostbrother"; break; case 1: sExtra = "lostsister"; break; } } if (nBackground == 2) { switch (Random(2)) { case 0: sExtra = "lostmale"; break; case 1: sExtra = "lostfemale"; break; } } if (nBackground == 3) { if (GetGender(oClient) == GENDER_MALE) sExtra = "wife"; else sExtra = "husband"; } //Some more commoner target info if (sExtra == "husband" || sExtra == "lostmale" || sExtra == "lostbrother") sSex = "m"; else sSex = "f"; if (sExtra == "lostbrother" || sExtra == "lostsister") { switch (GetRacialType(oClient)) { case RACIAL_TYPE_DWARF: sRace = "dw"; break; case RACIAL_TYPE_HUMAN: sRace = "hu"; break; case RACIAL_TYPE_ELF: sRace = "el"; break; case RACIAL_TYPE_HALFELF: sRace = "he"; break; case RACIAL_TYPE_HALFLING: sRace = "ha"; break; case RACIAL_TYPE_HALFORC: sRace = "ho"; break; case RACIAL_TYPE_GNOME: sRace = "gn"; break; } } } //If "escort" is the mission if (sTemplate == "escort") { //Select background nBackground = Random(4)+1; //4 possible backgrounds //Check whether a plot twist applies if (nBackground != 3 && Random(10) == 0) nTwist = TRUE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = Random(2)+1; //Generate a commoner target if applicable // //Generate an adventurer target if applicable and make modifications to it according to the background requirements // //Check whether any extra data should be saved and save it if (nBackground == 1) { switch (Random(2)) { case 0: sExtra = "escortmale"; break; case 1: sExtra = "escortfemale"; break; } } if (nBackground == 3) nEvil = TRUE; } //If "ransom" is the mission if (sTemplate == "ransom") { //Select background nBackground = Random(4)+1; //4 possible backgrounds //Check whether a plot twist applies nTwist = FALSE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nBackground != 3 && nBackground != 4 && nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = 1; //Generate a commoner target if applicable nCommoner = TRUE; sTargetLastName = sClientLastName; if (nBackground == 1 || nBackground == 3) nTargetSkin = nClientSkin; //Generate an adventurer target if applicable and make modifications to it according to the background requirements GenerateFreshQuestNPC(oPC); //Check whether any extra data should be saved and save it if (nBackground == 1 || nBackground == 3) { switch (Random(2)) { case 0: sExtra = "kidnbrother"; break; case 1: sExtra = "kidnsister"; break; } } if (nBackground == 2 || nBackground == 4) { if (GetGender(oClient) == GENDER_MALE) sExtra = "kidnwife"; else sExtra = "kidnhusband"; } if (nBackground == 1 || nBackground == 2) { switch (Random(3)) { case 0: sExtra2 = "1000"; break; case 1: sExtra2 = "1500"; break; case 2: sExtra2 = "2000"; break; } } if (nBackground == 3 || nBackground == 4) { sItem = GenerateRandomItem(oPC); switch (Random(3)) { case 0: sExtra2 = "700"; break; case 1: sExtra2 = "1000"; break; case 2: sExtra2 = "1500"; break; } } //Some more commoner target info if (sExtra == "kidnhusband" || sExtra == "kidnbrother") sSex = "m"; else sSex = "f"; if (sExtra == "kidnbrother" || sExtra == "kidnsister") { switch (GetRacialType(oClient)) { case RACIAL_TYPE_DWARF: sRace = "dw"; break; case RACIAL_TYPE_HUMAN: sRace = "hu"; break; case RACIAL_TYPE_ELF: sRace = "el"; break; case RACIAL_TYPE_HALFELF: sRace = "he"; break; case RACIAL_TYPE_HALFLING: sRace = "ha"; break; case RACIAL_TYPE_HALFORC: sRace = "ho"; break; case RACIAL_TYPE_GNOME: sRace = "gn"; break; } } } //If "kidnap" is the mission if (sTemplate == "kidnap") { //Select background nBackground = Random(6)+1; //6 possible backgrounds //Check whether a plot twist applies if (nBackground != 1 && nBackground != 2 && nBackground != 3 && nBackground != 4 && Random(10) == 0) nTwist = TRUE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = 1; //Generate a commoner target if applicable // //Generate an adventurer target if applicable and make modifications to it according to the background requirements GenerateFreshQuestNPC(oPC); //Check whether any extra data should be saved and save it if (nBackground == 1) { switch (Random(4)) { case 0: sExtra = "kid"; break; case 1: sExtra = "brother"; break; case 2: sExtra = "sister"; break; case 3: sExtra = "all"; break; } } if (nBackground != 5 && nBackground != 6) nEvil = TRUE; } //If "monsters" is the mission if (sTemplate == "monsters") { //Select background nBackground = Random(5)+1; //5 possible backgrounds //Check whether a plot twist applies nTwist = FALSE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = 1; //Generate a commoner target if applicable // //Generate an adventurer target if applicable and make modifications to it according to the background requirements // //Check whether any extra data should be saved and save it // } //If "rescue" is the mission if (sTemplate == "rescue") { //Select background nBackground = Random(3)+1; //3 possible backgrounds //Check whether a plot twist applies nTwist = FALSE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = 1; //Generate a commoner target if applicable nCommoner = TRUE; if (nBackground == 1 || nBackground == 3) sTargetLastName = sClientLastName; if (nBackground == 1) nTargetSkin = nClientSkin; //Generate an adventurer target if applicable and make modifications to it according to the background requirements // //Check whether any extra data should be saved and save it switch (Random(5)) { case 0: sExtra2 = "forc"; break; case 1: sExtra2 = "fhobgoblin"; break; case 2: sExtra2 = "freptilian"; break; case 3: sExtra2 = "fdrow"; break; case 4: sExtra2 = "fduergar"; break; } if (nBackground == 1) { switch (Random(2)) { case 0: sExtra = "rescuesister"; break; case 1: sExtra = "rescuebrother"; break; } } if (nBackground == 2) { switch (Random(2)) { case 0: sExtra = "rescueffriend"; break; case 1: sExtra = "rescuemfriend"; break; } } if (nBackground == 3) { if (GetGender(oClient) == GENDER_MALE) sExtra = "rescuewife"; else sExtra = "rescuehusband"; } //Some more commoner target info if (sExtra == "rescuehusband" || sExtra == "rescuebrother" || sExtra == "rescuemfriend") sSex = "m"; else sSex = "f"; if (sExtra == "rescuebrother" || sExtra == "rescuesister") { switch (GetRacialType(oClient)) { case RACIAL_TYPE_DWARF: sRace = "dw"; break; case RACIAL_TYPE_HUMAN: sRace = "hu"; break; case RACIAL_TYPE_ELF: sRace = "el"; break; case RACIAL_TYPE_HALFELF: sRace = "he"; break; case RACIAL_TYPE_HALFLING: sRace = "ha"; break; case RACIAL_TYPE_HALFORC: sRace = "ho"; break; case RACIAL_TYPE_GNOME: sRace = "gn"; break; } } } //If "defend" or "conquer" is the mission if (sTemplate == "defend" || sTemplate == "conquer") { //Select background nBackground = Random(2)+1; //2 possible backgrounds //Check whether a plot twist applies nTwist = FALSE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = 1; //Generate a commoner target if applicable // //Check whether any extra data should be saved and save it if (nBackground == 1) { nEvil = TRUE; switch (Random(2)) { case 0: sExtra = "drow"; break; case 1: sExtra = "duergar"; break; } switch (Random(6)) { case 0: sExtra2 = "human"; break; case 1: sExtra2 = "elf"; break; case 2: sExtra2 = "dwarf"; break; case 3: sExtra2 = "orc"; break; case 4: sExtra2 = "reptilian"; break; case 5: sExtra2 = "hobgoblin"; break; } } if (nBackground == 2) { switch (Random(3)) { case 0: sExtra = "human"; break; case 1: sExtra = "elf"; break; case 2: sExtra = "dwarf"; break; } switch (Random(5)) { case 0: sExtra2 = "drow"; break; case 1: sExtra2 = "duergar"; break; case 2: sExtra2 = "orc"; break; case 3: sExtra2 = "reptilian"; break; case 4: sExtra2 = "hobgoblin"; break; } } } //If "infiltrate" is the mission if (sTemplate == "infiltrate") { //Select background nBackground = Random(2)+1; //2 possible backgrounds //Check whether a plot twist applies if (Random(10) == 0) nTwist = TRUE; //Check whether a lucky event applies if (nTwist == FALSE && Random(10) == 0) nLuck = TRUE; //Check whether a complication applies and select it if (nTwist == FALSE && nLuck == FALSE && Random(10) <= 3) nComplication = 1; //Generate a commoner target if applicable // //Check whether any extra data should be saved and save it if (nBackground == 1) { nEvil = TRUE; switch (Random(2)) { case 0: sExtra = "drow"; break; case 1: sExtra = "duergar"; break; } switch (Random(6)) { case 0: sExtra2 = "human"; break; case 1: sExtra2 = "elf"; break; case 2: sExtra2 = "dwarf"; break; case 3: sExtra2 = "orc"; break; case 4: sExtra2 = "reptilian"; break; case 5: sExtra2 = "hobgoblin"; break; } } if (nBackground == 2) { switch (Random(3)) { case 0: sExtra = "human"; break; case 1: sExtra = "elf"; break; case 2: sExtra = "dwarf"; break; } switch (Random(5)) { case 0: sExtra2 = "drow"; break; case 1: sExtra2 = "duergar"; break; case 2: sExtra2 = "orc"; break; case 3: sExtra2 = "reptilian"; break; case 4: sExtra2 = "hobgoblin"; break; } } } //Generate an adventurer target for "conquer" and "defend" missions if applicable and make modifications to it according to the background requirements if ((sTemplate == "defend" || sTemplate == "conquer") && (nLuck == TRUE || nComplication == 1)) { if (sExtra2 != "orc" && sExtra2 != "hobgoblin" && sExtra2 != "reptilian") GenerateFreshQuestNPC(oPC); if ((nLuck == TRUE && sExtra == "drow") || (nComplication == 1 && sExtra2 == "drow")) { SetCampaignString(sDB, "QUEST_NPC_RACE", "el"); SetCampaignInt(sDB, "QUEST_NPC_SKIN", 134); SetCampaignInt(sDB, "QUEST_NPC_GOODAXIS", ALIGNMENT_EVIL); } if ((nLuck == TRUE && sExtra == "duergar") || (nComplication == 1 && sExtra2 == "duergar")) { SetCampaignString(sDB, "QUEST_NPC_RACE", "dw"); SetCampaignInt(sDB, "QUEST_NPC_SKIN", 42); SetCampaignInt(sDB, "QUEST_NPC_GOODAXIS", ALIGNMENT_EVIL); } if ((nLuck == TRUE && sExtra == "human") || (nComplication == 1 && sExtra2 == "human")) { SetCampaignString(sDB, "QUEST_NPC_RACE", "hu"); SetCampaignInt(sDB, "QUEST_NPC_GOODAXIS", ALIGNMENT_GOOD); } if ((nLuck == TRUE && sExtra == "elf") || (nComplication == 1 && sExtra2 == "elf")) { SetCampaignString(sDB, "QUEST_NPC_RACE", "el"); SetCampaignInt(sDB, "QUEST_NPC_SKIN", 1); SetCampaignInt(sDB, "QUEST_NPC_GOODAXIS", ALIGNMENT_GOOD); } if ((nLuck == TRUE && sExtra == "dwarf") || (nComplication == 1 && sExtra2 == "dwarf")) { SetCampaignString(sDB, "QUEST_NPC_RACE", "dw"); SetCampaignInt(sDB, "QUEST_NPC_SKIN", 2); SetCampaignInt(sDB, "QUEST_NPC_GOODAXIS", ALIGNMENT_GOOD); } if (sExtra2 == "orc" || sExtra2 == "reptilian" || sExtra2 == "hobgoblin") { nLuck = FALSE; nComplication = 0; } } //50% chance of a plot twist being actually true if (nTwist == TRUE) nTwist = Random(2)+1; //Determine how much information about the quest's target is known to the inn-keepers and how much gold they will demand for it nIntel = Random(5); //0 - no intel, 1 - target's archetype, 2 - target's weakness, 3 - target's strength, 4 - target's 2nd strength if (nIntel != 0) nIntelCost = Random(3); //0 - free if (nIntelCost != 0) nIntelCost = Random(300)+100; //Generate a commoner target if they are needed if (sRace == "") { switch (Random(20)) { case 0: case 1: case 2: case 3: case 4: case 5: sRace = "hu"; break; // 6/20, 30% case 6: case 7: case 8: case 9: sRace = "el"; break; // 4/20, 20% case 10: case 11: case 12: case 13: sRace = "dw"; break; // 4/20, 20% case 14: case 15: sRace = "gn"; break; // 2/20, 10% case 16: case 17: sRace = "ha"; break; // 2/20, 10% case 18: sRace = "ho"; break; // 1/20, 5% case 19: sRace = "he"; break; // 1/20, 5% } } if (sSex == "") { switch (Random(2)) { case 0: sSex = "m"; break; case 1: sSex = "f"; break; } } sTargetRef = "anc_npc_"+sRace+"_"+sSex; sTargetName = GenerateNPCName(sSex, sRace); if (sTargetLastName == "") sTargetLastName = GenerateNPCLastName(sRace); switch (Random(9)) { case 0: sTargetCloth = "NW_CLOTH001"; break; case 1: sTargetCloth = "NW_CLOTH022"; break; case 2: sTargetCloth = "NW_CLOTH006"; break; case 3: sTargetCloth = "NW_CLOTH024"; break; case 4: sTargetCloth = "NW_CLOTH013"; break; case 5: sTargetCloth = "NW_CLOTH003"; break; case 6: sTargetCloth = "NW_CLOTH002"; break; case 7: sTargetCloth = "NW_CLOTH028"; break; case 8: sTargetCloth = "NW_CLOTH018"; break; } nTargetHead = d10(); switch(d6()) { case 1: nTargetHair = 11; break; case 2: nTargetHair = 2; break; case 3: nTargetHair = 135; break; case 4: nTargetHair = 16; break; case 5: nTargetHair = 7; break; case 6: nTargetHair = 15; break; } if (nTargetSkin == 0) { if ( sRace == "hu" ) { if ( Random(100) < 16) { nTargetSkin = 7; } else { nTargetSkin = 2; } } if ( sRace == "el" ) { if ( Random(100) < 10) { nTargetSkin = 134; } else { nTargetSkin = 1; } } if ( sRace == "dw" ) { if ( Random(100) < 10) { nTargetSkin = 42; } else { nTargetSkin = 2; } } } if (sRace == "he" || sRace == "el") nTargetPheno = 3; else nTargetPheno = 15; if (Random(100) < nTargetPheno) nTargetPheno = PHENOTYPE_BIG; else nTargetPheno = PHENOTYPE_NORMAL; //Set the reward switch (nLevel) { case 1: nReward = 1000; break; case 2: nReward = 1500; break; case 3: nReward = 2000; break; case 4: nReward = 2500; break; case 5: nReward = 2700; break; case 6: nReward = 2900; break; case 7: nReward = 3100; break; case 8: nReward = 3300; break; case 9: nReward = 3400; break; case 10: nReward = 3500; break; case 11: nReward = 3550; break; case 12: nReward = 3600; break; case 13: nReward = 3650; break; case 14: nReward = 3700; break; case 15: nReward = 3750; break; case 16: nReward = 3800; break; case 17: nReward = 3850; break; case 18: nReward = 3900; break; case 19: nReward = 3950; break; default: nReward = 4000; break; /*case 10: nReward = 3700; break; case 11: nReward = 3900; break; case 12: nReward = 4100; break; case 13: nReward = 4300; break; case 14: nReward = 4500; break; case 15: nReward = 4600; break; case 16: nReward = 4700; break; case 17: nReward = 4800; break; case 18: nReward = 4900; break; case 19: nReward = 5000; break; default: nReward = 5000; break;*/ } nReward = nReward/2 + (Random(100)+1)*nReward/100; string sModDB = GetLocalString(GetModule(), "DB"); //let's adjust the reward according to local economy if (GetCampaignInt(sModDB, sTown+"_ECONOMY") >= 7) nReward = 5*nReward/4; //120% if (GetCampaignInt(sModDB, sTown+"_ECONOMY") <= 3) nReward = 6*nReward/10; //60% if ((nBackground == 3 || nBackground == 4) && sTemplate == "ransom") nReward = 0; switch (nLevel) { case 1: nExp = 1000; break; case 2: nExp = 1000; break; case 3: nExp = 1000; break; case 4: nExp = 1000; break; case 5: nExp = 1000; break; case 6: nExp = 1200; break; case 7: nExp = 1400; break; case 8: nExp = 1600; break; case 9: nExp = 1800; break; case 10: nExp = 2000; break; case 11: nExp = 2200; break; case 12: nExp = 2400; break; case 13: nExp = 2600; break; case 14: nExp = 2800; break; case 15: nExp = 3000; break; case 16: nExp = 3200; break; case 17: nExp = 3400; break; case 18: nExp = 3600; break; case 19: nExp = 3800; break; case 20: nExp = 6700; break; case 21: nExp = 7000; break; case 22: nExp = 7400; break; case 23: nExp = 7700; break; case 24: nExp = 8000; break; case 25: nExp = 8400; break; case 26: nExp = 8700; break; case 27: nExp = 9000; break; case 28: nExp = 9400; break; case 29: nExp = 9700; break; case 30: nExp = 10000; break; case 31: nExp = 10400; break; case 32: nExp = 10700; break; case 33: nExp = 11000; break; case 34: nExp = 11400; break; case 35: nExp = 11700; break; case 36: nExp = 12000; break; case 37: nExp = 12400; break; case 38: nExp = 12700; break; case 39: nExp = 13000; break; case 40: nExp = 13000; break; } //An extra item as a reward should generate 3% of the time if (Random(100) <= 2) sItem = GenerateRandomItem(oPC); //Save all other quest data in the database SetCampaignInt(sDB, "QUEST_ACTIVE", 1); SetCampaignInt(sDB, "QUEST_EVIL", nEvil); SetCampaignInt(sDB, "QUEST_EXP", nExp); SetCampaignInt(sDB, "QUEST_TAVERN", nTavernNumber); SetCampaignString(sDB, "QUEST_REGION", sRegion); SetCampaignString(sDB, "QUEST_TEMPLATE", sTemplate); SetCampaignInt(sDB, "QUEST_BACKGROUND", nBackground); SetCampaignInt(sDB, "QUEST_TWIST", nTwist); SetCampaignInt(sDB, "QUEST_COMPLICATION", nComplication); SetCampaignInt(sDB, "QUEST_LUCK", nLuck); SetCampaignString(sDB, "QUEST_EXTRA", sExtra); SetCampaignString(sDB, "QUEST_EXTRA2", sExtra2); SetCampaignInt(sDB, "QUEST_REWARD", nReward); SetCampaignString(sDB, "QUEST_ITEM", sItem); SetCampaignString(sDB, "QUEST_CLI_RESREF", sClientRef); SetCampaignInt(sDB, "QUEST_CLI_HEAD", nClientHead); SetCampaignInt(sDB, "QUEST_CLI_PHENO", nClientPheno); SetCampaignInt(sDB, "QUEST_CLI_HAIR", nClientHair); SetCampaignInt(sDB, "QUEST_CLI_SKIN", nClientSkin); SetCampaignString(sDB, "QUEST_CLI_CLOTH", sClientCloth); SetCampaignString(sDB, "QUEST_CLI_NAME", sClientName); SetCampaignString(sDB, "QUEST_CLI_LASTNAME", sClientLastName); SetCampaignInt(sDB, "QUEST_CLI_LAW", nClientLaw); SetCampaignInt(sDB, "QUEST_CLI_GOOD", nClientGood); if (nCommoner == TRUE) { SetCampaignString(sDB, "QUEST_NP2_RESREF", sTargetRef); SetCampaignInt(sDB, "QUEST_NP2_HEAD", nTargetHead); SetCampaignInt(sDB, "QUEST_NP2_PHENO", nTargetPheno); SetCampaignInt(sDB, "QUEST_NP2_HAIR", nTargetHair); SetCampaignInt(sDB, "QUEST_NP2_SKIN", nTargetSkin); SetCampaignString(sDB, "QUEST_NP2_CLOTH", sTargetCloth); SetCampaignString(sDB, "QUEST_NP2_NAME", sTargetName); SetCampaignString(sDB, "QUEST_NP2_LASTNAME", sTargetLastName); } if (GetCampaignString(sDB, "QUEST_NPC_NAME") != "") { SetCampaignInt(sDB, "QUEST_INTEL", nIntel); SetCampaignInt(sDB, "QUEST_INTELCOST", nIntelCost); } } //Deletes all quest data of a PC void DeleteQuest(object oPC) { string sDB = CharacterDB(oPC); DeleteCampaignVariable(sDB, "QUEST_REGION"); DeleteCampaignVariable(sDB, "QUEST_EVIL"); DeleteCampaignVariable(sDB, "QUEST_ACTIVE"); DeleteCampaignVariable(sDB, "QUEST_EXP"); DeleteCampaignVariable(sDB, "QUEST_JOURNAL"); DeleteCampaignVariable(sDB, "QUEST_TAVERN"); DeleteCampaignVariable(sDB, "QUEST_COMPLETE"); DeleteCampaignVariable(sDB, "QUEST_TEMPLATE"); DeleteCampaignVariable(sDB, "QUEST_BACKGROUND"); DeleteCampaignVariable(sDB, "QUEST_TWIST"); DeleteCampaignVariable(sDB, "QUEST_COMPLICATION"); DeleteCampaignVariable(sDB, "QUEST_LUCK"); DeleteCampaignVariable(sDB, "QUEST_EXTRA"); DeleteCampaignVariable(sDB, "QUEST_EXTRA2"); DeleteCampaignVariable(sDB, "QUEST_REWARD"); DeleteCampaignVariable(sDB, "QUEST_ITEM"); DeleteCampaignVariable(sDB, "QUEST_CLI_RESREF"); DeleteCampaignVariable(sDB, "QUEST_CLI_HEAD"); DeleteCampaignVariable(sDB, "QUEST_CLI_PHENO"); DeleteCampaignVariable(sDB, "QUEST_CLI_HAIR"); DeleteCampaignVariable(sDB, "QUEST_CLI_SKIN"); DeleteCampaignVariable(sDB, "QUEST_CLI_CLOTH"); DeleteCampaignVariable(sDB, "QUEST_CLI_LAW"); DeleteCampaignVariable(sDB, "QUEST_CLI_GOOD"); DeleteCampaignVariable(sDB, "QUEST_CLI_NAME"); DeleteCampaignVariable(sDB, "QUEST_CLI_LASTNAME"); DeleteCampaignVariable(sDB, "QUEST_NP2_RESREF"); DeleteCampaignVariable(sDB, "QUEST_NP2_HEAD"); DeleteCampaignVariable(sDB, "QUEST_NP2_PHENO"); DeleteCampaignVariable(sDB, "QUEST_NP2_HAIR"); DeleteCampaignVariable(sDB, "QUEST_NP2_SKIN"); DeleteCampaignVariable(sDB, "QUEST_NP2_CLOTH"); DeleteCampaignVariable(sDB, "QUEST_NP2_NAME"); DeleteCampaignVariable(sDB, "QUEST_NP2_LASTNAME"); DeleteCampaignVariable(sDB, "QUEST_NPC_TYPE"); DeleteCampaignVariable(sDB, "QUEST_NPC_RACE"); DeleteCampaignVariable(sDB, "QUEST_NPC_SUBTYPE"); DeleteCampaignVariable(sDB, "QUEST_NPC_EQTYPE"); DeleteCampaignVariable(sDB, "QUEST_NPC_NAME"); DeleteCampaignVariable(sDB, "QUEST_NPC_LASTNAME"); DeleteCampaignVariable(sDB, "QUEST_NPC_SEX"); DeleteCampaignVariable(sDB, "QUEST_NPC_TRAIT1"); DeleteCampaignVariable(sDB, "QUEST_NPC_TRAIT2"); DeleteCampaignVariable(sDB, "QUEST_NPC_TRAIT3"); DeleteCampaignVariable(sDB, "QUEST_NPC_LAWAXIS"); DeleteCampaignVariable(sDB, "QUEST_NPC_GOODAXIS"); DeleteCampaignVariable(sDB, "QUEST_NPC_HEAD"); DeleteCampaignVariable(sDB, "QUEST_NPC_HAIR"); DeleteCampaignVariable(sDB, "QUEST_NPC_SKIN"); DeleteCampaignVariable(sDB, "QUEST_NPC_PHENO"); DeleteCampaignVariable(sDB, "QUEST_NPC_ATTITUDE"); DeleteCampaignVariable(sDB, "QUEST_NPC_VISCLOAK"); DeleteCampaignVariable(sDB, "QUEST_NPC_WEAPON"); DeleteCampaignVariable(sDB, "QUEST_NPC_OFFHAND"); DeleteCampaignVariable(sDB, "QUEST_NPC_VISHELM"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE1"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE2"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE3"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE4"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE5"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE6"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE7"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE8"); DeleteCampaignVariable(sDB, "QUEST_NPC_DAMAGE9"); DeleteCampaignVariable(sDB, "QUEST_INTEL"); DeleteCampaignVariable(sDB, "QUEST_INTELCOST"); } //This should be done just before the tokens are used void SetQuestTokens(object oPC) { string sDB = CharacterDB(oPC); string sToken = GetLocalString(oPC, "QuestToken"); string sRegion = GetCampaignString(sDB, "QUEST_REGION"); int nTavern = GetCampaignInt(sDB, "QUEST_TAVERN"); string sExtra = GetCampaignString(sDB, "QUEST_EXTRA"); string sExtra2 = GetCampaignString(sDB, "QUEST_EXTRA2"); string sNpcName = GetCampaignString(sDB, "QUEST_NPC_NAME"); string sNpcLastName = GetCampaignString(sDB, "QUEST_NPC_LASTNAME"); string sCliName = GetCampaignString(sDB, "QUEST_CLI_NAME"); string sCliLastName = GetCampaignString(sDB, "QUEST_CLI_LASTNAME"); string sNp2Name = GetCampaignString(sDB, "QUEST_NP2_NAME"); string sNp2LastName = GetCampaignString(sDB, "QUEST_NP2_LASTNAME"); SetCustomToken(10001, GetCampaignString(sDB, "QUEST_CLI_NAME")); SetCustomToken(StringToInt(IntToString(10001)+sToken), sCliName); SetCustomToken(10002, GetCampaignString(sDB, "QUEST_CLI_LASTNAME")); SetCustomToken(StringToInt(IntToString(10002)+sToken), sCliLastName); SetCustomToken(10003, sNpcName); SetCustomToken(StringToInt(IntToString(10003)+sToken), sNpcName); SetCustomToken(10004, sNpcLastName); SetCustomToken(StringToInt(IntToString(10004)+sToken), sNpcLastName); SetCustomToken(10015, sNp2Name); SetCustomToken(StringToInt(IntToString(10015)+sToken), sNp2Name); SetCustomToken(10016, sNp2LastName); SetCustomToken(StringToInt(IntToString(10016)+sToken), sNp2LastName); SetCustomToken(10020, IntToString(GetCampaignInt(sDB, "QUEST_INTELCOST"))); if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "ransom" && (GetCampaignInt(sDB, "QUEST_BACKGROUND") == 1 || GetCampaignInt(sDB, "QUEST_BACKGROUND") == 2)) { SetCustomToken(10018, "kompletny"); SetCustomToken(StringToInt(IntToString(10018)+sToken), "kompletny"); SetCustomToken(10019, "a complete"); SetCustomToken(StringToInt(IntToString(10019)+sToken), "a complete"); } if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "ransom" && (GetCampaignInt(sDB, "QUEST_BACKGROUND") == 3 || GetCampaignInt(sDB, "QUEST_BACKGROUND") == 4)) { SetCustomToken(10018, "niekompletny"); SetCustomToken(StringToInt(IntToString(10018)+sToken), "niekompletny"); SetCustomToken(10019, "an incomplete"); SetCustomToken(StringToInt(IntToString(10019)+sToken), "an incomplete"); } if (sRegion == "greencoast") { SetCustomToken(10005, "Zielone Wybrzeze"); SetCustomToken(StringToInt(IntToString(10005)+sToken), "Zielone Wybrzeze"); SetCustomToken(10006, "Green Coast"); SetCustomToken(StringToInt(IntToString(10006)+sToken), "Green Coast"); } string sQuestReward = IntToString(GetCampaignInt(sDB, "QUEST_REWARD")); SetCustomToken(10007, sQuestReward); SetCustomToken(StringToInt(IntToString(10007)+sToken), sQuestReward); if (nTavern == 1) { SetCustomToken(10008, "Alverton"); SetCustomToken(StringToInt(IntToString(10008)+sToken), "Alverton"); SetCustomToken(10009, "Alverton"); SetCustomToken(StringToInt(IntToString(10009)+sToken), "Alverton"); } SetCustomToken(10010, IntToString(11*GetCampaignInt(sDB, "QUEST_REWARD")/10)); if (sExtra == "sister") { SetCustomToken(10011, "Moja ukochana siostra"); SetCustomToken(10012, "My beloved sister"); } if (sExtra == "brother") { SetCustomToken(10011, "Moj brat"); SetCustomToken(10012, "My brother"); } if (sExtra == "kid") { SetCustomToken(10011, "Moje biedne dziecko"); SetCustomToken(10012, "My poor child"); } if (sExtra == "all") { SetCustomToken(10011, "Moja rodzina"); SetCustomToken(10012, "My whole family"); } if (sExtra == "murderer") { SetCustomToken(10011, "winnym wielokrotnego morderstwa"); SetCustomToken(10012, "who is guilty of numerous murders"); } if (sExtra == "bandit") { SetCustomToken(10011, "przewodzi zorganizowanej gildii bandytow"); SetCustomToken(10012, "who is the leader of an organized bandit guild"); } if (sExtra == "fugitive") { SetCustomToken(10011, "niedawno uciekl z pilnie strzezonego garnizonu"); SetCustomToken(10012, "who has recently escaped from a guarded garrison"); } if (sExtra == "male") { SetCustomToken(10011, "mojego drogiego przyjaciela"); SetCustomToken(10012, "him"); } if (sExtra == "female") { SetCustomToken(10011, "moja droga przyjaciolke"); SetCustomToken(10012, "her"); } if (sExtra == "cards") { SetCustomToken(10011, "karty"); SetCustomToken(10012, "cards"); } if (sExtra == "dice") { SetCustomToken(10011, "kosci"); SetCustomToken(10012, "dice"); } if (sExtra2 == "cankill") { SetCustomToken(10013, "Moge zabic swoj cel."); SetCustomToken(StringToInt(IntToString(10013)+sToken), "Moge zabic swoj cel."); SetCustomToken(10014, "I can also kill my target."); SetCustomToken(StringToInt(IntToString(10014)+sToken), "I can also kill my target."); } if (sExtra2 == "mustkill") { SetCustomToken(10013, "Po wykonaniu tego zadania musze zabic moj cel."); SetCustomToken(StringToInt(IntToString(10013)+sToken), "Po wykonaniu tego zadania musze zabic moj cel."); SetCustomToken(10014, "I have to kill my target once I complete this task."); SetCustomToken(StringToInt(IntToString(10014)+sToken), "I have to kill my target once I complete this task."); } if (sExtra2 == "cantkill") { SetCustomToken(10013, "Nie moge zabic swojego celu."); SetCustomToken(StringToInt(IntToString(10013)+sToken), "Nie moge zabic swojego celu."); SetCustomToken(10014, "I must not kill my target."); SetCustomToken(StringToInt(IntToString(10014)+sToken), "I must not kill my target."); } if (sExtra2 == "cantnotice") { SetCustomToken(10013, "Moj cel nie moze zginac, ani nawet zauwazyc, ze zostal okradziony."); SetCustomToken(StringToInt(IntToString(10013)+sToken), "Moj cel nie moze zginac, ani nawet zauwazyc, ze zostal okradziony."); SetCustomToken(10014, "My target must not die or even notice they've been robbed."); SetCustomToken(StringToInt(IntToString(10014)+sToken), "My target must not die or even notice they've been robbed."); } if (sExtra2 == "1000" || sExtra2 == "700" || sExtra2 == "1500" || sExtra2 == "2000") { SetCustomToken(10017, sExtra2); } if (sExtra == "stealring") { SetCustomToken(10011, "pierscien"); SetCustomToken(10012, "ring"); } if (sExtra == "stealamulet") { SetCustomToken(10011, "amulet"); SetCustomToken(10012, "amulet"); } if (sExtra == "stealsphere") { SetCustomToken(10011, "przedmiot przypominajacy kule energii"); SetCustomToken(10012, "item resembling a sphere of energy"); } if (sExtra == "stealhand") { SetCustomToken(10011, "przedmiot przypominajacy martwa dlon"); SetCustomToken(10012, "item resembling a dead hand"); } if (sExtra == "stealdisc") { SetCustomToken(10011, "przedmiot przypominajacy kamienny dysk"); SetCustomToken(10012, "item resembling a stone disc"); } if (sExtra == "lostbrother") { SetCustomToken(10011, "moim drogim bracie"); SetCustomToken(10012, "my dear brother"); } if (sExtra == "lostsister") { SetCustomToken(10011, "mojej drogiej siostrze"); SetCustomToken(10012, "my dear sister"); } if (sExtra == "lostmale") { SetCustomToken(10011, "moj dobry przyjaciel"); SetCustomToken(10012, "him"); } if (sExtra == "lostfemale") { SetCustomToken(10011, "moja dobra przyjaciolka"); SetCustomToken(10012, "her"); } if (sExtra == "husband") { SetCustomToken(10011, "moj ukochany maz"); SetCustomToken(10012, "my beloved husband"); } if (sExtra == "wife") { SetCustomToken(10011, "moja ukochana zona"); SetCustomToken(10012, "my beloved wife"); } if (sExtra == "escortmale") { SetCustomToken(10011, "Moj przyjaciel"); SetCustomToken(10012, "he"); } if (sExtra == "escortfemale") { SetCustomToken(10011, "Moja przyjaciolka"); SetCustomToken(10012, "she"); } if (sExtra == "kidnbrother") { SetCustomToken(10011, "moj brat"); SetCustomToken(10012, "my brother"); } if (sExtra == "kidnsister") { SetCustomToken(10011, "moja siostra"); SetCustomToken(10012, "my sister"); } if (sExtra == "kidnhusband") { SetCustomToken(10011, "mojego drogiego meza"); SetCustomToken(10012, "my dear husband"); } if (sExtra == "kidnwife") { SetCustomToken(10011, "moja droga zone"); SetCustomToken(10012, "my dear wife"); } if (sExtra == "rescuewife") { SetCustomToken(10011, "Moja zona zostala porwana"); SetCustomToken(10012, "My wife has been kidnapped"); } if (sExtra == "rescuehusband") { SetCustomToken(10011, "Moj maz zostal porwany"); SetCustomToken(10012, "My husband has been kidnapped"); } if (sExtra == "rescuebrother") { SetCustomToken(10011, "Moj brat zostal porwany"); SetCustomToken(10012, "My brother has been kidnapped"); } if (sExtra == "rescuesister") { SetCustomToken(10011, "Moja siostra zostala porwana"); SetCustomToken(10012, "My sister has been kidnapped"); } if (sExtra == "rescuemfriend") { SetCustomToken(10011, "Moj przyjaciel zostal porwany"); SetCustomToken(10012, "My friend has been kidnapped"); } if (sExtra == "rescueffriend") { SetCustomToken(10011, "Moja przyjaciolka zostala porwana"); SetCustomToken(10012, "My friend has been kidnapped"); } if (sExtra2 == "forc") { SetCustomToken(10013, "orkow"); SetCustomToken(10014, "orcs"); } if (sExtra2 == "fhobgoblin") { SetCustomToken(10013, "orkliny"); SetCustomToken(10014, "bugbears"); } if (sExtra2 == "freptilian") { SetCustomToken(10013, "jaszczuroludzi"); SetCustomToken(10014, "reptilians"); } if (sExtra2 == "fdrow") { SetCustomToken(10013, "drowy"); SetCustomToken(10014, "drows"); } if (sExtra2 == "fduergar") { SetCustomToken(10013, "duergarow"); SetCustomToken(10014, "duergars"); } if (sExtra == "drow") { SetCustomToken(10011, "drowy"); SetCustomToken(10012, "drows"); } if (sExtra == "duergar") { SetCustomToken(10011, "duergary"); SetCustomToken(10012, "duergars"); } if (sExtra == "human") { SetCustomToken(10011, "ludzie"); SetCustomToken(10012, "humans"); } if (sExtra == "elf") { SetCustomToken(10011, "elfy"); SetCustomToken(10012, "elves"); } if (sExtra == "dwarf") { SetCustomToken(10011, "krasnoludy"); SetCustomToken(10012, "dwarves"); } if (sExtra2 == "drow") { SetCustomToken(10013, "drowy"); SetCustomToken(10014, "drows"); } if (sExtra2 == "duergar") { SetCustomToken(10013, "duergary"); SetCustomToken(10014, "duergars"); } if (sExtra2 == "human") { SetCustomToken(10013, "ludzie"); SetCustomToken(10014, "humans"); } if (sExtra2 == "elf") { SetCustomToken(10013, "elfy"); SetCustomToken(10014, "elves"); } if (sExtra2 == "dwarf") { SetCustomToken(10013, "krasnoludy"); SetCustomToken(10014, "dwarves"); } if (sExtra2 == "orc") { SetCustomToken(10013, "orkowie"); SetCustomToken(10014, "orcs"); } if (sExtra2 == "hobgoblin") { SetCustomToken(10013, "orkliny"); SetCustomToken(10014, "bugbears"); } if (sExtra2 == "reptilian") { SetCustomToken(10013, "jaszczuroludzie"); SetCustomToken(10014, "reptilians"); } } //Set intel tokens (used in inn-keepers' conversations) void SetIntelTokens(object oPC) { string sDB = CharacterDB(oPC); string sNpcName = GetCampaignString(sDB, "QUEST_NPC_NAME"); string sNpcLastName = GetCampaignString(sDB, "QUEST_NPC_LASTNAME"); //This part serves to set tokens used in the inn-keeper's conversation regarding intel string sType = GetCampaignString(sDB, "QUEST_NPC_TYPE"); string sNpcTypePL; string sNpcTypeENG; string sWeakness = GetCampaignString(sDB, "QUEST_NPC_TRAIT3"); string sStrength1 = GetCampaignString(sDB, "QUEST_NPC_TRAIT1"); string sStrength2 = GetCampaignString(sDB, "QUEST_NPC_TRAIT2"); int nDamage1 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE1"); int nDamage2 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE2"); int nDamage3 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE3"); int nDamage4 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE4"); int nDamage5 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE5"); int nDamage6 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE6"); int nDamage7 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE7"); int nDamage8 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE8"); int nDamage9 = GetCampaignInt(sDB, "QUEST_NPC_DAMAGE9"); if (sType == "fight") { sNpcTypePL = "wojownik"; sNpcTypeENG = "warrior"; } if (sType == "mage") { sNpcTypePL = "mag"; sNpcTypeENG = "mage"; } if (sType == "monk") { sNpcTypePL = "mnich"; sNpcTypeENG = "monk"; } if (sType == "rogue") { sNpcTypePL = "lotrzyk"; sNpcTypeENG = "rogue"; } if (sType == "arche") { sNpcTypePL = "strzelec"; sNpcTypeENG = "archer"; } if (sType == "cleric") { sNpcTypePL = "kaplan"; sNpcTypeENG = "cleric"; } string sDamage1PL; string sDamage2PL; string sDamage3PL; string sDamage1ENG; string sDamage2ENG; string sDamage3ENG; string sDamage4PL; string sDamage5PL; string sDamage6PL; string sDamage4ENG; string sDamage5ENG; string sDamage6ENG; string sDamage7PL; string sDamage8PL; string sDamage9PL; string sDamage7ENG; string sDamage8ENG; string sDamage9ENG; switch (nDamage1) { case DAMAGE_TYPE_FIRE: sDamage1PL = "ogniste"; sDamage1ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage1PL = "od zimna"; sDamage1ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage1PL = "kwasowe"; sDamage1ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage1PL = "elektryczne"; sDamage1ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage1PL = "boskie"; sDamage1ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage1PL = "od negatywnej energii"; sDamage1ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage1PL = "magiczne"; sDamage1ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage1PL = "dzwiekowe"; sDamage1ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage1PL = "ciete"; sDamage1ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage1PL = "obuchowe"; sDamage1ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage1PL = "klute"; sDamage1ENG = "piercing"; break; } switch (nDamage2) { case DAMAGE_TYPE_FIRE: sDamage2PL = "ogniste"; sDamage2ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage2PL = "od zimna"; sDamage2ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage2PL = "kwasowe"; sDamage2ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage2PL = "elektryczne"; sDamage2ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage2PL = "boskie"; sDamage2ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage2PL = "od negatywnej energii"; sDamage2ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage2PL = "magiczne"; sDamage2ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage2PL = "dzwiekowe"; sDamage2ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage2PL = "ciete"; sDamage2ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage2PL = "obuchowe"; sDamage2ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage2PL = "klute"; sDamage2ENG = "piercing"; break; } switch (nDamage3) { case DAMAGE_TYPE_FIRE: sDamage3PL = "ogniste"; sDamage3ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage3PL = "od zimna"; sDamage3ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage3PL = "kwasowe"; sDamage3ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage3PL = "elektryczne"; sDamage3ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage3PL = "boskie"; sDamage3ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage3PL = "od negatywnej energii"; sDamage3ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage3PL = "magiczne"; sDamage3ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage3PL = "dzwiekowe"; sDamage3ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage3PL = "ciete"; sDamage3ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage3PL = "obuchowe"; sDamage3ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage3PL = "klute"; sDamage3ENG = "piercing"; break; } switch (nDamage4) { case DAMAGE_TYPE_FIRE: sDamage4PL = "ogniste"; sDamage4ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage4PL = "od zimna"; sDamage4ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage4PL = "kwasowe"; sDamage4ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage4PL = "elektryczne"; sDamage4ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage4PL = "boskie"; sDamage4ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage4PL = "od negatywnej energii"; sDamage4ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage4PL = "magiczne"; sDamage4ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage4PL = "dzwiekowe"; sDamage4ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage4PL = "ciete"; sDamage4ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage4PL = "obuchowe"; sDamage4ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage4PL = "klute"; sDamage4ENG = "piercing"; break; } switch (nDamage5) { case DAMAGE_TYPE_FIRE: sDamage5PL = "ogniste"; sDamage5ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage5PL = "od zimna"; sDamage5ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage5PL = "kwasowe"; sDamage5ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage5PL = "elektryczne"; sDamage5ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage5PL = "boskie"; sDamage5ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage5PL = "od negatywnej energii"; sDamage5ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage5PL = "magiczne"; sDamage5ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage5PL = "dzwiekowe"; sDamage5ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage5PL = "ciete"; sDamage5ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage5PL = "obuchowe"; sDamage5ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage5PL = "klute"; sDamage5ENG = "piercing"; break; } switch (nDamage6) { case DAMAGE_TYPE_FIRE: sDamage6PL = "ogniste"; sDamage6ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage6PL = "od zimna"; sDamage6ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage6PL = "kwasowe"; sDamage6ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage6PL = "elektryczne"; sDamage6ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage6PL = "boskie"; sDamage6ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage6PL = "od negatywnej energii"; sDamage6ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage6PL = "magiczne"; sDamage6ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage6PL = "dzwiekowe"; sDamage6ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage6PL = "ciete"; sDamage6ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage6PL = "obuchowe"; sDamage6ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage6PL = "klute"; sDamage6ENG = "piercing"; break; } switch (nDamage7) { case DAMAGE_TYPE_FIRE: sDamage7PL = "ogniste"; sDamage7ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage7PL = "od zimna"; sDamage7ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage7PL = "kwasowe"; sDamage7ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage7PL = "elektryczne"; sDamage7ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage7PL = "boskie"; sDamage7ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage7PL = "od negatywnej energii"; sDamage7ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage7PL = "magiczne"; sDamage7ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage7PL = "dzwiekowe"; sDamage7ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage7PL = "ciete"; sDamage7ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage7PL = "obuchowe"; sDamage7ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage7PL = "klute"; sDamage7ENG = "piercing"; break; } switch (nDamage8) { case DAMAGE_TYPE_FIRE: sDamage8PL = "ogniste"; sDamage8ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage8PL = "od zimna"; sDamage8ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage8PL = "kwasowe"; sDamage8ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage8PL = "elektryczne"; sDamage8ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage8PL = "boskie"; sDamage8ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage8PL = "od negatywnej energii"; sDamage8ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage8PL = "magiczne"; sDamage8ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage8PL = "dzwiekowe"; sDamage8ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage8PL = "ciete"; sDamage8ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage8PL = "obuchowe"; sDamage8ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage8PL = "klute"; sDamage8ENG = "piercing"; break; } switch (nDamage9) { case DAMAGE_TYPE_FIRE: sDamage9PL = "ogniste"; sDamage9ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage9PL = "od zimna"; sDamage9ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage9PL = "kwasowe"; sDamage9ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage9PL = "elektryczne"; sDamage9ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage9PL = "boskie"; sDamage9ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage9PL = "od negatywnej energii"; sDamage9ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage9PL = "magiczne"; sDamage9ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage9PL = "dzwiekowe"; sDamage9ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage9PL = "ciete"; sDamage9ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage9PL = "obuchowe"; sDamage9ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage9PL = "klute"; sDamage9ENG = "piercing"; break; } string sNpcWeakPL; string sNpcWeakENG; if (sWeakness == "saves") { sNpcWeakPL = "wola, wytrzymalosc oraz refleks tej osoby sa na dosc niskim poziomie."; sNpcWeakENG = "their will, fortitude and reflexes stand at a fairly low level."; } if (sWeakness == "armor") { sNpcWeakPL = "nie radzi sobie dobrze z unikaniem ciosow, dzieki czemu latwo daje sie trafic w walce wrecz."; sNpcWeakENG = "they are not very good at dodging blows, which makes them easy to hit in melee combat."; } if (sWeakness == "skills") { sNpcWeakPL = "nie ma talentu do trenowania rozmaitych umiejetnosci, przez co stoja one na dosc niskim poziomie."; sNpcWeakENG = "they have no talent for skills. As such, they stand at a fairly low level."; } if (sWeakness == "immunity") { sNpcWeakPL = "podobno cechuje sie wrazliwoscia na nastepujace rodzaje obrazen: " + sDamage7PL + ", " + sDamage8PL + " oraz " + sDamage9PL + "."; sNpcWeakENG = "rumors say they are vulnerable to the following types of damage: " + sDamage7ENG + ", " + sDamage8ENG + " and " + sDamage9ENG + "."; } string sNpcStr1PL; string sNpcStr1ENG; if (sStrength1 == "saves") { sNpcStr1PL = "slynie ze swojej silnej woli, dobrej wytrzymalosci i znakomitego refleksu."; sNpcStr1ENG = "they are known for their strong will, great fortitude and exceptional reflexes."; } if (sStrength1 == "armor") { sNpcStr1PL = "znakomicie wykonuje uniki przed ciosami i nie daje sie latwo trafic."; sNpcStr1ENG = "they are very good at dodging blows, so it's difficult to land a hit."; } if (sStrength1 == "mind") { sNpcStr1PL = "ludzie mowia, ze cechuje sie niewrazliwoscia na magie dzialajaca na umysl."; sNpcStr1ENG = "people say they are immune to all mind-affecting magic."; } if (sStrength1 == "critical") { sNpcStr1PL = "podobno moze sie pochwalic niewrazliwoscia na ciosy krytyczne."; sNpcStr1ENG = "I've heard that they are immune to critical hits."; } if (sStrength1 == "skills") { sNpcStr1PL = "osoba ta jest znakomicie wyszkolona w wielu umiejetnosciach."; sNpcStr1ENG = "they are very well trained in various skills."; } if (sStrength1 == "regen") { sNpcStr1PL = "wszystkie rany, ktore zostana tej osobie zadane, bardzo szybko sie zasklepia."; sNpcStr1ENG = "all wounds dealt to them will heal very quickly."; } if (sStrength1 == "attack") { sNpcStr1PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr1ENG = "they are very precise, which makes them hit their enemies accurately."; } if (sStrength1 == "damage") { sNpcStr1PL = "jest w stanie zadawac wyjatkowo duze obrazenia."; sNpcStr1ENG = "they are capable of inflicting extraordinary damage to their enemies."; } if (sStrength1 == "immunity") { sNpcStr1PL = "powiadaja, ze cechuje sie czesciowa niewrazliwoscia na nastepujace rodzaje obrazen: " + sDamage1PL + ", " + sDamage2PL + " oraz " + sDamage3PL + "."; sNpcStr1ENG = "rumors say that they are partially immune to the following types of damage: " + sDamage1ENG + ", " + sDamage2ENG + " and " + sDamage3ENG + "."; } string sNpcStr2PL; string sNpcStr2ENG; if (sStrength2 == "saves") { sNpcStr2PL = "slynie ze swojej silnej woli, dobrej wytrzymalosci i znakomitego refleksu."; sNpcStr2ENG = "they are known for their strong will, great fortitude and exceptional reflexes."; } if (sStrength2 == "armor") { sNpcStr2PL = "znakomicie wykonuje uniki przed ciosami i nie daje sie latwo trafic."; sNpcStr2ENG = "they are very good at dodging blows, so it's difficult to land a hit."; } if (sStrength2 == "mind") { sNpcStr2PL = "ludzie mowia, ze cechuje sie niewrazliwoscia na magie dzialajaca na umysl."; sNpcStr2ENG = "people say they are immune to all mind-affecting magic."; } if (sStrength2 == "critical") { sNpcStr2PL = "podobno moze sie pochwalic niewrazliwoscia na ciosy krytyczne."; sNpcStr2ENG = "I've heard that they are immune to critical hits."; } if (sStrength2 == "skills") { sNpcStr2PL = "osoba ta jest znakomicie wyszkolona w wielu umiejetnosciach."; sNpcStr2ENG = "they are very well trained in various skills."; } if (sStrength2 == "regen") { sNpcStr2PL = "wszystkie rany, ktore zostana tej osobie zadane, bardzo szybko sie zasklepia."; sNpcStr2ENG = "all wounds dealt to them will heal very quickly."; } if (sStrength2 == "attack") { sNpcStr2PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr2ENG = "they are very precise, which makes them hit their enemies accurately."; } if (sStrength2 == "damage") { sNpcStr2PL = "jest w stanie zadawac dotkliwsze obrazenia niz mogloby sie wydawac."; sNpcStr2ENG = "they are capable of inflicting extraordinary damage to their enemies."; } if (sStrength2 == "immunity") { sNpcStr2PL = "powiadaja, ze cechuje sie czesciowa niewrazliwoscia na nastepujace rodzaje obrazen: " + sDamage4PL + ", " + sDamage5PL + " oraz " + sDamage6PL + "."; sNpcStr2ENG = "rumors say that they are partially immune to the following types of damage: " + sDamage4ENG + ", " + sDamage5ENG + " and " + sDamage6ENG + "."; } SetCustomToken(10021, "Niestety nie wiem za wiele. " + sNpcName + " to dobry " + sNpcTypePL + ", lecz innych informacji nie posiadam."); SetCustomToken(10022, "Unfortunately, I don't know much. " + sNpcName + " is a good " + sNpcTypeENG + ", but I don't have any other information."); SetCustomToken(10023, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " To wszystko co wiem."); SetCustomToken(10024, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " That's all I know."); SetCustomToken(10025, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " Wiem jednak rowniez o mocnej stronie tego awanturnika: " + sNpcStr1PL + " To wszystko co wiem."); SetCustomToken(10026, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " However, I also know about their strong point: " + sNpcStr1ENG + " That's all I know."); SetCustomToken(10027, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " Wiem jednak rowniez o mocnych stronach tego awanturnika: " + sNpcStr1PL + " Ponadto " + sNpcStr2PL); SetCustomToken(10028, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " However, I also know about their strong points: " + sNpcStr1ENG + " What's more, " + sNpcStr2ENG); } //Set intel tokens about one of the stored NPCs (used in inn-keepers' conversations) void SetStoredIntelTokens(object oPC, int nPosition) { string sDB = CharacterDB(oPC); string sPosition = IntToString(nPosition); string sNpcName = GetCampaignString(sDB, sPosition+"_NPC_NAME"); string sNpcLastName = GetCampaignString(sDB, sPosition+"_NPC_LASTNAME"); //This part serves to set tokens used in the inn-keeper's conversation regarding intel string sType = GetCampaignString(sDB, sPosition+"_NPC_TYPE"); string sNpcTypePL; string sNpcTypeENG; string sIntelCost = IntToString(GetCampaignInt(sDB, sPosition+"_NPC_INTELCOST")); string sWeakness = GetCampaignString(sDB, sPosition+"_NPC_TRAIT3"); string sStrength1 = GetCampaignString(sDB, sPosition+"_NPC_TRAIT1"); string sStrength2 = GetCampaignString(sDB, sPosition+"_NPC_TRAIT2"); int nDamage1 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE1"); int nDamage2 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE2"); int nDamage3 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE3"); int nDamage4 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE4"); int nDamage5 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE5"); int nDamage6 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE6"); int nDamage7 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE7"); int nDamage8 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE8"); int nDamage9 = GetCampaignInt(sDB, sPosition+"_NPC_DAMAGE9"); if (sType == "fight") { sNpcTypePL = "wojownik"; sNpcTypeENG = "warrior"; } if (sType == "mage") { sNpcTypePL = "mag"; sNpcTypeENG = "mage"; } if (sType == "monk") { sNpcTypePL = "mnich"; sNpcTypeENG = "monk"; } if (sType == "rogue") { sNpcTypePL = "lotrzyk"; sNpcTypeENG = "rogue"; } if (sType == "arche") { sNpcTypePL = "strzelec"; sNpcTypeENG = "archer"; } if (sType == "cleric") { sNpcTypePL = "kaplan"; sNpcTypeENG = "cleric"; } string sDamage1PL; string sDamage2PL; string sDamage3PL; string sDamage1ENG; string sDamage2ENG; string sDamage3ENG; string sDamage4PL; string sDamage5PL; string sDamage6PL; string sDamage4ENG; string sDamage5ENG; string sDamage6ENG; string sDamage7PL; string sDamage8PL; string sDamage9PL; string sDamage7ENG; string sDamage8ENG; string sDamage9ENG; switch (nDamage1) { case DAMAGE_TYPE_FIRE: sDamage1PL = "ogniste"; sDamage1ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage1PL = "od zimna"; sDamage1ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage1PL = "kwasowe"; sDamage1ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage1PL = "elektryczne"; sDamage1ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage1PL = "boskie"; sDamage1ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage1PL = "od negatywnej energii"; sDamage1ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage1PL = "magiczne"; sDamage1ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage1PL = "dzwiekowe"; sDamage1ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage1PL = "ciete"; sDamage1ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage1PL = "obuchowe"; sDamage1ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage1PL = "klute"; sDamage1ENG = "piercing"; break; } switch (nDamage2) { case DAMAGE_TYPE_FIRE: sDamage2PL = "ogniste"; sDamage2ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage2PL = "od zimna"; sDamage2ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage2PL = "kwasowe"; sDamage2ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage2PL = "elektryczne"; sDamage2ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage2PL = "boskie"; sDamage2ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage2PL = "od negatywnej energii"; sDamage2ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage2PL = "magiczne"; sDamage2ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage2PL = "dzwiekowe"; sDamage2ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage2PL = "ciete"; sDamage2ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage2PL = "obuchowe"; sDamage2ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage2PL = "klute"; sDamage2ENG = "piercing"; break; } switch (nDamage3) { case DAMAGE_TYPE_FIRE: sDamage3PL = "ogniste"; sDamage3ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage3PL = "od zimna"; sDamage3ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage3PL = "kwasowe"; sDamage3ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage3PL = "elektryczne"; sDamage3ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage3PL = "boskie"; sDamage3ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage3PL = "od negatywnej energii"; sDamage3ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage3PL = "magiczne"; sDamage3ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage3PL = "dzwiekowe"; sDamage3ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage3PL = "ciete"; sDamage3ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage3PL = "obuchowe"; sDamage3ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage3PL = "klute"; sDamage3ENG = "piercing"; break; } switch (nDamage4) { case DAMAGE_TYPE_FIRE: sDamage4PL = "ogniste"; sDamage4ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage4PL = "od zimna"; sDamage4ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage4PL = "kwasowe"; sDamage4ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage4PL = "elektryczne"; sDamage4ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage4PL = "boskie"; sDamage4ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage4PL = "od negatywnej energii"; sDamage4ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage4PL = "magiczne"; sDamage4ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage4PL = "dzwiekowe"; sDamage4ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage4PL = "ciete"; sDamage4ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage4PL = "obuchowe"; sDamage4ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage4PL = "klute"; sDamage4ENG = "piercing"; break; } switch (nDamage5) { case DAMAGE_TYPE_FIRE: sDamage5PL = "ogniste"; sDamage5ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage5PL = "od zimna"; sDamage5ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage5PL = "kwasowe"; sDamage5ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage5PL = "elektryczne"; sDamage5ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage5PL = "boskie"; sDamage5ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage5PL = "od negatywnej energii"; sDamage5ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage5PL = "magiczne"; sDamage5ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage5PL = "dzwiekowe"; sDamage5ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage5PL = "ciete"; sDamage5ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage5PL = "obuchowe"; sDamage5ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage5PL = "klute"; sDamage5ENG = "piercing"; break; } switch (nDamage6) { case DAMAGE_TYPE_FIRE: sDamage6PL = "ogniste"; sDamage6ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage6PL = "od zimna"; sDamage6ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage6PL = "kwasowe"; sDamage6ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage6PL = "elektryczne"; sDamage6ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage6PL = "boskie"; sDamage6ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage6PL = "od negatywnej energii"; sDamage6ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage6PL = "magiczne"; sDamage6ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage6PL = "dzwiekowe"; sDamage6ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage6PL = "ciete"; sDamage6ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage6PL = "obuchowe"; sDamage6ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage6PL = "klute"; sDamage6ENG = "piercing"; break; } switch (nDamage7) { case DAMAGE_TYPE_FIRE: sDamage7PL = "ogniste"; sDamage7ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage7PL = "od zimna"; sDamage7ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage7PL = "kwasowe"; sDamage7ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage7PL = "elektryczne"; sDamage7ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage7PL = "boskie"; sDamage7ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage7PL = "od negatywnej energii"; sDamage7ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage7PL = "magiczne"; sDamage7ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage7PL = "dzwiekowe"; sDamage7ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage7PL = "ciete"; sDamage7ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage7PL = "obuchowe"; sDamage7ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage7PL = "klute"; sDamage7ENG = "piercing"; break; } switch (nDamage8) { case DAMAGE_TYPE_FIRE: sDamage8PL = "ogniste"; sDamage8ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage8PL = "od zimna"; sDamage8ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage8PL = "kwasowe"; sDamage8ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage8PL = "elektryczne"; sDamage8ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage8PL = "boskie"; sDamage8ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage8PL = "od negatywnej energii"; sDamage8ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage8PL = "magiczne"; sDamage8ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage8PL = "dzwiekowe"; sDamage8ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage8PL = "ciete"; sDamage8ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage8PL = "obuchowe"; sDamage8ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage8PL = "klute"; sDamage8ENG = "piercing"; break; } switch (nDamage9) { case DAMAGE_TYPE_FIRE: sDamage9PL = "ogniste"; sDamage9ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage9PL = "od zimna"; sDamage9ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage9PL = "kwasowe"; sDamage9ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage9PL = "elektryczne"; sDamage9ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage9PL = "boskie"; sDamage9ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage9PL = "od negatywnej energii"; sDamage9ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage9PL = "magiczne"; sDamage9ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage9PL = "dzwiekowe"; sDamage9ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage9PL = "ciete"; sDamage9ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage9PL = "obuchowe"; sDamage9ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage9PL = "klute"; sDamage9ENG = "piercing"; break; } string sNpcWeakPL; string sNpcWeakENG; if (sWeakness == "saves") { sNpcWeakPL = "wola, wytrzymalosc oraz refleks tej osoby sa na dosc niskim poziomie."; sNpcWeakENG = "their will, fortitude and reflexes stand at a fairly low level."; } if (sWeakness == "armor") { sNpcWeakPL = "nie radzi sobie dobrze z unikaniem ciosow, dzieki czemu latwo daje sie trafic w walce wrecz."; sNpcWeakENG = "they are not very good at dodging blows, which makes them easy to hit in melee combat."; } if (sWeakness == "skills") { sNpcWeakPL = "nie ma talentu do trenowania rozmaitych umiejetnosci, przez co stoja one na dosc niskim poziomie."; sNpcWeakENG = "they have no talent for skills. As such, they stand at a fairly low level."; } if (sWeakness == "immunity") { sNpcWeakPL = "podobno cechuje sie wrazliwoscia na nastepujace rodzaje obrazen: " + sDamage7PL + ", " + sDamage8PL + " oraz " + sDamage9PL + "."; sNpcWeakENG = "rumors say they are vulnerable to the following types of damage: " + sDamage7ENG + ", " + sDamage8ENG + " and " + sDamage9ENG + "."; } string sNpcStr1PL; string sNpcStr1ENG; if (sStrength1 == "saves") { sNpcStr1PL = "slynie ze swojej silnej woli, dobrej wytrzymalosci i znakomitego refleksu."; sNpcStr1ENG = "they are known for their strong will, great fortitude and exceptional reflexes."; } if (sStrength1 == "armor") { sNpcStr1PL = "znakomicie wykonuje uniki przed ciosami i nie daje sie latwo trafic."; sNpcStr1ENG = "they are very good at dodging blows, so it's difficult to land a hit."; } if (sStrength1 == "mind") { sNpcStr1PL = "ludzie mowia, ze cechuje sie niewrazliwoscia na magie dzialajaca na umysl."; sNpcStr1ENG = "people say they are immune to all mind-affecting magic."; } if (sStrength1 == "critical") { sNpcStr1PL = "podobno moze sie pochwalic niewrazliwoscia na ciosy krytyczne."; sNpcStr1ENG = "I've heard that they are immune to critical hits."; } if (sStrength1 == "skills") { sNpcStr1PL = "osoba ta jest znakomicie wyszkolona w wielu umiejetnosciach."; sNpcStr1ENG = "they are very well trained in various skills."; } if (sStrength1 == "regen") { sNpcStr1PL = "wszystkie rany, ktore zostana tej osobie zadane, bardzo szybko sie zasklepia."; sNpcStr1ENG = "all wounds dealt to them will heal very quickly."; } if (sStrength1 == "attack") { sNpcStr1PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr1ENG = "they are very precise, which makes them hit their enemies accurately."; } if (sStrength1 == "damage") { sNpcStr1PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr1ENG = "they are very precise, which allows them to hit their enemies with great accuracy."; } if (sStrength1 == "immunity") { sNpcStr1PL = "powiadaja, ze cechuje sie czesciowa niewrazliwoscia na nastepujace rodzaje obrazen: " + sDamage1PL + ", " + sDamage2PL + " oraz " + sDamage3PL + "."; sNpcStr1ENG = "rumors say that they are partially immune to the following types of damage: " + sDamage1ENG + ", " + sDamage2ENG + " and " + sDamage3ENG + "."; } string sNpcStr2PL; string sNpcStr2ENG; if (sStrength2 == "saves") { sNpcStr2PL = "slynie ze swojej silnej woli, dobrej wytrzymalosci i znakomitego refleksu."; sNpcStr2ENG = "they are known for their strong will, great fortitude and exceptional reflexes."; } if (sStrength2 == "armor") { sNpcStr2PL = "znakomicie wykonuje uniki przed ciosami i nie daje sie latwo trafic."; sNpcStr2ENG = "they are very good at dodging blows, so it's difficult to land a hit."; } if (sStrength2 == "mind") { sNpcStr2PL = "ludzie mowia, ze cechuje sie niewrazliwoscia na magie dzialajaca na umysl."; sNpcStr2ENG = "people say they are immune to all mind-affecting magic."; } if (sStrength2 == "critical") { sNpcStr2PL = "podobno moze sie pochwalic niewrazliwoscia na ciosy krytyczne."; sNpcStr2ENG = "I've heard that they are immune to critical hits."; } if (sStrength2 == "skills") { sNpcStr2PL = "osoba ta jest znakomicie wyszkolona w wielu umiejetnosciach."; sNpcStr2ENG = "they are very well trained in various skills."; } if (sStrength2 == "regen") { sNpcStr2PL = "wszystkie rany, ktore zostana tej osobie zadane, bardzo szybko sie zasklepia."; sNpcStr2ENG = "all wounds dealt to them will heal very quickly."; } if (sStrength2 == "attack") { sNpcStr2PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr2ENG = "they are very precise, which makes them hit their enemies accurately."; } if (sStrength2 == "damage") { sNpcStr2PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr2ENG = "they are very precise, which allows them to hit their enemies with great accuracy."; } if (sStrength2 == "immunity") { sNpcStr2PL = "powiadaja, ze cechuje sie czesciowa niewrazliwoscia na nastepujace rodzaje obrazen: " + sDamage1PL + ", " + sDamage2PL + " oraz " + sDamage3PL + "."; sNpcStr2ENG = "rumors say that they are partially immune to the following types of damage: " + sDamage1ENG + ", " + sDamage2ENG + " and " + sDamage3ENG + "."; } SetCustomToken(10003, sNpcName); SetCustomToken(10004, sNpcLastName); SetCustomToken(10020, sIntelCost); SetCustomToken(10021, "Niestety nie wiem za wiele. " + sNpcName + " to dobry " + sNpcTypePL + ", lecz innych informacji nie posiadam."); SetCustomToken(10022, "Unfortunately, I don't know much. " + sNpcName + " is a good " + sNpcTypeENG + ", but I don't have any other information."); SetCustomToken(10023, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " To wszystko co wiem."); SetCustomToken(10024, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " That's all I know."); SetCustomToken(10025, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " Wiem jednak rowniez o mocnej stronie tego awanturnika: " + sNpcStr1PL + " To wszystko co wiem."); SetCustomToken(10026, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " However, I also know about their strong point: " + sNpcStr1ENG + " That's all I know."); SetCustomToken(10027, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " Wiem jednak rowniez o mocnych stronach tego awanturnika: " + sNpcStr1PL + " Ponadto " + sNpcStr2PL); SetCustomToken(10028, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " However, I also know about their strong points: " + sNpcStr1ENG + " What's more, " + sNpcStr2ENG); } //Set tokens used in gaining intel about famous NPC adventurers void SetAdventurerTokens(object oPC, int nPosition) { string sPosition = IntToString(nPosition); string sDB = GetLocalString(GetModule(), "DB"); string sNpcName = GetCampaignString(sDB, sPosition+"_ADV_NAME"); string sNpcLastName = GetCampaignString(sDB, sPosition+"_ADV_LASTNAME"); //This part serves to set tokens used in the inn-keeper's conversation regarding intel string sType = GetCampaignString(sDB, sPosition+"_ADV_TYPE"); string sNpcTypePL; string sNpcTypeENG; string sIntelCost = IntToString(GetCampaignInt(sDB, sPosition+"_ADV_INTELCOST")); string sWeakness = GetCampaignString(sDB, sPosition+"_ADV_TRAIT3"); string sStrength1 = GetCampaignString(sDB, sPosition+"_ADV_TRAIT1"); string sStrength2 = GetCampaignString(sDB, sPosition+"_ADV_TRAIT2"); int nDamage1 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE1"); int nDamage2 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE2"); int nDamage3 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE3"); int nDamage4 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE4"); int nDamage5 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE5"); int nDamage6 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE6"); int nDamage7 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE7"); int nDamage8 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE8"); int nDamage9 = GetCampaignInt(sDB, sPosition+"_ADV_DAMAGE9"); if (sType == "fight") { sNpcTypePL = "wojownik"; sNpcTypeENG = "warrior"; } if (sType == "mage") { sNpcTypePL = "mag"; sNpcTypeENG = "mage"; } if (sType == "monk") { sNpcTypePL = "mnich"; sNpcTypeENG = "monk"; } if (sType == "rogue") { sNpcTypePL = "lotrzyk"; sNpcTypeENG = "rogue"; } if (sType == "arche") { sNpcTypePL = "strzelec"; sNpcTypeENG = "archer"; } if (sType == "cleric") { sNpcTypePL = "kaplan"; sNpcTypeENG = "cleric"; } string sDamage1PL; string sDamage2PL; string sDamage3PL; string sDamage1ENG; string sDamage2ENG; string sDamage3ENG; string sDamage4PL; string sDamage5PL; string sDamage6PL; string sDamage4ENG; string sDamage5ENG; string sDamage6ENG; string sDamage7PL; string sDamage8PL; string sDamage9PL; string sDamage7ENG; string sDamage8ENG; string sDamage9ENG; switch (nDamage1) { case DAMAGE_TYPE_FIRE: sDamage1PL = "ogniste"; sDamage1ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage1PL = "od zimna"; sDamage1ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage1PL = "kwasowe"; sDamage1ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage1PL = "elektryczne"; sDamage1ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage1PL = "boskie"; sDamage1ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage1PL = "od negatywnej energii"; sDamage1ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage1PL = "magiczne"; sDamage1ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage1PL = "dzwiekowe"; sDamage1ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage1PL = "ciete"; sDamage1ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage1PL = "obuchowe"; sDamage1ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage1PL = "klute"; sDamage1ENG = "piercing"; break; } switch (nDamage2) { case DAMAGE_TYPE_FIRE: sDamage2PL = "ogniste"; sDamage2ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage2PL = "od zimna"; sDamage2ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage2PL = "kwasowe"; sDamage2ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage2PL = "elektryczne"; sDamage2ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage2PL = "boskie"; sDamage2ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage2PL = "od negatywnej energii"; sDamage2ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage2PL = "magiczne"; sDamage2ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage2PL = "dzwiekowe"; sDamage2ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage2PL = "ciete"; sDamage2ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage2PL = "obuchowe"; sDamage2ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage2PL = "klute"; sDamage2ENG = "piercing"; break; } switch (nDamage3) { case DAMAGE_TYPE_FIRE: sDamage3PL = "ogniste"; sDamage3ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage3PL = "od zimna"; sDamage3ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage3PL = "kwasowe"; sDamage3ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage3PL = "elektryczne"; sDamage3ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage3PL = "boskie"; sDamage3ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage3PL = "od negatywnej energii"; sDamage3ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage3PL = "magiczne"; sDamage3ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage3PL = "dzwiekowe"; sDamage3ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage3PL = "ciete"; sDamage3ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage3PL = "obuchowe"; sDamage3ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage3PL = "klute"; sDamage3ENG = "piercing"; break; } switch (nDamage4) { case DAMAGE_TYPE_FIRE: sDamage4PL = "ogniste"; sDamage4ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage4PL = "od zimna"; sDamage4ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage4PL = "kwasowe"; sDamage4ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage4PL = "elektryczne"; sDamage4ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage4PL = "boskie"; sDamage4ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage4PL = "od negatywnej energii"; sDamage4ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage4PL = "magiczne"; sDamage4ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage4PL = "dzwiekowe"; sDamage4ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage4PL = "ciete"; sDamage4ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage4PL = "obuchowe"; sDamage4ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage4PL = "klute"; sDamage4ENG = "piercing"; break; } switch (nDamage5) { case DAMAGE_TYPE_FIRE: sDamage5PL = "ogniste"; sDamage5ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage5PL = "od zimna"; sDamage5ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage5PL = "kwasowe"; sDamage5ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage5PL = "elektryczne"; sDamage5ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage5PL = "boskie"; sDamage5ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage5PL = "od negatywnej energii"; sDamage5ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage5PL = "magiczne"; sDamage5ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage5PL = "dzwiekowe"; sDamage5ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage5PL = "ciete"; sDamage5ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage5PL = "obuchowe"; sDamage5ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage5PL = "klute"; sDamage5ENG = "piercing"; break; } switch (nDamage6) { case DAMAGE_TYPE_FIRE: sDamage6PL = "ogniste"; sDamage6ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage6PL = "od zimna"; sDamage6ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage6PL = "kwasowe"; sDamage6ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage6PL = "elektryczne"; sDamage6ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage6PL = "boskie"; sDamage6ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage6PL = "od negatywnej energii"; sDamage6ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage6PL = "magiczne"; sDamage6ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage6PL = "dzwiekowe"; sDamage6ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage6PL = "ciete"; sDamage6ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage6PL = "obuchowe"; sDamage6ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage6PL = "klute"; sDamage6ENG = "piercing"; break; } switch (nDamage7) { case DAMAGE_TYPE_FIRE: sDamage7PL = "ogniste"; sDamage7ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage7PL = "od zimna"; sDamage7ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage7PL = "kwasowe"; sDamage7ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage7PL = "elektryczne"; sDamage7ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage7PL = "boskie"; sDamage7ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage7PL = "od negatywnej energii"; sDamage7ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage7PL = "magiczne"; sDamage7ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage7PL = "dzwiekowe"; sDamage7ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage7PL = "ciete"; sDamage7ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage7PL = "obuchowe"; sDamage7ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage7PL = "klute"; sDamage7ENG = "piercing"; break; } switch (nDamage8) { case DAMAGE_TYPE_FIRE: sDamage8PL = "ogniste"; sDamage8ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage8PL = "od zimna"; sDamage8ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage8PL = "kwasowe"; sDamage8ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage8PL = "elektryczne"; sDamage8ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage8PL = "boskie"; sDamage8ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage8PL = "od negatywnej energii"; sDamage8ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage8PL = "magiczne"; sDamage8ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage8PL = "dzwiekowe"; sDamage8ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage8PL = "ciete"; sDamage8ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage8PL = "obuchowe"; sDamage8ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage8PL = "klute"; sDamage8ENG = "piercing"; break; } switch (nDamage9) { case DAMAGE_TYPE_FIRE: sDamage9PL = "ogniste"; sDamage9ENG = "fire"; break; case DAMAGE_TYPE_COLD: sDamage9PL = "od zimna"; sDamage9ENG = "cold"; break; case DAMAGE_TYPE_ACID: sDamage9PL = "kwasowe"; sDamage9ENG = "acid"; break; case DAMAGE_TYPE_ELECTRICAL: sDamage9PL = "elektryczne"; sDamage9ENG = "electrical"; break; case DAMAGE_TYPE_DIVINE: sDamage9PL = "boskie"; sDamage9ENG = "divine"; break; case DAMAGE_TYPE_NEGATIVE: sDamage9PL = "od negatywnej energii"; sDamage9ENG = "negative"; break; case DAMAGE_TYPE_MAGICAL: sDamage9PL = "magiczne"; sDamage9ENG = "magical"; break; case DAMAGE_TYPE_SONIC: sDamage9PL = "dzwiekowe"; sDamage9ENG = "sonic"; break; case DAMAGE_TYPE_SLASHING: sDamage9PL = "ciete"; sDamage9ENG = "slashing"; break; case DAMAGE_TYPE_BLUDGEONING: sDamage9PL = "obuchowe"; sDamage9ENG = "bludgeoning"; break; case DAMAGE_TYPE_PIERCING: sDamage9PL = "klute"; sDamage9ENG = "piercing"; break; } string sNpcWeakPL; string sNpcWeakENG; if (sWeakness == "saves") { sNpcWeakPL = "wola, wytrzymalosc oraz refleks tej osoby sa na dosc niskim poziomie."; sNpcWeakENG = "their will, fortitude and reflexes stand at a fairly low level."; } if (sWeakness == "armor") { sNpcWeakPL = "nie radzi sobie dobrze z unikaniem ciosow, dzieki czemu latwo daje sie trafic w walce wrecz."; sNpcWeakENG = "they are not very good at dodging blows, which makes them easy to hit in melee combat."; } if (sWeakness == "skills") { sNpcWeakPL = "nie ma talentu do trenowania rozmaitych umiejetnosci, przez co stoja one na dosc niskim poziomie."; sNpcWeakENG = "they have no talent for skills. As such, they stand at a fairly low level."; } if (sWeakness == "immunity") { sNpcWeakPL = "podobno cechuje sie wrazliwoscia na nastepujace rodzaje obrazen: " + sDamage7PL + ", " + sDamage8PL + " oraz " + sDamage9PL + "."; sNpcWeakENG = "rumors say they are vulnerable to the following types of damage: " + sDamage7ENG + ", " + sDamage8ENG + " and " + sDamage9ENG + "."; } string sNpcStr1PL; string sNpcStr1ENG; if (sStrength1 == "saves") { sNpcStr1PL = "slynie ze swojej silnej woli, dobrej wytrzymalosci i znakomitego refleksu."; sNpcStr1ENG = "they are known for their strong will, great fortitude and exceptional reflexes."; } if (sStrength1 == "armor") { sNpcStr1PL = "znakomicie wykonuje uniki przed ciosami i nie daje sie latwo trafic."; sNpcStr1ENG = "they are very good at dodging blows, so it's difficult to land a hit."; } if (sStrength1 == "mind") { sNpcStr1PL = "ludzie mowia, ze cechuje sie niewrazliwoscia na magie dzialajaca na umysl."; sNpcStr1ENG = "people say they are immune to all mind-affecting magic."; } if (sStrength1 == "critical") { sNpcStr1PL = "podobno moze sie pochwalic niewrazliwoscia na ciosy krytyczne."; sNpcStr1ENG = "I've heard that they are immune to critical hits."; } if (sStrength1 == "skills") { sNpcStr1PL = "osoba ta jest znakomicie wyszkolona w wielu umiejetnosciach."; sNpcStr1ENG = "they are very well trained in various skills."; } if (sStrength1 == "regen") { sNpcStr1PL = "wszystkie rany, ktore zostana tej osobie zadane, bardzo szybko sie zasklepia."; sNpcStr1ENG = "all wounds dealt to them will heal very quickly."; } if (sStrength1 == "attack") { sNpcStr1PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr1ENG = "they are very precise, which makes them hit their enemies accurately."; } if (sStrength1 == "damage") { sNpcStr1PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr1ENG = "they are very precise, which allows them to hit their enemies with great accuracy."; } if (sStrength1 == "immunity") { sNpcStr1PL = "powiadaja, ze cechuje sie czesciowa niewrazliwoscia na nastepujace rodzaje obrazen: " + sDamage1PL + ", " + sDamage2PL + " oraz " + sDamage3PL + "."; sNpcStr1ENG = "rumors say that they are partially immune to the following types of damage: " + sDamage1ENG + ", " + sDamage2ENG + " and " + sDamage3ENG + "."; } string sNpcStr2PL; string sNpcStr2ENG; if (sStrength2 == "saves") { sNpcStr2PL = "slynie ze swojej silnej woli, dobrej wytrzymalosci i znakomitego refleksu."; sNpcStr2ENG = "they are known for their strong will, great fortitude and exceptional reflexes."; } if (sStrength2 == "armor") { sNpcStr2PL = "znakomicie wykonuje uniki przed ciosami i nie daje sie latwo trafic."; sNpcStr2ENG = "they are very good at dodging blows, so it's difficult to land a hit."; } if (sStrength2 == "mind") { sNpcStr2PL = "ludzie mowia, ze cechuje sie niewrazliwoscia na magie dzialajaca na umysl."; sNpcStr2ENG = "people say they are immune to all mind-affecting magic."; } if (sStrength2 == "critical") { sNpcStr2PL = "podobno moze sie pochwalic niewrazliwoscia na ciosy krytyczne."; sNpcStr2ENG = "I've heard that they are immune to critical hits."; } if (sStrength2 == "skills") { sNpcStr2PL = "osoba ta jest znakomicie wyszkolona w wielu umiejetnosciach."; sNpcStr2ENG = "they are very well trained in various skills."; } if (sStrength2 == "regen") { sNpcStr2PL = "wszystkie rany, ktore zostana tej osobie zadane, bardzo szybko sie zasklepia."; sNpcStr2ENG = "all wounds dealt to them will heal very quickly."; } if (sStrength2 == "attack") { sNpcStr2PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr2ENG = "they are very precise, which makes them hit their enemies accurately."; } if (sStrength2 == "damage") { sNpcStr2PL = "cechuje sie dobra precyzja, dzieki czemu zazwyczaj trafia atakami tam, gdzie chce."; sNpcStr2ENG = "they are very precise, which allows them to hit their enemies with great accuracy."; } if (sStrength2 == "immunity") { sNpcStr2PL = "powiadaja, ze cechuje sie czesciowa niewrazliwoscia na nastepujace rodzaje obrazen: " + sDamage1PL + ", " + sDamage2PL + " oraz " + sDamage3PL + "."; sNpcStr2ENG = "rumors say that they are partially immune to the following types of damage: " + sDamage1ENG + ", " + sDamage2ENG + " and " + sDamage3ENG + "."; } SetCustomToken(10020, sIntelCost); SetCustomToken(10021, "Niestety nie wiem za wiele. " + sNpcName + " to dobry " + sNpcTypePL + ", lecz innych informacji nie posiadam."); SetCustomToken(10022, "Unfortunately, I don't know much. " + sNpcName + " is a good " + sNpcTypeENG + ", but I don't have any other information."); SetCustomToken(10023, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " To wszystko co wiem."); SetCustomToken(10024, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " That's all I know."); SetCustomToken(10025, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " Wiem jednak rowniez o mocnej stronie tego awanturnika: " + sNpcStr1PL + " To wszystko co wiem."); SetCustomToken(10026, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " However, I also know about their strong point: " + sNpcStr1ENG + " That's all I know."); SetCustomToken(10027, sNpcName + " to dobry " + sNpcTypePL + ", lecz ma pewna wade: " + sNpcWeakPL + " Wiem jednak rowniez o mocnych stronach tego awanturnika: " + sNpcStr1PL + " Ponadto " + sNpcStr2PL); SetCustomToken(10028, sNpcName + " is a good " + sNpcTypeENG + ", but I know about their weakness: " + sNpcWeakENG + " However, I also know about their strong points: " + sNpcStr1ENG + " What's more, " + sNpcStr2ENG); } //Get PC and module's difficulty adjusted difficulty class for role-playing skills checks int GetAdjustedSkillDC(object oPC) { int nDC = GetHitDice(oPC); if (nDC < 20) nDC = 10+nDC/2; string sDatabase = GetLocalString(GetModule(), "DB"); string sDCommu = GetCampaignString(sDatabase, "difficulty_commu"); //commoner, adventurer, hero, legend, demigod if (sDCommu == "COMMONER") nDC = nDC - 5; if (sDCommu == "HERO") nDC = nDC + 5; if (sDCommu == "LEGEND") nDC = nDC + 10; if (sDCommu == "DEMIGOD") nDC = nDC + 15; return nDC; } //Add a quest journal entry for a PC void AddRandomQuestJournalEntry(object oPC, int nProgression=1) { string sDB = CharacterDB(oPC); string sToken = GetLocalString(oPC, "QuestToken"); SetQuestTokens(oPC); if (nProgression != 1) DeleteLocalObject(oPC, "oEscorted"); string sQuest = GetCampaignString(sDB, "QUEST_TEMPLATE"); int nIndex; if (sQuest == "kill") nIndex = 100 + nProgression; if (sQuest == "interrogate") nIndex = 200 + nProgression; if (sQuest == "item") nIndex = 300 + nProgression; if (sQuest == "lost") nIndex = 400 + nProgression; if (sQuest == "escort") nIndex = 500 + nProgression; if (sQuest == "ransom") nIndex = 600 + nProgression; if (sQuest == "kidnap") nIndex = 700 + nProgression; if (sQuest == "monsters") nIndex = 800 + nProgression; if (sQuest == "rescue") nIndex = 900 + nProgression; if (sQuest == "defend") nIndex = 110 + nProgression; if (sQuest == "conquer") nIndex = 120 + nProgression; if (sQuest == "infiltrate") nIndex = 130 + nProgression; AddJournalQuestEntry("random_quest"+sToken, nIndex, oPC, FALSE, FALSE); SetCampaignInt(sDB, "QUEST_JOURNAL", nIndex); } //Check if the quest is complete int GetIsQuestComplete(object oPC) { string sDB = CharacterDB(oPC); int nIndex = GetCampaignInt(sDB, "QUEST_JOURNAL"); if (nIndex == 102 || nIndex == 202 || nIndex == 302 || nIndex == 402 || nIndex == 502 || nIndex == 602 || nIndex == 702 || nIndex == 802 || nIndex == 902 || nIndex == 112 || nIndex == 122 || nIndex == 132) return TRUE; else return FALSE; } //Check if the quest is failed int GetIsQuestFailed(object oPC) { string sDB = CharacterDB(oPC); int nIndex = GetCampaignInt(sDB, "QUEST_JOURNAL"); if (nIndex == 103 || nIndex == 203 || nIndex == 303 || nIndex == 403 || nIndex == 503 || nIndex == 603 || nIndex == 703 || nIndex == 803 || nIndex == 903 || nIndex == 113 || nIndex == 123 || nIndex == 133) return TRUE; else return FALSE; } void SetClientAppearance(int nHair, int nSkin, int nPheno, int nHead, object oClient) { SetColor(oClient, COLOR_CHANNEL_HAIR, nHair); SetColor(oClient, COLOR_CHANNEL_SKIN, nSkin); SetPhenoType(nPheno, oClient); SetCreatureBodyPart(CREATURE_PART_HEAD, nHead, oClient); } object SpawnLost(object oPC, location lLocation) { //Get DB string sDB = CharacterDB(oPC); //Get NPC data string sResRef = GetCampaignString(sDB, "QUEST_NP2_RESREF"); int nHead = GetCampaignInt(sDB, "QUEST_NP2_HEAD"); int nPheno = GetCampaignInt(sDB, "QUEST_NP2_PHENO"); int nHair = GetCampaignInt(sDB, "QUEST_NP2_HAIR"); int nSkin = GetCampaignInt(sDB, "QUEST_NP2_SKIN"); string sCloth = GetCampaignString(sDB, "QUEST_NP2_CLOTH"); int nLaw = GetCampaignInt(sDB, "QUEST_NP2_LAW"); int nGood = GetCampaignInt(sDB, "QUEST_NP2_GOOD"); string sName = GetCampaignString(sDB, "QUEST_NP2_NAME"); string sLastName = GetCampaignString(sDB, "QUEST_NP2_LASTNAME"); //Spawn the NPC object oClient = CreateObject(OBJECT_TYPE_CREATURE, sResRef, lLocation); //Set NPC's name and last name SetName(oClient, sName+" "+sLastName); SetLocalString(oClient, "sName", sName); SetLocalString(oClient, "sLastName", sLastName); //Restore NPC's appearance and alignment DelayCommand(0.3, SetClientAppearance(nHair, nSkin, nPheno, nHead, oClient)); AdjustAlignment(oClient, ALIGNMENT_CHAOTIC, 100, FALSE); AdjustAlignment(oClient, ALIGNMENT_EVIL, 100, FALSE); AdjustAlignment(oClient, ALIGNMENT_LAWFUL, nLaw, FALSE); AdjustAlignment(oClient, ALIGNMENT_GOOD, nGood, FALSE); object oCloth = CreateItemOnObject(sCloth, oClient); AssignCommand(oClient, ActionEquipItem(oCloth, INVENTORY_SLOT_CHEST)); //Mark the NPC as lost SetLocalInt(oClient, "LostQuest", TRUE); SetLocalInt(oClient, "Escorted", FALSE); //SetLocalInt(oClient, "Client", TRUE); //Store the PC on the NPC SetLocalObject(oClient, "oPC", oPC); //Make NPC's eq undroppable object oItem = GetFirstItemInInventory(oClient); SetDroppableFlag(oItem, TRUE); oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oClient); SetDroppableFlag(oItem, TRUE); //Level-up int nLevel; if (GetHitDice(oPC) > 25) nLevel = GetHitDice(oPC) - 5; else nLevel = GetHitDice(oPC); LevelHenchmanUpTo(oClient, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oClient), PACKAGE_INVALID); return oClient; } object SpawnKidnapped(object oPC, location lLocation) { //Get DB string sDB = CharacterDB(oPC); //Get NPC data string sResRef = GetCampaignString(sDB, "QUEST_NP2_RESREF"); int nHead = GetCampaignInt(sDB, "QUEST_NP2_HEAD"); int nPheno = GetCampaignInt(sDB, "QUEST_NP2_PHENO"); int nHair = GetCampaignInt(sDB, "QUEST_NP2_HAIR"); int nSkin = GetCampaignInt(sDB, "QUEST_NP2_SKIN"); string sCloth = GetCampaignString(sDB, "QUEST_NP2_CLOTH"); int nLaw = GetCampaignInt(sDB, "QUEST_NP2_LAW"); int nGood = GetCampaignInt(sDB, "QUEST_NP2_GOOD"); string sName = GetCampaignString(sDB, "QUEST_NP2_NAME"); string sLastName = GetCampaignString(sDB, "QUEST_NP2_LASTNAME"); //Spawn the NPC object oKidnapped = CreateObject(OBJECT_TYPE_CREATURE, sResRef, lLocation); //Set NPC's name and last name SetName(oKidnapped, sName+" "+sLastName); SetLocalString(oKidnapped, "sName", sName); SetLocalString(oKidnapped, "sLastName", sLastName); //Restore NPC's appearance and alignment DelayCommand(0.3, SetClientAppearance(nHair, nSkin, nPheno, nHead, oKidnapped)); AdjustAlignment(oKidnapped, ALIGNMENT_CHAOTIC, 100, FALSE); AdjustAlignment(oKidnapped, ALIGNMENT_EVIL, 100, FALSE); AdjustAlignment(oKidnapped, ALIGNMENT_LAWFUL, nLaw, FALSE); AdjustAlignment(oKidnapped, ALIGNMENT_GOOD, nGood, FALSE); object oCloth = CreateItemOnObject(sCloth, oKidnapped); AssignCommand(oKidnapped, ActionEquipItem(oCloth, INVENTORY_SLOT_CHEST)); //Mark the NPC as a ransom target SetLocalInt(oKidnapped, "RansomQuest", TRUE); //SetLocalInt(oClient, "Client", TRUE); //Store the PC on the NPC SetLocalObject(oKidnapped, "oPC", oPC); //Make NPC's eq undroppable object oItem = GetFirstItemInInventory(oKidnapped); SetDroppableFlag(oItem, TRUE); oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oKidnapped); SetDroppableFlag(oItem, TRUE); return oKidnapped; } //Spawn quest NPCs in an area identified by a given area string void SpawnQuest(object oPC, string sAreaString) { string sDB = CharacterDB(oPC); if (GetCampaignInt(sDB, "QUEST_ACTIVE") == FALSE) return; //no quest spawned if the given PC does not have a quest! //Declaring variables object oNPC; object oMob1; object oMob2; object oWaypoint; location lLocation; string sRace; int nBonus; //Quest types 1, 2, 3 & 7 - kill, interrogate, item & kidnap if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "kill" || GetCampaignString(sDB, "QUEST_TEMPLATE") == "interrogate" || GetCampaignString(sDB, "QUEST_TEMPLATE") == "item" || GetCampaignString(sDB, "QUEST_TEMPLATE") == "kidnap") { oWaypoint = GetWaypointByTag("event_wp_"+sAreaString+"_1"); lLocation = GetLocation(oWaypoint); oNPC = SpawnFreshQuestNPC(oPC, lLocation); SetPlotFlag(oNPC, TRUE); SetLocalInt(oNPC, "Quest_Target", TRUE); //boost the NPC if the PC is in a party int nPartyCount = 0; object oMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oMember)) { nPartyCount++; //include henchmen in the count object oAssociate = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oMember, 1); int k; for (k = 2; GetIsObjectValid(oAssociate); k++) { if (GetLocalInt(oAssociate, "HenchPosition") > 0) nPartyCount++; oAssociate = GetAssociate(ASSOCIATE_TYPE_HENCHMAN, oMember, k); } oMember = GetNextFactionMember(oPC, TRUE); } nPartyCount--; if (nPartyCount > 0) { effect eBoost = EffectTemporaryHitpoints(nPartyCount*6*GetMaxHitPoints(oNPC)/5); eBoost = EffectLinkEffects(eBoost, EffectSavingThrowIncrease(SAVING_THROW_ALL, nPartyCount*2)); eBoost = SupernaturalEffect(eBoost); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBoost, oNPC); } //if the NPC is a target of a kidnap quest if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "kidnap") { SetLocalInt(oNPC, "KidnapTarget", TRUE); } //If the NPC is supposed to have guards if (GetCampaignInt(sDB, "QUEST_COMPLICATION") == 1 && GetHitDice(oPC) >= 5) { sRace = GetCampaignString(sDB, "QUEST_NPC_RACE"); oWaypoint = GetWaypointByTag("event_wp_"+sAreaString+"_2"); lLocation = GetLocation(oWaypoint); oMob1 = CreateObject(OBJECT_TYPE_CREATURE, "quest_bguard_"+sRace, lLocation); SetPlotFlag(oMob1, TRUE); oWaypoint = GetWaypointByTag("event_wp_"+sAreaString+"_3"); lLocation = GetLocation(oWaypoint); oMob2 = CreateObject(OBJECT_TYPE_CREATURE, "quest_bguard_"+sRace, lLocation); SetPlotFlag(oMob2, TRUE); LevelHenchmanUpTo(oMob1, GetHitDice(oPC)-3, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oMob1), PACKAGE_INVALID); LevelHenchmanUpTo(oMob2, GetHitDice(oPC)-3, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oMob2), PACKAGE_INVALID); switch (GetHitDice(oPC)-25) { case 1: case 2: nBonus = 1; break; case 3: case 4: nBonus = 2; break; case 5: nBonus = 3; break; case 6: case 7: nBonus = 4; break; case 8: case 9: nBonus = 5; break; case 10: nBonus = 6; break; case 11: case 12: nBonus = 7; break; case 13: case 14: nBonus = 8; break; case 15: nBonus = 9; break; default: nBonus = 0; } if (nBonus != 0) { ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAttackIncrease(nBonus), oMob1); ApplyEffectToObject(DURATION_TYPE_PERMANENT, EffectAttackIncrease(nBonus), oMob2); } } } //Quest type 4 - lost if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "lost") { oWaypoint = GetWaypointByTag("event_wp_"+sAreaString+"_1"); lLocation = GetLocation(oWaypoint); oNPC = SpawnLost(oPC, lLocation); SetPlotFlag(oNPC, FALSE); //SetLocalInt(oNPC, "Quest_Target", TRUE); if (GetCampaignInt(sDB, "QUEST_COMPLICATION") == 1) { int nLevel = GetHitDice(oPC); int nNumber = 2; if (nLevel >= 26 && nLevel <= 33) nNumber = 3; if (nLevel == 34 || nLevel == 35) nNumber = 4; if (nLevel == 36 || nLevel == 37) nNumber = 5; if (nLevel > 37) nNumber = 6; int i = 1; string sWpNum = "2"; object oBandit; string sResRef; string sRegionString = GetStringLeft(sAreaString, 1); //Race should depend on the region sResRef = "anc_roadbandit_h"; while (i <= nNumber) { oWaypoint = GetWaypointByTag("event_wp_"+sAreaString+"_"+sWpNum); lLocation = GetLocation(oWaypoint); oBandit = CreateObject(OBJECT_TYPE_CREATURE, sResRef, lLocation, FALSE); SetLocalInt(oBandit, "EscortBandit", TRUE); LevelHenchmanUpTo(oBandit, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oBandit), PACKAGE_INVALID); SetIsTemporaryEnemy(oPC, oBandit); i++; sWpNum = IntToString(i+1); } } } //Quest type 6 - ransom if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "ransom") { oWaypoint = GetWaypointByTag("event_wp_"+sAreaString+"_2"); lLocation = GetLocation(oWaypoint); oNPC = SpawnKidnapped(oPC, lLocation); SetPlotFlag(oNPC, TRUE); oWaypoint = GetWaypointByTag("event_wp_"+sAreaString+"_1"); lLocation = GetLocation(oWaypoint); oNPC = SpawnFreshQuestNPC(oPC, lLocation); SetPlotFlag(oNPC, TRUE); SetLocalInt(oNPC, "Quest_Target", TRUE); SetLocalInt(oNPC, "Kidnapper", TRUE); //boost the NPC if the PC is in a party int nPartyCount = 0; object oMember = GetFirstFactionMember(oPC, TRUE); while (GetIsObjectValid(oMember)) { nPartyCount++; oMember = GetNextFactionMember(oPC, TRUE); } nPartyCount--; if (nPartyCount > 0) { effect eBoost = EffectTemporaryHitpoints(nPartyCount*6*GetMaxHitPoints(oNPC)/5); eBoost = EffectLinkEffects(eBoost, EffectSavingThrowIncrease(SAVING_THROW_ALL, nPartyCount*2)); eBoost = SupernaturalEffect(eBoost); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBoost, oNPC); } if (GetCampaignInt(sDB, "QUEST_LUCK") == TRUE) { SetPlotFlag(oNPC, FALSE); AssignCommand(oNPC, SetIsDestroyable(TRUE, FALSE, TRUE)); ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDeath(), oNPC); } } //Quest type 8 - monsters if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "monsters") { int nNumber; int nLevel = GetHitDice(oPC); if (nLevel < 5) nNumber = 1; if (nLevel >= 5 && nLevel <= 25) nNumber = 2; if (nLevel >= 26 && nLevel <= 33) nNumber = 3; if (nLevel == 34 || nLevel == 35) nNumber = 4; if (nLevel == 36 || nLevel == 37) nNumber = 5; if (nLevel > 37) nNumber = 6; if (GetCampaignInt(sDB, "QUEST_COMPLICATION") == 1) { if (nLevel <= 10) nNumber = nNumber + 1; else nNumber = nNumber + 2; } if (GetCampaignInt(sDB, "QUEST_LUCK") == 1) { if (nNumber == 2) nNumber = 1; if (nNumber == 3) nNumber = 2; if (nNumber == 4) nNumber = 2; if (nNumber == 5) nNumber = 3; if (nNumber == 6) nNumber = 4; } //Select monsters to spawn string sMonster1; string sMonster2; string sBoss; if (GetCampaignInt(sDB, "QUEST_BACKGROUND") == 1) //orcs { sMonster1 = "quest_mon_orc_1"; sMonster2 = "quest_mon_orc_2"; sBoss = "quest_mon_orc_3"; } if (GetCampaignInt(sDB, "QUEST_BACKGROUND") == 2) //lizardfolk { sMonster1 = "quest_mon_rep_1"; sMonster2 = "quest_mon_rep_2"; sBoss = "quest_mon_rep_3"; } if (GetCampaignInt(sDB, "QUEST_BACKGROUND") == 3) //demons { sMonster1 = "quest_mon_dem_1"; sMonster2 = "quest_mon_dem_1"; sBoss = "quest_mon_dem_2"; } if (GetCampaignInt(sDB, "QUEST_BACKGROUND") == 4) //undead { sMonster1 = "quest_mon_und_1"; sMonster2 = "quest_mon_und_2"; sBoss = "quest_mon_und_3"; } if (GetCampaignInt(sDB, "QUEST_BACKGROUND") == 5) //giants { sMonster1 = "quest_mon_gia_1"; sMonster2 = "quest_mon_gia_1"; sBoss = "quest_mon_gia_2"; } //Spawn the group leader object oCreature; object oWaypoint = GetWaypointByTag("event_wp_" + sAreaString + "_1"); oCreature = CreateObject(OBJECT_TYPE_CREATURE, sBoss, GetLocation(oWaypoint)); LevelHenchmanUpTo(oCreature, nLevel+3, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oCreature), PACKAGE_INVALID); SetLocalInt(oCreature, "QuestMonster", TRUE); SetLocalObject(oCreature, "oPC", oPC); //Spawn monsters int i; string sResRef; for (i = 2; i <= nNumber+1; i++) { if (Random(2) == 0) sResRef = sMonster1; else sResRef = sMonster2; oWaypoint = GetWaypointByTag("event_wp_" + sAreaString + "_" + IntToString(i)); oCreature = CreateObject(OBJECT_TYPE_CREATURE, sResRef, GetLocation(oWaypoint)); LevelHenchmanUpTo(oCreature, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oCreature), PACKAGE_INVALID); SetLocalInt(oCreature, "QuestMonster", TRUE); SetLocalObject(oCreature, "oPC", oPC); } } } object SpawnEscortedClient(object oPC) { //Get DB string sDB = CharacterDB(oPC); //Get client data string sResRef = GetCampaignString(sDB, "QUEST_CLI_RESREF"); int nHead = GetCampaignInt(sDB, "QUEST_CLI_HEAD"); int nPheno = GetCampaignInt(sDB, "QUEST_CLI_PHENO"); int nHair = GetCampaignInt(sDB, "QUEST_CLI_HAIR"); int nSkin = GetCampaignInt(sDB, "QUEST_CLI_SKIN"); string sCloth = GetCampaignString(sDB, "QUEST_CLI_CLOTH"); int nLaw = GetCampaignInt(sDB, "QUEST_CLI_LAW"); int nGood = GetCampaignInt(sDB, "QUEST_CLI_GOOD"); string sName = GetCampaignString(sDB, "QUEST_CLI_NAME"); string sLastName = GetCampaignString(sDB, "QUEST_CLI_LASTNAME"); //Spawn client next to the PC object oClient = CreateObject(OBJECT_TYPE_CREATURE, sResRef, GetLocation(oPC)); //Set the NPC's name and last name SetName(oClient, sName+" "+sLastName); SetLocalString(oClient, "Name", sName); SetLocalString(oClient, "LastName", sLastName); //Restore client's appearance and alignment DelayCommand(0.3, SetClientAppearance(nHair, nSkin, nPheno, nHead, oClient)); AdjustAlignment(oClient, ALIGNMENT_CHAOTIC, 100, FALSE); AdjustAlignment(oClient, ALIGNMENT_EVIL, 100, FALSE); AdjustAlignment(oClient, ALIGNMENT_LAWFUL, nLaw, FALSE); AdjustAlignment(oClient, ALIGNMENT_GOOD, nGood, FALSE); object oCloth = CreateItemOnObject(sCloth, oClient); AssignCommand(oClient, ActionEquipItem(oCloth, INVENTORY_SLOT_CHEST)); //Mark the NPC as an escort quest NPC SetLocalInt(oClient, "EscortQuest", TRUE); SetLocalInt(oClient, "Escorted", TRUE); SetLocalInt(oClient, "Client", TRUE); //Store PC on the NPC SetLocalObject(oClient, "oPC", oPC); //Make the NPC's eq undroppable object oItem = GetFirstItemInInventory(oClient); SetDroppableFlag(oItem, TRUE); oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, oClient); SetDroppableFlag(oItem, TRUE); //Level-up int nLevel; if (GetHitDice(oPC) > 25) nLevel = GetHitDice(oPC) - 5; else nLevel = GetHitDice(oPC); LevelHenchmanUpTo(oClient, nLevel, CLASS_TYPE_INVALID, 0, GetCreatureStartingPackage(oClient), PACKAGE_INVALID); //Add the NPC as henchman AddHenchman(oPC, oClient); return oClient; } object RetrieveClient(object oPC) { string sDB = CharacterDB(oPC); if (GetCampaignString(sDB, "QUEST_TEMPLATE") == "escort" && !GetIsQuestComplete(oPC) && !GetIsQuestFailed(oPC)) { int i = 1; while ( i != 0) { object oHench = GetHenchman(oPC, i); if (GetLocalInt(oHench, "EscortQuest") == TRUE) return OBJECT_INVALID; if (oHench == OBJECT_INVALID) { object oClient = SpawnEscortedClient(oPC); return oClient; } i++; } } return OBJECT_INVALID; } void DestroyEscortedClient(object oPC) { int i = 1; while ( i != 0) { object oHench = GetHenchman(oPC, i); if (GetLocalInt(oHench, "EscortQuest") == TRUE) DestroyObject(oHench); if (oHench == OBJECT_INVALID) return; i++; } return; }