Here is a modification of Lightfoot's that should get around leaving a Destroyable flag indefinitely.
void main()
{
object oStaff = GetItemActivated();
int nCharges = GetItemCharges(oStaff);
int nChargePerUse = 2;
if (nCharges < nChargePerUse)
{
AssignCommand(oStaff,SetIsDestroyable(FALSE));
DelayCommand(0.5, AssignCommand(oStaff, SetIsDestroyable(TRUE)));
if(!nCharges) SetItemCharges(oStaff, 1);
}
EDIT added the ! so the check would be for zero charges
Modifié par WhiZard, 08 janvier 2013 - 05:36 .