For my own future reference as well as for others, I'm leaving what I've learned here for people to examine and perhaps add to. People can add more answers to this if they want, but it was hard for me to figure out on my own as I didn't know what tags to search up on google. I am using this to create mini-games:
How to display a picture of some sort, then click on that picture to proceed
1) Firstly, you need a picture of some sort. Measure the picture out. I used a picture of a computer mouse that was 50x50 in size.
2) Download the following script that I've created:
http://www.forums.rpgmakerweb.com/index.php?/topic/54888-astra-cats-simple-cursor-script/
Install it and activate it. This will create a variable for the X and Y positions of the mouse: MouseX and MouseY. It's a cursor script so it will also allow you to set up a cursor if you'd like.
3) Create the following rpg maker game variables:
0001: PictureXPos
0002: PictureYPos
0003: EventPage
(Use the 1st and 2nd slots available)
4) Create your event on your map.
5) Create three pages for your event. On the first page check where it says "Variable" and set it to the 0003: Event Page you've created and set it to greater than or equal to 0.
6) Set the second page 0003: Event Page greater or equal to 1, and the third page 0003: Event Page greater or equal to 2.
7) Set your event Pages all to Auto-run.
8) On the first page set up the PictureXPos and PictureYPos variables. Let's say we're doing 200x200 as an example.
9) Do a "Show Picture" event command.
10) Make sure to keep the origin of the picture displayed to the top left.
11) Know your picture's size in pixels here. As an example it's 50x50.
12) Do a "Set Variable" event command and set the 0003: EventPage variable = 1 (so that the event goes on to the next page).
13) On the second page, make sure it's on Autorun just in case it wasn't set to that before...
14) Do a "Conditional Branch" event command, and on the 4th page click on the bubble "Script"
15) For this example, you can put:
TouchInput.isTriggered()
(You can also do "TouchInput.isCancelled()" to wait for a right click instead of a left click)
16) Do a second "Conditional Branch" event command inside of the first one. On the 4th page click on the bubble "Script"
17) For this example, you can put something like:
MouseX > $gameVariables._data[1] && MouseY > $gameVariables._data[2] && MouseX < $gameVariables._data[1]+50 && MouseY < $gameVariables._data[2]+50
(Remember that the picture is 50x50 for this example, so you'd have to adjust the size accordingly. A better practice would be to put the picture's size into a $gameVariable as well, then add that on to the MouseX < and MouseY < parts)
18) If the conditional branch is true, do a "Set Variable" event command and set the 0003: EventPage variable to 2 (to go to the next event page)
19) Create whatever you want on the third page of the event and beyond.
What you've create above by doing this is an event in where you click on a picture that's displayed to proceed.
Note: Also
$gameVariables._data[] is the part that took me a while to figure out. You can also use it to set an in-game variable in rpg maker mv to a comparison between 2 or more numbers like so:
Script: $gameVariables._data[4] = $gameVariables._data[5] * $gameVariables._data[6]
You can use this to create health bars, an example being that you could have 10 or more health bar pictures, and use conditional branches to display them using the following math equation:
PercentageOfHPLeft = HP / TotalHP * 100
Mine ended up looking in a Script command like:
$gameVariables._data[11] = $gameVariables._data[12] / $gameVariables._data[13] * 100
Which gave me a percentage of how much HP the character had left, due to the fact that game variable 0011 was HPpercentage, 0012 was HPcurrent, 0013 was HPtotal and 100 just changes the decimal place of your final result.
HP will change, giving you the percent of your characters HP, which you can then use to change pictures of your health bar.
本贴来自国际rpgmaker官方论坛作者:astracat111处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/click-on-a-picture-to-proceed-easy-tutorial.60245/