//Script Name: counterspawns /////////////////////////////////// //IMPORTANT SETTING: //Set the # below to how many MAXIMUM # of monsters //you wish to allow any player to spawn before //they are sent to jail for overspawning too many monsters. const int nMax = 32; //Default = 18 (max = 38) //WARNING: DO NOT set the # above lower than 13!!! //Otherwise players might end up in jail by accident! ///////////////////////////////////////////////////////////// //Created By: Genisys / Guile //Created On: 7/1/08 //Updated On: 9/16/08 //////////////////////////////////// /* IMPORTANT NOTE: I added this script to this module for a GOOD reason, first, it prevents players from crashing your server!!!! Secondly, it prevents bad players from lagging down the server by herding XXX monsters into awaiting massive destructive spells, which CAN CRASH A SERVER! IF a player is sent to jail, they deserve to be there, so don't let their complaining prevent you from using this script it's here for YOUR Protection and other player's rights to have a quality gaming experience, and not to allow jerks to ruin the server module for other players! UPDATED: Added switch to control spawn count.. and added variable to verify they are indeed overspawning!! Anyone sent to jail DESERVES To BE THERE! This script checks for all monsters in the area and counts them up, if there are 18 monsters the PC entering the encounter trigger is sent to jail and the server is warned about them overspawning. I changed this to 18 for POA because of the drow, they usually spawn in large #s! Unforunately anyone in the area will have to stop and kill the remaining monsters or they will also go to jail. (Usually party members) MAKE SURE YOU CACHE THIS SCIPT!! (Edit / Module Properties / Cached Scripts Tab) (find it in the list and click add) (Do not cache includes!!!) */ //////////////////////////////////// void main() { object oPC = GetEnteringObject(); if(!GetIsPC(oPC))return; int nCount = 0; object oMon = GetFirstObjectInArea(GetArea(oPC)); //Let's make sure every object is valid.. while(GetIsObjectValid(oMon)==TRUE) { //Only add +1 of the object is indeed a hostile Creature/NPC and not a PC! if(!GetIsPC(oMon) && GetObjectType(oMon)==OBJECT_TYPE_CREATURE) { nCount+=1; } //find the next monster.. oMon = GetNextObjectInArea(GetArea(oPC)); } //Set the # 18 to the Max # of spawns that can be in an area.. if(nCount>=25 && nCount=nMax) { //Always tell the server which Player is overspawning.. AssignCommand(oPC, SpeakString("I'm Overspawning Monsters!", TALKVOLUME_SHOUT));//Have them shout it.. //If the player is level 6 or higher, send them to jail instantly! //We give new players some time to learn not to overspawn... if(GetHitDice(oPC) >4) { if(GetLocalInt(oPC, "OVERSPAWNED")==2) { object oTarget; location lTarget; oTarget = GetWaypointByTag("partyjail"); lTarget = GetLocation(oTarget); //Do the teleport only if it's valid! if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) { return; } AssignCommand(oPC, ClearAllActions()); AssignCommand(oPC, ActionJumpToLocation(lTarget)); //Tell them why they were sent to jail.. DelayCommand(6.0, FloatingTextStringOnCreature ("You have been sent to jail because of overspawning!", oTarget)); } //Otherwise set that they have in fact overspawned! //This ensures they are the offender! //The next time the enter the next trigger //If they have this variable they are going to jail! else { SetLocalInt(oPC, "OVERSPAWNED", 2); //Let's clear this so they will have to overspawn //again in order to go to jail.. DelayCommand(15.0, SetLocalInt(oPC, "OVERSPAWNED", 0)); } } //if statement end } //Script End }