So, I made a weapon that has 5 charges, with 2 charges per use for a unique spell it casts, but unless i make it a plot it keeps disappearing when it hits 1 charge left. Also, it gets rechaged with 2 charges (1 more effective use) every time a certain enemy is killed. However, although the charge amount in the description changes the amount of uses will not => Maybe because it is a plot, or maybe because I used the item until it had 1 charge left (zero uses) then recharged it and it didn't work.
Please help me with this!
Here's the script for the unique power self only:
#include "x2_inc_switches"
void main()
{
object oPC = GetItemActivator();
int nEvent = GetUserDefinedItemEventNumber();
switch (nEvent)
{
case X2_ITEM_EVENT_ACTIVATE:
{
location lCenter = GetLocation(oPC);
object oDagger = GetItemActivated();
effect eTimeStopVFX = EffectVisualEffect(VFX_FNF_TIME_STOP);
effect eGlobe = EffectVisualEffect(VFX_DUR_GLOBE_INVULNERABILITY);
effect eParalyze = EffectCutsceneParalyze();
effect eImmobilize = EffectCutsceneImmobilize();
eParalyze = SupernaturalEffect(eParalyze);
eImmobilize = SupernaturalEffect(eImmobilize);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTimeStopVFX, oPC);
object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 10.0f, lCenter, OBJECT_TYPE_CREATURE);
while(GetIsObjectValid(oTarget))
{
if (oTarget == oPC)
{
// do nothing
}
else
{
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eParalyze, oTarget, 12.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eImmobilize, oTarget, 12.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eGlobe, oTarget, 12.0);
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_DUR_FREEZE_ANIMATION), oTarget, 12.0);
}
oTarget = GetNextObjectInShape(SHAPE_SPHERE, 10.0f, lCenter, OBJECT_TYPE_CREATURE);
}
}
break;
case X2_ITEM_EVENT_EQUIP:
ExecuteScript("eq_"+GetTag(GetPCItemLastEquipped()), OBJECT_SELF); break;
case X2_ITEM_EVENT_UNEQUIP:
ExecuteScript("ue_"+GetTag(GetPCItemLastUnequipped()), OBJECT_SELF); break;
case X2_ITEM_EVENT_ACQUIRE:
ExecuteScript("aq_"+GetTag(GetModuleItemAcquired()), OBJECT_SELF); break;
case X2_ITEM_EVENT_UNACQUIRE:
ExecuteScript("ua_"+GetTag(GetModuleItemLost()), OBJECT_SELF); break;
case X2_ITEM_EVENT_SPELLCAST_AT:
ExecuteScript("sp_"+GetTag(GetModuleItemLost()), OBJECT_SELF); break;
case X2_ITEM_EVENT_ONHITCAST:
ExecuteScript("on_"+GetTag(GetModuleItemLost()), OBJECT_SELF); break;
}
}
and here is the ondeath script of the dudes getting killed
void main()
{
object oPC = GetLastKiller();
object oWeaponRight = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
object oWeaponLeft = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
int nDaggerChargeRight = GetItemCharges(oWeaponRight);
int nDaggerChargeLeft = GetItemCharges(oWeaponLeft);
if (GetTag(oWeaponRight) == "daggeroftime")
{
if (nDaggerChargeRight < 5)
{
SetItemCharges(oWeaponRight, nDaggerChargeRight+2);
}
}
else if (GetTag(oWeaponLeft) == "daggeroftime")
{
if (nDaggerChargeLeft < 5)
{
SetItemCharges(oWeaponLeft, nDaggerChargeLeft+2);
}
}
}Thanks again, DITB
[P.S.- For those of you who noticed it in the scripts, yes, this is the 'Dagger of Time' from the prince of persia games
]