Okay, I replaced all of the returns with the curly brackets and tested the area. It is still not spawning any cocoons. I also checked to make sure the script was in the OnEnter of the area properties...it is.
GoG, do you mind taking another look and see if I missed anything?
Thanks...here it is..
/* Script generated by
Lilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:
http://nwvault.ign.c...&id=4683&id=625 */
//Modified by Paul Postel
//Modified on 03/15/13
//Modified with help from GhostofGod, from Bioware Social Forums
//Modified on 03/16/13
//Added loop to destroy all cocoons
//Removed returns; (they were ending the script) and placed curly brackets to separate die rolls so
// each roll would occur
//Objective:
//Keep spider-infested area full of spider cocoons, even if PC has destroyed some or all
//Spider encounters regenerate so area will always have spiders; this script is to make sure there are always cocoons
//When the PC enters the area the script destroys all spider cocoons in the area
//The script will then make ten separate d100 rolls; three set to succeed at 50% while three will be set at 100%
// so there will always be cocoons somewhere in the area
//Success means spider cocoons will be spawned at specific waypoints
//The end result is that the area will be populated with cocoons ranging from 30 to 60 in number
//Put this script OnEnter of the area
void main()
{
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
// Only fire for (real) PCs.
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
return;
object oTarget;
object oSpawn;
location lTarget;
int iNth = 0;
//Destroy all cocoons in this area
oTarget = GetObjectByTag("SpiderwebCocoon", iNth);
//loop to get all cocoons
while (GetIsObjectValid(oTarget))
{
DestroyObject(oTarget, 0.0);
iNth++;
oTarget = GetObjectByTag("SpiderwebCocoon", iNth);
}
//Roll d100
if (d100()>50)
{
//If successful, spawn cocoon at waypoint A
oTarget = GetWaypointByTag("SC_SpawnCocoonA");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>0) //This could be coded without the d100 roll but leaving in in case we want to change later
{
//If successful, spawn cocoon at waypoint B
oTarget = GetWaypointByTag("SC_SpawnCocoonB");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>50)
{
//If successful, spawn cocoon at waypoint C
oTarget = GetWaypointByTag("SC_SpawnCocoonC");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>50)
{
//If successful, spawn cocoon at waypoint D
oTarget = GetWaypointByTag("SC_SpawnCocoonD");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>50)
{
//If successful, spawn cocoon at waypoint E
oTarget = GetWaypointByTag("SC_SpawnCocoonE");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>0)//This could be coded without the d100 roll but leaving in in case we want to change later
{
//If successful, spawn cocoon at waypoint F
oTarget = GetWaypointByTag("SC_SpawnCocoonF");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>0)//This could be coded without the d100 roll but leaving in in case we want to change later
{
//If successful, spawn cocoon at waypoint G
oTarget = GetWaypointByTag("SC_SpawnCocoonG");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>50)
{
//If successful, spawn cocoon at waypoint H
oTarget = GetWaypointByTag("SC_SpawnCocoonH");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>50)
{
//If successful, spawn cocoon at waypoint I
oTarget = GetWaypointByTag("SC_SpawnCocoonI");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
//Move on to the nexdt d100 roll
if (d100()>50)
{
//If successful, spawn cocoon at waypoint J
oTarget = GetWaypointByTag("SC_SpawnCocoonJ");
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "spdcocoon001", lTarget);
}
}