Here try this I commented on it a bit.
[nwscript]
void main()
{
object oPC = GetEnteringObject();//establish oPC as the entering object
if (!GetIsPC(oPC)) return;//if oPC is not a PC end here
object oTarget = GetWaypointByTag("WAYPOINT1");//establish oTarget as a waypoint with "WAYPOINT1" as its tag
location lTarget = GetLocation(oTarget);//get the location of the oTarget
string CSPAWN1 = GetLocalString(oTarget,"CSPAWN1");
//the string variable set on the waypoint of a creature resref to spawn.
int nNumber = 6;//number of times we want to the loop to run
object oSpawn;//establish this object variable for later use in the loop
if (GetLocalInt(oTarget, "DO_ONCE")== 0) return;//if already been done stope here
while(nNumber != 0)//only loop if nNumber DOES NOT equal 0
{
oSpawn = CreateObject(OBJECT_TYPE_CREATURE, CSPAWN1, lTarget); //spawn critter
nNumber = nNumber-1;//reduce count by 1
}
//loop should be done so set DO_ONCE to 1 now
SetLocalInt(oTarget, "DO_ONCE", 1);
}[/nwscript]
Modifié par Baragg, 12 février 2011 - 04:29 .