Updated to PRC8. Further function integration. Fixed NPC onDeath script. Full compile. Updated release archive.
1345 lines
54 KiB
Plaintext
1345 lines
54 KiB
Plaintext
//Script Name: gen_gem
|
||
//////////////////////////////////////////
|
||
// Created By: Genisys (Guile)
|
||
// Created On: 4/13/09
|
||
/////////////////////////////////////////
|
||
/*
|
||
This is my Enchanting Gem System
|
||
Tagbased Item Script which handles
|
||
ALL Gems in the System..
|
||
|
||
Please see the include script
|
||
"gen_ench_config" To set up this system!
|
||
As there are important configuration within
|
||
that script!
|
||
|
||
*/
|
||
////////////////////////////////////////
|
||
#include "x2_inc_switches"
|
||
#include "gen_enc_config"
|
||
#include "prc_inc_spells"
|
||
|
||
|
||
//Main Script
|
||
void main()
|
||
{
|
||
|
||
//All Major Variables Declared (Commonly used variables as well)
|
||
|
||
int nEvent = GetUserDefinedItemEventNumber(); //Which event triggered this
|
||
object oPC; //The player character using the item
|
||
object oItem; //The item being used
|
||
object oSpellOrigin; //The origin of the spell
|
||
object oSpellTarget; //The target of the spell
|
||
int iSpell; //The Spell ID number
|
||
object oTarget; //Define oTarget below
|
||
object oObject; //Define oObject below
|
||
int nInt; //A commonly used intergal (Must be defined)
|
||
int nLvl; //Commonly used intergal for levels (ie. GetHitDice(oTarget); etc.)
|
||
string sTag; //Used to define a tagname of something
|
||
string sResref; //Used to define a resref name of something
|
||
string sMsg; //Used to define a message
|
||
effect eEffect; //Used to define an effect to be applied to an object or location
|
||
effect eVis; //Used to define a visual effect to be applied to an object or location
|
||
location lTarget; //The Target Location of the PC ONLY! (USE - Getlocation(oPC);)
|
||
location lway; //The Target location for the Activated Item's Target only! (See below)
|
||
|
||
//For Enchanting Gem Item Properties on the items.....
|
||
string sProp, sType, sCType;
|
||
itemproperty iProp, iDesc;
|
||
int nAC, nAB, nEB, nDB, nDType, nType, nTotal, nProp;
|
||
int nAmount, nSub, nClass, a, b, c, d, p, r, s, w;
|
||
string sResRef;
|
||
int nAttribute; //This is for reading the type of bonus!
|
||
int nConstant; //This is for reading any other types.
|
||
|
||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||
//Set the return value for the item event script
|
||
// * X2_EXECUTE_SCRIPT_CONTINUE - continue calling script after executed script is done
|
||
// * X2_EXECUTE_SCRIPT_END - end calling script after executed script is done
|
||
int nResult = X2_EXECUTE_SCRIPT_END;
|
||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||
|
||
//Deterimine which event has fired for the item...
|
||
switch (nEvent)
|
||
{
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
///////The Item has the property: On-Hit Cast Spell: Unique Power/////////
|
||
|
||
case X2_ITEM_EVENT_ONHITCAST:
|
||
{ // * This code runs when the item has the 'OnHitCastSpell: Unique power' property
|
||
// * and it hits a target(if it is a weapon) or is being hit (if it is a piece of armor)
|
||
// * Note that this event fires for non PC creatures as well.
|
||
|
||
oItem = PRCGetSpellCastItem(); // The item triggering this spellscript
|
||
oPC = OBJECT_SELF; // The player triggering it
|
||
oSpellOrigin = OBJECT_SELF ; // Where the spell came from
|
||
oSpellTarget = PRCGetSpellTargetObject(); // What the spell is aimed at
|
||
|
||
//Your code goes here
|
||
|
||
}
|
||
break;
|
||
|
||
///////////////////////////////////////////////////////////////////////////
|
||
/////////////Cast Spell: Unique Power /or/ Activate Item//////////////////
|
||
//**********************************************************************/
|
||
|
||
case X2_ITEM_EVENT_ACTIVATE:
|
||
{
|
||
//Define major variables here...
|
||
oPC = GetItemActivator(); // The player who activated the item
|
||
oItem = GetItemActivated(); // The item that was activated
|
||
oTarget = GetItemActivatedTarget(); //The target of the item's power
|
||
lway = GetItemActivatedTargetLocation(); //To get the location of the target!
|
||
|
||
//The IP Const Name of the Type of Enchantment
|
||
sProp = GetLocalString(oItem, "ENCHANTMENT");
|
||
//Actual int # of bonus
|
||
nInt = GetLocalInt(oItem, "ENCHANT_BONUS");
|
||
//Type of Enchantment
|
||
sCType = GetLocalString(oItem, "CONST_TYPE");
|
||
a = DefinePropertyType(sCType);
|
||
//Special Definition of Enchantment (bonuses / types / etc.)
|
||
sType = GetLocalString(oItem, "ENCHANT_TYPE");
|
||
b = DefinePropertyType(sType);
|
||
|
||
/////////////////////////////////////////////////
|
||
//Redefine how we know which gem they are using!
|
||
sResRef = GetResRef(oItem);
|
||
//////////////////////////////////////////////////
|
||
|
||
//the targeted item's base type
|
||
nType = GetBaseItemType(oTarget);
|
||
|
||
//Lets see how many properties are on the item FIRST
|
||
//If there are too many properties, stop here!
|
||
if(IPGetNumberOfItemProperties(oItem)>MAX_PROPERTIES)
|
||
{
|
||
sMsg = "There are too many item properties on this item to enchant it further.";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
|
||
///////////////////////////////////////////////////////////////////////
|
||
//Determine what to do now that the item has been activated
|
||
//and define what properties to add, if any...
|
||
///////////////////////////////////////////////////////////////////////
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's an AC Bonus Gem...
|
||
|
||
if(sResRef == "gen_gem_0")
|
||
{
|
||
//Only Allow AC only on these types of items!
|
||
if(GetIsACItem(oTarget, nType)==1)
|
||
{
|
||
//Increment the bonus we will be adding to the item...
|
||
//nAC = GetACBonuses(oTarget, nType);
|
||
nAC = GetIPValue(oTarget, ITEM_PROPERTY_AC_BONUS);
|
||
|
||
//Prevent any errors...
|
||
if(nAC <1 || nAC >21)
|
||
{ nAC = 1; }
|
||
else if(nAC == 21)
|
||
{
|
||
sMsg = "This Item has the Maximum AC Bonus!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
}
|
||
|
||
//If the Item has reached it's MAX AC Bonuses..
|
||
//Note the GetACBonus (is the TO BE Applied AC Bonus!)
|
||
if(nAC>MAX_AC)
|
||
{
|
||
sMsg = "This Item has the Maximum AC Bonus!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
iProp = ItemPropertyACBonus(nAC);
|
||
}
|
||
|
||
//End check to see if it's a valid AC Item..
|
||
}
|
||
//Otherwise AC is not allowed on this item!
|
||
else
|
||
{
|
||
sMsg = "You can only enchant AC on Wearable / Non-Weapon items!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
|
||
//End check for item property definition..
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////
|
||
//If it's an Attack Bonus Gem..
|
||
|
||
else if(sResRef == "gen_gem_1")
|
||
{
|
||
//If this is the proper item to put AB on...
|
||
if(IPGetIsRangedWeapon(oTarget) || nType == BASE_ITEM_GLOVES)
|
||
{
|
||
//Determine How may Attack Bonuses we are adding
|
||
nAB = IPGetWeaponEnhancementBonus
|
||
(oTarget, ITEM_PROPERTY_ATTACK_BONUS);
|
||
|
||
if(nAB>=MAX_AB)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "This item has reached it's Max Attack Bonus!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
//Otherwise continue with the item property enchanting...
|
||
else
|
||
{
|
||
//This only replaces matching similar properties..
|
||
nTotal = nAB +1; //We only increment this by one!
|
||
iProp = ItemPropertyAttackBonus(nTotal);
|
||
|
||
//Else statement end
|
||
}
|
||
|
||
//If statment end
|
||
}
|
||
//Otherwise tell them it's the wrong target
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a Ranged Weapon or Gauntlets!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
//////////////////////////////////////////////////////////////
|
||
//If it's an Enchantment Bonus Gem..
|
||
|
||
else if(sResRef == "gen_gem_2")
|
||
{
|
||
//Determine How may Attack Bonuses we are adding
|
||
nEB = IPGetWeaponEnhancementBonus
|
||
(oTarget, ITEM_PROPERTY_ENHANCEMENT_BONUS);
|
||
|
||
if(nEB>=MAX_AB)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "This item has reached it's Max Attack Bonus!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//If this is the proper item to put an Enchantment Bonus on...
|
||
if(IPGetIsMeleeWeapon(oTarget) && nType != BASE_ITEM_GLOVES)
|
||
{
|
||
nAB = nEB +1; //We only add +1!
|
||
iProp = ItemPropertyEnhancementBonus(nAB);
|
||
}
|
||
//Otherwise if it's not a Melee weapon then stop here!
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a melee weapon!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Spell Resistance Gem
|
||
|
||
else if(sResRef == "gen_gem_3")
|
||
{
|
||
if(GetIsLegalItem(oTarget, nType)==1)
|
||
{
|
||
if(GetHasLowSR(oTarget)==1)
|
||
{
|
||
iProp = ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_12);
|
||
}
|
||
else
|
||
{
|
||
nAmount = GetIPValue(oTarget, ITEM_PROPERTY_SPELL_RESISTANCE);
|
||
if(nAmount == 99)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "This Item Has The Maximum Spell Resistance!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//This replaces existing matching properties...
|
||
iProp = ItemPropertyBonusSpellResistance(nAmount);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a legal target for this Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Haste Gem
|
||
|
||
if(sResRef == "gen_gem_4")
|
||
{
|
||
//Only Allow Non Weapons!
|
||
if(GetIsACItem(oTarget, nType)==1)
|
||
{
|
||
iProp = ItemPropertyHaste();
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Freedom of Movement Gem
|
||
|
||
//Check to make sure it's a Bonus Feat Gem
|
||
if(sResRef == "gen_gem_5")
|
||
{
|
||
//Only Allow Non Weapons!
|
||
if(GetIsACItem(oTarget, nType)==1)
|
||
{
|
||
iProp = ItemPropertyFreeAction();
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Improved Evasion Gem
|
||
|
||
else if(sResRef == "gen_gem_6")
|
||
{
|
||
//Only Allow Non Weapons!
|
||
if(GetIsACItem(oTarget, nType)==1)
|
||
{
|
||
iProp = ItemPropertyImprovedEvasion();
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Regneration Gem
|
||
|
||
//Only on NON-Weapons!
|
||
else if(sResRef == "gen_gem_7")
|
||
{
|
||
if(GetIsACItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
//This replaces existing property..
|
||
nAmount = REGEN_BONUS;
|
||
iProp = ItemPropertyRegeneration(nAmount);
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a True Seeing Gem
|
||
|
||
else if(sResRef == "gen_gem_8")
|
||
{
|
||
//Only Allow Non Weapons!
|
||
if(GetIsACItem(oTarget, nType)==1)
|
||
{
|
||
iProp = ItemPropertyTrueSeeing();
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Saving Thow Bonus Gem
|
||
|
||
//Check to make sure it's an AC Property...
|
||
if(sResRef == "gen_gem_9" || sResRef == "gen_gem_10" || sResRef == "gen_gem_11")
|
||
{
|
||
if(sResRef == "gen_gem_9")
|
||
{ nDType = IP_CONST_SAVEBASETYPE_FORTITUDE; }
|
||
else if(sResRef == "gen_gem_10")
|
||
{ nDType = IP_CONST_SAVEBASETYPE_REFLEX; }
|
||
else if(sResRef == "gen_gem_11")
|
||
{ nDType = IP_CONST_SAVEBASETYPE_WILL; }
|
||
|
||
nAmount = SAVE_BONUS;
|
||
//Make sure it's a legitimate wearable item..
|
||
if(GetIsLegalItem(oTarget, nType)==1)
|
||
{
|
||
nAmount = SAVE_BONUS;
|
||
//Set Max/Minimum values..
|
||
if(nAmount == 0)
|
||
{ nAmount == 1;}
|
||
if(nAmount>=21)
|
||
{ nAmount =20; }
|
||
|
||
//Only remove exact matching properties!
|
||
nSub =2;
|
||
|
||
iProp = ItemPropertyBonusSavingThrow(nDType, nAmount);
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a legal target for this Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Ability Bonus Gem..
|
||
|
||
else if(sResRef == "gen_gem_12" || sResRef == "gen_gem_13" || sResRef == "gen_gem_14" ||
|
||
sResRef == "gen_gem_15" || sResRef == "gen_gem_16" || sResRef == "gen_gem_17")
|
||
{
|
||
//Determine which gem is being used exactly..
|
||
if(sResRef == "gen_gem_12") { a = IP_CONST_ABILITY_CHA; }
|
||
else if(sResRef == "gen_gem_13") { nAttribute = IP_CONST_ABILITY_CON; }
|
||
else if(sResRef == "gen_gem_14") { nAttribute = IP_CONST_ABILITY_DEX; }
|
||
else if(sResRef == "gen_gem_15") { nAttribute = IP_CONST_ABILITY_INT; }
|
||
else if(sResRef == "gen_gem_16") { nAttribute = IP_CONST_ABILITY_STR; }
|
||
else if(sResRef == "gen_gem_17") { nAttribute = IP_CONST_ABILITY_WIS; }
|
||
|
||
//Only Allow Non Weapons!
|
||
if(GetIsACItem(oTarget, nType)==1)
|
||
{
|
||
//Do not remove similar properties!
|
||
nSub = 2;
|
||
nAmount = ABILITY_BONUS;
|
||
|
||
//Prevent Null Value & Over Max..
|
||
if(nAmount ==0)
|
||
{ nAmount = 1; }
|
||
if(nAmount >=13)
|
||
{ nAmount = 12; }
|
||
|
||
iProp = ItemPropertyAbilityBonus(nAttribute, nAmount);
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's an Immunity To Misc. Gem
|
||
|
||
else if(sResRef == "gen_gem_18" || sResRef == "gen_gem_19" ||
|
||
sResRef == "gen_gem_20" || sResRef == "gen_gem_21" ||
|
||
sResRef == "gen_gem_22" || sResRef == "gen_gem_23" ||
|
||
sResRef == "gen_gem_24" || //Forgot Disease & Knockdown DOH!
|
||
sResRef == "gen_gem_194" || sResRef == "gen_gem_195" )
|
||
{
|
||
if(GetIsACItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
if(sResRef == "gen_gem_18") { nAttribute = IP_CONST_IMMUNITYMISC_CRITICAL_HITS; }
|
||
else if(sResRef == "gen_gem_19") { nAttribute = IP_CONST_IMMUNITYMISC_DEATH_MAGIC; }
|
||
else if(sResRef == "gen_gem_20") { nAttribute = IP_CONST_IMMUNITYMISC_FEAR; }
|
||
else if(sResRef == "gen_gem_21") { nAttribute = IP_CONST_IMMUNITYMISC_LEVEL_ABIL_DRAIN; }
|
||
else if(sResRef == "gen_gem_22") { nAttribute = IP_CONST_IMMUNITYMISC_MINDSPELLS; }
|
||
else if(sResRef == "gen_gem_23") { nAttribute = IP_CONST_IMMUNITYMISC_PARALYSIS; }
|
||
else if(sResRef == "gen_gem_24") { nAttribute = IP_CONST_IMMUNITYMISC_POISON; }
|
||
else if(sResRef == "gen_gem_194") { nAttribute = IP_CONST_IMMUNITYMISC_DISEASE; }
|
||
else if(sResRef == "gen_gem_195") { nAttribute = IP_CONST_IMMUNITYMISC_KNOCKDOWN; }
|
||
|
||
//Do not remove similar properties!
|
||
nSub =2;
|
||
iProp = ItemPropertyImmunityMisc(nAttribute);
|
||
}
|
||
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Skill Bonus Gem
|
||
|
||
//Only on Non-Weapons
|
||
else if(sResRef == "gen_gem_25" || sResRef == "gen_gem_26" ||
|
||
sResRef == "gen_gem_27" || sResRef == "gen_gem_28" ||
|
||
sResRef == "gen_gem_29" || sResRef == "gen_gem_30" ||
|
||
sResRef == "gen_gem_31" || sResRef == "gen_gem_32" ||
|
||
sResRef == "gen_gem_33" || sResRef == "gen_gem_34" ||
|
||
sResRef == "gen_gem_35" || sResRef == "gen_gem_36" ||
|
||
sResRef == "gen_gem_37" || sResRef == "gen_gem_38" ||
|
||
sResRef == "gen_gem_39" || sResRef == "gen_gem_40" ||
|
||
sResRef == "gen_gem_41" || sResRef == "gen_gem_42" ||
|
||
sResRef == "gen_gem_43" || sResRef == "gen_gem_44" ||
|
||
sResRef == "gen_gem_45" || sResRef == "gen_gem_46" ||
|
||
sResRef == "gen_gem_47" || sResRef == "gen_gem_48" ||
|
||
sResRef == "gen_gem_49")
|
||
{
|
||
if(GetIsACItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
if(sResRef == "gen_gem_25") { nAttribute = SKILL_ANIMAL_EMPATHY; }
|
||
else if(sResRef == "gen_gem_26") { nAttribute = SKILL_APPRAISE; }
|
||
else if(sResRef == "gen_gem_27") { nAttribute = SKILL_BLUFF; }
|
||
else if(sResRef == "gen_gem_28") { nAttribute = SKILL_CONCENTRATION; }
|
||
else if(sResRef == "gen_gem_29") { nAttribute = SKILL_DISABLE_TRAP; }
|
||
else if(sResRef == "gen_gem_30") { nAttribute = SKILL_DISCIPLINE; }
|
||
else if(sResRef == "gen_gem_31") { nAttribute = SKILL_HEAL; }
|
||
else if(sResRef == "gen_gem_32") { nAttribute = SKILL_HIDE; }
|
||
else if(sResRef == "gen_gem_33") { nAttribute = SKILL_INTIMIDATE; }
|
||
else if(sResRef == "gen_gem_34") { nAttribute = SKILL_LISTEN; }
|
||
else if(sResRef == "gen_gem_35") { nAttribute = SKILL_LORE; }
|
||
else if(sResRef == "gen_gem_36") { nAttribute = SKILL_MOVE_SILENTLY; }
|
||
else if(sResRef == "gen_gem_37") { nAttribute = SKILL_OPEN_LOCK; }
|
||
else if(sResRef == "gen_gem_38") { nAttribute = SKILL_PARRY; }
|
||
else if(sResRef == "gen_gem_39") { nAttribute = SKILL_PERFORM; }
|
||
else if(sResRef == "gen_gem_40") { nAttribute = SKILL_PERSUADE; }
|
||
else if(sResRef == "gen_gem_41") { nAttribute = SKILL_PICK_POCKET; }
|
||
else if(sResRef == "gen_gem_42") { nAttribute = SKILL_RIDE; }
|
||
else if(sResRef == "gen_gem_43") { nAttribute = SKILL_SEARCH; }
|
||
else if(sResRef == "gen_gem_44") { nAttribute = SKILL_SET_TRAP; }
|
||
else if(sResRef == "gen_gem_45") { nAttribute = SKILL_SPELLCRAFT; }
|
||
else if(sResRef == "gen_gem_46") { nAttribute = SKILL_SPOT; }
|
||
else if(sResRef == "gen_gem_47") { nAttribute = SKILL_TAUNT; }
|
||
else if(sResRef == "gen_gem_48") { nAttribute = SKILL_TUMBLE; }
|
||
else if(sResRef == "gen_gem_49") { nAttribute = SKILL_USE_MAGIC_DEVICE; }
|
||
|
||
//Do not remove similar properties!
|
||
nSub =2;
|
||
nAmount = SKILL_BONUS;
|
||
iProp = ItemPropertySkillBonus(nAttribute, SKILL_BONUS);
|
||
}
|
||
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Bonus Spell Slot Gem...
|
||
|
||
else if(sResRef == "gen_gem_50" || sResRef == "gen_gem_51" ||
|
||
sResRef == "gen_gem_52" || sResRef == "gen_gem_53" ||
|
||
sResRef == "gen_gem_54" || sResRef == "gen_gem_55" ||
|
||
sResRef == "gen_gem_56" || sResRef == "gen_gem_57" ||
|
||
sResRef == "gen_gem_58" || sResRef == "gen_gem_59" ||
|
||
sResRef == "gen_gem_60" || sResRef == "gen_gem_61" ||
|
||
sResRef == "gen_gem_62" || sResRef == "gen_gem_63" ||
|
||
sResRef == "gen_gem_64" || sResRef == "gen_gem_65" ||
|
||
sResRef == "gen_gem_66" || sResRef == "gen_gem_67" ||
|
||
sResRef == "gen_gem_68" || sResRef == "gen_gem_69" ||
|
||
sResRef == "gen_gem_70" || sResRef == "gen_gem_71" ||
|
||
sResRef == "gen_gem_72" || sResRef == "gen_gem_73" ||
|
||
sResRef == "gen_gem_74" || sResRef == "gen_gem_75" ||
|
||
sResRef == "gen_gem_76" || sResRef == "gen_gem_77" ||
|
||
sResRef == "gen_gem_78" || sResRef == "gen_gem_79" ||
|
||
sResRef == "gen_gem_80" || sResRef == "gen_gem_81" ||
|
||
sResRef == "gen_gem_82" || sResRef == "gen_gem_83" ||
|
||
sResRef == "gen_gem_84" || sResRef == "gen_gem_85" ||
|
||
sResRef == "gen_gem_86" || sResRef == "gen_gem_87" ||
|
||
sResRef == "gen_gem_88" || sResRef == "gen_gem_89")
|
||
{
|
||
if(GetIsACItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//Only allow 4 Bonus spell slots!
|
||
if(GetBonusSpellCount(oTarget)>=4)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You may only put 4 Bonus spells slots on an item!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
|
||
//Determine which spell level and class to use..
|
||
if(sResRef == "gen_gem_50") { nAttribute = 0; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_51") { nAttribute = 1; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_52") { nAttribute = 2; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_53") { nAttribute = 3; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_54") { nAttribute = 4; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_55") { nAttribute = 5; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_56") { nAttribute = 6; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_57") { nAttribute = 7; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_58") { nAttribute = 8; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_59") { nAttribute = 9; nConstant = IP_CONST_CLASS_CLERIC;}
|
||
else if(sResRef == "gen_gem_60") { nAttribute = 0; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_61") { nAttribute = 1; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_62") { nAttribute = 2; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_63") { nAttribute = 3; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_64") { nAttribute = 4; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_65") { nAttribute = 5; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_66") { nAttribute = 6; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_67") { nAttribute = 7; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_68") { nAttribute = 8; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_79") { nAttribute = 9; nConstant = IP_CONST_CLASS_DRUID;}
|
||
else if(sResRef == "gen_gem_70") { nAttribute = 0; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_71") { nAttribute = 1; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_72") { nAttribute = 2; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_73") { nAttribute = 3; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_74") { nAttribute = 4; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_75") { nAttribute = 5; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_76") { nAttribute = 6; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_77") { nAttribute = 7; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_78") { nAttribute = 8; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_79") { nAttribute = 9; nConstant = IP_CONST_CLASS_SORCERER;}
|
||
else if(sResRef == "gen_gem_80") { nAttribute = 0; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_81") { nAttribute = 1; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_82") { nAttribute = 2; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_83") { nAttribute = 3; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_84") { nAttribute = 4; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_85") { nAttribute = 5; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_86") { nAttribute = 6; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_87") { nAttribute = 7; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_88") { nAttribute = 8; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
else if(sResRef == "gen_gem_89") { nAttribute = 9; nConstant = IP_CONST_CLASS_WIZARD;}
|
||
|
||
//Do not remove similar properties!
|
||
nSub =4;
|
||
iProp = ItemPropertyBonusLevelSpell(nConstant, nAttribute);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
//////////////////////////////////////////////////////////////
|
||
//If it's a Damage Bonus Gem...
|
||
|
||
//Check to make sure it's an Enchantment Bonus Property.
|
||
else if(sResRef == "gen_gem_90" || sResRef == "gen_gem_91" ||
|
||
sResRef == "gen_gem_92" || sResRef == "gen_gem_93" ||
|
||
sResRef == "gen_gem_94" || sResRef == "gen_gem_95" ||
|
||
sResRef == "gen_gem_96" || sResRef == "gen_gem_97" ||
|
||
sResRef == "gen_gem_98" || sResRef == "gen_gem_99" ||
|
||
sResRef == "gen_gem_100" || sResRef == "gen_gem_101")
|
||
{
|
||
|
||
//If they are targeting a melee weapon or ammunition!
|
||
if(IPGetIsMeleeWeapon(oTarget) || GetIsAmmo(nType)==TRUE)
|
||
{
|
||
//See how many damage types are on the item first!
|
||
p = GetTotalDmgBonuses(oTarget);
|
||
if(p>=MAX_DMG_TYPES)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "This weapon cannot have more damage types!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
//Determine which amount to add to the weapon...
|
||
nDB = GetDmgBonus();
|
||
|
||
nSub =2;
|
||
|
||
//Determine what type of damage it is!
|
||
if (sResRef == "gen_gem_90") { nAttribute = IP_CONST_DAMAGETYPE_ACID; }
|
||
else if(sResRef == "gen_gem_91") { nAttribute = IP_CONST_DAMAGETYPE_BLUDGEONING; }
|
||
else if(sResRef == "gen_gem_92") { nAttribute = IP_CONST_DAMAGETYPE_COLD; }
|
||
else if(sResRef == "gen_gem_93") { nAttribute = IP_CONST_DAMAGETYPE_DIVINE; }
|
||
else if(sResRef == "gen_gem_94") { nAttribute = IP_CONST_DAMAGETYPE_ELECTRICAL; }
|
||
else if(sResRef == "gen_gem_95") { nAttribute = IP_CONST_DAMAGETYPE_FIRE; }
|
||
else if(sResRef == "gen_gem_96") { nAttribute = IP_CONST_DAMAGETYPE_MAGICAL; }
|
||
else if(sResRef == "gen_gem_97") { nAttribute = IP_CONST_DAMAGETYPE_NEGATIVE; }
|
||
else if(sResRef == "gen_gem_98") { nAttribute = IP_CONST_DAMAGETYPE_PIERCING; }
|
||
else if(sResRef == "gen_gem_99") { nAttribute = IP_CONST_DAMAGETYPE_POSITIVE; }
|
||
else if(sResRef == "gen_gem_100") { nAttribute = IP_CONST_DAMAGETYPE_SLASHING; }
|
||
else if(sResRef == "gen_gem_101") { nAttribute = IP_CONST_DAMAGETYPE_SONIC; }
|
||
|
||
|
||
//Otherwise get the next higest dmg type!
|
||
iProp = ItemPropertyDamageBonus(nAttribute, nDB);
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a melee weapon or ammunition!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
/////////////////////////////////////////////////
|
||
//If it's a Damage Resistance Gem..
|
||
|
||
else if(sResRef == "gen_gem_102" || sResRef == "gen_gem_103" ||
|
||
sResRef == "gen_gem_104" || sResRef == "gen_gem_105" ||
|
||
sResRef == "gen_gem_106" || sResRef == "gen_gem_107" ||
|
||
sResRef == "gen_gem_108" || sResRef == "gen_gem_109" ||
|
||
sResRef == "gen_gem_110" || sResRef == "gen_gem_111" ||
|
||
sResRef == "gen_gem_112" || sResRef == "gen_gem_113")
|
||
{
|
||
//Determine the Damage Type First...
|
||
if (sResRef == "gen_gem_102") { nAttribute = IP_CONST_DAMAGETYPE_ACID; }
|
||
else if(sResRef == "gen_gem_103") { nAttribute = IP_CONST_DAMAGETYPE_BLUDGEONING; }
|
||
else if(sResRef == "gen_gem_104") { nAttribute = IP_CONST_DAMAGETYPE_COLD; }
|
||
else if(sResRef == "gen_gem_105") { nAttribute = IP_CONST_DAMAGETYPE_DIVINE; }
|
||
else if(sResRef == "gen_gem_106") { nAttribute = IP_CONST_DAMAGETYPE_ELECTRICAL; }
|
||
else if(sResRef == "gen_gem_107") { nAttribute = IP_CONST_DAMAGETYPE_FIRE; }
|
||
else if(sResRef == "gen_gem_108") { nAttribute = IP_CONST_DAMAGETYPE_MAGICAL; }
|
||
else if(sResRef == "gen_gem_109") { nAttribute = IP_CONST_DAMAGETYPE_NEGATIVE; }
|
||
else if(sResRef == "gen_gem_110") { nAttribute = IP_CONST_DAMAGETYPE_PIERCING; }
|
||
else if(sResRef == "gen_gem_111") { nAttribute = IP_CONST_DAMAGETYPE_POSITIVE; }
|
||
else if(sResRef == "gen_gem_112") { nAttribute = IP_CONST_DAMAGETYPE_SLASHING; }
|
||
else if(sResRef == "gen_gem_113") { nAttribute = IP_CONST_DAMAGETYPE_SONIC; }
|
||
|
||
|
||
//If it's not a legal item... stop here..
|
||
if(GetIsLegalItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
if(nAttribute == IP_CONST_DAMAGETYPE_MAGICAL || nAttribute == IP_CONST_DAMAGETYPE_NEGATIVE ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_DIVINE || nAttribute == IP_CONST_DAMAGETYPE_POSITIVE)
|
||
{
|
||
nAmount = MAX_HOU_RESIST;
|
||
}
|
||
else { nAmount = MAX_DMG_RESIST; }
|
||
|
||
nDB = nAmount;
|
||
|
||
//Replace only exact matching properties!
|
||
nSub = 2;
|
||
|
||
iProp = ItemPropertyDamageResistance(nAttribute, nDB);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Damage Immunity Gem
|
||
|
||
else if(sResRef == "gen_gem_114" || sResRef == "gen_gem_115" ||
|
||
sResRef == "gen_gem_116" || sResRef == "gen_gem_117" ||
|
||
sResRef == "gen_gem_118" || sResRef == "gen_gem_119" ||
|
||
sResRef == "gen_gem_120" || sResRef == "gen_gem_121" ||
|
||
sResRef == "gen_gem_122" || sResRef == "gen_gem_123" ||
|
||
sResRef == "gen_gem_124" || sResRef == "gen_gem_125")
|
||
{
|
||
//Determine the Damage Type First...
|
||
if (sResRef == "gen_gem_114") { nAttribute = IP_CONST_DAMAGETYPE_ACID; }
|
||
else if(sResRef == "gen_gem_115") { nAttribute = IP_CONST_DAMAGETYPE_BLUDGEONING; }
|
||
else if(sResRef == "gen_gem_116") { nAttribute = IP_CONST_DAMAGETYPE_COLD; }
|
||
else if(sResRef == "gen_gem_117") { nAttribute = IP_CONST_DAMAGETYPE_DIVINE; }
|
||
else if(sResRef == "gen_gem_118") { nAttribute = IP_CONST_DAMAGETYPE_ELECTRICAL; }
|
||
else if(sResRef == "gen_gem_119") { nAttribute = IP_CONST_DAMAGETYPE_FIRE; }
|
||
else if(sResRef == "gen_gem_120") { nAttribute = IP_CONST_DAMAGETYPE_MAGICAL; }
|
||
else if(sResRef == "gen_gem_121") { nAttribute = IP_CONST_DAMAGETYPE_NEGATIVE; }
|
||
else if(sResRef == "gen_gem_122") { nAttribute = IP_CONST_DAMAGETYPE_PIERCING; }
|
||
else if(sResRef == "gen_gem_123") { nAttribute = IP_CONST_DAMAGETYPE_POSITIVE; }
|
||
else if(sResRef == "gen_gem_124") { nAttribute = IP_CONST_DAMAGETYPE_SLASHING; }
|
||
else if(sResRef == "gen_gem_125") { nAttribute = IP_CONST_DAMAGETYPE_SONIC; }
|
||
|
||
if(GetIsACItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//Damage immunity can only be applied to 2 Items max!
|
||
if(nAttribute == IP_CONST_DAMAGETYPE_ACID || nAttribute == IP_CONST_DAMAGETYPE_COLD ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_ELECTRICAL || nAttribute == IP_CONST_DAMAGETYPE_FIRE ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_SONIC)
|
||
{
|
||
if(nType != BASE_ITEM_AMULET && nType != BASE_ITEM_BOOTS)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You can only target an amulet or boots with this type damage!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
else if(nAttribute == IP_CONST_DAMAGETYPE_BLUDGEONING ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_PIERCING ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_SLASHING)
|
||
{
|
||
if(nType != BASE_ITEM_BELT && nType != BASE_ITEM_GLOVES ||
|
||
nType != BASE_ITEM_BRACER)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You can only target a Belt, Bracers, or Gloves with this type damage!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
else if(nAttribute == IP_CONST_DAMAGETYPE_DIVINE ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_MAGICAL ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_NEGATIVE ||
|
||
nAttribute == IP_CONST_DAMAGETYPE_POSITIVE)
|
||
{
|
||
if(nType != BASE_ITEM_CLOAK && nType != BASE_ITEM_HELMET)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You can only target a Cloak or Helmet with this type damage!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
//Do not remove similar properties!
|
||
nSub =2;
|
||
iProp = ItemPropertyDamageImmunity(nAttribute, DMG_IMMUNE);
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Damage Reduction Gem
|
||
|
||
else if(sResRef == "gen_gem_126" || sResRef == "gen_gem_127" ||
|
||
sResRef == "gen_gem_128" || sResRef == "gen_gem_129" ||
|
||
sResRef == "gen_gem_130" || sResRef == "gen_gem_131" ||
|
||
sResRef == "gen_gem_132" || sResRef == "gen_gem_133" ||
|
||
sResRef == "gen_gem_134" || sResRef == "gen_gem_135")
|
||
{
|
||
//Determine the amount of Soak First
|
||
if (sResRef == "gen_gem_126") { nAttribute = IP_CONST_DAMAGEREDUCTION_1; }
|
||
else if(sResRef == "gen_gem_127") { nAttribute = IP_CONST_DAMAGEREDUCTION_2; }
|
||
else if(sResRef == "gen_gem_128") { nAttribute = IP_CONST_DAMAGEREDUCTION_3; }
|
||
else if(sResRef == "gen_gem_129") { nAttribute = IP_CONST_DAMAGEREDUCTION_4; }
|
||
else if(sResRef == "gen_gem_130") { nAttribute = IP_CONST_DAMAGEREDUCTION_5; }
|
||
else if(sResRef == "gen_gem_131") { nAttribute = IP_CONST_DAMAGEREDUCTION_6; }
|
||
else if(sResRef == "gen_gem_132") { nAttribute = IP_CONST_DAMAGEREDUCTION_7; }
|
||
else if(sResRef == "gen_gem_133") { nAttribute = IP_CONST_DAMAGEREDUCTION_8; }
|
||
else if(sResRef == "gen_gem_134") { nAttribute = IP_CONST_DAMAGEREDUCTION_9; }
|
||
else if(sResRef == "gen_gem_135") { nAttribute = IP_CONST_DAMAGEREDUCTION_10; }
|
||
|
||
if(GetIsACItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//Remove Similar properties when adding this one!
|
||
iProp = ItemPropertyDamageReduction(nAttribute , DMG_SOAK);
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Holy Avenger Gem
|
||
|
||
//Check to make sure it's a Bonus Feat Gem
|
||
else if(sResRef == "gen_gem_136")
|
||
{
|
||
if(IPGetIsMeleeWeapon(oTarget) && nType != BASE_ITEM_GLOVES)
|
||
{
|
||
iProp = ItemPropertyHolyAvenger();
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a Melee Weapon!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Keen Gem
|
||
|
||
else if(sResRef == "gen_gem_137")
|
||
{
|
||
//Make sure it's a valid weapon!
|
||
if(IPGetIsMeleeWeapon(oTarget) && nType != BASE_ITEM_GLOVES)
|
||
{ iProp = ItemPropertyKeen(); }
|
||
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a melee weapon!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Massive Criticals Gem
|
||
|
||
else if(sResRef == "gen_gem_138")
|
||
{
|
||
if(nType == BASE_ITEM_GLOVES || GetIsAmmo(nType)==TRUE)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a Ranged or Melee weapon!!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//Find the set constant amount
|
||
nDB = GetDmgBonus();
|
||
iProp = ItemPropertyMassiveCritical(nDB);
|
||
}
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Mighty Gem
|
||
|
||
else if(sResRef == "gen_gem_139")
|
||
{
|
||
if(IPGetIsRangedWeapon(oTarget))
|
||
{
|
||
//This replaces existing matching properties
|
||
nDB = MIGHTY_BONUS;
|
||
iProp = ItemPropertyMaxRangeStrengthMod(nDB);
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a Ranged Weapon!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Vampiric Gem
|
||
|
||
else if(sResRef == "gen_gem_140")
|
||
{
|
||
//If they are targeting a melee weapon or ammunition!
|
||
if(IPGetIsMeleeWeapon(oTarget) || GetIsAmmo(nType)==TRUE)
|
||
{
|
||
//this remove similar properties...
|
||
nAmount = VAMP_BONUS;
|
||
iProp = ItemPropertyVampiricRegeneration(nAmount);
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a Ranged Weapon!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Base Item Weight Reduction Gem
|
||
|
||
else if(sResRef == "gen_gem_141")
|
||
{
|
||
iProp = ItemPropertyWeightReduction(IP_CONST_REDUCEDWEIGHT_80_PERCENT);
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Bonus Feat Gem
|
||
|
||
//Check to make sure it's a Bonus Feat Gem
|
||
|
||
else if(sResRef == "gen_gem_142" || sResRef == "gen_gem_143" ||
|
||
sResRef == "gen_gem_144" || sResRef == "gen_gem_145" ||
|
||
sResRef == "gen_gem_146" || sResRef == "gen_gem_147" ||
|
||
sResRef == "gen_gem_148" || sResRef == "gen_gem_149" ||
|
||
sResRef == "gen_gem_150" || sResRef == "gen_gem_151" ||
|
||
sResRef == "gen_gem_152" || sResRef == "gen_gem_153" ||
|
||
sResRef == "gen_gem_154" || sResRef == "gen_gem_155" ||
|
||
sResRef == "gen_gem_156" || sResRef == "gen_gem_157" ||
|
||
sResRef == "gen_gem_158" || sResRef == "gen_gem_159" ||
|
||
sResRef == "gen_gem_160" || sResRef == "gen_gem_161" ||
|
||
sResRef == "gen_gem_162" || sResRef == "gen_gem_163" ||
|
||
sResRef == "gen_gem_164" || sResRef == "gen_gem_215")
|
||
{
|
||
|
||
//Determine the Type of Feat it's going to be..
|
||
if (sResRef == "gen_gem_142") { nAttribute = IP_CONST_FEAT_ALERTNESS; }
|
||
else if(sResRef == "gen_gem_143") { nAttribute = IP_CONST_FEAT_AMBIDEXTROUS; }
|
||
else if(sResRef == "gen_gem_144") { nAttribute = IP_CONST_FEAT_ARMOR_PROF_HEAVY; }
|
||
else if(sResRef == "gen_gem_145") { nAttribute = IP_CONST_FEAT_ARMOR_PROF_LIGHT; }
|
||
else if(sResRef == "gen_gem_146") { nAttribute = IP_CONST_FEAT_ARMOR_PROF_MEDIUM; }
|
||
else if(sResRef == "gen_gem_147") { nAttribute = IP_CONST_FEAT_CLEAVE; }
|
||
else if(sResRef == "gen_gem_148") { nAttribute = IP_CONST_FEAT_COMBAT_CASTING; }
|
||
else if(sResRef == "gen_gem_149") { nAttribute = IP_CONST_FEAT_DODGE; }
|
||
else if(sResRef == "gen_gem_150") { nAttribute = IP_CONST_FEAT_EXTRA_TURNING; }
|
||
else if(sResRef == "gen_gem_151") { nAttribute = IP_CONST_FEAT_HIDE_IN_PLAIN_SIGHT; }
|
||
else if(sResRef == "gen_gem_152") { nAttribute = IP_CONST_FEAT_IMPCRITUNARM; }
|
||
else if(sResRef == "gen_gem_153") { nAttribute = IP_CONST_FEAT_KNOCKDOWN; }
|
||
else if(sResRef == "gen_gem_154") { nAttribute = IP_CONST_FEAT_MOBILITY; }
|
||
else if(sResRef == "gen_gem_155") { nAttribute = IP_CONST_FEAT_POINTBLANK; }
|
||
else if(sResRef == "gen_gem_156") { nAttribute = IP_CONST_FEAT_POWERATTACK; }
|
||
else if(sResRef == "gen_gem_157") { nAttribute = IP_CONST_FEAT_RAPID_SHOT; }
|
||
else if(sResRef == "gen_gem_158") { nAttribute = IP_CONST_FEAT_SHIELD_PROFICIENCY; }
|
||
else if(sResRef == "gen_gem_159") { nAttribute = IP_CONST_FEAT_SPELLPENETRATION; }
|
||
else if(sResRef == "gen_gem_160") { nAttribute = IP_CONST_FEAT_TWO_WEAPON_FIGHTING; }
|
||
else if(sResRef == "gen_gem_161") { nAttribute = IP_CONST_FEAT_WEAPFINESSE; }
|
||
else if(sResRef == "gen_gem_162") { nAttribute = IP_CONST_FEAT_WEAPON_PROF_EXOTIC; }
|
||
else if(sResRef == "gen_gem_163") { nAttribute = IP_CONST_FEAT_WEAPSPEUNARM; }
|
||
else if(sResRef == "gen_gem_164") { nAttribute = IP_CONST_FEAT_WHIRLWIND; }
|
||
else if(sResRef == "gen_gem_215") { nAttribute = IP_CONST_FEAT_DISARM; }
|
||
//Only Allow Non Weapons!
|
||
if(GetIsACItem(oTarget, nType)==1)
|
||
{
|
||
//Do not remove similar properties!
|
||
nSub =2;
|
||
iProp = ItemPropertyBonusFeat(nAttribute);
|
||
}
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a On-Hit Property Gem
|
||
|
||
else if(sResRef == "gen_gem_165" || sResRef == "gen_gem_166" ||
|
||
sResRef == "gen_gem_167" || sResRef == "gen_gem_168" ||
|
||
sResRef == "gen_gem_169" || sResRef == "gen_gem_170" ||
|
||
sResRef == "gen_gem_171" || sResRef == "gen_gem_172" ||
|
||
sResRef == "gen_gem_173" || sResRef == "gen_gem_174" ||
|
||
sResRef == "gen_gem_175" || sResRef == "gen_gem_176" ||
|
||
sResRef == "gen_gem_177" || sResRef == "gen_gem_178" ||
|
||
sResRef == "gen_gem_179" || sResRef == "gen_gem_180" ||
|
||
sResRef == "gen_gem_181" || sResRef == "gen_gem_182" ||
|
||
sResRef == "gen_gem_183" || sResRef == "gen_gem_184" ||
|
||
sResRef == "gen_gem_185" || sResRef == "gen_gem_186" ||
|
||
sResRef == "gen_gem_187" || sResRef == "gen_gem_188" ||
|
||
sResRef == "gen_gem_189" || sResRef == "gen_gem_190" ||
|
||
sResRef == "gen_gem_191")
|
||
{
|
||
|
||
//Determine the Type of On-Hit it will enchant
|
||
if (sResRef == "gen_gem_165") { nAttribute = IP_CONST_ONHIT_ABILITYDRAIN; nConstant = IP_CONST_ABILITY_CON;}
|
||
else if(sResRef == "gen_gem_166") { nAttribute = IP_CONST_ONHIT_ABILITYDRAIN; nConstant = IP_CONST_ABILITY_DEX;}
|
||
else if(sResRef == "gen_gem_167") { nAttribute = IP_CONST_ONHIT_ABILITYDRAIN; nConstant = IP_CONST_ABILITY_STR;}
|
||
else if(sResRef == "gen_gem_168") { nAttribute = IP_CONST_ONHIT_BLINDNESS; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_169") { nAttribute = IP_CONST_ONHIT_CONFUSION; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_170") { nAttribute = IP_CONST_ONHIT_DEAFNESS; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_171") { nAttribute = IP_CONST_ONHIT_DISEASE; nConstant = DISEASE_MUMMY_ROT;}
|
||
else if(sResRef == "gen_gem_172") { nAttribute = IP_CONST_ONHIT_DISPELMAGIC; }
|
||
else if(sResRef == "gen_gem_173") { nAttribute = IP_CONST_ONHIT_DOOM; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_174") { nAttribute = IP_CONST_ONHIT_FEAR; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_175") { nAttribute = IP_CONST_ONHIT_GREATERDISPEL; }
|
||
else if(sResRef == "gen_gem_176") { nAttribute = IP_CONST_ONHIT_HOLD; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_177") { nAttribute = IP_CONST_ONHIT_KNOCK; }
|
||
else if(sResRef == "gen_gem_178") { nAttribute = IP_CONST_ONHIT_LEVELDRAIN; }
|
||
else if(sResRef == "gen_gem_179") { nAttribute = IP_CONST_ONHIT_MORDSDISJUNCTION; }
|
||
else if(sResRef == "gen_gem_180") { nAttribute = IP_CONST_ONHIT_ITEMPOISON; nConstant = IP_CONST_POISON_1D2_CONDAMAGE;}//POISON (FIX IT)
|
||
else if(sResRef == "gen_gem_181") { nAttribute = IP_CONST_ONHIT_SILENCE; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_182") { nAttribute = IP_CONST_ONHIT_SLAYALIGNMENTGROUP; nConstant = IP_CONST_ALIGNMENTGROUP_CHAOTIC;}
|
||
else if(sResRef == "gen_gem_183") { nAttribute = IP_CONST_ONHIT_SLAYALIGNMENTGROUP; nConstant = IP_CONST_ALIGNMENTGROUP_EVIL;}
|
||
else if(sResRef == "gen_gem_184") { nAttribute = IP_CONST_ONHIT_SLAYALIGNMENTGROUP; nConstant = IP_CONST_ALIGNMENTGROUP_GOOD;}
|
||
else if(sResRef == "gen_gem_185") { nAttribute = IP_CONST_ONHIT_SLAYALIGNMENTGROUP; nConstant = IP_CONST_ALIGNMENTGROUP_LAWFUL;}
|
||
else if(sResRef == "gen_gem_186") { nAttribute = IP_CONST_ONHIT_SLAYALIGNMENTGROUP; nConstant = IP_CONST_ALIGNMENTGROUP_NEUTRAL;}
|
||
else if(sResRef == "gen_gem_187") { nAttribute = IP_CONST_ONHIT_SLEEP; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_188") { nAttribute = IP_CONST_ONHIT_SLOW; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_189") { nAttribute = IP_CONST_ONHIT_STUN; nConstant = IP_CONST_ONHIT_DURATION_50_PERCENT_2_ROUNDS;}
|
||
else if(sResRef == "gen_gem_190") { nAttribute = IP_CONST_ONHIT_VORPAL; }
|
||
else if(sResRef == "gen_gem_191") { nAttribute = IP_CONST_ONHIT_WOUNDING; }
|
||
|
||
//Only Allow Non Weapons!
|
||
if(IPGetIsMeleeWeapon(oTarget) || GetIsAmmo(nType)==TRUE)
|
||
{
|
||
//Replace any matching similar properties!
|
||
iProp = ItemPropertyOnHitProps(nAttribute, ON_HIT_SAVE_DC, nConstant);
|
||
}
|
||
|
||
else
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "You must target a melee weapon or ammunition!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
////////////////////////////////////////////////
|
||
//If it's a Spell Immunity Gem
|
||
|
||
else if(sResRef == "gen_gem_192" || sResRef == "gen_gem_193" ||
|
||
sResRef == "gen_gem_194" || sResRef == "gen_gem_195" ||
|
||
sResRef == "gen_gem_196" || sResRef == "gen_gem_197" ||
|
||
sResRef == "gen_gem_198" || sResRef == "gen_gem_199" ||
|
||
sResRef == "gen_gem_200" || sResRef == "gen_gem_201" ||
|
||
sResRef == "gen_gem_202" || sResRef == "gen_gem_203" ||
|
||
sResRef == "gen_gem_204" || sResRef == "gen_gem_205" ||
|
||
sResRef == "gen_gem_206" || sResRef == "gen_gem_207" ||
|
||
sResRef == "gen_gem_208" || sResRef == "gen_gem_209" ||
|
||
sResRef == "gen_gem_210" || sResRef == "gen_gem_211" ||
|
||
sResRef == "gen_gem_212" || sResRef == "gen_gem_213" ||
|
||
sResRef == "gen_gem_214")
|
||
{
|
||
//Define which spell we are granting immunity to!
|
||
if(sResRef == "gen_gem_192") { nAttribute = IP_CONST_IMMUNITYSPELL_FINGER_OF_DEATH; }
|
||
else if(sResRef == "gen_gem_193") { nAttribute = IP_CONST_IMMUNITYSPELL_HARM; }
|
||
else if(sResRef == "gen_gem_196") { nAttribute = IP_CONST_IMMUNITYSPELL_BESTOW_CURSE; }
|
||
else if(sResRef == "gen_gem_197") { nAttribute = IP_CONST_IMMUNITYSPELL_CHAIN_LIGHTNING; }
|
||
else if(sResRef == "gen_gem_198") { nAttribute = IP_CONST_IMMUNITYSPELL_CONE_OF_COLD; }
|
||
else if(sResRef == "gen_gem_199") { nAttribute = IP_CONST_IMMUNITYSPELL_DARKNESS; }
|
||
else if(sResRef == "gen_gem_200") { nAttribute = IP_CONST_IMMUNITYSPELL_ENERGY_DRAIN; }
|
||
else if(sResRef == "gen_gem_201") { nAttribute = IP_CONST_IMMUNITYSPELL_FIRE_STORM; }
|
||
else if(sResRef == "gen_gem_202") { nAttribute = IP_CONST_IMMUNITYSPELL_FLAME_STRIKE; }
|
||
else if(sResRef == "gen_gem_203") { nAttribute = IP_CONST_IMMUNITYSPELL_HAMMER_OF_THE_GODS; }
|
||
else if(sResRef == "gen_gem_204") { nAttribute = IP_CONST_IMMUNITYSPELL_HOLD_PERSON; }
|
||
else if(sResRef == "gen_gem_205") { nAttribute = IP_CONST_IMMUNITYSPELL_IMPLOSION; }
|
||
else if(sResRef == "gen_gem_206") { nAttribute = IP_CONST_IMMUNITYSPELL_MAGIC_MISSILE; }
|
||
else if(sResRef == "gen_gem_207") { nAttribute = IP_CONST_IMMUNITYSPELL_METEOR_SWARM; }
|
||
else if(sResRef == "gen_gem_208") { nAttribute = IP_CONST_IMMUNITYSPELL_SLAY_LIVING; }
|
||
else if(sResRef == "gen_gem_209") { nAttribute = IP_CONST_IMMUNITYSPELL_SLOW; }
|
||
else if(sResRef == "gen_gem_210") { nAttribute = IP_CONST_IMMUNITYSPELL_STORM_OF_VENGEANCE; }
|
||
else if(sResRef == "gen_gem_211") { nAttribute = IP_CONST_IMMUNITYSPELL_WAIL_OF_THE_BANSHEE; }
|
||
else if(sResRef == "gen_gem_212") { nAttribute = IP_CONST_IMMUNITYSPELL_WEIRD; }
|
||
else if(sResRef == "gen_gem_213") { nAttribute = IP_CONST_IMMUNITYSPELL_WORD_OF_FAITH; }
|
||
else if(sResRef == "gen_gem_214") { nAttribute = IP_CONST_IMMUNITYSPELL_SILENCE; }
|
||
|
||
|
||
if(GetIsACItem(oTarget, nType)!=1)
|
||
{
|
||
//Stop here and tell the PC why it didn't work..
|
||
sMsg = "That is not a valid target for the Gem!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
//Do not remove similar properties!
|
||
nSub =2;
|
||
iProp = ItemPropertySpellImmunitySpecific(nAttribute);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
/////////////////////////////////////////////////////////////////////
|
||
//Apply the enchantment if we are allowed to continue...
|
||
/////////////////////////////////////////////////////////////////////
|
||
|
||
//First check the # of properties vs the Max # allowed..
|
||
if(nTotalProps(oTarget)>=MAX_PROPERTIES)
|
||
{
|
||
//If it already has the max amount, then stop here!
|
||
sMsg = "This item can hold no more enchantments!!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
|
||
if(ENCH_PLOT_ITEMS==FALSE)
|
||
{
|
||
if(GetPlotFlag(oTarget)==TRUE || GetDroppableFlag(oTarget)==TRUE ||
|
||
GetItemCursedFlag(oTarget)==TRUE)
|
||
{
|
||
//If it already has the max amount, then stop here!
|
||
sMsg = "You cannot enchant a plot item!";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
return;
|
||
}
|
||
}
|
||
|
||
//If in fact the PC is the possessor of the item...
|
||
if(oTarget != OBJECT_INVALID && GetItemPossessor(oTarget) == oPC)
|
||
{
|
||
//If we are not Ignoring existing subtypes!
|
||
//This only removes EXACT Matching Subtype properties!
|
||
if(nSub==2)
|
||
{
|
||
eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M ,FALSE);
|
||
IPSafeAddItemProperty(oTarget, iProp, 0.0f, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, FALSE);
|
||
//Destroy the item after it has been used!
|
||
DestroyObject(oItem, 0.0f);
|
||
}
|
||
else if(nSub==3)
|
||
{
|
||
eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M ,FALSE);
|
||
IPSafeAddItemProperty(oTarget, iProp, 0.0f, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, TRUE, FALSE);
|
||
//Destroy the item after it has been used!
|
||
DestroyObject(oItem, 0.0f);
|
||
}
|
||
else if(nSub==4)
|
||
{
|
||
eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M ,FALSE);
|
||
IPSafeAddItemProperty(oTarget, iProp, 0.0f, X2_IP_ADDPROP_POLICY_IGNORE_EXISTING, TRUE, FALSE);
|
||
//Destroy the item after it has been used!
|
||
DestroyObject(oItem, 0.0f);
|
||
}
|
||
|
||
//If we are Ignorning existing Subtypes...
|
||
//If you don't use the above function then it will remove
|
||
//the existing similar properties! (This can be a good thing!)
|
||
else
|
||
{
|
||
eVis = EffectVisualEffect(VFX_IMP_LIGHTNING_M ,FALSE);
|
||
IPSafeAddItemProperty(oTarget, iProp, 0.0f, X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE);
|
||
//Destroy the item after it has been used!
|
||
DestroyObject(oItem, 0.0f);
|
||
}
|
||
|
||
//Tell the PC of their success =)
|
||
//Do a fancy visual effect...
|
||
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC, 0.0f);
|
||
sMsg = "Your item was successfully enchanted.";
|
||
FloatingTextStringOnCreature(sMsg, oPC, FALSE);
|
||
}
|
||
|
||
//Otherwise tell them why this has failed
|
||
else
|
||
{
|
||
FloatingTextStringOnCreature
|
||
("<c)<29><>>You must target an item in your inventory!",
|
||
oPC,
|
||
FALSE);
|
||
}
|
||
|
||
///////////////////////////////////////////////////////////////
|
||
|
||
//End of Activate Item Check...
|
||
} break;
|
||
|
||
/**********************************************************************/
|
||
///////////////////////////////////////////////////////////////////////////
|
||
///////////When the User Equips this item////////////////////////////////
|
||
|
||
case X2_ITEM_EVENT_EQUIP:
|
||
{// * This code runs when the item is equipped
|
||
// * Note that this event fires for PCs only
|
||
|
||
oPC = GetPCItemLastEquippedBy(); // The player who equipped the item
|
||
oItem = GetPCItemLastEquipped(); // The item that was equipped
|
||
|
||
//Your code goes here
|
||
|
||
}
|
||
break;
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
/////////////When the User Unequips this item//////////////////////////////
|
||
|
||
case X2_ITEM_EVENT_UNEQUIP:
|
||
{// * This code runs when the item is unequipped
|
||
// * Note that this event fires for PCs only
|
||
|
||
oPC = GetPCItemLastUnequippedBy();// The player who unequipped the item
|
||
oItem = GetPCItemLastUnequipped(); // The item that was unequipped
|
||
|
||
//Your code goes here
|
||
}
|
||
break;
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
////////////Everytime ANYONE Acquires this item////////////////////////////
|
||
|
||
case X2_ITEM_EVENT_ACQUIRE:
|
||
{// * This code runs when the item is acquired
|
||
// * Note that this event fires for PCs only
|
||
|
||
oPC = GetModuleItemAcquiredBy(); // The player who acquired the item
|
||
oItem = GetModuleItemAcquired(); // The item that was acquired
|
||
|
||
//Your code goes here
|
||
|
||
}
|
||
break;
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
//////////Everytime ANYONE Loses this item/////////////////////////////////
|
||
|
||
case X2_ITEM_EVENT_UNACQUIRE:
|
||
{// * This code runs when the item is unacquired
|
||
// * Note that this event fires for PCs only
|
||
|
||
oPC = GetModuleItemLostBy(); // The player who dropped the item
|
||
oItem = GetModuleItemLost(); // The item that was dropped
|
||
|
||
//Your code goes here
|
||
|
||
}
|
||
break;
|
||
|
||
////////////////////////////////////////////////////////////////////////////
|
||
/////Everytime ANYONE Cast a spell at this item////////////////////////////
|
||
|
||
case X2_ITEM_EVENT_SPELLCAST_AT:
|
||
{//* This code runs when a PC or DM casts a spell from one of the
|
||
//* standard spellbooks on the item
|
||
|
||
oPC = OBJECT_SELF; // The player who cast the spell
|
||
oItem = PRCGetSpellTargetObject();// The item targeted by the spell
|
||
iSpell = PRCGetSpellId(); // The id of the spell that was cast
|
||
// See the list of SPELL_* constants
|
||
|
||
//Your code goes here
|
||
|
||
//Change the following line from X2_EXECUTE_SCRIPT_CONTINUE to
|
||
//X2_EXECUTE_SCRIPT_END if you want to prevent the spell that was
|
||
//cast on the item from taking effect
|
||
nResult = X2_EXECUTE_SCRIPT_CONTINUE;
|
||
|
||
}
|
||
break;
|
||
|
||
}
|
||
|
||
//Pass the return value back to the calling script
|
||
SetExecutedScriptReturnValue(nResult);
|
||
}
|
||
|
||
///////////////////////////////////////////////////////////////////////
|
||
//MAIN SCRIPT END! WOOOOSH!
|
||
///////////////////////////////////////////////////////////////////////
|
||
//(Be sure to open up the include "gen_ench_config" to edit it!)
|
||
///////////////////////////////////////////////////////////////////////
|