66 lines
1.7 KiB
Plaintext
66 lines
1.7 KiB
Plaintext
|
void main()
|
||
|
{
|
||
|
string sSelf = GetResRef(OBJECT_SELF);
|
||
|
location lSelf = GetLocation(OBJECT_SELF);
|
||
|
string sLootBag;
|
||
|
int iSearchForBag = 0;
|
||
|
object oSearchForBag;
|
||
|
object oBagItem;
|
||
|
|
||
|
if (sSelf == "temporaryplaceho")
|
||
|
{
|
||
|
sSelf = GetLocalString(OBJECT_SELF,"sType");
|
||
|
//SendMessageToPC(GetFirstPC(),"Destroying Dropped Lootbag");
|
||
|
|
||
|
|
||
|
while (sLootBag != "Body Bag")
|
||
|
{
|
||
|
|
||
|
oSearchForBag = GetNearestObject(OBJECT_TYPE_ALL,OBJECT_SELF,iSearchForBag);
|
||
|
if (oSearchForBag== OBJECT_INVALID)
|
||
|
{
|
||
|
//SendMessageToPC(GetFirstPC(),"Bag Not Found");
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
sLootBag = GetTag(oSearchForBag);
|
||
|
|
||
|
iSearchForBag++;
|
||
|
}
|
||
|
|
||
|
if (sLootBag == "Body Bag")
|
||
|
{
|
||
|
//SendMessageToPC(GetFirstPC(),"Distance: "+FloatToString(GetDistanceToObject(oSearchForBag)));
|
||
|
if (GetDistanceToObject(oSearchForBag)<= 0.5)
|
||
|
{
|
||
|
oBagItem = GetFirstItemInInventory(oSearchForBag);
|
||
|
while (oBagItem != OBJECT_INVALID)
|
||
|
{
|
||
|
DestroyObject(oBagItem,1.0);
|
||
|
oBagItem = GetNextItemInInventory(oSearchForBag);
|
||
|
}
|
||
|
DestroyObject(oSearchForBag,1.0);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//SendMessageToPC(GetFirstPC(),"lootbag = " +sLootBag);
|
||
|
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
oBagItem = GetFirstItemInInventory(OBJECT_SELF);
|
||
|
|
||
|
while (oBagItem != OBJECT_INVALID)
|
||
|
{
|
||
|
DestroyObject(oBagItem,1.0);
|
||
|
oBagItem = GetNextItemInInventory(OBJECT_SELF);
|
||
|
}
|
||
|
|
||
|
//SendMessageToPC(GetFirstPC(),"Destroying Chest");
|
||
|
}
|
||
|
DestroyObject(OBJECT_SELF,5.0);
|
||
|
//SendMessageToPC(GetFirstPC(),"Replacing Chest");
|
||
|
CreateObject(OBJECT_TYPE_PLACEABLE,sSelf,lSelf,FALSE);
|
||
|
|
||
|
}
|