//************************************************************************ // Custom Magic Treasure Function for generating magic treasure of varying types in placeable, store or creature // B W-Husey, 30th May 2003 // See cu_treasure for the remaining categories (split into two for compile ease) // Treasure Types are: /* Potions - Potions without custom activated ones (up to 3) (Stores) Scrolls1 - Level 0 & 1 scrolls (Bookcases, stores & Wizards) Scrolls12 - Level 1 & 2 scrolls (Bookcases, stores & Wizards) Scrolls34 - level 3 & 4 scrolls (Bookcases, stores & Wizards) Weapon1 - +1 weapons (Containers and stores) Weapon2 - +2 weapons (Containers and stores) Armour1 - +1 Armour (Containers and stores) Armour2 - +2 Armour (Containers and stores) Major - Various gems (including major), jewelry, chance of minor magic (Containers, stores and some creatures: Bosses) Inputs: sTreasureSet - The name of the group of treasure as above oCreateIn - The object to contain the treasure nChance - Chance of any of this type nBonus - For Magic (improves treasure) - do not make nBonus negative. Max 79 (12 for Magic2). The following are found in cu_treasure and use GetTreasure(): Gold10 - Up to 10 gold, bonus adds to quantity Gold100 - 10d10 Gold, bonus adds to quantity Misc - Various kits, torches, arrows, etc (Containers and Stores) Weapon - standard weapon (no club) (Any, creature arms) Armour - Armour, send a bonus for better stuff (Any, creature armour?) Minor - 1-3 gold, Various gems & non valuable rings, etc. (Containers, stores and some creatures: Bodyguards, etc) Major - Various gems (including major), jewelry, chance of minor magic (Containers, stores and some creatures: Bosses) Gems - Any gem except ruby, diamond, sapphire, emerald (Containers and Creatures) */ void GetMagic(string sTreasureSet, object oCreateIn=OBJECT_SELF, int nChance=100, int nBonus=0) { if (Random(100)+11) {CreateItemOnObject(sItem, oCreateIn, nStack);} // All scrolls except last created by this line iNumb ++; } //End of While Loop } //End of Scrolls12 If if (sTreasureSet == "Scrolls34") //SCROLLS LEVEL 3 & 4 { int counter=0; int iNumb=0; int rnd2= Random(10)+1; if (rnd2<6) counter=1; else if (rnd2 <10 ) counter=2; else if (rnd2 <11 ) counter=3; while (iNumb1) {CreateItemOnObject(sItem, oCreateIn, nStack);} // All scrolls except last created by this line iNumb ++; } //End of While Loop } //End of Scrolls34 If if (sTreasureSet == "Weapon1") //+1 WEAPONS { rnd = Random(112); // Calculate _one_ random number if (rnd < 15) sItem = "nw_wswdg002"; //dagger else if (rnd < 20) sItem = "nw_wblmhl002"; //light hammer else if (rnd < 30) sItem = "nw_wdbmqs002"; //quarterstaff else if (rnd < 33) sItem = "nw_waxmhn002"; //hand axe else if (rnd < 38) sItem = "nw_waxmbt002"; //battleaxeaxe else if (rnd < 44) sItem = "nw_wblmml002"; //light mace else if (rnd < 48) sItem = "nw_wblmfl002"; //light flail else if (rnd < 52) sItem = "nw_wblmms002"; //morning star else if (rnd < 60) sItem = "nw_wswmss002"; //short sword else if (rnd < 70) sItem = "nw_wswmls002"; //long sword else if (rnd < 73) sItem = "nw_wswmbs002"; //bastard sword else if (rnd < 75) sItem = "nw_wswmgs002"; //greatsword else if (rnd < 77) sItem = "nw_waxmgr002"; //greataxe else if (rnd < 81) sItem = "nw_wplmss002"; //spear else if (rnd < 83) sItem = "nw_wplmhb002"; //halberd else if (rnd < 84) sItem = "nw_wplmsc002"; //scythe else if (rnd < 85) sItem = "nw_wswmka002"; //katana else if (rnd < 86) sItem = "nw_wspmku002"; //kukri else if (rnd < 88) sItem = "nw_wspmka002"; //kama else if (rnd < 91) sItem = "nw_wbwmsh002"; //short bow else if (rnd < 93) sItem = "nw_wbwmln002"; //long bow else if (rnd < 96) sItem = "nw_wbwmxl002"; //light crossbow else if (rnd < 97) sItem = "nw_wbwmxh002"; //heavy crossbow else if (rnd < 99) sItem = "nw_wbwmsl002"; //sling else if (rnd < 100) sItem = "nw_wblmfh002"; //heavy flail else if (rnd < 101) sItem = "nw_wblmhw002"; //warhammer else if (rnd < 102) sItem = "nw_wdbmma002"; //Dire Mace else if (rnd < 103) sItem = "nw_wdbmax002"; //double axe else if (rnd < 104) sItem = "nw_wdbmsw002"; //double sword // else if (rnd < 105) sItem = "nw_wspmnn002"; //Nunchaku else if (rnd < 106) sItem = "nw_wspmsc002"; //sickle else if (rnd < 108) sItem = "nw_wswmmrp002"; //rapier else if (rnd < 110) sItem = "nw_wswmsc002"; //scimitar else if (rnd < 112) sItem = "x2_it_wpmwhip1"; //whip } if (sTreasureSet == "Weapon2") //+2 WEAPONS { rnd = Random(112); // Calculate _one_ random number if (rnd < 15) sItem = "nw_wswdg008"; //dagger else if (rnd < 20) sItem = "nw_wblmhl010"; //light hammer else if (rnd < 30) sItem = "nw_wdbmqs008"; //quarterstaff else if (rnd < 33) sItem = "nw_waxmhn010"; //hand axe else if (rnd < 38) sItem = "nw_waxmbt010"; //battleaxeaxe else if (rnd < 44) sItem = "nw_wblmml011"; //light mace else if (rnd < 48) sItem = "nw_wblmfl010"; //light flail else if (rnd < 52) sItem = "nw_wblmms010"; //morning star else if (rnd < 60) sItem = "nw_wswmss009"; //short sword else if (rnd < 70) sItem = "nw_wswmls010"; //long sword else if (rnd < 73) sItem = "nw_wswmbs009"; //bastard sword else if (rnd < 75) sItem = "nw_wswmgs011"; //greatsword else if (rnd < 77) sItem = "nw_waxmgr009"; //greataxe else if (rnd < 81) sItem = "nw_wplmss010"; //spear else if (rnd < 83) sItem = "nw_wplmhb010"; //halberd else if (rnd < 84) sItem = "nw_wplmsc010"; //scythe else if (rnd < 85) sItem = "nw_wswmka010"; //katana else if (rnd < 86) sItem = "nw_wspmku008"; //kukri else if (rnd < 88) sItem = "nw_wspmka008"; //kama else if (rnd < 91) sItem = "nw_wbwmsh008"; //short bow else if (rnd < 93) sItem = "nw_wbwmln008"; //long bow else if (rnd < 96) sItem = "nw_wbwmxl008"; //light crossbow else if (rnd < 97) sItem = "nw_wbwmxh008"; //heavy crossbow else if (rnd < 99) sItem = "nw_wbwmsl009"; //sling else if (rnd < 100) sItem = "nw_wblmfh010"; //heavy flail else if (rnd < 101) sItem = "nw_wblmhw011"; //warhammer else if (rnd < 102) sItem = "nw_wdbmma010"; //Dire Mace else if (rnd < 103) sItem = "nw_wdbmax010"; //double axe else if (rnd < 104) sItem = "nw_wdbmsw010"; //double sword // else if (rnd < 105) sItem = "nw_wspmnn008"; //Nunchaks else if (rnd < 106) sItem = "nw_wspmsc010"; //sickle else if (rnd < 108) sItem = "nw_wswmrp010"; //rapier else if (rnd < 110) sItem = "nw_wswmsc010"; //scimitar else if (rnd < 112) sItem = "x2_it_wpmwhip2"; //whip } if (sTreasureSet == "Armour1") //+1 Armour { rnd = Random(12); // Calculate _one_ random number if (rnd < 1) sItem = "nw_maarcl044"; //Leather armour else if (rnd <2) sItem = "nw_maarcl043"; //Padded armour else if (rnd <3) sItem = "nw_maarcl045"; //Studded Leather armour else if (rnd <4) sItem = "nw_maarcl047"; //Hide armour else if (rnd <5) sItem = "nw_maarcl046"; //Chain Shirt else if (rnd <6) sItem = "nw_maarcl048"; //Scale Mail else if (rnd <7) sItem = "nw_maarcl049"; //Breastplate else if (rnd <8) sItem = "nw_maarcl035"; //Chain Mail else if (rnd <9) sItem = "nw_maarcl051"; //Banded Mail else if (rnd <10) sItem = "nw_maarcl050"; //Splint Mail else if (rnd <11) sItem = "nw_maarcl052"; //Half Plate else if (rnd <12) sItem = "nw_maarcl053"; //Full Plate } if (sTreasureSet == "Armour2") //+2 Armour { rnd = Random(12); // Calculate _one_ random number if (rnd < 1) sItem = "nw_maarcl071"; //Leather armour else if (rnd <2) sItem = "nw_maarcl072"; //Padded armour else if (rnd <3) sItem = "nw_maarcl075"; //Studded Leather armour else if (rnd <4) sItem = "nw_maarcl070"; //Hide armour else if (rnd <5) sItem = "nw_maarcl067"; //Chain Shirt else if (rnd <6) sItem = "nw_maarcl073"; //Scale Mail else if (rnd <7) sItem = "nw_maarcl065"; //Breastplate else if (rnd <8) sItem = "nw_maarcl066"; //Chain Mail else if (rnd <9) sItem = "nw_maarcl064"; //Banded Mail else if (rnd <10) sItem = "nw_maarcl074"; //Splint Mail else if (rnd <11) sItem = "nw_maarcl069"; //Half Plate else if (rnd <12) sItem = "nw_maarcl068"; //Full Plate } if (sTreasureSet == "Major") //MAJOR ITEMS { rnd = Random(100); // Calculate _one_ random number if (rnd < 7) sItem = "nw_it_mring023"; //Gold Ring else if (rnd <9) sItem = "potionofresistance"; //Potion of Resistance else if (rnd <12) sItem = "nw_it_mring022"; //Silver Ring else if (rnd <17) sItem = "nw_it_mneck022"; //Gold Necklace else if (rnd <20) sItem = "nw_it_mneck021"; //Silver Necklace else if (rnd <23) sItem = "nw_it_mneck023"; //Glittering Necklace else if (rnd <24) sItem = "nw_it_mpotion001"; //Cure Light Wounds else if (rnd <28) sItem = "nw_it_mpotion002"; //Cure Serious Wounds else if (rnd <30) sItem = "nw_it_mpotion006"; //Potion of Antidote else if (rnd <33) sItem = "nw_it_mpotion016"; //Potion of Aid else if (rnd <36) sItem = "nw_it_mpotion005"; //Potion of Barkskin else if (rnd <40) sItem = "nw_it_mpotion009"; //Potion of Bless else if (rnd <42) sItem = "nw_it_mpotion011"; //Potion of Lesser Restoration else if (rnd <45) sItem = "nw_it_mpotion013"; //Potion of Endurance else if (rnd <47) sItem = "nw_it_spdvscr401"; //Restoration else if (rnd <49) sItem = "nw_it_mring012"; //Ring of Insight else if (rnd <57) sItem = "nw_it_mpotion003"; //Potion of Cure Critical Wounds else if (rnd <60) sItem = "nw_it_spdvscr201"; //Lesser Restoration else if (rnd <64) sItem = "nw_it_contain003"; //Magic Bag else if (rnd <68) sItem = "nw_it_contain004"; //Magic Bag else if (rnd <74) sItem = "nw_it_mpotion012"; //Potion of Heal else if (rnd <77) sItem = "nw_it_mpotion004"; //Potion of Speed else if (rnd <79) sItem = "nw_it_mring013"; //Ring of Scholars else if (rnd <83) sItem = "nw_it_spdvscr501"; //Raise Dead else if (rnd <88) sItem = "nw_it_gem005"; // Diamond else if (rnd <92) sItem = "nw_it_gem006"; // Ruby else if (rnd <96) sItem = "nw_it_gem008"; //Sapphire else if (rnd <100) sItem = "nw_it_gem012"; //Emerald }//End of MAJOR if if (sTreasureSet == "Potions") //POTIONS without custom { int counter=0; //Define variables int iNumb=0; int rnd2= Random(10)+1; //Determine how many potions (1-3) if (rnd2<6) counter=1; else if (rnd2 <9 ) counter=2; else if (rnd2 <11 ) counter=3; while (iNumb1) {CreateItemOnObject(sItem, oCreateIn, nStack);} // All potions except last created by this line iNumb ++; } //End of While Loop } //End of Potions If CreateItemOnObject(sItem, oCreateIn,nStack); // Create the item } //End of nChance } //End of Void