718
edits
Kernelmethod (talk | contribs) (Add a section on dynamically adding secrets to the map.) |
Kernelmethod (talk | contribs) 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 | 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(" | 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, | zoneManager.AddZoneBuilder(zoneID, ZoneBuilderPriority.LATE, nameof(RoadNorthMouth)); | ||
zoneManager.AddZoneBuilder(zoneID, | 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 | // 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)); |