Example event:---PLUGIN COMMANDS---
There are 2 plugin commands.
enableTtm - Enabels touch-to-move
disableTtm - Disables touch-to-move
--- SCRIPT FUNCTIONS ---
This plugin lets you enable or disable the default touch
to move in game, as well as allows you to create events
that detect mouse clicks! If you're making a game with
no playable character for example, you can make pictures
clickable using this API.
There are several functions you can use. First off,
we'll be creating an event! So, go ahead and make
a blank event somewhere. Make sure to set it's
trigger to parallel. Now, create a "Conditional Branch",
and select the 4th tab to select "Script".
The conditions you can use for this are:
umapi.touch(x, y, width, height) -
this determines if a part of the screen
has been clicked. (Not linked to map location)
umapi.mtouch(x, y, width, height) -
The same as before, but is linked to map
location, so you can use this to have a hotspot
on the map. for example, you can select where
a house is (in pixels, not tiles), and have that
house be clickable.
umapi.gtouch(x, y) -
This will happen when you click or touch a tile
specified by the x/y coords.
You can get an events location
by typing umapi.eventX()/eventY() inside of the condition.
In addition, there's realEventX()/realEventY(), which will
tell the true x/y of the event instead of tile based.
For example, if you wanted to make a taller event
(such as a crystal) clickable, you can use this following
condition in the conditional branch:
umapi.mtouch(umapi.realEventX(4), umapi.realEventY(4)-umapi.tileHeight(), umapi.tileWidth(), umapi.tileHeight()*2)
4 would be the event id of the crystal graphic. It'd be different for you.
Notice how we subtract the y position by umapi.tileHeight(),
this grabs the height of the tile (even if it's changed by another plugin).
Same goes for umapi.tileWidth();. We also multiply umapi.tileHeight()*2,
meaning the clickable section are 2 tiles thick in height.
Additional function List:
umapi.mapX() - gets the X position of the map.
umapi.mapY() - gets the Y position of the map.
umapi.tileWidth() - returns the default tile width.
umapi.tileHeight() - returns the default tile height.
umapi.eventX(id) - gets the X tile of the event specified
umapi.eventY(id) - gets the Y tile of the event specified
umapi.realEventX(id) - gets the real x position of the event specified.
umapi.realEventY(id) - gets the real y position of the event specified.
umapi.block() - Stops the ability to touch-to-move on the map.
umapi.restore() - Re-enables the ability to touch-to-move on the map.
Using block/restore should be done via the event command "script",
optionally, there are plugin commands you can use as well.
◆Comment：Disable movement when click/touched ◆Plugin Command：disableTtm ◆Comment：Random click region on map ◆If：Script：umapi.mtouch(umapi.realEventX(2), umapi.realEventY(2), umapi.tileWidth(), umapi.tileHeight()) ◆Show Animation：EV002, Cure One 1 (Wait) ◆ ：End ◆Comment：Person click ◆If：Script：umapi.mtouch(umapi.realEventX(3), umapi.realEventY(3), umapi.tileWidth(), umapi.tileHeight()) ◆Set Movement Route：EV003 (Wait) ： ：◇Turn at Random ： ：◇Jump：+0, +0 ： ：◇SE：Jump1 (90, 100, 0) ◆ ：End ◆Comment：crystal click ◆If：Script：umapi.mtouch(umapi.realEventX(4), umapi.realEventY(4)-umapi.tileHeight(), umapi.tileWidth(), umapi.tileHeight()*2) ◆Open Save Screen ◆ ：End