string GetResource(string ID) { if (GetStringLeft(ID, 5) == "METAL") { if (ID == "METAL01") return "cnrRockCopp"; else if (ID == "METAL02") return "cnrRockTin"; else if (ID == "METAL03") return "cnrRockIron"; else if (ID == "METAL04") return "cnrRockGold"; // TODO - Forlorn city / Currently in Mt Eska else if (ID == "METAL05") return "cnrRockPlat"; // Laidly cave else if (ID == "METAL06") return "cnrRockAdam"; // Duergar mines else if (ID == "METAL07") return "cnrRockCoba"; // Kahalala/Kuruh else if (ID == "METAL08") return "cnrRockSilv"; // Red tribe cave, Kahalala else if (ID == "METAL09") return "cnrRockTita"; // Uttersea Isle - Frozen Lake Ice Tomb else if (ID == "METAL10") return "cnrRockMith"; // TODO - TBD } if (GetStringLeft(ID, 4) == "GEM0") { if (ID == "GEM001") return "cnrGemDeposit001"; // Greenstone - North/Kobolds, Stream/Kobolds, Seris/Kobolds else if (ID == "GEM002") return "cnrGemDeposit007"; // Malachite - Suman Mountain, Brie Valley, Coast SW, Seris/Ogres, UD (beetles) else if (ID == "GEM003") return "cnrGemDeposit002"; // Fire Agate - Krillan's Pass, Coast Far SE, UD (Ramsallis), Passage - South, Kuruh else if (ID == "GEM004") return "cnrGemDeposit014"; // Aventurine - Loriette West, Cleaven Ruins, UD (GFW), else if (ID == "GEM005") return "cnrGemDeposit004"; // Phenalope - Plains Gorgon/Mino Cave, Rustin Mountain peak, UD (Krillan's), Kuruh Canyons else if (ID == "GEM006") return "cnrGemDeposit003"; // Amethyst - UD (GF), Webby Cavern Queen, Kurst (level 1) else if (ID == "GEM007") return "cnrGemDeposit015"; // Feldspar - Coast SE, UD (GFE), UD (Uttersea) else if (ID == "GEM008") return "cnrGemDeposit011"; // Garnet - Kahalala West, Hope North, Hope SouthWest, Kuruh Canyons else if (ID == "GEM009") return "cnrGemDeposit013"; // Alexandrite - Red Tribe Valley, Kir Lanaan upper, Kuruh Canyons, Kurst (level 2) else if (ID == "GEM010") return "cnrGemDeposit010"; // Topaz - Taluk else if (ID == "GEM011") return "cnrGemDeposit008"; // Sapphire - Liz marsh south else if (ID == "GEM012") return "cnrGemDeposit009"; // Fire Opal - TODO - Heart of the Flame area else if (ID == "GEM013") return "cnrGemDeposit005"; // Diamond - Duergar Mines else if (ID == "GEM014") return "cnrGemDeposit006"; // Ruby - The Great Lake else if (ID == "GEM015") return "cnrGemDeposit012"; // Emerald - TODO - Lizard Marches 3/Hydras else if (ID == "GEM016") return "cnrGemDeposit016"; // Obsidian - TODO - Obsidian isle } if (ID == "SAND") return "cnrDepositSand"; else if (ID == "CLAY") return "cnrDepositClay"; else if (ID == "DIRT") return "cnrPileOfDirt"; // Greaveyards else if (ID == "SALT") return "cnrPileOfSalt"; // Coast else if (ID == "BEENEST") return "cnrBeeNest"; else if (ID == "BEEHIVE") return "cnrBeeHive"; if (GetStringLeft(ID, 4) == "WOOD") { if (ID == "WOOD1") return "cnrTreeHickory"; // Plains, headlands else if (ID == "WOOD2") return "cnrTreeOak"; // Grand forest else if (ID == "WOOD3") return "cnrTreeMahogany"; // Keeper of the grove, liz marsh } if (GetStringLeft(ID, 4) == "TREE") { if (ID == "TREE1") return "cnrTreeHickory"; // Plains, headlands else if (ID == "TREE2") return "cnrTreeOak"; // Grand forest else if (ID == "TREE3") return "cnrTreeMahogany"; // Keeper of the grove, liz marsh } if (GetStringLeft(ID, 5) == "GRAIN") { if (ID == "GRAIN1") return "cnrRicePlant"; else if (ID == "GRAIN2") return "cnrWheatPlant"; else if (ID == "GRAIN3") return "cnrCottonPlant"; else if (ID == "GRAIN4") return "cnrCornPlant"; else if (ID == "GRAIN5") return "cnrOatsPlant"; else if (ID == "GRAIN6") return "cnrRyePlant"; else if (ID == "GRAIN7") return "cnrBarleyPlant"; } if (GetStringLeft(ID, 8) == "MUSHROOM") { if (ID == "MUSHROOM1") return "cnrPatchMushWht"; else if (ID == "MUSHROOM2") return "cnrPatchMushSpot"; else if (ID == "MUSHROOM3") return "cnrPatchMushRed"; else if (ID == "MUSHROOM4") return "cnrPatchMushWht"; else if (ID == "MUSHROOM5") return "cnrPatchMushBlk"; else if (ID == "MUSHROOM6") return "cnrPatchMushYel"; } /******************************************************************************* // WONT WORK // For example Ginseng and Ginger are high valued plants // and should not be found from farmlands else if (ID == "FARMPLANT1") return "cnrApplePlant"); else if (ID == "FARMPLANT1") return "cnrCherryPlant"); else if (ID == "FARMPLANT1") return "cnrChestnutPlant"); else if (ID == "FARMPLANT1") return "cnrWalnutPlant"); else if (ID == "FARMPLANT1") return "cnrRyePlant"); else if (ID == "FARMPLANT1") return "cnrCornPlant"); else if (ID == "FARMPLANT1") return "cnrWheatPlant"); else if (ID == "FARMPLANT1") return "cnrOatPlant"); else if (ID == "FARMPLANT1") return "cnrBarleyPlant"); else if (ID == "FARMPLANT1") return "cnrGrapePlant"); else if (ID == "FARMPLANT1") return "cnrHopsPlant"); else if (ID == "FARMPLANT1") return "cnrGarlicPlant"); */ if (GetStringLeft(ID, 4) == "MISC") { if (ID == "MISC1") return "cnrApplePlant"; // Farmlands else if (ID == "MISC2") return "cnrCherryPlant"; // Farmlands else if (ID == "MISC3") return "cnrMaplePlant"; // Plains, rustin point else if (ID == "MISC4") return "cnrGrapePlant"; // Ranzington wall else if (ID == "MISC5") return "cnrNettlePlant"; // grand forest, loriette else if (ID == "MISC6") return "cnrPearPlant"; // farmlands else if (ID == "MISC7") return "cnrBlkberryPlant"; // loriette, grand forest else if (ID == "MISC8") return "cnrRspberryPlant"; // loriette, grand forest else if (ID == "MISC9") return "cnrBluberryPlant"; // suman mountain, rustin north else if (ID == "MISC10") return "cnrEchinaceaPlant"; // NOWHERE ATM } if (GetStringLeft(ID, 5) == "PLANT") { if (ID == "PLANT01") return "cnrBkCohoshPlant"; // Fort areas else if (ID == "PLANT02") return "cnrAngelicaPlant"; // Fort areas/near else if (ID == "PLANT03") return "cnrWalnutPlant"; // Farmlands else if (ID == "PLANT04") return "cnrAloePlant"; // Rustin road/Suman valley else if (ID == "PLANT05") return "cnrPepmintPlant"; // Farmlands else if (ID == "PLANT06") return "cnrAlmondPlant"; // Plains, brie valley else if (ID == "PLANT07") return "cnrGarlicPlant"; // North of fort, creek else if (ID == "PLANT08") return "cnrSagePlant"; // Suman mountain, rustin mountain else if (ID == "PLANT09") return "cnrHazelnutPlant"; // Plains, coast else if (ID == "PLANT10") return "cnrCrnberryPlant"; // Ruins, Loriette else if (ID == "PLANT11") return "cnrEldberryPlant"; // Suman mountain peak, rustin mountain peak else if (ID == "PLANT12") return "cnrBirchPlant"; // Plains, Rustin south else if (ID == "PLANT13") return "cnrHawthornPlant"; // Red tribe entrance, rustin north else if (ID == "PLANT14") return "cnrCatnipPlant"; // Plains near cats, headlands near cats else if (ID == "PLANT15") return "cnrChestnutPlant"; // Coast west from ranz, coast 2 east from ranz else if (ID == "PLANT16") return "cnrChamomilePlant"; // outside krust else if (ID == "PLANT17") return "cnrPecanPlant"; // Fort raut else if (ID == "PLANT18") return "cnrComfreyPlant"; // north from ranz else if (ID == "PLANT19") return "cnrCoverPlant"; // east from ranz else if (ID == "PLANT25") return "cnrHazelPlant"; // Is there plant called this? :) ...Yes there is, found from witch-hut else if (ID == "PLANT20") return "cnrSkullcapPlant"; // broken cliffs else if (ID == "PLANT21") return "cnrThistlePlant"; // Fort cleaven ruins else if (ID == "PLANT22") return "cnrHopsPlant"; // South rustin mountian else if (ID == "PLANT23") return "cnrGingerPlant"; // Outside fort raut else if (ID == "PLANT24") return "cnrGinsengPlant"; // Red tribe, Taluk } return "INVALID RESOURCE"; } string GetPlaceable(string ID) { if (ID == "FORGE") return "cnrForgePublic"; else if (ID == "ANVIL WEAPON") return "cnrAnvilPublic"; else if (ID == "ANVIL ARMOR") return "cnrAnvilArmor"; else if (ID == "TRASH") return "cnrTrashBarrel"; else if (ID == "CARPENTERY") return "cnrCarpenteryBench"; else if (ID == "OVEN") return "cnrBakersOven"; else if (ID == "WATERTUB") return "cnrWaterTubg"; else if (ID == "TAILOR1") return "cnrCuringTub"; else if (ID == "TAILOR2") return "cnrTailorsTable"; else if (ID == "ALTAR") return "cnrEnchantAltar"; else return "INVALID RESOURCE"; } const int CNR_WAYPOINTS_IN_SINGLE_PASS = 500; void main() { int Nth = GetLocalInt(GetModule(), "WaypointNumber"); int StartNth = Nth; object Waypoint; object Created; string Tag = "cnr_resourcepoint"; string name, resref, sOffset, ID; int StartPoint, offset; float orientation; vector vPosition; location SpawnPoint; int EndPlc = 0; int EndRes = 0; Waypoint = GetObjectByTag(Tag, Nth); while (Waypoint != OBJECT_INVALID && Nth < StartNth+CNR_WAYPOINTS_IN_SINGLE_PASS) { // Get ResRef and offset for resource spawned name = GetName(Waypoint); StartPoint = FindSubString(name, ", offset "); sOffset = GetSubString(name, StartPoint + 9, GetStringLength(name) - StartPoint - 9); offset = StringToInt(sOffset); ID = GetStringLeft(name, StartPoint); resref = GetResource(ID); // Get Vectors for resource spawned vPosition = GetPosition(Waypoint); vector vPosition = GetPosition(Waypoint); if (d2() == 1) vPosition.x = vPosition.x - (IntToFloat(Random(offset*10))/10); else vPosition.x = vPosition.x + (IntToFloat(Random(offset*10))/10); if (d2() == 1) vPosition.y = vPosition.y - (IntToFloat(Random(offset*10))/10); else vPosition.y = vPosition.y + (IntToFloat(Random(offset*10))/10); // Check if waypoints facing has been altered orientation = GetFacing(Waypoint); if (orientation == 0.0) orientation = IntToFloat(Random(360)); // Get Location for resources SpawnPoint = Location(GetArea(Waypoint), vPosition, orientation); Created = CreateObject(OBJECT_TYPE_PLACEABLE, resref, SpawnPoint); SetLocalObject(Created, "waypoint", Waypoint); SetLocalInt(Created, "offset", offset); // DUN ASK WHAT THIS MEANS! IT MEANS NOTHING // ijghakgjhalgjalkfla.. just bored :) // End of boredness code if (Created == OBJECT_INVALID) WriteTimestampedLogEntry(resref + " creation failed to " + GetName(Waypoint)); // SendMessageToAllDMs("Creating " + GetName(Waypoint) + " to " + GetName(GetArea(Waypoint)) + " (#" + IntToString(Nth) + ")"); Nth++; Waypoint = GetObjectByTag(Tag, Nth); } if (Waypoint == OBJECT_INVALID) { SetLocalInt(GetModule(), "placedres", Nth-1); EndRes = 1; } Nth = StartNth; Tag = "cnr_placeablepoint"; Waypoint = GetObjectByTag(Tag, Nth); while (Waypoint != OBJECT_INVALID && Nth < StartNth + CNR_WAYPOINTS_IN_SINGLE_PASS) { name = GetName(Waypoint); resref = GetPlaceable(name); SpawnPoint = GetLocation(Waypoint); Created = CreateObject(OBJECT_TYPE_PLACEABLE, resref, SpawnPoint); if (Created == OBJECT_INVALID) WriteTimestampedLogEntry(resref + " creation failed to " + GetName(Waypoint)); // SendMessageToAllDMs("Creating " + GetName(Waypoint) + " to " + GetName(GetArea(Waypoint)) + " (#" + IntToString(Nth) + ")"); Nth++; Waypoint = GetObjectByTag(Tag, Nth); } if (Waypoint == OBJECT_INVALID) EndPlc = 1; SetLocalInt(GetModule(), "WaypointNumber", StartNth+CNR_WAYPOINTS_IN_SINGLE_PASS); if (EndRes == 0 || EndPlc == 0) DelayCommand(0.1, ExecuteScript("cnr_res_spawn", OBJECT_SELF)); }