Modding:Worlds: Difference between revisions

Jump to navigation Jump to search
m
Use hills instead of jungle since RoadNorthMouth / RoadSouthMouth won't really have any effect on the latter
(Add a section on dynamically adding secrets to the map.)
m (Use hills instead of jungle since RoadNorthMouth / RoadSouthMouth won't really have any effect on the latter)
 
(2 intermediate revisions by the same user not shown)
Line 101: Line 101:
# (Optional) If you want to make the secret findable while traversing the world map, get the <code>TerrainTravel</code> part on the block of terrain that you popped and add a new <code>EncounterEntry</code> to it.
# (Optional) If you want to make the secret findable while traversing the world map, get the <code>TerrainTravel</code> part on the block of terrain that you popped and add a new <code>EncounterEntry</code> to it.


The code example below demonstrates how we would go through these steps to add a secret creature to a random jungle tile.
The code example below demonstrates how we would go through these steps to add a secret creature to a random hills tile.


<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
Line 116: Line 116:
         public override void OnAfterBuild(JoppaWorldBuilder builder)
         public override void OnAfterBuild(JoppaWorldBuilder builder)
         {
         {
             var location = builder.popMutableLocationOfTerrain("Jungle", centerOnly: false);
             var location = builder.popMutableLocationOfTerrain("Hills", centerOnly: false);
             var zoneID = builder.ZoneIDFromXY("JoppaWorld", location.X, location.Y);
             var zoneID = builder.ZoneIDFromXY("JoppaWorld", location.X, location.Y);


Line 143: Line 143:


             // Add some roads to the north and south
             // Add some roads to the north and south
             zoneManager.AddZoneBuilder(zoneID, 5000, nameof(RoadNorthMouth));
             zoneManager.AddZoneBuilder(zoneID, ZoneBuilderPriority.LATE, nameof(RoadNorthMouth));
             zoneManager.AddZoneBuilder(zoneID, 5000, nameof(RoadSouthMouth));
             zoneManager.AddZoneBuilder(zoneID, ZoneBuilderPriority.LATE, nameof(RoadSouthMouth));


             // Add an object to the zone
             // Add an object to the zone
             // Replace "Oboroqoru" with the object ID of the creature you wnat to add
             // Replace "Oboroqoru" with the object ID of the creature you want to add
             var creature = GameObject.Create("Oboroqoru");
             var creature = GameObject.Create("Oboroqoru");
             zoneManager.AddZonePostBuilder(zoneID, nameof(AddObjectBuilder), "Object", zoneManager.CacheObject(creature));
             zoneManager.AddZonePostBuilder(zoneID, nameof(AddObjectBuilder), "Object", zoneManager.CacheObject(creature));

Navigation menu