Jaysyn904 102ba7dab6 Initial Commit
Initial Commit
2023-09-21 19:51:32 -04:00

111 lines
3.3 KiB
Plaintext

void main()
{
object oEntered = GetEnteringObject();
ExploreAreaForPlayer(GetArea(oEntered), oEntered);
if(oEntered != OBJECT_INVALID) {
SetLocalInt(oEntered, "nShooter", 0);
SetLocalInt(oEntered, "nPass", 0);
SetLocalInt(oEntered, "nDontPass", 0);
SetLocalInt(oEntered, "nPassOdds", 0);
SetLocalInt(oEntered, "nCome", 0);
SetLocalInt(oEntered, "nDontCome", 0);
SetLocalInt(oEntered, "nComeOdds", 0);
SetLocalInt(oEntered, "nPlace4", 0);
SetLocalInt(oEntered, "nPlace5", 0);
SetLocalInt(oEntered, "nPlace6", 0);
SetLocalInt(oEntered, "nPlace8", 0);
SetLocalInt(oEntered, "nPlace9", 0);
SetLocalInt(oEntered, "nPlace10", 0);
SetLocalInt(oEntered, "nBuy4", 0);
SetLocalInt(oEntered, "nBuy5", 0);
SetLocalInt(oEntered, "nBuy6", 0);
SetLocalInt(oEntered, "nBuy8", 0);
SetLocalInt(oEntered, "nBuy9", 0);
SetLocalInt(oEntered, "nBuy10", 0);
SetLocalInt(oEntered, "nLay4", 0);
SetLocalInt(oEntered, "nLay5", 0);
SetLocalInt(oEntered, "nLay6", 0);
SetLocalInt(oEntered, "nLay8", 0);
SetLocalInt(oEntered, "nLay9", 0);
SetLocalInt(oEntered, "nLay10", 0);
SetLocalInt(oEntered, "nField", 0);
SetLocalInt(oEntered, "nBig6", 0);
SetLocalInt(oEntered, "nBig8", 0);
SetLocalInt(oEntered, "nSeven", 0);
SetLocalInt(oEntered, "nHard4", 0);
SetLocalInt(oEntered, "nHard6", 0);
SetLocalInt(oEntered, "nHard8", 0);
SetLocalInt(oEntered, "nHard10", 0);
SetLocalInt(oEntered, "n2", 0);
SetLocalInt(oEntered, "n3", 0);
SetLocalInt(oEntered, "n11", 0);
SetLocalInt(oEntered, "n12", 0);
SetLocalInt(oEntered, "nCraps", 0);
SetLocalInt(oEntered, "nHorn", 0);
SetLocalInt(oEntered, "nComePoint", 0);
}
//This part generates and spawns random NPCs
if(GetLocalInt(OBJECT_SELF, "NPCGenerated") == FALSE)
{
string sResRef;
string sRace;
string sGender;
int i;
int n;
location loc;
string sSpot;
object oNPC;
string sArea = GetLocalString(OBJECT_SELF, "Area");
//Determine the number of waypoints for NPC spawning
for(n=1; n>0; n++)
{
sSpot = IntToString(n);
if (GetWaypointByTag(sArea+"_SPAWN_"+sSpot) == OBJECT_INVALID)
{
n--;
break;
}
}
//Generate and spawn NPCs
for(i=1; i<=n; i++)
{
switch (Random(7))
{
case 0: sRace = "hu"; break;
case 1: sRace = "ha"; break;
case 2: sRace = "el"; break;
case 3: sRace = "he"; break;
case 4: sRace = "ho"; break;
case 5: sRace = "dw"; break;
case 6: sRace = "gn"; break;
}
switch (Random(2))
{
case 0: sGender = "_m"; break;
case 1: sGender = "_f"; break;
}
sResRef = "anc_npc_"+sRace+sGender;
sSpot = IntToString(i);
loc = GetLocation(GetWaypointByTag(sArea+"_SPAWN_"+sSpot));
oNPC = CreateObject(OBJECT_TYPE_CREATURE, sResRef, loc);
SetPlotFlag(oNPC, TRUE);
SetLocalString(oNPC, "Waypoint", sArea+"_SPAWN_"+sSpot);
SetLocalInt(oNPC, "Commoner", TRUE);
SetLocalInt(oNPC, "Rumor", Random(3)+1);
if(Random(4) != 3)
{
SetLocalInt(oNPC, "ToSit", TRUE);
SetLocalInt(oNPC, "X2_L_SPAWN_USE_AMBIENT", FALSE);
}
}
SetLocalInt(OBJECT_SELF, "NPCGenerated", TRUE);
}
//Done generating and spawning NPCs
}