[RMMV Plugin] Pathfinding Extras

Version: v1.00

Introduction

Unlike in RPG Maker VX Ace and former, RPG Maker MV's default game system allows the player to click on a game map tile as destination. The player character will find a shortest path to it using A* pathfinding algorithm, as implemented in method Game_Character.findDirectionTo.

In this plugin, such that method is overriden and extended to allow you to select one of pathfinding algorithms: A*, Jump-point Search, Dijkstra and Greedy Best-first Search. Additionally, you can also enable the characters to move diagonally by setting the parameter '8-directional Mode'.

Contact me for support/bug report:

listra92@gmail.com
https://www.facebook.com/don.listRA92

About Pathfinding Algorithms

You can learn about the pathfinding algorithms in the following articles.

A*:

Jump-point Search:

Dijkstra:

Features and Usages

  • Option to select other pathfinding algorithms to experiment: Jump-point Search, Dijkstra and Greedy Best-first Search.
  • Option whether to keep the found path until the character reach the destination; thus the pathfinding algorithm is only executed once when being ordered to move to the destination. However, the path can be obstructed by some moving objects (other characters), as the character won't move avoiding them.
  • Option whether to draw diagnostic traces as magenta and blue squares that represent path and explored tiles.

Notes

  • If you have MK_AdvancedMove plugin installed, put this plugin under it.
  • Jump-point search is the fastest algorithm since it searches fewer tiles than A* does, but still produces shortest path.
  • Greedy best-first search often performs badly; it tends to produce much longer path. Also unless the 'Remember Path' option is enabled, the character's movement can somewhat get stalled.

Coming in the Next Version

  • Some optimizations, probably.

Known issues

  • The current implemented jump-point search somehow fails on dealing with some certain tiles, like in sample map 'School Hall'.

Download Plugin

MK_Pathfinding.js

RPG MV Plugins Wishlist

Notes

Here I have some idea of RPG Maker MV plugins to develop in some time. There's no estimation on when they'll be done. Anyway if you want to suggest some more, feel free to comment here.

Plugins Wishlist

  • Easy draw text: allows you to draw styled text as pictures on the game map. This can help you to, e.g. make some HUD and on-map popups.
  • On-map bullet: allows the player character and events to spawn 'bullets' as pictures on the game map. The bullets will vanish when hitting impassable tiles and can trigger some common events when hitting the characters.
  • Localization and string table (done, see on this link!): allows player to select a different language through the Options menu for the game terms. You can also define table of strings for each language in a file data\Strings.json, to be used for e.g. dialog messages.
  • Custom weathers: allows you to freely customize how particles spawn for each weather. You can also use image for each particle (can affect the game performance).
  • Free/pixel movement in Advanced Movement plugin: the player character won't be always snapped to the tiles upon moving.
  • Item usage dependency: enables items to use up some other items when consumed, like recipes.
  • Advanced currency: allows you to define multiple currencies and fractional terms (for example 1g 500s that's equal to 1500s).
  • Secure data & resource encryptor: provides a tool to encrypt (almost) all game files. Still being researched since resource and data files, including scripts are exposed and thus vulnerable to kind of abuses, as decrypting files using a script in the game isn't a completely secure way.
  • Vitality/hunger system: each actor has vitality points (VP) that indicates his/her hunger. His/her stats (max HP, ATK, etc.) will be penalized by certain percentage if his/her VP runs low. There's also critical level of VP where the actor can't participate in battles, and zero level (starvation) where he/she dies. VP of the actors decreases upon attacking/casting skills, while you can define skills and items ('foods') that give the user/designated targets some VP.
  • Advanced targeting and unit classification: allows you to define unit classifications (like Mechanical, Undead, etc.) and extends possible target scope of each skill (including the unit classifications), pretty like in Warcraft III. In addition, you can define different effects for each target scope, e.g. a skill that deals damage to Undead units and recover HP of non-Undead units.
  • MMO-style map navigation: displays minimap HUD and adds a menu option to show the full map. The map also contains certain icon marks for some events (e.g. NPCs that gives you quests). The player can also click on the map as destination point to auto-path.
  • MMO-style quest system: just like in most Korean MMORPGs.
  • And finally a 'project' plan, μ'ki's Action System: a whole on-map action battle system (ABS), adopted from Korean MMOs and offline RPGs like Zenonia.

[Game] The Mystery House

Concept Story

At a midnight, a thief named Baron got in Diana's house when Diana and Lina were sleeping. He quietly kidnapped and brought Lina to a mystery house. That house has 20 floors and looks scary. Baron uses a teleportation device in order to get in the mystery house instantly. In that house, Baron hid Lina in an unknown place, on 20th floor.

Meanwhile, Diana suddenly got up. She was shocked that Lina was lost. Then a security came and told to Diana, "I saw Baron Lina in a mystery house. Save her!"

Diana went to the mystery house soon and brought nothing to save Lina. Will she find Lina in such a scary house...?

Screenshots

Download

Download The Mystery House (about 11 MB)

Credits

  • Enterbrain
  • redlagart
  • reijubv
  • Sithjester
  • ardo_wei

[RMMV Plugin] Self Variables

Version: v1.00

Introduction

The RPG MV default game system has self switches data, but you may also need 'self variables' that belong to each event object like self switches do. That was inspired by RPG VX script "Rei Self Variable", which can be found at RPGMakerID forum, so that I developed this RPG MV plugin for it.

Contact me for support/bug report:

listra92@gmail.com
https://www.facebook.com/don.listRA92

Features and Usages

  • Allows self variables data to be stored in the game save data.
  • Provides easier access to self variables and switches:
    $gameSelfVariables.valueOf(eventId, 'name')
    $gameSelfVariables.setValueOf(eventId, 'name', value);
    $gameSelfSwitches.valueOf(eventId, 'name')
    $gameSelfSwitches.setValueOf(eventId, 'name', value);

    Note: The self switch names by default are 'A', 'B', 'C' and 'D', but here you can define the names by yourself.

Download Plugin

MK_SelfVariables.js

JavaScript Tips & Tricks

Introduction

While writing some JavaScript code in your RPG Maker MV plugins, web applications, and whatever, there are somewhat small things you're ignoring. They may not often affect your script performance and results, but practically you should pay attention on them to write more efficient code and avoid unwanted effects. Here some useful tips for such those.

Tip #1: Avoid global variables, always declare local variables

Minimize the use of global variables. This includes all data types, objects, and functions. Global variables and functions can be overwritten by other scripts.

All variables used in a function/scope should be declared as local variables. Local variables must be declared with the var keyword, otherwise they will become global variables.

Tip #2: Declarations on top

It is a good coding practice to put all declarations at the top of each script or function. This will:

  • Give cleaner code
  • Provide a single place to look for local variables
  • Make it easier to avoid unwanted (implied) global variables
  • Reduce the possibility of unwanted re-declarations

Tip #3: Initialize variables

It is a good coding practice to initialize variables when you declare them. This will:

  • Give cleaner code
  • Provide a single place to initialize variables
  • Avoid undefined values

var firstName = "",
lastName = "",
price = 0,
discount = 0,
fullPrice = 0,
myArray = [],
myObject = {};

Tip #4: Never declare Number, String, or Boolean objects

Declaring these types as objects, slows down execution speed, and produces nasty side effects.

  • Use {} instead of new Object()
  • Use "" instead of new String()
  • Use 0 instead of new Number()
  • Use false instead of new Boolean()
  • Use [] instead of new Array()
  • Use /()/ instead of new RegExp()
  • Use function (){} instead of new function()

Tip #5: Beware of automatic type conversions

Beware that numbers can accidentally be converted to strings or NaN (Not a Number). JavaScript is loosely typed. A variable can contain different data types, and a variable can change its data type:

var x = 5 + "7"; // x is "57", typeof x is a string

Tip #6: Use === comparison

The == comparison operator always converts (to matching types) before comparison. The === operator forces comparison of values and type.

0 == ""; // true
1 == "1"; // true
1 == true; // true
0 === ""; // false
1 === "1"; // false
1 === true; // false

Tip #7: Use Parameter Defaults

If a function is called with a missing argument, the value of the missing argument is set to undefined. Undefined values can break your code. It is a good habit to assign default values to arguments.

function myFunction(x, y) {
if (y === undefined) {
y = 0;
}
}

or shorter one...

function myFunction(x, y) {
y = y || 0;
}

Tip #8: End Your Switches with Defaults

Always end your switch statements with a default. Even if you think there is no need for it.

Tip #9: Avoid Using eval()

The eval() function is used to run text as code. In almost all cases, it should not be necessary to use it. Because it allows arbitrary code to be run, it also represents a security problem.

Source

w3schools.com

[RMMV Plugin] Advanced Parallax

Version: v1.00

Introduction

This plugin allows you to have more control on map parallaxes by defining them in the map notetag. It also allows you to define multiple layered parallaxes (either behind or in front of the tiles and characters), a bit like in RPG Maker XP games, which have panoramas and fogs. Additionally, you can make animated parallaxes (having more than one frame).

Contact me for support/bug report:

listra92@gmail.com
https://www.facebook.com/don.listRA92

Map Notetag

Example:

<parallax>
name: StarlitSky
loopx: true
loopy: true
sx: 4
sy: $gameVariables.value(1)
depth: 1
frames: 4
framesp: 2
</parallax>

Read the instructions for the explanation.

Animated Parallaxes

You can make parallaxes animated with more than one frame. For such that, put several files in \img\parallaxes folder, for example StarlitSky_1.png, StarlitSky_2.png, ... for each frame of the parallax StarlitSky defined in the map note. For non-animated ones, just put the file as usual, i.e. StarlitSky.png.

Download Plugin

MK_AdvParallax.js

[RMMV] How to Use & Update Plugins + General Q/A

Introduction

For those who don't know about that, plugins in RPG Maker MV are basically extending scripts that are managed by PluginManager in a game system script rpg_managers.js. Unlike in RPG Maker VX Ace and former, RPG MV editor provides plugin manager for such that, as shown in the picture below. I explain it in the next section.

Adding, Removing, and Configuring Plugins

  1. Put a plugin (.js file) to add into directory: [game_directory]\js\plugins
  2. In the RPG MV editor, open Tools -> Plugin Manager... (F10).
  3. To add a plugin, double click the blank entry at the bottom.
  4. Click the Name: combo box to select a plugin (all in the plugin directory).
  5. Click the Status: combo box to enable/disable the plugin (whether to let it loaded & executed by the game system).
  6. Some plugins provide certain parameters to configure. Double click on a parameter to change its value.
  7. Click the Help... to see instructions for the plugin.
  8. Click OK if you're done.
  9. To reorder a plugin, right click -> Cut (Ctrl+X) on it and right click -> Paste (Ctrl+V) on the place you think it should be.
  10. To remove a plugin, right click -> Delete (Del) on it. Note that the file won't be deleted from the disk.

Updating Plugins

Some 'baka's said that we have to recreate a new project for the current one in order to update some plugins. Well, here I explain the better way to update plugins. First, put an 'updated' plugin into the plugin directory and replace the existing 'old' one. Then, there are two cases:

Case 1: Only difference on some script code.

You don't need to do anything with the plugin manager, just playtest the game to see some effects.

Case 2: Difference on the parameters definition.

The plugin may not work well when running the game, especially dealing with newly added parameters. So, do the following steps:

  1. Open the plugin manager.
  2. Remove a plugin you want to update. Note that any changes on the parameter values will be lost.
  3. Add the plugin again, reconfigure the parameters, and reorder it.
  4. Save your project and playtest the game to see some effects.

RPG MV Plugins General Q/A

Q: I can't find plugin(s) I want. What should I do?
A: Try searching in the RPG Maker official forum and some other unofficial forums. They may haven't been released yet, since RPG MV was still newly released in end of October, 2015. Or if you think you can, try developing them by yourself.

Q: Do plugin orders matter?
A: In many cases, yes, like scripts in RPG VX Ace and former. Some of them may override variables and/or functions that were defined in the plugin at above, and they may be overriden by one(s) at below. Some of them may also require variables and/or functions defined in the plugin at above.

Q: What capabilities could RPG MV plugins perform?
A: Basically, RPG MV games are HTML5 applications, and the game runner is a Chrome-based mini-browser. Thus, all JavaScript and HTML5 features (including AJAX) are of course applicable. WebGL library features are also applicable due to support on it. So, we could develop a browser-based MMORPG that utilizes AJAX, or even a game using WebGL's 3D graphics renderer.

Q: I want to develop RPG MV plugins by myself. What things do I need?
A: First, and the most important, programming skill and ability to script using JavaScript, like you do for web applications. You can learn JavaScript in w3schools.com.
Second, it's necessary to learn some code in the default RPG MV game system. You can also learn the structures documented in the RPG MV help file.
If your plugin utilizes other existing plugin(s), of course you need to learn their code.

Q: Can I make and apply external JS scripts (not plugin) on RPG MV games?
A: Yes. A thing you need to do is modifying index.html in the game directory. Add the following in the <body> tag, above the element for main.js:
<script type="text/javascript" src="js/yourscript.js"></script>
But still, it's recommended to make them as plugins that can be easily managed using the plugin manager.