//new enchant script - Oct 18,2005 //#include "_persist_01a" #include "x2_inc_itemprop" #include "aps_include" void GetNextItemPossessedBy(object oPC, string sItemTag); void GetNextStackedItem(object oPC, string sEssenceTag, int iCount); void CreateAnObject(string sResource, object oPC, int iStackSize); object CreatePlaceable(string sObject, location lPlace, float fDuration); object oTestValid=OBJECT_INVALID; void EnchantWeapon(object oItem,int wBonus); void EnPowerWeapon(object oItem,int DamageType,int DamageQty); void GiveToPC(object oItem, object oPC); string sDialogResRef=""; string sEssence; int iEnpower=0; void main() { object oPC = GetLastDisturbed(); object oItem = GetInventoryDisturbItem(); string sItemTag = GetTag(oItem); string sReEnchantMessage = "INVALID"; int iReEnchant = 0; int iBaseItem=0; int iMaxReEnchant; int iMaxReEnchant2; int iMaxReEnchant3; int wBonus=1; int wEffect=0; int iEnchantSkill = GetPersistentInt(oPC,"iEnchantSkill","UOACraft"); int iEnchantChance = iEnchantSkill; if (GetInventoryDisturbType()!= INVENTORY_DISTURB_TYPE_ADDED) { if (sItemTag=="ENCHANT_WEAPON1") { SetLocalInt(oPC,"iEnchant",1); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +1.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON2") { if (iEnchantChance >= 100) { SetLocalInt(oPC,"iEnchant",2); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +2.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON3") { if (iEnchantChance >= 157) { SetLocalInt(oPC,"iEnchant",3); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +3.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON4") { if (iEnchantChance >= 214) { SetLocalInt(oPC,"iEnchant",4); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +4.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON5") { if (iEnchantChance >= 271) { SetLocalInt(oPC,"iEnchant",5); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +5",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON6") { if (iEnchantChance >= 328) { SetLocalInt(oPC,"iEnchant",6); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +6.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON7") { if (iEnchantChance >= 385) { SetLocalInt(oPC,"iEnchant",7); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +7.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON8") { if (iEnchantChance >= 442) { SetLocalInt(oPC,"iEnchant",8); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +8.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON9") { if (iEnchantChance >= 500) { SetLocalInt(oPC,"iEnchant",9); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +9.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON10") { if (iEnchantChance >= 590) { SetLocalInt(oPC,"iEnchant",10); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +10.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON11") { if (iEnchantChance >= 640) { SetLocalInt(oPC,"iEnchant",11); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +11.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON12") { if (iEnchantChance >= 730) { SetLocalInt(oPC,"iEnchant",12); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +12.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON13") { if (iEnchantChance >= 840) { SetLocalInt(oPC,"iEnchant",13); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +13.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } if (sItemTag=="ENCHANT_WEAPON14") { if (iEnchantChance >= 950) { SetLocalInt(oPC,"iEnchant",14); SetLocalInt(oPC,"iEnpower",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enchant a weapon to +14.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enchant this.",oPC,FALSE); } //XXXXX the following is Bows XXXXXXXXXXXX // this is a brand new section new tags and ienchant goes to higher numbers //end of bows if (sItemTag=="ENPOWER_WEAPON1") { if (iEnchantChance >= 700) { SetLocalInt(oPC,"iEnpower",1); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Acid.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON2") { if (iEnchantChance >= 700) { SetLocalInt(oPC,"iEnpower",2); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Cold.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON3") { if (iEnchantChance >= 700) { SetLocalInt(oPC,"iEnpower",3); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Electricity.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON4") { if (iEnchantChance >= 700) { SetLocalInt(oPC,"iEnpower",4); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Fire.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON5") { if (iEnchantChance >= 800) { SetLocalInt(oPC,"iEnpower",5); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Acid.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON6") { if (iEnchantChance >= 800) { SetLocalInt(oPC,"iEnpower",6); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Cold.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON7") { if (iEnchantChance >= 800) { SetLocalInt(oPC,"iEnpower",7); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Electricity.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON8") { if (iEnchantChance >= 800) { SetLocalInt(oPC,"iEnpower",8); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Fire.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON9") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",9); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Acid.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON10") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",10); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Cold.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON11") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",11); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Electricity.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON12") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",12); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Fire.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON13") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",13); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Acid.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON14") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",14); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Cold.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON15") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",15); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Electricity.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } if (sItemTag=="ENPOWER_WEAPON16") { if (iEnchantChance >= 900) { SetLocalInt(oPC,"iEnpower",16); SetLocalInt(oPC,"iEnchant",0); FloatingTextStringOnCreature("Enchanting forge is now set to Enpower a weapon with Fire.",oPC,FALSE); } else FloatingTextStringOnCreature("You do not have sufficient skill to enpower this.",oPC,FALSE); } CopyObject(oItem,GetLocation(oPC),OBJECT_SELF,GetTag(oItem)); DestroyObject(oItem); return; } // 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 table has been destroyed."); return; } // End of compatability portion. if (GetLocalInt(OBJECT_SELF,"iAmInUse")!=0) { FloatingTextStringOnCreature("You must wait for this item to finish enchanting..",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem); return; } iBaseItem = GetBaseItemType(oItem); string sItemResRef = ""; int iStackSize = 0; int iMaxStack = 5; string sSuccess = ""; if (GetStringLeft(sItemTag,5) != "WEAP_" && GetStringLeft(sItemTag,5) != "GLOV_") { CopyItem(oItem,oPC,TRUE); FloatingTextStringOnCreature("You cannot Enchant this item!.",oPC,FALSE); DestroyObject(oItem); return; } if (iEnchantChance <350) { iEnchantChance = GetAbilityScore(oPC,ABILITY_INTELLIGENCE)*3; iEnchantChance = iEnchantChance + GetAbilityScore(oPC,ABILITY_DEXTERITY) + GetAbilityScore(oPC,ABILITY_WISDOM); iEnchantChance = iEnchantChance * 3; if (iEnchantChance >350) iEnchantChance = 350; if (iEnchantSkill > iEnchantChance) iEnchantChance = iEnchantSkill; } if (sItemResRef=="INVALID") { SendMessageToPC(oPC,"You cannot Enchant this item!"); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } if (iEnchantChance < 1) { if (iReEnchant==0) { FloatingTextStringOnCreature("You have no idea how to Enchant this item.",oPC,FALSE); } else { FloatingTextStringOnCreature("You have no idea how to reEnchant this item.",oPC,FALSE); } CopyItem(oItem,oPC,TRUE); DestroyObject(oItem); return; } string sFlame= ""; int iEnchant = GetLocalInt(oPC,"iEnchant"); float fAngleToVector = 0.4; switch(iEnchant) //se chance of success { case 1: { fAngleToVector = 0.5; if (iReEnchant==0)iEnchantChance = iEnchantChance+150; break; } case 2: { fAngleToVector = 0.6; if (iReEnchant==0)iEnchantChance = iEnchantChance+100; break; } case 3: { fAngleToVector = 0.6; if (iReEnchant==0)iEnchantChance = iEnchantChance+75; break; } case 4: { fAngleToVector = 0.2; if (iReEnchant==0)iEnchantChance = iEnchantChance+50; break; } case 5: { fAngleToVector = 0.3; if (iReEnchant==0)iEnchantChance = iEnchantChance; break; } case 6: { fAngleToVector = 0.3; if (iReEnchant==0)iEnchantChance = iEnchantChance-100; break; } case 7: { fAngleToVector = 0.3; if (iReEnchant==0)iEnchantChance = iEnchantChance-250; break; } case 8: { fAngleToVector = 0.4; if (iReEnchant==0)iEnchantChance = iEnchantChance-270; sFlame = "plc_flamemedium"; break; } case 9: { fAngleToVector = 0.4; if (iReEnchant==0)iEnchantChance = iEnchantChance-290; sFlame = "plc_flamemedium"; break; } case 10: { fAngleToVector = 0.4; if (iReEnchant==0)iEnchantChance = iEnchantChance-310; sFlame = "plc_flamemedium"; break; } case 11: { fAngleToVector = 0.4; if (iReEnchant==0)iEnchantChance = iEnchantChance-330; sFlame = "plc_flamelarge"; break; } case 12: { fAngleToVector = 0.4; if (iReEnchant==0)iEnchantChance = iEnchantChance-350; sFlame = "plc_flamelarge"; break; } case 13: { fAngleToVector = 0.4; if (iReEnchant==0)iEnchantChance = iEnchantChance-370; sFlame = "plc_flamelarge"; break; } case 14: { fAngleToVector = 0.4; if (iReEnchant==0)iEnchantChance = iEnchantChance-390; sFlame = "plc_flamelarge"; break; } default: { sFlame = "plc_flamemedium"; break; } } int iEnpower = GetLocalInt(oPC,"iEnpower"); switch(iEnpower) { case 1: { sEssence = "essence001"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ACID); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d6); FloatingTextStringOnCreature("Item valid. Damage set.",oPC,FALSE); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } break; } case 2: { sEssence = "essence017"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_COLD); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d6); FloatingTextStringOnCreature("Item valid. Damage set.",oPC,FALSE); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } break; } case 3: { sEssence = "essence006"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ELECTRICAL); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d6); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } break; } case 4: { sEssence = "essence011"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_FIRE); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d6); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } break; } case 5: { sEssence = "essence001"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ACID); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d8); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } break; } case 6: { sEssence = "essence017"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_COLD); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d8); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } break; } case 7: { sEssence = "essence006"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ELECTRICAL); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d8); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); return; } break; } case 8: { sEssence = "essence011"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_FIRE); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d8); return; } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 9: { sEssence = "essence001"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ACID); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d10); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 10: { sEssence = "essence017"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_COLD); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d10); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 11: { sEssence = "essence006"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ELECTRICAL); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d10); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 12: { sEssence = "essence011"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_FIRE); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d10); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 13: { sEssence = "essence001"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ACID); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d12); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 14: { sEssence = "essence017"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_COLD); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d12); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 15: { sEssence = "essence006"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_ELECTRICAL); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d12); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } case 16: { sEssence = "essence011"; if(GetItemPossessedBy(oPC,sEssence) != oTestValid) { SetLocalInt(oPC,"DamageType",IP_CONST_DAMAGETYPE_FIRE); SetLocalInt(oPC,"DamageQty",IP_CONST_DAMAGEBONUS_1d12); } else { SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); CopyItem(oItem,oPC,TRUE); DestroyObject(oItem,0.1); FloatingTextStringOnCreature("You do not have enough essence for this.",oPC,FALSE); return; } break; } default: { int DamageType=0; int DamageQty=0; break; } } //end of switch location lSelf = GetLocation(OBJECT_SELF); float fSelf = GetFacing(OBJECT_SELF); vector vSelf = GetPosition(OBJECT_SELF); object oArea = GetArea(OBJECT_SELF); vector vFire; int vDirection; vFire = vSelf + (AngleToVector(fSelf) * fAngleToVector); location lFire = Location(oArea,vFire,fSelf); object oFire = CreatePlaceable(sFlame, lFire, 6.0); AssignCommand(oPC,PlaySound("al_mg_chntmagic1")); AssignCommand(oPC,PlaySound("al_mg_crystalgd1")); AssignCommand(oPC,PlaySound("al_mg_jacobs1")); AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,4.0)); PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE,1.0,6.0); SetLocalInt(OBJECT_SELF,"iAmInUse",99); DelayCommand(7.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)); } int iRandom = 0; int iSuccess = 0; int iSkillGain = 0; ///////////////////////////////////////////begin stackables object oTemp = OBJECT_INVALID; oTemp = GetItemPossessedBy(oPC,sEssence); object oEssence = oTemp; string sEssenceTag = GetTag(oEssence); int iCount = 0; int iEssence = 1; iCount = GetNumStackedItems(oTemp); DestroyObject(oTemp); if (iCount iEssence) { iCount = iCount - iEssence; SendMessageToPC(oPC,"You should get back "+IntToString(iCount)+" essences"); DelayCommand(1.0,CreateAnObject(sEssence,oPC,iCount)); } } //DestroyObject(GetItemPossessedBy(oPC,sEssence)); //Comment out ////////////////////////////////////////////////////////////////end stackables iEnpower = GetLocalInt(oPC,"iEnpower"); if (iEnpower > 0) iEnchantChance = iEnchantChance - (iEnchantSkill * iEnpower/100); //SendMessageToPC(oPC,"Value of iEnchantChance : " + IntToString(iEnchantChance)); if (Random(1000) <= iEnchantChance) { iSuccess = 1; iStackSize = 1; if (iEnchant>=1) { DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_CONJURE1,1.0,1.0))); DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY1,1.0,1.0))); DelayCommand(5.0,EnchantWeapon(oItem,iEnchant)); DelayCommand(6.0, GiveToPC(oItem,oPC)); sSuccess = "You successfully Enchant the Item"; DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)); DelayCommand(5.8,PlaySound("vs_chant_conj_lm")); DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_DUR_BLUR,FALSE),OBJECT_SELF,2.0)); } //end of iEnchant if int DamageType =GetLocalInt(oPC,"DamageType"); int DamageQty =GetLocalInt(oPC,"DamageQty"); if (iEnpower>=1) { DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_CONJURE2,1.0,1.0))); DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_FIREFORGET_VICTORY2,1.0,1.0))); DelayCommand(5.0,EnPowerWeapon(oItem,DamageType,DamageQty)); DelayCommand(6.0, GiveToPC(oItem,oPC)); sSuccess = "You successfully Enpower the Item"; SetLocalInt(oPC,"DamageType",0); SetLocalInt(oPC,"DamageQty",0); DelayCommand(6.0,FloatingTextStringOnCreature(sSuccess,oPC,FALSE)); DelayCommand(5.8,PlaySound("vs_chant_ench_hm")); DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_BEAM_LIGHTNING,FALSE),OBJECT_SELF,2.0)); } //end of iEnpower if } else { DelayCommand(5.0,AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_TIRED,1.0,1.0))); DelayCommand(6.0,FloatingTextStringOnCreature("The incantation fails and the item is lost.",oPC,FALSE)); DelayCommand(5.8,PlaySound("as_na_steamshrt2")); DelayCommand(6.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectVisualEffect(VFX_DUR_PARALYZED,FALSE),OBJECT_SELF,2.0)); } DelayCommand(6.0,DestroyObject(oItem)); if (iSuccess == 1) { iRandom = Random(1000); if (iEnchantSkill > 700) iRandom = iRandom + 30; if (iEnchantSkill > 998) iRandom = iRandom - 25; if (iEnchantSkill > 999) iRandom = 0; if (iRandom > iEnchantSkill) { if (d10(1)+1 >= iEnchantChance/100) iSkillGain = 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)); } } // end of if iskill gain == 1 if (iSkillGain ==1) { string sOldSkill = ""; string sOldSkill2 = ""; iEnchantSkill++; sOldSkill2 = IntToString(iEnchantSkill); sOldSkill = "."+GetStringRight(sOldSkill2,1); if (iEnchantSkill > 9) { sOldSkill = GetStringLeft(sOldSkill2,GetStringLength(sOldSkill2)-1)+sOldSkill; } else { sOldSkill = "0"+sOldSkill; } if (iEnchantSkill <= 1000) { DelayCommand(6.0,SetPersistentInt(oPC,"iEnchantSkill",iEnchantSkill,0,"UOACraft")); DelayCommand(6.0,SendMessageToPC(oPC,"===================================")); DelayCommand(6.0,SendMessageToPC(oPC,"Your skill in Enchanting has gone up!")); DelayCommand(6.0,SendMessageToPC(oPC,"Current Enchanting skill :"+ sOldSkill+"%")); DelayCommand(6.0,SendMessageToPC(oPC,"===================================")); DelayCommand(6.0, GiveXPToCreature(oPC, 5)); } } // end of skill gain } //end of main void CreateAnObject(string sResource, object oPC, int iStackSize) { CreateItemOnObject(sResource,oPC,iStackSize); 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 EnchantWeapon(object oItem,int wBonus) { itemproperty iBonus; if (wBonus < 15) { if (IPGetIsRangedWeapon(oItem)) { iBonus = ItemPropertyAttackBonus(wBonus); } if (GetStringLeft(GetTag(oItem),5) == "GLOV_") { iBonus = ItemPropertyAttackBonus(wBonus); } if (IPGetIsMeleeWeapon(oItem)) { iBonus = ItemPropertyEnhancementBonus(wBonus); } } else { if (IPGetIsRangedWeapon(oItem)) { switch(wBonus) { case 15: { iBonus = ItemPropertyUnlimitedAmmo(); break; } case 16: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_PLUS1); break; } case 17: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_PLUS2); break; } case 18: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_PLUS3); break; } case 19: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_PLUS4); break; } case 20: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_PLUS5); break; } case 21: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_1D6COLD); break; } case 22: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_1D6FIRE); break; } case 23: { iBonus = ItemPropertyUnlimitedAmmo(IP_CONST_UNLIMITEDAMMO_1D6LIGHT); break; } default: { break; } } } if (IPGetIsMeleeWeapon(oItem)) { iBonus = ItemPropertyKeen(); } } IPSafeAddItemProperty(oItem,iBonus); } void GiveToPC(object oItem, object oPC) { CopyItem(oItem,oPC,TRUE); } void EnPowerWeapon(object oItem,int DamageType,int DamageQty) { itemproperty iEffect = ItemPropertyDamageBonus(DamageType,DamageQty); IPSafeAddItemProperty(oItem,iEffect); } /* IP_CONST_DAMAGEBONUS_1 IP_CONST_DAMAGEBONUS_10 IP_CONST_DAMAGEBONUS_1d10 IP_CONST_DAMAGEBONUS_1d12 IP_CONST_DAMAGEBONUS_1d4 IP_CONST_DAMAGEBONUS_1d6 IP_CONST_DAMAGEBONUS_1d8 IP_CONST_DAMAGEBONUS_2 IP_CONST_DAMAGEBONUS_2d10 IP_CONST_DAMAGEBONUS_2d12 IP_CONST_DAMAGEBONUS_2d4 IP_CONST_DAMAGEBONUS_2d6 IP_CONST_DAMAGEBONUS_2d8 IP_CONST_DAMAGEBONUS_3 IP_CONST_DAMAGEBONUS_4 IP_CONST_DAMAGEBONUS_5 IP_CONST_DAMAGEBONUS_6 IP_CONST_DAMAGEBONUS_7 IP_CONST_DAMAGEBONUS_8 IP_CONST_DAMAGEBONUS_9 IP_CONST_DAMAGETYPE_ACID IP_CONST_DAMAGETYPE_BLUDGEONING IP_CONST_DAMAGETYPE_COLD IP_CONST_DAMAGETYPE_DIVINE IP_CONST_DAMAGETYPE_ELECTRICAL IP_CONST_DAMAGETYPE_FIRE IP_CONST_DAMAGETYPE_MAGICAL Any magical (i.e. not physical) damage type. IP_CONST_DAMAGETYPE_NEGATIVE IP_CONST_DAMAGETYPE_PHYSICAL Physical (i.e. not magical) damage type. IP_CONST_DAMAGETYPE_PIERCING IP_CONST_DAMAGETYPE_POSITIVE IP_CONST_DAMAGETYPE_SLASHING IP_CONST_DAMAGETYPE_SONIC IP_CONST_DAMAGETYPE_SUBDUAL */