Files
HeroesStone_PRC8/_module/nss/corpse_disturb.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

53 lines
1.5 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name corpse_disturb
//:: FileName
//::
//:://////////////////////////////////////////////
/*
Responds to the ondisturb event of the placeable.
Destroys duplicated items and detect that some one
took the corpse.
*/
//:://////////////////////////////////////////////
//:: Created By: Alexandre Brunel
//:: Created On: 21/04/2003
//:://////////////////////////////////////////////
#include "corpse_lib"
void main()
{
//GetLastDisturbed
int type = GetInventoryDisturbType();
object item = GetInventoryDisturbItem();
if(type == INVENTORY_DISTURB_TYPE_REMOVED || type == INVENTORY_DISTURB_TYPE_STOLEN)
{
object linked = GetLocalObject(item,CorpseOriginalObject);
//WriteTimestampedLogEntry("Corpse: object taken");
if(GetIsObjectValid(linked))
{
SetPlotFlag(linked,FALSE);
DestroyObject(linked);
if(GetIsObjectValid(GetLocalObject(item,CorpsePCCorpse)))
{
DestroyObject(GetLocalObject(item,CorpsePCCorpse));
}
//WriteTimestampedLogEntry("Destroying object: " + GetTag(linked));
DeleteLocalObject(item,CorpseOriginalObject);
}
else if(item == GetPickableCorpse())
{
object copy = MoveCorpseTo(GetLocation(GetWaypointByTag(CorpsePickableWayPoint)));
DestroyObject(GetPickableCorpse(copy));
SetPickableCorpse(GetPickableCorpse(),copy);
SetPickableCorpse(copy,GetPickableCorpse());
}
else
{
}
}
}