Help - Search - Members - Calendar
Full Version: [VX/XP] clickable events mini-game
RPG RPG Revolution Forums > Scripting > Event Emporium > Eventing Tutorials
Tsukihime
Was collecting scripts and came across Glitchfinder's keyboard and mouse input systems.

Difficulty: easy
Engines: XP, VX
Scripts required: Keyboard Input, Mouse input.
Switches: none
Variables: none
Common events: none

Note that these values are based on a minimalistic design.
If you're making a mini-game that is contained in a single map, consider using map variables. That way, you can copy it into another project and not have to worry about variable conflicts.

Concept:

There's an event on the map. When you click on the event, something will happen.
It's a very general idea with plenty of applications.

The key idea behind these events is to use the following script in a conditional branch:

CODE
Mouse.press?(1) and Mouse.tile_pos == [$game_map.events[@event_id].x, $game_map.events[@event_id].y]


That just means when you click the left button on the event (specifically, it checks whether the position of your cursor is the same as the position of the event). I'm not sure if there's an easier way to get the x,y position of an event.

If it's true, you would just fill in what's supposed to happen when you click on the event successfully.
Additionally, you can separate it into nested conditional branches if you want to specify what happens if you miss the target.

CODE
Conditional Branch: Script: Mouse.press?(1)
   Conditional Branch: Script: Mouse.tile_pos == [$game_map.events[@event_id].x, $game_map.events[@event_id].y]
      <what happens when you click on it>
      else
         <what happens when you miss it>
      branch end
   else
      <leave this empty, otherwise it'll always run since you probably aren't clicking your mouse>
   branch end


Examples:

When you click on the event, you receive 1000 gold. If you miss, you exit the map.
Redd
Would you mind making a demo for us to test out? What makes this different than just common knowledge about Glitchfinder's inputs? The instructions for it are right inside of the script.
Tsukihime
There should be no difference, as scripted conditions as well as attributes for each class in the default system should be common knowledge to anyone that's making events anyways.

I am simply amusing myself with the discovery of scripts, class attributes, and removing dependencies on global switches and variables.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.