Well following the subject of cursed items I want to make a sword that can render its wielder berserk here's the function I use but I ran into one issue...Once in "berserk" state the PC never leave cutscene mode anymore even when there's no more creature around!
Here's the function:
void SetBerserk(object oPC, int nChance = 20, float fDelay = 6.0)
{
if (!GetIsCursed(oPC))
{
SetCutsceneMode(oPC, FALSE);
return;
}
SetCommandable(TRUE, oPC);
object oCrea = GetFirstObjectInShape(SHAPE_SPHERE, 15.0, GetLocation(oPC), TRUE, OBJECT_TYPE_CREATURE);
int nRand = d100();
if ((nRand <= nChance || GetLocalInt(oPC, "berserk") == 1) && GetIsObjectValid(oCrea))
{
SetCutsceneMode(oPC, TRUE);
SetPlotFlag(oPC, FALSE);
SetLocalInt(oPC, "berserk", 1);
DelayCommand(0.0, AssignCommand(oPC, ClearAllActions()));
DelayCommand(0.5, AssignCommand(oPC, ActionAttack(oCrea)));
DelayCommand(fDelay, SetBerserk(oPC, nChance, fDelay));
}
else
{
SetCutsceneMode(oPC, FALSE);
DeleteLocalInt(oPC, "berserk");
DelayCommand(fDelay, SetBerserk(oPC, nChance, fDelay));
}
}
I tried the same function without using the cutscene mode (with setcommandable(TRUE/FALSE)) in that case the issue is the same the PC ends up in SetCommandable(FALSE) even when there's no more creature around...
What am I missing here? Thanks!