Ancordia_PRC8/_module/nss/underwater_onent.nss
Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

41 lines
1.2 KiB
Plaintext

//courtesy of FunkySwerve
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);
DelayCommand(0.1, ForceUnequip(oTarget, oItem));
} else {
AssignCommand(oTarget, ClearAllActions(TRUE));
SetLocalInt(oItem, "ForceUnequipped", TRUE);
AssignCommand(oTarget, ActionUnequipItem(oItem));
AssignCommand(oTarget, ActionDoCommand(SetCommandable(TRUE)));
AssignCommand(oTarget, SetCommandable(FALSE));
}
}
void main()
{
object oPC = GetEnteringObject();
if (GetTag(GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC)) == "NW_IT_TORCH001")
{
DelayCommand(0.3, FloatingTextStringOnCreature("You can't use torches underwater!", oPC));
DelayCommand(0.3, ForceUnequip(oPC, GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC)));
}
}