Overworld Scripting ‐ Using Templates - haven1433/HexManiacAdvance GitHub Wiki

Click to return to the main scripting page

At this point, you should understand what event scripts are. So now you're ready to try writing your first script!

Script Templates

But you don't actually need to write a single line of instructions. Many common, simple scripts can be made for you automatically using HMA.

Start by clicking this button to see the available templates:

image

After you select the template that you want, you can drag it down from the toolbar to create the event in the map.

using-item-event-template

Many of the templates can be configured before you create them. For example, the NPC template lets you pick an overworld sprite, while the item template lets you pick what item you pick up. You can also edit them after you create them. But the template doesn't let you configure everything: for example, you can't configure what the NPC will say when you talk to them. So you need to be able to edit the script after the new event is created.

Editing a Script from a Template Event

Since all the template's scripts are relatively simple, HMA can read the script and turn it into controls that you see on the left panel. For example, after dropping the item template onto the map, you'll see that the item in the pokeball is listed at the bottom of the left panel.

image

You'll see different controls for each template's script that let you configure the important pieces of that script. For items, that just means the item in the pokeball. For NPCs, the only thing you can configure is what they say when you talk to them. But some scripts have a little more.

image

Shop keepers end up having 3 extra fields: how they welcome you, what they sell, and how they say goodbye. Other templates have so much information, they deserve their own tutorial!

Some Existing Events Support Template Editing Too!

HMA is reading the script to create the template editing controls in the left panel. So existing scripts in the game that are similar to the template scripts can also be edited directly from the map editor. For example, in Oldale Town's shop, the character on the right (red) has a simple script, so you can edit in the map editor. But the character on the left (blue) has a more complicated script, so it won't show up in the map editor and you'll need to edit it using the script editor.

image

(The red NPC's script can be edited in the map editor even though it was already in the game! The blue NPC's script is too complicated to edit directly in the map editor.)

simple-vs-complex-trainers

(In Route 102, the trainer on the left is pretty simple, so you can edit the script directly from the left panel in the map editor. But the trainer on the right supports rematches, so you need to edit the script using the script editor.)