What's your way of the Ninja?!
Would you like to react to this message? Create an account in a few clicks or log in to continue.

REMOVE SPAWN DROP BAGS

Go down

REMOVE SPAWN DROP BAGS Empty REMOVE SPAWN DROP BAGS

Post  DM Ramen Sat Dec 13, 2008 1:29 pm

Remove Spawn Drop Bags

**note that TSM (Tales of the Silver Marches) is the module name of a different server, so it should be changed appropriately to this server's name

Quoted from Perkko

Since you have access to the module, do you think you have time to modify the script named "area_exitdespawn" (the one currently in use in OnExit) so it does what we need? I don't know when the next update is planned but per haps in a week or two depending what areas get finished. If you can just ship me the modified script and I'll overwrite the old one when I do the next update that would be fab!

This is the current script if you don't have access to the mod atm.
// This script removes spawned creatures, all items and body bags.
// If you're not careful to use the matching onenter script it will
// happily destroy all your NPCs.
#include "inc_area_scripts"

/*****************************************************************************
* Changed by: D. Gavin
* Changed on: 6/11/2004
* Changes: Added Area Script Executing where script names are stored in
* an area's variables. At this time returned value does nothing.
*
* Variables examined for scripts to run are:
* TSM_AREA_RESET can be set to script to run after last PC leaves
* TSM_AREA_EXIT can be set to script to run when any PC leaves
*
****************************************************************************/
/*****************************************************************************
* Changed by: D. Gavin
* Changed on: 8/14/2004
* Changes: Placed NPC's were being destroyed as the check for isPlaced
* was commented out, readded the line.
****************************************************************************/
/***************************************************************************
* Change by: Memengwa
* Changed on: 2/10 2005
* Changes: Added a line that destroys the bodybag, hopefully this will work now.
***************************************************************************/
/***************************************************************************
* Change by: Malachias (aka Amier)
* Changed on: 8/17 2006
* Changes: DM:s now don't clear areas. Tried to fix bodybag removing.
***************************************************************************/

void ClearSpawned(object oExiter) {
if (GetIsPC(oExiter)&&!GetIsDM(oExiter)) {
int isLastPC = TRUE;
object oPC = GetFirstPC();
while (GetIsObjectValid(oPC) && isLastPC) {
object PCArea = GetArea(oPC);
if (oExiter != oPC && PCArea == OBJECT_SELF) {
isLastPC = FALSE;}
oPC = GetNextPC();
}
if (isLastPC) {
SetLocalInt(OBJECT_SELF, "NotEmpty", FALSE);
object oTarget = GetFirstObjectInArea(OBJECT_SELF);
while (oTarget != OBJECT_INVALID) {
switch (GetObjectType(oTarget)) {
case OBJECT_TYPE_CREATURE:
if(GetIsPC(oTarget) || GetIsDM(oTarget) ||
GetLocalInt(oTarget, "isPlaced") ||
GetIsObjectValid(GetMaster(oTarget)))
break; // player, NPC or pet
DestroyObject(oTarget);
break;
case OBJECT_TYPE_PLACEABLE:
/* It seems bodybags are a bit special.
They are only destroyed when their contents are. */
if(GetTag(oTarget)=="BodyBag") {
object oItem=GetFirstItemInInventory(oTarget);
while(oItem!=OBJECT_INVALID) {
DestroyObject(oItem);
oItem=GetNextItemInInventory(oTarget);
}
DestroyObject(oTarget);
}
break;
case OBJECT_TYPE_ITEM:
DestroyObject(oTarget);
}
oTarget = GetNextObjectInArea(OBJECT_SELF);
}
// Run Area's Reset script if variable set
// whne last PC has left area
int iRetVal = ExecuteAreaScriptReturnInt(GetLocalString(OBJECT_SELF, "TSM_AREA_RESET"), OBJECT_SELF);
}
}
}

void main()
{
object oExiter = GetExitingObject();
// Run Area's Exit script if variable set
if (GetIsPC(oExiter)) {
int iRetVal = ExecuteAreaScriptReturnInt(GetLocalString(OBJECT_SELF, "TSM_AREA_EXIT"), OBJECT_SELF);
}
ClearSpawned(oExiter);
}
DM Ramen
DM Ramen
Admin

Male Number of posts : 354
Registration date : 2008-12-04

https://nwnnaruto.forumotion.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum