Added helms and dynamic goblins. Added onEnter spawner scripts to all dungeon areas. Fixed the Dishonest Patrol to be dynamic & more like PnP. Full compile. Co-Authored-By: Draygoth <65428430+Draygoth@users.noreply.github.com>
		
			
				
	
	
		
			100 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			100 lines
		
	
	
		
			3.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| //::///////////////////////////////////////////////
 | |
| //:: Name Area Auto-cleaner
 | |
| //:: FileName areaclean
 | |
| //:: Copyright (c) 2001 Bioware Corp.
 | |
| //:://////////////////////////////////////////////
 | |
| /*
 | |
| Place this script in the OnExit field of an area's event
 | |
| tab. This will wait a few minutes after the last PC has
 | |
| left the area then destroy all non-plot items dropped by
 | |
| a PC or a slain NPC.
 | |
| It will never perform a cleaning while a PC is in the area.
 | |
| */
 | |
| //:://////////////////////////////////////////////
 | |
| //:: Created By: Undivine
 | |
| //:: Created On: November 2002
 | |
| //:://////////////////////////////////////////////
 | |
| void DestroyAllItems();
 | |
| int GetIsAreaOccupied(object oArea);
 | |
| void main()
 | |
|     {
 | |
|     if ((!GetIsAreaOccupied(OBJECT_SELF)) && (GetIsPC(GetExitingObject())))
 | |
|         {
 | |
|         float Wait = 0.0; // How many seconds to delay after PC has left area
 | |
|         int Rounds = GetLocalInt(OBJECT_SELF, "PrepClean") + 1;
 | |
|         /*
 | |
|         Rounds counts how many times the delayed DestroyAllItems fires.
 | |
|         This accounts for when a PC leaves and comes back and leaves again.
 | |
|         */
 | |
|         SetLocalInt(OBJECT_SELF, "PrepClean", Rounds);
 | |
|         Rounds = GetLocalInt(OBJECT_SELF, "PrepClean");
 | |
|         DelayCommand(Wait, 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 (GetTag(oItem) == "Body Bag")
 | |
|                   //  {
 | |
|                     object oLookIn = GetFirstItemInInventory(oItem);
 | |
|                     // Destroy everything in it except plot items.
 | |
|                     while (oLookIn != OBJECT_INVALID)
 | |
|                         {
 | |
|                        // if (!GetPlotFlag(oLookIn))   uncomment to not destroy plot items
 | |
|                             DestroyObject(oLookIn);
 | |
|                         oLookIn = GetNextItemInInventory(oItem);
 | |
|                         }
 | |
|                //     }
 | |
|                // else
 | |
|                 if (((GetObjectType(oItem) == OBJECT_TYPE_ITEM)||(GetObjectType(oItem) == OBJECT_TYPE_CREATURE)) && (!GetPlotFlag(oItem))) //modified to clear out creatures smo
 | |
|                     DestroyObject(oItem);
 | |
|                 oItem = GetNextObjectInArea(OBJECT_SELF);
 | |
|                 }
 | |
|             SetLocalInt(OBJECT_SELF, "PrepClean", 0);
 | |
|             SetLocalInt(OBJECT_SELF, "iInUse", 0);//for PW support
 | |
|             }
 | |
|         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 if 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;
 | |
|     }
 | |
| 
 |