Files
Anphillia_PRC8/_module/nss/hc_on_unacq_item.nss
Jaysyn904 28cdb617b3 Initial commit
Adding all of the current content for Anphillia Unlimited.
2024-01-04 07:49:38 -05:00

74 lines
2.8 KiB
Plaintext

// HardCore Module Destruction of dropped object
// Archaegeo 2002 Jun 24th
// 28 June 2002 Now also works with the drag corpse system to move players about
// Update: No Drop Script added for the subrace spell-like ability items
// - Panduh
#include "hc_inc"
#include "hc_inc_transfer"
#include "hc_text_unacq"
#include "i_tagtests"
#include "anph_inc"
void main()
{
object oDropped = GetModuleItemLost();
string sDTag=GetTag(oDropped);
object oPC=GetModuleItemLostBy();
// If someone drops a corpse, move the Death Corpse (item container) to where
// the PC Token was dropped, and then put the PC Token back in it
if (sDTag=="PlayerCorpse")
{
object oPoss=GetItemPossessor(oDropped);
if(oPoss==OBJECT_INVALID && GetTag(GetArea(oDropped))=="")
{
return;
}
object oDC=GetLocalObject(oDropped,"DeathCorpse");
object oOwner=GetLocalObject(oDropped,"Owner");
string sName=GetLocalString(oDropped,"Name");
string sCDK=GetLocalString(oDropped,"Key");
// If a Death Corpse exits, move all the stuff from the old one to the new one
// at the new location
object oDeadMan;
object oDeathCorpse;
if(GetIsObjectValid(oDC))
{
oDeathCorpse=CreateObject(OBJECT_TYPE_PLACEABLE, "DeathCorpse",
GetLocation(oDropped));
}
// Otherwise make a Death Corpse to put the new Player Corpse Token on
else
{
oDeathCorpse=CreateObject(OBJECT_TYPE_PLACEABLE, "DeathCorpse",
GetLocation(oDropped));
}
// Make a new PC Token to put on the new Death Corpse
oDeadMan=CreateItemOnObject("PlayerCorpse", oDeathCorpse);
SetLocalObject(oDeadMan,"Owner",oOwner);
SetLocalString(oDeadMan,"Name",sName);
SetLocalString(oDeadMan,"Key", sCDK);
SetLocalObject(oDeadMan,"DeathCorpse",oDeathCorpse);
SetLocalInt(oDeadMan,"Alignment",GetLocalInt(oDropped,"Alignment"));
SetLocalString(oDeadMan,"Deity",GetLocalString(oDropped,"Deity"));
SetLocalObject(oMod,"DeathCorpse"+sName+sCDK,oDeathCorpse);
SetLocalObject(oMod,"PlayerCorpse"+sName+sCDK,oDeadMan);
SetLocalObject(oDeathCorpse,"Owner",oOwner);
SetLocalString(oDeathCorpse,"Name",sName);
SetLocalString(oDeathCorpse,"Key",sCDK);
SetLocalObject(oDeathCorpse,"PlayerCorpse",oDeadMan);
// Destroy the old dropped PC Token
DestroyObject(oDropped);
hcTransferObjects(oDC, oDeathCorpse);
DestroyObject(oDC);
}
}