Step-by-Step Mapbuilder Guide

New to Mapbuilder? This guide will walk you through all of the steps required to create a brand new map, introducing key features along the way. All region owners and helpers can access Mapbuilder at the url http://pokengine.org/mapbuilder.

## Step 1: Create a Map

After you open Mapbuilder, navigate to the **Maps** tab and click the “create new” button at the top left of the tab (arrow pointing to it below).

After you create a new map, you’ll see a black rectangle. This is your new map! The first thing you’ll want to do is fill in the settings for your map.

Click on the **Settings** tab to edit settings. There are a lot of options if you scroll down, but the most important are at the top here.

**Name:** Name your map. This name will be displayed in-game when you enter the map if you leave that option checked. I usually disable the option for interiors like random houses in a town, but leave it checked for most other maps.

If you check the **Private?** option, your map will not appear when searching on site. Otherwise, there’s no difference (people can still visit your map in-game). I leave most of my maps public. I do hide cutscene-related maps and anything related to a secret event I’m planning, but for the most part, no one is constantly posting about maps I’m making or anything.

The number visible in the option header is the map’s **ID number**. Use this for any code pertaining to your map.

**Description:** This is visible on-site in the regions section, if this map is tagged as a location on your regional map. Not hugely important.

**Folder:** This is very important for your organization! All your maps should be in a folder specific to your region or project. Sub-folders are incredibly helpful for organization.

The above would put my new map in the Rica folder, and then in the sub-folder Mimosa Town.

**Size:** I nearly always choose “use tilemap size”. Click the button after you upload a tilemap.

**Tilemap:** This is where you enter the tilemap the map will be using! Choose the correct map from the dropdown. In this case I’m making a Pokemon Center so I’m using my standard Pokemon Center tilemap.

**Region:** Enter the region this map belongs to here. This is extremely important! Pokemon, items, and variables are specific to each region, so your map will not work correctly if it’s not assigned the correct region.

The rest of the options are less important for now, so I will cover them later.

## Step 2: Add Objects

If you were to visit your map before adding objects, it would essentially just be a background image. You could run through walls, etc. Objects are the code that bring the map to life!

Navigate to the **Objects** tab to view, place, and edit objects. You’ll see a suite of objects in a folder named Default. Everyone gets access to these.

A **root object** is an object seen in the menu of objects. Many root objects contain code inherently, so that when you place them on the map, you don’t need to write any additional code. This use is best for code that you repeat a lot, such as solid walls.

Alternatively, you can write code in **individual objects** placed on the map. This is best used when you’re creating a unique event, such as NPC dialogue, that never needs to be repeated exactly.

**IMPORTANT NOTE:** If you want to be able to teleport to your map using in-text commands (AKA your special teleport powers), you must place a **Safe Point** object. That is where you’ll teleport to when teleporting to the map using this command. However, if you don’t want people to be able to teleport to your map, you don’t need to place a safe point. You can still reach the map through in-game code or connection points.

### Adding Solid Walls

I always start by placing wall blocks. The two solid-colored objects named **Block** have identical code inside (seen below), so use whichever you want based on which contrasts with the tilemap best for visibility. Place them wherever the walls are in your map. Players cannot stand on a tile containing a Block object.

NOTE: Left click to place objects. Hold down and drag to place multiple. Right click to delete. You can also mass-select objects using this option, in the bottom right corner of the screen:

### Writing Code in Objects

In order for anything exciting to happen in your map, you’re going to have to write some code. Here I’ve placed some more objects. The PC objects contain code already in the root, so I don’t need to write anything. However, the warp point and spawn point objects (at the entryway) do not contain code, so I have to write my own code to make them work.

Double-click on the object you want to edit on your map. A textbox will pop up. Here, you write your code. Below is my spawn point code. Spawn code is very simple, because I only need to specify two things: a spawn ID number (used for code) and the direction you face when you spawn there. **Be sure to hit save or else this will not save!** Don’t click on other areas of Mapbuilder until you’ve saved.

Next, I’m going to write my warp code. This code is also pretty simple, but includes one additional piece: a condition causing you to warp. You must specify under what condition the player is warped. In this case, I want the player to warp when they touch the tile but before they walk onto it, because the object is placed in “the void”.

The warp() command includes two details: the ID of the map it’s sending you to (map 1095 is Mimosa Town), and the ID of the spawn point on that map it’s sending you to (in this case, spawn ID 0, which is placed at the entrance to the Pokemon Center).

### Creating Root Objects

Root objects make your life SO much easier, so you should get into the habit of using them early! Pokemon Center healing code is a bit more complex than the above, but I’ve made root objects for nearly all of my code.

In order to create a root object, click the “create new” button in the top left. This will create a new object in your list called ???. Find it and double-click it in the left bar in order to open up its options.

Below is an example of the root object editing screen, featuring my small PC counter root object. This contains the dialogue tree used to initiate healing.

Other important settings:

**Name:** Self-explanatory.

**Sprite:** The icon you see in the bar on the left, and when you place the object on the map. This is pretty important for visibility. It quickly becomes a nightmare to keep track of your objects if they all have the same ? icon.

**Folder:** Same as maps, saving objects in folders is very useful.

## Step 3: Compiling and Testing the Map

Now that you have some basic stuff in, you probably want to check out your map in-game!

You may have noticed this floppy disc icon in the Settings tab. This is **not a save button**. Mapbuilder saves automatically! This is a **compile button** - when you click it, your edits are pushed live, so they become viewable in-game.

**IMPORTANT NOTE:** When you first create a new map, the compile button will be greyed out until you refresh the Mapbuilder window. I haven’t yet refreshed, so that’s why my compile button is still greyed out.

When I refresh, I see this, which means the map has saved changes which are not live. Click the compile button to compile your map.

**I suggest refreshing the Mapbuilder window often, and saving your longer code in Notepad or some other text format outside of Mapbuilder until you are sure the code is saved properly.** Sometimes Mapbuilder doesn’t save objects properly, and you can have “ghost” objects messing up your map. This is most likely to happen when rapidly placing and deleting objects, or when your internet connection is poor. When in doubt, refresh!

After refreshing, I can see there are some objects I placed that didn’t delete properly.

Once the map is compiled, I can teleport to it by typing /tp 1251 into the game chat, because I’ve placed a safe point object (at the counter in the image above). Now I can test the warp to make sure that it sends me to the correct location!

When testing maps, you need to clear cache to get the latest map data. The easiest way to do this is to click the game window and hit F5 - this reloads the map you’re on. This is great for testing small fixes. However, this doesn’t save when you refresh the window!

To fully clear cache, you need to first press F12 to open the dev console (seen below). This console is also useful for identifying bugs when you crash.

Next, go to the top of the browser window and right click the refresh button. Then, choose Empty Cache and Hard Reload.

### Important Notes About Cached Data

You can update most of a map’s data by clearing cache or hitting F5, including all the object data and Jcoad. However, there are some data stored on the server side that you cannot clear.

**Region settings and map’s existence** - these are stored server-side and update every few hours. If you’re having trouble viewing your new map (black screen) just wait a little bit.

**Pokemon stats** - Let’s say you added a new Pokemon to your wild encounters, but forgot to give it an EXP yield. Whoops! Pokemon stats take about a day to update, after you’ve already seen them in-game. You’ll have to wait.

**Items, trainer classes, moves, abilities, achievements** - These won’t be live until Jext reboots the server (which he does regularly). Add things you need in advance.