I'll post in the same subject because my question is about cursed items
'>
First i'll give you my scripts and the i'll explain the issue...
onequip script:
#include "inc_functions"
void main()
{
object oPC = GetPCItemLastEquippedBy();
object oItem = GetPCItemLastEquipped();
string sTag = GetTag(oItem);
////////////////////////////////////////////////////////////////////////////////
if (GetIsCursed(oItem)) SetLocalInt(oPC, "cursed", 1);
if (sTag == "grandeepee16") SetBerserk(oPC);
}
onunequip script:#include "inc_functions"
void main()
{
object oPC = GetPCItemLastUnequippedBy();
object oItem = GetPCItemLastUnequipped();
////////////////////////////////////////////////////////////////////////////////
if (GetIsCursed(oPC) && GetIsCursed(oItem))
{
int nSlot = GetItemSlot(oItem);
AssignCommand(oPC, ClearAllActions(TRUE));
AssignCommand(oPC, ActionEquipItem(oItem, nSlot));
AssignCommand(oPC, ActionSpeakString("Cet objet est maudit!"));
DelayCommand(0.1, SetCommandable(FALSE, oPC));
DelayCommand(2.0, SetCommandable(TRUE, oPC));
}
}
onunacquire script:
#include "inc_functions"
void main()
{
object oPC = GetModuleItemLostBy();
object oItem = GetModuleItemLost();
////////////////////////////////////////////////////////////////////////////////
if (GetIsCursed(oPC) && GetIsCursed(oItem))
{
int nSlot = GetItemSlot(oItem);
AssignCommand(oPC, ClearAllActions(TRUE));
AssignCommand(oPC, ActionPickUpItem(oItem));
AssignCommand(oPC, ActionEquipItem(oItem, nSlot));
AssignCommand(oPC, ActionSpeakString("Cet objet est maudit!"));
DelayCommand(0.1, SetCommandable(FALSE, oPC));
DelayCommand(2.0, SetCommandable(TRUE, oPC));
}
}
GetIsCursed, GetItemSlot and SetBersek are custom functions as you can imagine...Theses scripts work almost perfectly but i ran into one big issue...If the player swaps a cursed item for another cursed in the same inventory slot the loop is infinite! Any idea on how to prevent this?
Thanks in advance script gods!