//#include "_persist_01a" #include "nw_i0_plot" void GetNextItemPossessedBy(object oPC, string sItemTag); object CreatePlaceable(string sObject, location lPlace, float fDuration); void CreateAnObject(string sResource, object oPC, int iStackSize); void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef); void main() { int iUseMode = 0; if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED) { iUseMode = 99; if (GetLastDisturbed() == OBJECT_SELF) { //DestroyObject(GetInventoryDisturbItem()); return; } } object oPC = GetLastDisturbed(); object oItem = GetInventoryDisturbItem(); object oTemp = OBJECT_INVALID; string sDItemResRef = GetResRef(oItem); string sItemTag = GetTag(oItem); string sOldTag = sItemTag; //int iAlchemyChance = GetTokenPair(oPC,14,12); //int iAlchemySkill = iAlchemyChance; int iAlchemySkill = GetCampaignInt("UOACraft","iAlchemySkill",oPC); int iAlchemyChance = iAlchemySkill; int iSuccess = 0; int iSkillGain = 0; int iRandom = 0; string sComponent1 = ""; string sComponent2 = ""; string sComponent3 = ""; string sComponent1Name = ""; string sComponent2Name = ""; string sComponent3Name = ""; string sComponentResRef = ""; int iComponent1 = 0; int iComponent2 = 0; int iComponent3 = 0; int iComponent1Stackable = 0; int iComponent2Stackable = 0; int iComponent3Stackable = 0; int iStackSize = 0; int iFailStackable = 0; string sItemResRef = ""; string sFailResRef = ""; string sSuccess = ""; string sFail = ""; float fTemp = 0.0; int iSuccessNumber = 1; //this is the number of end products produced int iStackable = 0; // This flag tells whether its a stackable or not int iFailNumber = 1; // this is the number of failed items produced int iFailFlag = 0; // this flag means to make both success *and* fail on each success attempt. // this facilitaes the creation of byproducts. float fDelay; if (iAlchemyChance <350) { iAlchemyChance = GetAbilityScore(oPC,ABILITY_WISDOM)*5; iAlchemyChance = iAlchemyChance +(GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3); iAlchemyChance = iAlchemyChance +(GetAbilityScore(oPC,ABILITY_DEXTERITY)*2); iAlchemyChance = iAlchemyChance * 3; if (iAlchemyChance >350) iAlchemyChance = 350; if (iAlchemySkill > iAlchemyChance) iAlchemyChance = iAlchemySkill; } if (iUseMode == 0) { // The following 3 lines are to ensure compatability with UOAbigal's Persistent Token System. // You can replace them with whatever 'no-drop' code you have or comment them out. string sNoDropFlag = (GetStringLeft(GetTag(oItem),6)); if (sNoDropFlag == "NoDrop" || sNoDropFlag == "TOKEN_"||sNoDropFlag=="_TBOX_") return; if (GetBaseItemType(oItem)==BASE_ITEM_LARGEBOX) { DestroyObject(oItem); SendMessageToPC(oPC,"To avoid possible dupe exploits, the container placed in this bag may be destroyed."); return; } // End of compatability portion. if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0) { CopyItem(oItem,oPC,TRUE); SendMessageToPC(oPC,"You must wait till the current alchemy process is done before starting another."); DestroyObject(oItem); return; } if (sItemTag == "SaltBlock") { iSuccessNumber = 4; sItemResRef = "cookingsalt"; iFailFlag = 1; iFailNumber = 1; sSuccess = "You carefully and methodically grind the saltblock into small grains of cooking salt."; sFail = "You manage to get a little cooking salt."; } if (sItemTag == "FLOWER_BLUEIRIS") { iSuccessNumber = 3; sItemResRef = "dye001"; sSuccess = "You boil the iris and extract the light-blue aqua pigment."; sFail = "You fail to extract any pigment from this iris."; } if (sItemTag == "FLOWER_BLACKTULIP") { iSuccessNumber = 3; sItemResRef = "dye002"; sSuccess = "You boil the tulip and extract the dark pigment."; sFail = "You fail to extract any pigment from this tulip."; } if (sItemTag == "FLOWER_BLUETULIP") { iSuccessNumber = 3; sItemResRef = "dye003"; sSuccess = "You boil the tulip and extract the dark-blue pigment."; sFail = "You fail to extract any pigment from this tulip."; } if (sItemTag == "FLOWER_YELLOWTULIP") { iSuccessNumber = 3; sItemResRef = "dye004"; sSuccess = "You boil the tulip and extract the yellow pigment."; sFail = "You fail to extract any pigment from this tulip."; } if (sItemTag == "SEED_GOOSEBERRY") { iSuccessNumber = 3; sItemResRef = "dye005"; sSuccess = "You boil the gooseberries and extract the green pigment."; sFail = "You fail to extract any pigment from these gooseberries."; } if (sItemTag == "ITEM_PINECONE") { iSuccessNumber = 3; sItemResRef = "dye006"; sSuccess = "You boil the pinecone and extract the greenish-brown pigment."; sFail = "You fail to extract any pigment from this pinecone."; } if (sItemTag == "SEED_MARIGOLD") { iSuccessNumber = 3; sItemResRef = "dye007"; sSuccess = "You boil the marigold and extract the golden pigment."; sFail = "You fail to extract any pigment from this marigold."; } if (sItemTag == "SEED_SNAPDRAGON") { iSuccessNumber = 3; sItemResRef = "dye008"; sSuccess = "You boil the snapdragon and extract a bronze-toned pigment."; sFail = "You fail to extract any pigment from this snapdragon."; } if (sItemTag == "SEED_TARRAGON") { iSuccessNumber = 3; sItemResRef = "dye009"; sSuccess = "You boil the tarragon and extract a silvery pigment."; sFail = "You fail to extract any pigment from the tarragon."; } if (sItemTag == "FLOWER_WHITEIRIS") { iSuccessNumber = 3; sItemResRef = "dye010"; sSuccess = "You boil the iris and extract a greyish pigment."; sFail = "You fail to extract any pigment from this iris."; } if (sItemTag == "SEED_LAVENDER") { iSuccessNumber = 3; sItemResRef = "dye011"; sSuccess = "You boil the lavender and extract a pink pigment."; sFail = "You fail to extract any pigment from the lavender."; } if (sItemTag == "SEED_NASTURTIUM") { iSuccessNumber = 3; sItemResRef = "dye012"; sSuccess = "You boil the nasturtium and extract a greyish pigment."; sFail = "You fail to extract any pigment from this nasturtium."; } if (sItemTag == "SEED_SAGE") { iSuccessNumber = 3; sItemResRef = "dye013"; sSuccess = "You boil the sage and extract a tan pigment."; sFail = "You fail to extract any pigment from the sage."; } if (sItemTag == "SEED_CHIVES") { iSuccessNumber = 3; sItemResRef = "dye014"; sSuccess = "You boil the chives and extract a coppery pigment."; sFail = "You fail to extract any pigment from these chives."; } if (sItemTag == "FLOWER_WHITETULIP") { iSuccessNumber = 3; sItemResRef = "dye015"; sSuccess = "You boil the tulip and extract the white pigment."; sFail = "You fail to extract any pigment from this tulip."; } if (sItemTag == "FLOWER_YELLOWIRIS") { iSuccessNumber = 3; sItemResRef = "dye016"; sSuccess = "You boil the iris and extract a platinum-hued pigment."; sFail = "You fail to extract any pigment from this iris."; } if (sItemTag == "SEED_PERIWINKLE") { iSuccessNumber = 3; sItemResRef = "dye017"; sSuccess = "You boil the periwinkle and extract a purple pigment."; sFail = "You fail to extract any pigment from this periwinkle."; } if (sItemTag == "FLOWER_BLACKIRIS") { iSuccessNumber = 3; sItemResRef = "dye018"; sSuccess = "You boil the iris and extract a dark grey pigment."; sFail = "You fail to extract any pigment from this iris."; } if (sItemTag == "SEED_SPEARMINT") { iSuccessNumber = 3; sItemResRef = "dye019"; sSuccess = "You boil the spearmint and extract a minty green pigment."; sFail = "You fail to extract any pigment from this spearmint."; } if (sItemTag == "SEED_BEETS") { iSuccessNumber = 3; sItemResRef = "dye020"; sSuccess = "You boil the beets and extract a deep red pigment."; sFail = "You fail to extract any pigment from these beets."; } if (sItemTag == "SEED_PEPPERMINT") { iSuccessNumber = 3; sItemResRef = "dye021"; sSuccess = "You boil the peppermint and extract a deep green pigment."; sFail = "You fail to extract any pigment from this peppermint."; } if (sItemTag == "SEED_BLUEBERRY") { iSuccessNumber = 3; sItemResRef = "dye022"; sSuccess = "You boil the blueberries and extract a deep blue pigment."; sFail = "You fail to extract any pigment from these blueberries."; } if (sItemTag == "SEED_ORIENTALPOPPY") { iSuccessNumber = 3; sItemResRef = "dye023"; sSuccess = "You boil the oriental poppy and extract a peach-hued pigment."; sFail = "You fail to extract any pigment from this oriental poppy."; } if (sItemTag == "SEED_MAYAPPLE") { iSuccessNumber = 3; sItemResRef = "dye024"; sSuccess = "You boil the mayapple and extract a greyish pigment."; sFail = "You fail to extract any pigment from this mayapple."; } if (sItemTag == "SEED_TURNIP") { iSuccessNumber = 3; sItemResRef = "dye025"; sSuccess = "You boil the turnip and extract a fuschia pigment."; sFail = "You fail to extract any pigment from this turnip."; } if (sItemTag == "ITEM_OLIVE") { iSuccessNumber = 3; sItemResRef = "dye026"; sSuccess = "You boil the olives and extract an olive-colored pigment."; sFail = "You fail to extract any pigment from these olives."; } if (sItemTag == "SEED_CATNIP") { iSuccessNumber = 3; sItemResRef = "dye027"; sSuccess = "You boil the catnip and extract a yellowish-green pigment."; sFail = "You fail to extract any pigment from this catnip."; } if (sItemTag == "ITEM_FIG") { iSuccessNumber = 3; sItemResRef = "dye028"; sSuccess = "You boil the figs and extract a rusty pigment."; sFail = "You fail to extract any pigment from these figs."; } if (sItemTag == "ITEM_KIWI") { iSuccessNumber = 3; sItemResRef = "dye029"; sSuccess = "You boil the kiwi and extract a chromatic pigment."; sFail = "You fail to extract any pigment from this kiwi."; } if (sItemTag == "SEED_ARTICHOKE") { iSuccessNumber = 3; sItemResRef = "dye030"; sSuccess = "You boil the artichoke and extract a metallic pigment."; sFail = "You fail to extract any pigment from the artichoke."; } if (sItemTag == "FISH_BLUESHARK") // 80 lbs { iSuccessNumber = 7; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the blue shark."; sFail = "You fail to extract any useable oil from the blue shark."; } if (sItemTag == "FISH_BLUEFINTUNA") // 300 lbs { iSuccessNumber = 10; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the bluefin tuna."; sFail = "You fail to extract any useable oil from the bluefin tuna."; } if (sItemTag == "FISH_MAKOSHARK") // 150 lbs { iSuccessNumber = 8; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the mako shark."; sFail = "You fail to extract any useable oil from the mako shark."; } if (sItemTag == "FISH_STRIPEDBASS") // 50 lbs { iSuccessNumber = 4; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the striped bass."; sFail = "You fail to extract any useable oil from the striped bass."; } if (sItemTag == "FISH_SWORDFISH") // 200 lbs { iSuccessNumber = 9; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the swordfish."; sFail = "You fail to extract any useable oil from the swordfish."; } if (sItemTag == "FISH_WHITEMARLIN") // 80 lbs { iSuccessNumber = 7; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the white marlin."; sFail = "You fail to extract any useable oil from the white marlin."; } if (sItemTag == "FISH_YELLOWFINTUNA") // 125 lbs { iSuccessNumber = 8; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the yellowfin tuna."; sFail = "You fail to extract any useable oil from the yellowfin tuna."; } if (sItemTag == "FISH_BLACKSEABASS") // 10 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the black sea bass."; sFail = "You fail to extract any useable oil from the black sea bass."; } if (sItemTag == "FISH_BLUEFISH") // 20 lbs { iSuccessNumber = 2; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the bluefish."; sFail = "You fail to extract any useable oil from the bluefish."; } if (sItemTag == "FISH_BLUEGILL") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the bluegill meat."; sFail = "You fail to extract any useable oil from the bluegill."; } if (sItemTag == "FISH_CARP") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the carp."; sFail = "You fail to extract any useable oil from the carp."; } if (sItemTag == "FISH_COD") // 20 lbs { iSuccessNumber = 2; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the cod."; sFail = "You fail to extract any useable oil from the cod."; } if (sItemTag == "FISH_CRAPPIE") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the crappie."; sFail = "You fail to extract any useable oil from the crappie."; } if (sItemTag == "FISH_FLOUNDER") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the flounder."; sFail = "You fail to extract any useable oil from the flounder."; } if (sItemTag == "FISH_FLUKE") // 10 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the fluke."; sFail = "You fail to extract any useable oil from the fluke."; } if (sItemTag == "FISH_CHANNELCATFISH05") // 25 lbs { iSuccessNumber = 2; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the channel catfish."; sFail = "You fail to extract any useable oil from the channel catfish."; } if (sItemTag == "FISH_LARGEMOUTHBASS") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the largemouth bass."; sFail = "You fail to extract any useable oil from the largemouth bass."; } if (sItemTag == "FISH_MACKEREL") // 10 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the mackerel."; sFail = "You fail to extract any useable oil from the mackerel."; } if (sItemTag == "FISH_CHANNELCATFISH03") // 15 lbs { iSuccessNumber = 2; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the channel catfish."; sFail = "You fail to extract any useable oil from the channel catfish."; } if (sItemTag == "FISH_CHANNELCATFISH04") // 20 lbs { iSuccessNumber = 2; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the channel catfish."; sFail = "You fail to extract any useable oil from the channel catfish."; } if (sItemTag == "FISH_RAINBOWTROUT") // 10 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the rainbow trout."; sFail = "You fail to extract any useable oil from the rainbow trout."; } if (sItemTag == "FISH_SEABASS") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the sea bass."; sFail = "You fail to extract any useable oil from the sea bass."; } if (sItemTag == "FISH_SHAD") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the shad."; sFail = "You fail to extract any useable oil from the shad."; } if (sItemTag == "FISH_CHANNELCATFISH01") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the channel catfish."; sFail = "You fail to extract any useable oil from the channel catfish."; } if (sItemTag == "FISH_CHANNELCATFISH02") // 10 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the channel catfish."; sFail = "You fail to extract any useable oil from the channel catfish."; } if (sItemTag == "FISH_SMALLMOUTHBASS") // 5 lbs { iSuccessNumber = 1; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the smallmouth bass."; sFail = "You fail to extract any useable oil from the smallmouth bass."; } if (sItemTag == "FISH_CHANNELCATFISH06") // 35 lbs { iSuccessNumber = 3; sItemResRef = "tanningoil"; sSuccess = "You carefully extract the oils from the channel catfish."; sFail = "You fail to extract any useable oil from the channel catfish."; } DelayCommand(8.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0)); //ensure at least 1 respawn 10 minutes after used... //this is to prevent a broken placeable that is used, with a 'in use' delay //which would cancel the respawn if (GetLocalInt(OBJECT_SELF,"iAmSetToRespawn")!=99) { SetLocalInt(OBJECT_SELF,"iAmSetToRespawn",99); DelayCommand(600.0,ExecuteScript("_onclose_clear",OBJECT_SELF)); } if (sSuccess == "") { FloatingTextStringOnCreature("You cannot use "+GetName(oItem)+" in this way.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem); return; } if (sItemResRef != "") DestroyObject(oItem); } // END OF iUseMode = 0 section (added to inventory) if (iUseMode !=0) { if (GetLocalInt(OBJECT_SELF,"iAmInUse") != 0) { CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem)); SendMessageToPC(oPC,"You must wait till the current alchemy process is done before starting another."); DestroyObject(oItem); return; } if (GetStringLeft(sDItemResRef,7)!="pattern") { if (GetStringLeft(sDItemResRef,7)!="essence") return; // removed something other than a pattern } //Begin code for fixing stackables issue if (GetStringRight(sItemTag,6)=="_Store") { //SendMessageToPC(oPC,"*******Old Tag: "+GetTag(oItem)+"*******"); sItemTag = GetStringLeft(sItemTag,GetStringLength(sItemTag)-6); //SendMessageToPC(oPC,"*******New Tag: "+sItemTag+"*******"); SetLocalInt(oItem,"iAmValid",1); } //End code for fixing stackables issue if (GetStringRight(sDItemResRef,3)=="013") // Tanning Oil { FloatingTextStringOnCreature("To create tanning oil you need to drop a fish into this container.",oPC,FALSE); CopyObject(oItem,GetLocation(OBJECT_SELF),OBJECT_SELF,GetTag(oItem)); DestroyObject(oItem); return; } if (GetStringRight(sDItemResRef,3)=="014") // Tannic Acid { sComponent1 = "WOOD_OAK"; iComponent1 = 1; sComponent1Name = "oaken logs"; iSuccessNumber = 10; iStackable = 1; sSuccess = "You strip the bark and produce enough tannic acid for 10 uses."; sFail = "You strip the bark, but the tannic acid produced is impure and unuseable."; iFailNumber = 4; iFailFlag = 1; sFailResRef = "kindling"; sItemResRef = "tannicacid"; } if (GetStringRight(sDItemResRef,3)=="015") // Tanning Salt { sComponent1 = "SaltBlock"; sComponent2 = "ITEM_LIME"; sComponent1Name = "pure salt"; sComponent2Name = "pure lime"; iComponent1 = 1; iComponent2 = 1; iSuccessNumber = 8; sItemResRef = "tannerssalt"; sSuccess = "You carefully and methodically grind the salt and lime into small grains of tanning salt."; sFail = "You fail to mix the salt and lime in proper proportion, resulting in useless byproduct."; } if (GetStringRight(sDItemResRef,3)=="034") // Weak Acid { iStackable = 1; sComponent1 = "ITEM_SULPHUR"; sComponent1Name = "pure sulphur"; iComponent1 = 1; iSuccessNumber = 10; sItemResRef = "acid001"; sSuccess = "You carefully grind, measure, and mix the sulphur to create a weak acid."; sFail = "You fail to mix the sulphur in proper proportion, resulting in useless byproduct."; } if (GetStringRight(sDItemResRef,3)=="076") // Moderate Acid { iAlchemyChance=iAlchemyChance-250; iStackable = 1; sComponent1 = "ITEM_SULPHUR"; sComponent1Name = "pure sulphur"; iComponent1 = 1; iSuccessNumber = 5; sItemResRef = "acid002"; sSuccess = "You carefully grind, measure, and mix the sulphur to create a moderate acid."; sFail = "You fail to mix the sulphur in proper proportion, resulting in useless byproduct."; } if (GetStringRight(sDItemResRef,3)=="077") // Strong Acid { iAlchemyChance=iAlchemyChance-350; iStackable = 1; sComponent1 = "ITEM_SULPHUR"; sComponent1Name = "pure sulphur"; iComponent1 = 1; iSuccessNumber = 3; sItemResRef = "acid003"; sSuccess = "You carefully grind, measure, and mix the sulphur to create a strong acid."; sFail = "You fail to mix the sulphur in proper proportion, resulting in useless byproduct."; } if (GetStringRight(sDItemResRef,3)=="078") // Very Strong Acid { iAlchemyChance=iAlchemyChance-450; iStackable = 1; sComponent1 = "ITEM_SULPHUR"; sComponent1Name = "pure sulphur"; iComponent1 = 1; iSuccessNumber = 1; sItemResRef = "acid004"; sSuccess = "You carefully grind, measure, and mix the sulphur to create a very strong acid."; sFail = "You fail to mix the sulphur in proper proportion, resulting in useless byproduct."; } if (GetStringRight(sDItemResRef,3)=="035") // Coarse Grit { iStackable = 1; sComponent1 = "ITEM_SAND"; sComponent1Name = "sand"; iComponent1 = 1; iSuccessNumber = 10; sItemResRef = "grit001"; sSuccess = "You carefully grind the sand into a coarse grit."; sFail = "You fail to grind the sand properly, and it is now unsuitable for gem polishing."; } if (GetStringRight(sDItemResRef,3)=="036") // Medium Grit { iStackable = 1; sComponent1 = "ITEM_SAND"; sComponent1Name = "sand"; iComponent1 = 1; iSuccessNumber = 5; sItemResRef = "grit002"; sSuccess = "You carefully grind the sand into a medium grit."; sFail = "You fail to grind the sand properly, and it is now unsuitable for gem polishing."; } if (GetStringRight(sDItemResRef,3)=="037") // Fine Grit { iStackable = 1; sComponent1 = "ITEM_SAND"; sComponent1Name = "sand"; iComponent1 = 1; iSuccessNumber = 2; sItemResRef = "grit003"; sSuccess = "You carefully grind the sand into a fine grit."; sFail = "You fail to grind the sand properly, and it is now unsuitable for gem polishing."; } if (GetStringRight(sDItemResRef,3)=="071") // Pulp Bleach { iStackable = 1; sComponent1 = "SaltBlock"; sComponent1Name = "salt block"; iComponent1 = 1; iSuccessNumber = 10; sItemResRef = "item_chlorine"; sSuccess = "You carefully extract the chlorine from the salt block."; sFail = "The chemical process goes awry and you fail to concentrate the chlorine from the salt block."; } if (GetStringRight(sDItemResRef,3)=="068") // Black Ink { iStackable=1; sComponent1 = "item_mushroom007"; iComponent1 = 2; sComponent2 = "ITEM_GLASSVIAL"; iComponent2 = 1; sComponent3 = "DYE_BLACK"; iComponent3 = 1; iComponent3Stackable=1; sSuccess = "You carefully powder the wooly ink cap and combine it with the black dye."; sFail = "The ink turns milky and is ruined by impurities.."; sItemResRef = "ink_black"; sFailResRef = "glassvial"; sComponent1Name = "wooly ink caps"; sComponent2Name = "glass vials"; sComponent3Name = "black dyes"; } //**Please note these are standard Bioware potions.. you can replace the //sItemResRef with any custom 'cure potions' resref for your module. if (GetStringRight(sDItemResRef,3)=="084") // Potion of Cure Light Wounds { iAlchemyChance=iAlchemyChance-100; iStackable=1; sComponent1 = "SEED_GINGER"; iComponent1 = 2; sComponent2 = "item_mushroom020"; iComponent2 = 1; sComponent3 = "ITEM_GLASSVIAL"; iComponent3 = 1; sSuccess = "You carefully powder the ginger roots and stone fungus and brew the potion."; sFail = "The potion coagulates into a smelly, useless sludge."; sItemResRef = "nw_it_mpotion001"; //Replace this with custom potion resref, if available sFailResRef = "glassvial"; sComponent1Name = "ginger roots"; sComponent2Name = "stone fungi"; sComponent3Name = "glass vials"; } if (GetStringRight(sDItemResRef,3)=="085") // Potion of Cure Moderate Wounds { iAlchemyChance=iAlchemyChance-200; iStackable=1; sComponent1 = "SEED_MANDRAKE"; iComponent1 = 2; sComponent2 = "item_mushroom053"; iComponent2 = 1; sComponent3 = "ITEM_GLASSVIAL"; iComponent3 = 1; sSuccess = "You carefully powder the mandrake roots and violet pouch fungus and brew the potion."; sFail = "The potion coagulates into a smelly, useless sludge."; sItemResRef = "nw_it_mpotion020"; //Replace this with custom potion resref, if available sFailResRef = "glassvial"; sComponent1Name = "mandrake roots"; sComponent2Name = "violet pouch fungi"; sComponent3Name = "glass vials"; } if (GetStringRight(sDItemResRef,3)=="086") // Potion of Cure Serious Wounds { iAlchemyChance=iAlchemyChance-350; iStackable=1; iComponent1Stackable=1; sComponent1 = "GEM_POWDER_AMETHYST"; iComponent1 = 2; sComponent2 = "item_mushroom035"; iComponent2 = 2; sComponent3 = "ITEM_GLASSVIAL"; iComponent3 = 1; sSuccess = "You carefully powder the witches butter, mixing in the powdered amethyst and brew the potion."; sFail = "The potion coagulates into a smelly, useless sludge."; sItemResRef = "nw_it_mpotion002"; //Replace this with custom potion resref, if available sFailResRef = "glassvial"; sComponent1Name = "powdered amethyst"; sComponent2Name = "witches butter fungi"; sComponent3Name = "glass vials"; } if (GetStringRight(sDItemResRef,3)=="087") // Potion of Cure Critical Wounds { iAlchemyChance=iAlchemyChance-500; iStackable=1; sComponent1 = "GEM_POWDER_BLOODSTONE"; iComponent1 = 2; iComponent1Stackable=1; sComponent2 = "essence018"; iComponent2 = 1; iComponent2Stackable=1; sComponent3 = "ITEM_GLASSVIAL"; iComponent3 = 1; sSuccess = "You carefully combine the powdered bloodstone with the essence of nature and brew the potion."; sFail = "The potion coagulates into a smelly, useless sludge."; sItemResRef = "nw_it_mpotion003"; //Replace this with custom potion resref, if available sFailResRef = "glassvial"; sComponent1Name = "powdered bloodstone"; sComponent2Name = "essences of nature"; sComponent3Name = "glass vials"; } if (GetStringRight(sDItemResRef,3)=="088") // Mapmaker's Ink { iStackable=1; sComponent1 = "item_mushroom062"; //Shaggy ink cap iComponent1 = 2; sComponent2 = "ITEM_GLASSVIAL"; iComponent2 = 1; sComponent3 = "DYE_CHARCOAL"; iComponent3 = 1; iComponent3Stackable=1; sSuccess = "You carefully powder the shaggy ink cap and combine it with the charcoal dye."; sFail = "The ink turns milky and is ruined by impurities.."; sItemResRef = "ink_mapmaker"; sFailResRef = "glassvial"; sComponent1Name = "shaggy ink caps"; sComponent2Name = "glass vials"; sComponent3Name = "charcoal dyes"; } if (GetStringRight(sDItemResRef,3)=="090") // Alchemist's Fire { iAlchemyChance=iAlchemyChance-150; iStackable=1; iComponent1Stackable=1; sComponent1 = "_UOA_BOTTLE_TAR"; //Bottle of Tar iComponent1 = 1; sComponent2 = "ITEM_SULPHUR"; iComponent2 = 1; sComponent3 = "item_coal"; iComponent3 = 1; iComponent3Stackable=1; iFailFlag=1; iFailNumber=1; sSuccess = "You carefully powder the sulphur and coal, mixing it with the tar."; sFail = "The tar hardens as you mix the coal and sulpher improperly, rending this batch useless."; sItemResRef = "_uoa_alch_fire"; sFailResRef = "glassbottle"; sComponent1Name = "bottles of tar"; sComponent2Name = "blocks of sulphur"; sComponent3Name = "lumps of coal"; } if (GetStringRight(sDItemResRef,3)=="091") // Weak poison { iStackable=1; sComponent1 = "FLOWER_REDTULIP"; //Red Tulip Blossoms iComponent1 = 2; sSuccess = "You carefully powder and liquify the tulip blossoms, extracting the toxins."; sFail = "The toxins evaporate as you fail to liquify the tulips properly."; sItemResRef = "poison_001"; sComponent1Name = "red tulip"; } if (GetStringRight(sDItemResRef,3)=="092") // Moderate poison { iAlchemyChance = iAlchemyChance - 100; iStackable=1; sComponent1 = "ITEM_ACORN"; //Acorns sComponent2 = "FLOWER_BLUETULIP"; //blue tulips iComponent1 = 2; iComponent2 = 1; sSuccess = "You carefully powder and liquify the tulip blossom and acorns, extracting the toxins."; sFail = "The toxins evaporate as you fail to liquify the acorns and tulip properly."; sItemResRef = "poison_002"; sComponent1Name = "acorn"; sComponent2Name = "blue tulip"; } if (GetStringRight(sDItemResRef,3)=="093") // Strong Poison { iAlchemyChance = iAlchemyChance - 300; iStackable=1; sComponent1 = "item_mushroom070"; //Spring Agaric iComponent1 = 2; sSuccess = "You carefully powder and liquify the spring agaric, extracting the toxins."; sFail = "The toxins evaporate as you fail to liquify the fungus properly."; sItemResRef = "poison_003"; sComponent1Name = "spring agaric"; } if (GetStringRight(sDItemResRef,3)=="094") // Very Strong poison { iAlchemyChance = iAlchemyChance - 500; iStackable=1; sComponent1 = "item_mushroom070"; //Spring Agaric sComponent2 = "item_mushroom027"; //Fly Agaric iComponent1 = 2; iComponent2 = 2; sSuccess = "You carefully powder and liquify the fungus, extracting the toxins."; sFail = "The toxins evaporate as you fail to liquify the fungus properly."; sItemResRef = "poison_004"; sComponent1Name = "spring agaric"; sComponent2Name = "fly agaric"; } if (GetStringRight(sDItemResRef,3)=="095") // Deadly Poison { iAlchemyChance = iAlchemyChance - 600; iStackable=1; sComponent1 = "item_mushroom028"; //Death Cap iComponent1 = 5; sSuccess = "You carefully powder and liquify the deadly death cap, extracting the toxins."; sFail = "The toxins evaporate as you fail to liquify the fungus properly."; sItemResRef = "poison_005"; sComponent1Name = "death cap"; } if (GetStringRight(sDItemResRef,3)=="114") // Bakers Yeast { iAlchemyChance=iAlchemyChance-200; sComponent1 = "yeastvial001"; // iComponent1 = 1; sComponent2 = "ITEM_KINDLING"; iComponent2 = 1; iFailFlag=1; iFailNumber=1; sSuccess = "The yeast culture grows within the vial, feeding on the powdered kindling."; sFail = "The powdered kindling is contaminated and the yeast fails to grow."; sItemResRef = "item_yeast001"; sFailResRef = "yeastvial001"; sComponent1Name = "yeast vials"; sComponent2Name = "kindling"; } if (GetStringRight(sDItemResRef,3)=="115") // Brewers Yeast - Lager { iAlchemyChance=iAlchemyChance-250; sComponent1 = "yeastvial001"; // iComponent1 = 1; sComponent2 = "ITEM_KINDLING"; iComponent2 = 2; iFailFlag=1; iFailNumber=1; sSuccess = "The yeast culture grows within the vial, feeding on the powdered kindling."; sFail = "The powdered kindling is contaminated and the yeast fails to grow."; sItemResRef = "item_yeast002"; sFailResRef = "yeastvial001"; sComponent1Name = "yeast vials"; sComponent2Name = "kindling"; } if (GetStringRight(sDItemResRef,3)=="116") // Brewers Yeast - Ale { iAlchemyChance=iAlchemyChance-300; sComponent1 = "yeastvial001"; // iComponent1 = 1; sComponent2 = "ITEM_KINDLING"; iComponent2 = 3; iFailFlag=1; iFailNumber=1; sSuccess = "The yeast culture grows within the vial, feeding on the powdered kindling."; sFail = "The powdered kindling is contaminated and the yeast fails to grow."; sItemResRef = "item_yeast003"; sFailResRef = "yeastvial001"; sComponent1Name = "yeast vials"; sComponent2Name = "kindling"; } if (GetStringLeft(sDItemResRef,7)=="essence") { iStackable=1; iComponent1Stackable =1; sItemResRef = "essence"+GetStringRight(sDItemResRef,3); sFail = "The essence evaporates away as you fail to extract it properly..."; sSuccess = "You carefully extract the "; iAlchemyChance=iAlchemyChance-150; switch (StringToInt(GetStringRight(sDItemResRef,3))) { case 1: { sSuccess=sSuccess+"Essence of Acid"; sComponent1 = "GEM_POWDER_HEMATITE"; iComponent1 = 5; sComponent2 = "ITEM_SULPHUR"; iComponent2 = 2; sComponent3 = "NW_IT_MSMLMISC08"; iComponent3 = 4; sComponent1Name="powdered hematite"; sComponent2Name="sulphur"; sComponent3Name="fire beetle bellies"; break; } case 2: { sSuccess=sSuccess+"Essence of Necrosis"; sComponent1 = "GEM_POWDER_CHALCENDONY"; iComponent1 = 3; sComponent2 = "NW_IT_MSMLMISC13"; iComponent2 = 5; sComponent3 = "item_mushroom027"; iComponent3 = 3; sComponent1Name="powdered chalcendony"; sComponent2Name="skeleton knuckles"; sComponent3Name="fly agaric fungi"; break; } case 3: { sSuccess=sSuccess+"Essence of Luck"; sComponent1 = "GEM_POWDER_RUBY"; iComponent1 = 1; sComponent2 = "NW_IT_MSMLMISC19"; iComponent2 = 3; sComponent3 = "ITEM_ACORN"; iComponent3 = 4; sComponent1Name="powdered ruby"; sComponent2Name="fairy dust"; sComponent3Name="acorns"; break; } case 4: { sSuccess=sSuccess+"Essence of the Five Senses"; sComponent1 = "GEM_POWDER_TOURMALINE"; iComponent1 = 3; sComponent2 = "item_mushroom064"; iComponent2 = 5; sComponent3 = "SEED_PERIWINKLE"; iComponent3 = 4; sComponent1Name="powdered tourmaline"; sComponent2Name="dung-loving psilocybe fungi"; sComponent3Name="periwinkle blossoms"; break; } case 5: { sSuccess=sSuccess+"Essence of Ability"; sComponent1 = "GEM_POWDER_SAPPHIRE"; iComponent1 = 2; sComponent2 = "SEED_MANDRAKE"; iComponent2 = 2; sComponent3 = "item_mushroom020"; iComponent3 = 2; sComponent1Name="powdered sapphire"; sComponent2Name="mandrake roots"; sComponent3Name="stone fungi"; break; } case 6: { sSuccess=sSuccess+"Essence of Electricity"; sComponent1 = "GEM_POWDER_STARRUBY"; iComponent1 = 2; sComponent2 = "NW_IT_MSMLMISC10"; iComponent2 = 2; sComponent3 = "FLOWER_WHITETULIP"; iComponent3 = 2; sComponent1Name="powdered star ruby"; sComponent2Name="slaad's tongues"; sComponent3Name="white tulip blossoms"; break; } case 7: { sSuccess=sSuccess+"Essence of the Mind"; sComponent1 = "GEM_POWDER_OPAL"; iComponent1 = 2; sComponent2 = "FLOWER_BLUEIRIRS"; iComponent2 = 3; sComponent3 = "item_mushroom032"; iComponent3 = 2; sComponent1Name="powdered opal"; sComponent2Name="blue iris blossoms"; sComponent3Name="devil's snuffbox puffball fungi"; break; } case 8: { sSuccess=sSuccess+"Essence of Venom"; sComponent1 = "GEM_POWDER_JASPER"; iComponent1 = 3; sComponent2 = "item_mushroom028"; iComponent2 = 4; sComponent3 = "FLOWER_BLACKTULIP"; iComponent3 = 5; sComponent1Name="powdered jasper"; sComponent2Name="death cap fungi"; sComponent3Name="black tulip blossoms"; break; } case 9: { sSuccess=sSuccess+"Essence of the Trickster"; sComponent1 = "GEM_POWDER_AQUAMARINE"; iComponent1 = 3; sComponent2 = "SEED_CATNIP"; iComponent2 = 5; sComponent3 = "item_mushroom059"; iComponent3 = 3; sComponent1Name="powdered aquamarine"; sComponent2Name="sprigs of catnip"; sComponent3Name="dung-loving bird's nest fungi"; break; } case 10: { sSuccess=sSuccess+"Essence of Light"; sComponent1 = "GEM_POWDER_CITRINE"; iComponent1 = 3; sComponent2 = "item_mushroom013"; iComponent2 = 3; sComponent3 = "FLOWER_WHITEIRIS"; iComponent3 = 3; sComponent1Name="powdered citrine"; sComponent2Name="sulfur tuft fungi"; sComponent3Name="white iris blossoms"; break; } case 11: { sSuccess=sSuccess+"Essence of Fire"; sComponent1 = "GEM_POWDER_FIREOPAL"; iComponent1 = 2; sComponent2 = "SEED_MISTLETOE"; iComponent2 = 5; sComponent3 = "item_mushroom069"; iComponent3 = 2; sComponent1Name="powdered fire opal"; sComponent2Name="sprigs of mistletoe"; sComponent3Name="giant puffball fungi"; break; } case 12: { sSuccess=sSuccess+"Essence of the Planes"; sComponent1 = "GEM_POWDER_JET"; iComponent1 = 2; sComponent2 = "item_mushroom047"; iComponent2 = 4; sComponent3 = "SEED_NASTURTIUM"; iComponent3 = 4; sComponent1Name="powdered jet"; sComponent2Name="quivering spine fungi"; sComponent3Name="nasturtium blossoms"; break; } case 13: { sSuccess=sSuccess+"Essence of Power"; sComponent1 = "GEM_POWDER_DIAMOND"; iComponent1 = 1; sComponent2 = "FLOWER_REDIRIS"; iComponent2 = 4; sComponent3 = "item_mushroom017"; iComponent3 = 3; sComponent1Name="powdered diamond"; sComponent2Name="red iris blossoms"; sComponent3Name="earth star fungi"; break; } case 14: { sSuccess=sSuccess+"Essence of the Elements"; sComponent1 = "GEM_POWDER_CORAL"; iComponent1 = 3; sComponent2 = "item_mushroom009"; iComponent2 = 4; sComponent3 = "FLOWER_BLUETULIP"; iComponent3 = 3; sComponent1Name="powdered coral"; sComponent2Name="earthball fungi"; sComponent3Name="blue tulip blossoms"; break; } case 15: { sSuccess=sSuccess+"Essence of Energy"; sComponent1 = "GEM_POWDER_BLACKOPAL"; iComponent1 = 2; sComponent2 = "FLOWER_BLACKIRIS"; iComponent2 = 2; sComponent3 = "item_mushroom035"; iComponent3 = 3; sComponent1Name="powdered black opal"; sComponent2Name="black iris blossoms"; sComponent3Name="witch's butter fungi"; break; } case 16: { sSuccess=sSuccess+"Essence of Protection"; sComponent1 = "GEM_POWDER_AMETHYST"; iComponent1 = 3; sComponent2 = "item_mushroom016"; iComponent2 = 3; sComponent3 = "FLOWER_YELLOWTULIP"; iComponent3 = 3; sComponent1Name="powdered amethyst"; sComponent2Name="pale blue pouch fungi"; sComponent3Name="yellow tulip blossoms"; break; } case 17: { sSuccess=sSuccess+"Essence of Cold"; sComponent1 = "GEM_POWDER_JADE"; iComponent1 = 3; sComponent2 = "SEED_SPEARMINT"; iComponent2 = 5; sComponent3 = "item_mushroom051"; iComponent3 = 3; sComponent1Name="powdered jade"; sComponent2Name="spearmint"; sComponent3Name="sugar icing fungi"; break; } case 18: { sSuccess=sSuccess+"Essence of Nature"; sComponent1 = "GEM_POWDER_BLOODSTONE"; iComponent1 = 3; sComponent2 = "item_mushroom022"; iComponent2 = 3; sComponent3 = "SEED_GINGER"; iComponent3 = 5; sComponent1Name="powdered bloodstone"; sComponent2Name="earth tongue fungi"; sComponent3Name="ginger roots"; break; } case 19: { sSuccess=sSuccess+"Essence of the Soul"; sComponent1 = "GEM_POWDER_OPAL"; iComponent1 = 2; sComponent2 = "SEED_JUNIPERBERRY"; iComponent2 = 5; sComponent3 = "item_mushroom001"; iComponent3 = 4; sComponent1Name="powdered opal"; sComponent2Name="juniper berries"; sComponent3Name="artist's conk fungi"; break; } case 20: { sSuccess=sSuccess+"Essence of Transmutation"; sComponent1 = "GEM_POWDER_MOONSTONE"; iComponent1 = 5; sComponent2 = "item_mushroom025"; iComponent2 = 3; sComponent3 = "ITEM_BEESWAX"; iComponent3 = 5; iComponent3Stackable = 1; sComponent1Name="powdered moonstone"; sComponent2Name="false truffles"; sComponent3Name="beeswax"; break; } default:{break;} } sSuccess=sSuccess+"."; } if (GetNumItems(oPC,sComponent1) < iComponent1) { FloatingTextStringOnCreature("You do not have enough "+sComponent1Name+" to do this.",oPC,FALSE); CreateItemOnObject(GetResRef(oItem),OBJECT_SELF,1); //CopyObject(oItem,GetLocation(OBJECT_SELF),OBJECT_SELF,sOldTag); //DelayCommand(10.0,DestroyObject(oItem)); DestroyObject(oItem); return; } if (iComponent2 > 0) { if (GetNumItems(oPC,sComponent2) < iComponent2) { FloatingTextStringOnCreature("You do not have enough "+sComponent2Name+" to do this.",oPC,FALSE); CreateItemOnObject(GetResRef(oItem),OBJECT_SELF,1); //CopyObject(oItem,GetLocation(OBJECT_SELF),OBJECT_SELF,sOldTag); //DelayCommand(10.0,DestroyObject(oItem)); DestroyObject(oItem); return; } } if (iComponent3 > 0) { if (GetNumItems(oPC,sComponent3) < iComponent3) { FloatingTextStringOnCreature("You do not have enough "+sComponent3Name+" to do this.",oPC,FALSE); CreateItemOnObject(GetResRef(oItem),OBJECT_SELF,1); //CopyObject(oItem,GetLocation(OBJECT_SELF),OBJECT_SELF,sOldTag); //DelayCommand(10.0,DestroyObject(oItem)); DestroyObject(oItem); return; } } fDelay=0.1; if (iComponent1Stackable != 0) { //WriteTimestampedLogEntry("Begin Component 1 destruction"); oTemp = GetItemPossessedBy(oPC,sComponent1); //WriteTimestampedLogEntry("GetItemPossessedBy successful"); if (oTemp==OBJECT_INVALID) { SendMessageToPC(oPC,"ERROR -- Locating components for destruction."); return; } sComponentResRef = GetResRef(oTemp); iStackSize = GetNumStackedItems(oTemp); //WriteTimestampedLogEntry("Destroying object"); DestroyObject(oTemp); //WriteTimestampedLogEntry("Destroyed Object - Successful"); if (iStackSize < iComponent1) { iComponent1 = iComponent1 - iStackSize; DelayCommand(2.0,GetNextStackedItem(oPC,sComponent1,iComponent1,1,sComponentResRef)); } else { if (iStackSize > iComponent1) { //WriteTimestampedLogEntry("Returning unused stack"); iStackSize = iStackSize - iComponent1; DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize)); } } } else { for (iComponent1; iComponent1>0; iComponent1--) { //WriteTimestampedLogEntry("Destroying Non-Stacked items (inside loop)"); fDelay = fDelay+0.5; DelayCommand(fDelay,GetNextItemPossessedBy(oPC,sComponent1)); } } //WriteTimestampedLogEntry("Component 1 completed"); if (sComponent2 != "") { if (iComponent2Stackable != 0) { oTemp = GetItemPossessedBy(oPC,sComponent2); sComponentResRef = GetResRef(oTemp); iStackSize = GetNumStackedItems(oTemp); DestroyObject(oTemp); if (iStackSize < iComponent2) { iComponent2 = iComponent2 - iStackSize; DelayCommand(2.0,GetNextStackedItem(oPC,sComponent2,iComponent2,1, sComponentResRef)); } else { if (iStackSize > iComponent2) { iStackSize = iStackSize - iComponent2; DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize)); } } } else { for (iComponent2; iComponent2>0; iComponent2--) { fDelay = fDelay+0.5; DelayCommand(fDelay,GetNextItemPossessedBy(oPC,sComponent2)); } } } if (sComponent3 != "") { if (iComponent3Stackable != 0) { oTemp = GetItemPossessedBy(oPC,sComponent3); sComponentResRef = GetResRef(oTemp); iStackSize = GetNumStackedItems(oTemp); DestroyObject(oTemp); if (iStackSize < iComponent3) { iComponent3 = iComponent3 - iStackSize; DelayCommand(2.0,GetNextStackedItem(oPC,sComponent3,iComponent3,1, sComponentResRef)); } else { if (iStackSize > iComponent3) { iStackSize = iStackSize - iComponent3; DelayCommand(1.0,CreateAnObject(sComponentResRef,oPC,iStackSize)); } } } else { for (iComponent3; iComponent3>0; iComponent3--) { fDelay = fDelay+0.5; DelayCommand(fDelay,GetNextItemPossessedBy(oPC,sComponent3)); } } } // end of inserted stackable item checker/deleter DelayCommand(8.0,SetLocalInt(OBJECT_SELF,"iAmInUse",0)); CreateItemOnObject(GetResRef(oItem),OBJECT_SELF,1); //CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem)); DelayCommand(6.0,DestroyObject(oItem)); } // end of iUseMode != 0 section (removed recipe token) //-------------------- SetLocalInt(OBJECT_SELF,"iAmInUse",99); AssignCommand(oPC,PlaySound("as_na_splash2")); AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,6.0)); // This snippet of code is cut-n-paste direct from ATS // Reason for this is because I had no clue how to assign an increase // in the z-axis of the location of the anvil for sparks to display. // After reading through this code, it is obvious that vEffecrPos.z // is the line which assigns this. Due to my own ignorance in this issue // I have decided to leave this snippet of code intact with this credit to // the original ATS script coders, whomever they may have been. location locAnvil = GetLocation(OBJECT_SELF); vector vEffectPos = GetPositionFromLocation(locAnvil); vEffectPos.z += 1.0; location locEffect = Location( GetAreaFromLocation(locAnvil), vEffectPos,GetFacingFromLocation(locAnvil) ); object oFire = CreatePlaceable("plc_dustplume", locEffect, 6.0); AssignCommand(oFire,PlaySound("as_na_steamlong1")); AssignCommand(oFire,DelayCommand(2.0,PlaySound("as_cv_smithbelo1"))); AssignCommand(oFire,DelayCommand(3.0,PlaySound("as_cv_smithbelo1"))); AssignCommand(oFire,DelayCommand(4.0,PlaySound("as_cv_smithbelo1"))); AssignCommand(oFire,DelayCommand(5.0,PlaySound("as_cv_smithbelo1"))); DelayCommand(3.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_FNF_SMOKE_PUFF,FALSE),GetLocation(oFire),6.0)); DelayCommand(2.0,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_COM_SPARKS_PARRY),locEffect)); //location lSelf = GetLocation(OBJECT_SELF); //float fSelf = GetFacing(OBJECT_SELF)+180.0; //vector vSelf = GetPosition(OBJECT_SELF); //object oArea = GetArea(OBJECT_SELF); //vector vFire; //int vDirection; //vFire = vSelf + (AngleToVector(fSelf) * 0.5); //location lFire = Location(oArea,vFire,fSelf); iRandom = Random(1000); if (iRandom < iAlchemyChance) { iSuccess = 1; } if (iSuccess == 1) { DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)); if (iSuccessNumber >1) { if (iStackable != 0) { DelayCommand(6.1,CreateAnObject(sItemResRef,oPC,iSuccessNumber)); if (iFailFlag != 0) if (iFailStackable !=0) { DelayCommand(6.5,CreateAnObject(sFailResRef,oPC,iFailNumber)); } else { for (iFailNumber; iFailNumber>0; iFailNumber--) { fTemp = fTemp+0.1; DelayCommand(6.5+fTemp,CreateAnObject(sFailResRef,oPC,1)); } } } else { for (iSuccessNumber; iSuccessNumber>0; iSuccessNumber--) { fTemp = fTemp+0.1; DelayCommand(5.0+fTemp,CreateAnObject(sItemResRef,oPC,1)); //DelayCommand(5.0+fTemp,SendMessageToPC(oPC,sItemResRef+" is created")); } if (iFailFlag != 0) { for (iFailNumber; iFailNumber>0; iFailNumber--) { fTemp = fTemp+0.1; DelayCommand(5.0+fTemp,CreateAnObject(sFailResRef,oPC,1)); } } } } else { DelayCommand(6.0,CreateAnObject(sItemResRef,oPC,1)); if (iFailFlag !=0) { for (iFailNumber; iFailNumber>0; iFailNumber--) { fTemp = fTemp+0.1; DelayCommand(5.0+fTemp,CreateAnObject(sFailResRef,oPC,1)); } } } iRandom = Random(1000); if (iRandom >= iAlchemySkill) { if (d10(1)+1 >= iAlchemyChance/100) iSkillGain = 1; } } else { DelayCommand(6.0,FloatingTextStringOnCreature(sFail,oPC,FALSE)); if (sFailResRef != "") { if (Random(1000) <= iAlchemySkill) { DelayCommand(7.0,FloatingTextStringOnCreature("You manage to recover the ruined product....",oPC,FALSE)); DelayCommand(7.0,CreateAnObject(sFailResRef,oPC,1)); } } } //Ensure no more than 1 skill gain every 10 seconds to avoid token droppage. if (iSkillGain ==1) { if (GetLocalInt(oPC,"iSkillGain")!= 0) { iSkillGain = 0; } else { SetLocalInt(oPC,"iSkillGain",99); DelayCommand(10.0,SetLocalInt(oPC,"iSkillGain",0)); } } if (iSkillGain ==1) { string sOldSkill = ""; string sOldSkill2 = ""; iAlchemySkill++; sOldSkill2 = IntToString(iAlchemySkill); sOldSkill = "."+GetStringRight(sOldSkill2,1); if (iAlchemySkill > 9) { sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill; } else { sOldSkill = "0"+sOldSkill; } if (iAlchemySkill <= 1000) { //DelayCommand(6.0,SetTokenPair(oPC,14,12,iAlchemySkill)); DelayCommand(6.0,SetCampaignInt("UOACraft","iAlchemySkill",iAlchemySkill,oPC)); DelayCommand(6.0,SendMessageToPC(oPC,"==================================")); DelayCommand(6.0,SendMessageToPC(oPC,"Your skill in alchemy has gone up!")); DelayCommand(6.0,SendMessageToPC(oPC,"Current alchemy skill : "+ sOldSkill+"%")); DelayCommand(6.0,SendMessageToPC(oPC,"==================================")); if (GetLocalInt(GetModule(),"_UOACraft_XP")!=0) DelayCommand(5.9,GiveXPToCreature(oPC,GetLocalInt(GetModule(),"_UOACraft_XP"))); } } } void CreateAnObject(string sResource, object oPC, int iStackSize) { CreateItemOnObject(sResource,oPC,iStackSize); return; } void GetNextItemPossessedBy(object oPC, string sItemTag) { object oTemp = GetItemPossessedBy(oPC,sItemTag); DestroyObject(oTemp); return; } object CreatePlaceable(string sObject, location lPlace, float fDuration) { object oPlaceable = CreateObject(OBJECT_TYPE_PLACEABLE,sObject,lPlace,FALSE); if (fDuration != 0.0) DestroyObject(oPlaceable,fDuration); return oPlaceable; } void GetNextStackedItem(object oPC, string sItemTag, int iCount, int iMode, string sStackResRef) { object oTemp = GetItemPossessedBy(oPC,sItemTag); int iStackCount = GetNumStackedItems(oTemp); int iTemp = iCount - iStackCount; iStackCount = iStackCount-iCount; DestroyObject(oTemp); if (iStackCount > 0) { SendMessageToPC(oPC,"You should get back "+IntToString(iStackCount)); DelayCommand(1.0,CreateAnObject(sStackResRef,oPC,iStackCount)); } // this next line *should* recursively call this function if the number of // stacked items does not meet the required number of items to be destroyed. if (iTemp > 0) DelayCommand(1.0,GetNextStackedItem(oPC,sItemTag,iTemp, iMode, sStackResRef)); return; }