Alright, trying to get this to work as a tag based script on an item, but I seem to be having some issues. If anyone has any advise, please lend a hand. It should be adding properties depending on the targeted item, ie, shield, armor, or weapon. I have tag based turned on, so not really sure why it’s not working.
#include “x0_i0_position”
#include “x2_inc_switches”
#include “x2_inc_itemprop”
void main()
{
//major variables
object oPC = OBJECT_SELF;
object oTarget = GetItemActivatedTarget();
object oArmor = GetItemInSlot(INVENTORY_SLOT_CHEST, oTarget);
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oTarget);
object oShield = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oTarget);
effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_POSITIVE);
effect eVis = EffectVisualEffect(VFX_IMP_AC_BONUS);
int nDur = 10;
int nEvent = GetUserDefinedItemEventNumber(); //Which event triggered this
object oItem;
location lSpellLocation;
{
switch (nEvent)
case X2_ITEM_EVENT_ACTIVATE:
// * This code runs when the Unique Power property of the item is used
// * Note that this event fires for PCs only
oPC = GetItemActivator(); // The player who activated the item
oItem = GetItemActivated(); // The item that was activated
lSpellLocation = GetItemActivatedTargetLocation(); // The target creature
{
if (GetIsObjectValid(oTarget))
{
if (GetIsObjectValid (oShield))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
itemproperty iProp = ItemPropertyACBonus(1);
IPSafeAddItemProperty(oShield, iProp, RoundsToSeconds(nDur), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE);
}
}
else if (GetIsObjectValid(oTarget))
{
if (GetIsObjectValid (oArmor))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
itemproperty iProp = ItemPropertyACBonus(1);
IPSafeAddItemProperty(oArmor, iProp, RoundsToSeconds(nDur), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE);
}
}
else if (GetIsObjectValid(oTarget))
{
if (GetIsObjectValid (oWeapon))
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oPC);
itemproperty iProp = ItemPropertyEnhancementBonus(1);
IPSafeAddItemProperty(oWeapon, iProp, RoundsToSeconds(nDur), X2_IP_ADDPROP_POLICY_REPLACE_EXISTING, FALSE, TRUE);
}
}
else FloatingTextStringOnCreature(“The potion has no effect”, oPC, FALSE);
}
}
}