#include "jw_smith_copy" // Do the correct enchantment according to the type of scroll used. // oItem is the scroll used, oUser is the PC using it, sItemTag is the tag of // the scroll used, oTarget is the armour being targeted. void ZachScroll(object oItem, object oUser,string sItemTag, object oTarget); // Check the item for temporary effects and remove those effects if they exist void RemoveTempEffects (object oTarget); // Do the Minstrel's travelling robe enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nMinstrelsRobe(object oTarget, object oUser); // Do the robe of Andros Dray enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nAndrosRobe(object oTarget, object oUser); // Do the robe of Mystra enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nMystraRobe(object oTarget, object oUser); // Do the robe of Mystra's Champion enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nChampionRobe(object oTarget, object oUser); // Do the robe of Mystra's fist enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nFistRobe(object oTarget, object oUser); // Do the disciple's robe enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nDisciplesRobe(object oTarget, object oUser); // Set as fighter, but we will use this to check if it has any class restriction at all itemproperty iClassRestriction = ItemPropertyLimitUseByClass (IP_CONST_CLASS_FIGHTER); // Do the correct enchantment according to the type of scroll used. // oItem is the scroll used, oUser is the PC using it, sItemTag is the tag of // the scroll used, oTarget is the armour being targeted. void ZachScroll(object oItem, object oUser,string sItemTag, object oTarget) { if (!GetIsObjectValid(oTarget)) { SendMessageToPC(oUser,"You must target an item of clothing with this scroll to use it"); return; } if (GetBaseItemType(oTarget)!=BASE_ITEM_ARMOR) { SendMessageToPC(oUser,"You must target an item of clothing with this scroll to use it"); return; } int nVFX=VFX_FNF_DISPEL_GREATER; // Potion of Cormanthor if(sItemTag=="jw_zach_2"||sItemTag=="jw_zach_3"||sItemTag=="jw_zach_4") { nVFX=VFX_FNF_ELECTRIC_EXPLOSION; } // remove any temp effects from the armour RemoveTempEffects (oTarget); int nSuccess; if (sItemTag=="jw_zach_6") { // this is the Minstrel's travelling robe nSuccess=nMinstrelsRobe(oTarget,oUser); } if (sItemTag=="jw_zach_1") { // this is the robe of Andros Dray nSuccess=nAndrosRobe(oTarget,oUser); } if (sItemTag=="jw_zach_2") { // this is the robe of Mystra nSuccess=nMystraRobe(oTarget,oUser); } if (sItemTag=="jw_zach_3") { // this is the robe of Mystra's Champion nSuccess=nChampionRobe(oTarget,oUser); } if (sItemTag=="jw_zach_4") { // this is the robe of Mystra's Fist nSuccess=nFistRobe(oTarget,oUser); } if (sItemTag=="jw_zach_5") { // this is the robe of the disciple nSuccess=nDisciplesRobe(oTarget,oUser); } // Finish it off if we have been succesful if (nSuccess==TRUE) { ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectVisualEffect(nVFX),oUser); DestroyObject(oItem); } } // Check the item for temporary effects and remove those effects if they exist void RemoveTempEffects (object oTarget) { itemproperty oProperty; object oItem=oTarget; oProperty=GetFirstItemProperty(oItem); while (GetIsItemPropertyValid(oProperty)) { if(GetItemPropertyDurationType(oProperty)==DURATION_TYPE_TEMPORARY) { RemoveItemProperty(oItem,oProperty); } oProperty=GetNextItemProperty(oItem); } } // Do the Minster's travelling robe enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nMinstrelsRobe(object oTarget, object oUser) { int nSuccess=FALSE; // add concentration +5 and perform +5 itemproperty iAdd; // Check if it has ANY class restriction int nHasClass=IPGetItemHasProperty(oTarget,iClassRestriction,-1,TRUE); itemproperty iCheck = ItemPropertyLimitUseByClass(IP_CONST_CLASS_BARD); // This next line checks whether it does have a class restriction but not the one we are looking for if (nHasClass==TRUE && IPGetItemHasProperty(oTarget,iCheck,-1) == FALSE) { SendMessageToPC(oUser,"This scroll will make a robe for bards to use, but this item is only useable by a different class. Therefore the scroll will not work on it."); return FALSE; } iAdd=ItemPropertySkillBonus(SKILL_CONCENTRATION,5); if (IPGetItemHasProperty(oTarget,iAdd,-1)) { SendMessageToPC(oUser,"This item already gives a bonus to concentration and Zacharia's scroll cannot give it any more."); } else { // The first time we do it, we wipe out existing skills IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); iAdd=ItemPropertySkillBonus(SKILL_PERFORM,5); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,FALSE); // When adding bard only, we REMOVE any other classes that are allowed to use it. iAdd=ItemPropertyLimitUseByClass(IP_CONST_CLASS_BARD); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } return nSuccess; } // Do the robe of Andros Dray enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nAndrosRobe(object oTarget, object oUser) { int nSuccess=FALSE; // add concentration +5 and bonus spell of level 2; itemproperty iAdd; string sClass = "wizard"; int nClass=IP_CONST_CLASS_WIZARD; if (GetLevelByClass(CLASS_TYPE_SORCERER,oUser)>=1) { nClass=IP_CONST_CLASS_SORCERER; sClass="sorcerer"; } // Check if it has ANY class restriction int nHasClass=IPGetItemHasProperty(oTarget,iClassRestriction,-1,TRUE); itemproperty iCheck = ItemPropertyLimitUseByClass(nClass); // This next line checks whether it does have a class restriction but not the one we are looking for if (nHasClass==TRUE && IPGetItemHasProperty(oTarget,iCheck,-1) == FALSE) { SendMessageToPC(oUser,"This scroll will make a robe for a "+sClass+" to use, but this item is only useable by a different class. Therefore the scroll will not work on it."); return FALSE; } // do the concentration stuff iAdd=ItemPropertySkillBonus(SKILL_CONCENTRATION,5); if (IPGetItemHasProperty(oTarget,iAdd,-1)) { SendMessageToPC(oUser,"This item already gives a bonus to concentration and Zacharia's scroll cannot give it any more."); } else { // The first time we do it, we wipe out existing skills IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } // do the spell stuff iAdd=ItemPropertyBonusLevelSpell(nClass,2); if (IPGetItemHasProperty(oTarget,iAdd,-1)) { SendMessageToPC(oUser,"This item already gives a bonus level 2 spell for your class and Zacharia's scroll cannot give it any more."); } else { // Wipe out any existing bonus spells IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } // if we have had any success, we now make it wiz or sorc only if (nSuccess==TRUE) { // First of all we REMOVE any other classes that are allowed to use it. iAdd=ItemPropertyLimitUseByClass(IP_CONST_CLASS_SORCERER); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); // Then we KEEP what we just did iAdd=ItemPropertyLimitUseByClass(IP_CONST_CLASS_WIZARD); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,FALSE); } return nSuccess; } // Do the robe of Mystra enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nMystraRobe(object oTarget, object oUser) { int nSuccess=FALSE; // int plus 2, spell level 6 wiz itemproperty iAdd; // Check if it has ANY class restriction int nHasClass=IPGetItemHasProperty(oTarget,iClassRestriction,-1,TRUE); itemproperty iCheck = ItemPropertyLimitUseByClass(IP_CONST_CLASS_WIZARD); // This next line checks whether it does have a class restriction but not the one we are looking for if (nHasClass==TRUE && IPGetItemHasProperty(oTarget,iCheck,-1) == FALSE) { SendMessageToPC(oUser,"This scroll will make a robe for wizards to use, but this item is only useable by a different class. Therefore the scroll will not work on it."); return FALSE; } // do the int stuff iAdd=ItemPropertyAbilityBonus(ABILITY_INTELLIGENCE,2); //if (IPGetItemHasProperty(oTarget,iAdd,-1)) //{ //SendMessageToPC(oUser,"This item already gives a +2 bonus to intelligence and Zacharia's scroll cannot give it any more."); //} //else { // The first time we do it, we wipe out existing skills IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } // do the spell stuff iAdd=ItemPropertyBonusLevelSpell(IP_CONST_CLASS_WIZARD,6); //if (IPGetItemHasProperty(oTarget,iAdd,-1)) //{ //SendMessageToPC(oUser,"This item already gives a bonus level 6 spell and Zacharia's scroll cannot give it any more."); //} //else { // Wipe out any existing bonus spells IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } // if we have had any success, we now make it wiz only if (nSuccess==TRUE) { // First of all we REMOVE any other classes that are allowed to use it. iAdd=ItemPropertyLimitUseByClass(IP_CONST_CLASS_WIZARD); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); } return nSuccess; } // Do the robe of Mystra's Champion enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nChampionRobe(object oTarget, object oUser) { int nSuccess=FALSE; // charis plus 2, spell level 6 sorc itemproperty iAdd; // Check if it has ANY class restriction int nHasClass=IPGetItemHasProperty(oTarget,iClassRestriction,-1,TRUE); itemproperty iCheck = ItemPropertyLimitUseByClass(IP_CONST_CLASS_SORCERER); // This next line checks whether it does have a class restriction but not the one we are looking for if (nHasClass==TRUE && IPGetItemHasProperty(oTarget,iCheck,-1) == FALSE) { SendMessageToPC(oUser,"This scroll will make a robe for sorcerers to use, but this item is only useable by a different class. Therefore the scroll will not work on it."); return FALSE; } // do the char stuff iAdd=ItemPropertyAbilityBonus(ABILITY_CHARISMA,2); //if (IPGetItemHasProperty(oTarget,iAdd,-1)) //{ //SendMessageToPC(oUser,"This item already gives a +2 bonus to charisma and Zacharia's scroll cannot give it any more."); //} //else { // The first time we do it, we wipe out existing skills IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } // do the spell stuff iAdd=ItemPropertyBonusLevelSpell(IP_CONST_CLASS_SORCERER,6); //if (IPGetItemHasProperty(oTarget,iAdd,-1)) //{ //SendMessageToPC(oUser,"This item already gives a bonus level 6 spell and Zacharia's scroll cannot give it any more."); //} //else { // Wipe out any existing bonus spells IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } // if we have had any success, we now make it sorc only if (nSuccess==TRUE) { // First of all we REMOVE any other classes that are allowed to use it. iAdd=ItemPropertyLimitUseByClass(IP_CONST_CLASS_SORCERER); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); } return nSuccess; } // Do the robe of Mystra's fist enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nFistRobe(object oTarget, object oUser) { int nSuccess=FALSE; // wis +2, discipline +5, tumble +5 itemproperty iAdd; // Check if it has ANY class restriction int nHasClass=IPGetItemHasProperty(oTarget,iClassRestriction,-1,TRUE); itemproperty iCheck = ItemPropertyLimitUseByClass(IP_CONST_CLASS_MONK); // This next line checks whether it does have a class restriction but not the one we are looking for if (nHasClass==TRUE && IPGetItemHasProperty(oTarget,iCheck,-1) == FALSE) { SendMessageToPC(oUser,"This scroll will make a robe for monks to use, but this item is only useable by a different class. Therefore the scroll will not work on it."); return FALSE; } // do the wis stuff iAdd=ItemPropertyAbilityBonus(ABILITY_WISDOM,2); if (IPGetItemHasProperty(oTarget,iAdd,-1)) { SendMessageToPC(oUser,"This item already gives a +2 bonus to wisdom and Zacharia's scroll cannot give it any more."); } else { // The first time we do it, we wipe out existing skills IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } // Do the discipline and tumble stuff iAdd=ItemPropertySkillBonus(SKILL_DISCIPLINE,5); // The first time we do it, we wipe out existing skills IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); iAdd=ItemPropertySkillBonus(SKILL_TUMBLE,5); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,FALSE); // In this case, we will just assume we are succeseful nSuccess=TRUE; // First of all we REMOVE any other classes that are allowed to use it. iAdd=ItemPropertyLimitUseByClass(IP_CONST_CLASS_MONK); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); // We also remove any other alignments allowed to use it iAdd=ItemPropertyLimitUseByAlign(IP_CONST_ALIGNMENTGROUP_LAWFUL); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); return nSuccess; } // Do the disciple's robe enchantment. // oTarget is the item of clothing, oUser is the PC using the scroll int nDisciplesRobe(object oTarget, object oUser) { int nSuccess=FALSE; // add discipline +4, tumble +4 itemproperty iAdd; // Check if it has ANY class restriction int nHasClass=IPGetItemHasProperty(oTarget,iClassRestriction,-1,TRUE); itemproperty iCheck = ItemPropertyLimitUseByClass(IP_CONST_CLASS_MONK); // This next line checks whether it does have a class restriction but not the one we are looking for if (nHasClass==TRUE && IPGetItemHasProperty(oTarget,iCheck,-1) == FALSE) { SendMessageToPC(oUser,"This scroll will make a robe for monks to use, but this item is only useable by a different class. Therefore the scroll will not work on it."); return FALSE; } iAdd=ItemPropertySkillBonus(SKILL_DISCIPLINE,4); if (IPGetItemHasProperty(oTarget,iAdd,-1)) { SendMessageToPC(oUser,"This item already gives a bonus to discipline and Zacharia's scroll cannot give it any more."); } else { // The first time we do it, we wipe out existing skills IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); iAdd=ItemPropertySkillBonus(SKILL_TUMBLE,4); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,FALSE,FALSE); // When adding bard only, we REMOVE any other classes that are allowed to use it. iAdd=ItemPropertyLimitUseByClass(IP_CONST_CLASS_MONK); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); // We also remove any other alignments allowed to use it iAdd=ItemPropertyLimitUseByAlign(IP_CONST_ALIGNMENTGROUP_LAWFUL); IPSafeAddItemProperty(oTarget,iAdd,0.0,X2_IP_ADDPROP_POLICY_REPLACE_EXISTING,TRUE,TRUE); nSuccess=TRUE; } return nSuccess; }