Initial Commit
Initial Commit
This commit is contained in:
40
_module/nss/underwater_onent.nss
Normal file
40
_module/nss/underwater_onent.nss
Normal file
@@ -0,0 +1,40 @@
|
||||
//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)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user