Here's an exploit-proof unequipper script:
void ForceUnequip (object oTarget, object oItem) {
if (!GetIsObjectValid(oTarget) || GetObjectType(oTarget) != OBJECT_TYPE_CREATURE)
return;
if (!GetIsObjectValid(GetArea(oTarget))) {
DelayCommand(5.0, ForceUnequip(oTarget, oItem));
return;
}
if (GetIsDead(oTarget)) {
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oTarget)), oTarget);
if (GetIsPC(oTarget))
AssignCommand(oTarget, ExecuteScript("fky_deathprocess", oTarget));
DelayCommand(0.1, ForceUnequip(oTarget, oItem));
} else {
AssignCommand(oTarget, ClearAllActions(TRUE));
AssignCommand(oTarget, ActionUnequipItem(oItem));
AssignCommand(oTarget, ActionDoCommand(SetCommandable(TRUE)));
AssignCommand(oTarget, SetCommandable(FALSE));
}
}
This clause:
if (GetIsPC(oTarget))
AssignCommand(oTarget, ExecuteScript("fky_deathprocess", oTarget));
is only necessary if you have a script you execute when a player is brought back to life, in which case you would substitute the name of that script. Otherwise just remove that if clause.
Funky
Modifié par FunkySwerve, 18 octobre 2011 - 06:29 .