Area Changes and other fixes
added areas and ccoh, fixed some areas to work with crafting fixed some on death issues added server entry/ooc
This commit is contained in:
@@ -1,97 +0,0 @@
|
||||
//#include "gz_inc_db"
|
||||
|
||||
void DestroyAllItems();
|
||||
int GetIsAreaOccupied(object oArea);
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
// First check to see if the ExitingObject is a PC or not
|
||||
object oPC = GetExitingObject();
|
||||
|
||||
//Save player Status on exiting an area!
|
||||
//GTSavePlayerStatus(oPC);
|
||||
|
||||
// If not, we'll just exit
|
||||
if (!GetIsPC(oPC))
|
||||
return;
|
||||
|
||||
if ((!GetIsAreaOccupied(OBJECT_SELF)) && (GetIsPC(GetExitingObject())))
|
||||
{
|
||||
int Rounds = GetLocalInt(OBJECT_SELF, "PrepClean") + 1;
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", Rounds);
|
||||
Rounds = GetLocalInt(OBJECT_SELF, "PrepClean");
|
||||
DelayCommand(60.0, DestroyAllItems());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DestroyAllItems()
|
||||
{
|
||||
int Rounds = GetLocalInt(OBJECT_SELF, "PrepClean");
|
||||
if (!GetIsAreaOccupied(OBJECT_SELF))
|
||||
{
|
||||
// If this is in reaction to the most recent instance of a PC leaving the area, clean up.
|
||||
if (Rounds == 1)
|
||||
{
|
||||
object oItem = GetFirstObjectInArea(OBJECT_SELF);
|
||||
// When an NPC dies, they drop an object, not an item... like a treasure chest.
|
||||
while (oItem != OBJECT_INVALID)
|
||||
{
|
||||
if (GetIsEncounterCreature(oItem))
|
||||
DestroyObject(oItem);
|
||||
if (GetTag(oItem) == "BodyBag")
|
||||
{
|
||||
object oLookIn = GetFirstItemInInventory(oItem);
|
||||
// Destroy everything in it except plot items.
|
||||
while (oLookIn != OBJECT_INVALID)
|
||||
{
|
||||
//Set to delete plot items
|
||||
//if (!GetPlotFlag(oLookIn))
|
||||
DestroyObject(oLookIn);
|
||||
oLookIn = GetNextItemInInventory(oItem);
|
||||
}
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
else if ((GetObjectType(oItem) == OBJECT_TYPE_ITEM))
|
||||
DestroyObject(oItem);
|
||||
oItem = GetNextObjectInArea(OBJECT_SELF);
|
||||
}
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If this is not from the most recent instance of a PC leaving an area, decriment.
|
||||
Rounds--;
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", Rounds);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Rounds--;
|
||||
SetLocalInt(OBJECT_SELF, "PrepClean", Rounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
This function returns TRUE if oArea currently
|
||||
has a PC in it and FALSE it doesn't.
|
||||
*Note: Returns FALSE if oArea is not valid.
|
||||
*/
|
||||
int GetIsAreaOccupied(object oArea)
|
||||
{
|
||||
if (GetIsObjectValid(oArea))
|
||||
{
|
||||
object oPlayer = GetFirstPC();
|
||||
while ((GetArea(oPlayer) != oArea) && (oPlayer != OBJECT_INVALID))
|
||||
oPlayer = GetNextPC();
|
||||
if (oPlayer != OBJECT_INVALID)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
Reference in New Issue
Block a user