Maybe someone could take a look at this and tell me where I went wrong? Spells are NOT decrementing to pre-rest levels like they should. Note that it should only fire for Wizards AND only if they do NOT have the item indicated.
Note - BioWare forums seems to dislike the class constants. The word class will only display in lowercase. This block of code does compile.
if (GetLastRestEventType()==REST_EVENTTYPE_REST_STARTED)
{
if (GetLevelByclass(class_TYPE_WIZARD, oPC) > 0)
{
if (GetItemPossessedBy(oPC, "m1_it_spellbk001") == OBJECT_INVALID)
{
//Store pre-rest values for all memorized spells
int nSpell, nUses;
for (nSpell = 0; nSpell < 599; nSpell ++)
{
nUses = GetHasSpell(nSpell, oPC);
if (nUses > 0)
{
SetLocalInt(oPC, IntToString(nSpell), nUses);
}
}
}
}
}
else if (GetLastRestEventType()==REST_EVENTTYPE_REST_FINISHED)
{
if (GetLevelByclass(class_TYPE_WIZARD, oPC) > 0)
{
if (GetItemPossessedBy(oPC, "m1_it_spellbk001") == OBJECT_INVALID)
{
//Reset spells to their pre-rest values
int nSpell, nUses, nStored;
for (nSpell = 0; nSpell < 599; nSpell ++)
{
nUses = GetHasSpell(nSpell, oPC);
nStored = GetLocalInt(oPC, IntToString(nSpell));
nStored = nUses - nStored;
for (nUses = 0; nUses < nStored; nUses ++)
{
DecrementRemainingSpellUses(oPC, nSpell);
}
DeleteLocalInt(oPC, IntToString(nSpell));
}
}
}
Modifié par Pstemarie, 12 août 2011 - 12:52 .