I was looking at all kinds of spawn scripts myself today.I seen this one the nwn2 vault. I was wondering if this can be fitted for nwn? It's looks pretty easy to use.
// crypt_onenter
// by Gilgon Avalrock
// this script, when placed in the OnEnter slot for an area, will find all waypoints tagged WP_SPAWNSKEL,
// and randomly create a skeleton at that location. This will only happen once for each PC that enters
// the area, and the difficulty and number of creatures will increase based on the PC's overall level.
// Just replace the monster pallete names with those of whatever creatures you want in your random table,
// and you can adjust the numbers below to change the probablilities.
void main()
{
int eChance;
string sTemplate;
location lLoca;
int nRoll,i;
object oEntered = GetEnteringObject();
//Makes sure it's a PC entering the area for the first time(don't want looping scripts or too many monsters)
if (GetIsPC(oEntered) && GetLocalInt(OBJECT_SELF,"m_n"+GetPCPlayerName(oEntered))==0 ) {//store a local int with the player's name
SetLocalInt(OBJECT_SELF,"m_n"+GetPCPlayerName(oEntered),1);
int nlvl = GetLevelByPosition(1,oEntered)+GetLevelByPosition(2,oEntered)
+GetLevelByPosition(3,oEntered);
object oWaypoint = GetFirstObjectInArea(OBJECT_SELF);
while(GetIsObjectValid(oWaypoint)) //loop through all objects in area
{
if(TestStringAgainstPattern("WP_SPAWNSKEL",GetTag(oWaypoint))){ //finds all waypoints tagged WP_SPAWNSKEL (change this to whatever tag you want)
lLoca = GetLocation(oWaypoint);
eChance = d100(1);
if (eChance > (5+(3*(20-nlvl)))) //chance of a spawn (38% to 95% based on level)
{
nRoll = d20(1)+nlvl-1; //results range from 1-20 to 20-40 based on level
if (nRoll <= 10) { //1-10
sTemplate = "nw_skeleton";
}else if (nRoll <= 20) {//11-20
sTemplate = "nw_skelmage";
}else if (nRoll <= 25) {//21-25
sTemplate = "nw_skelpriest";
}else if (nRoll <= 30) {//26-30
sTemplate = "nw_skelwarr01";
}else if (nRoll <= 35) {//31-35
sTemplate = "nw_skelwarr02";
}else { //36-40
sTemplate = "nw_skelchief";
}
CreateObject(OBJECT_TYPE_CREATURE, sTemplate,lLoca, TRUE);
SetIsDestroyable(TRUE);
}
}
oWaypoint = GetNextObjectInArea(OBJECT_SELF);
}
}
}