jakeis.com = doing things @ Jake Jilg's personal home page = jakeis.com
(aesthetic only)

jakeis.com = Jake Jilg, doing things....

Jake Jilg
Howto Make An RPG Maker MV Plugin

Formerly known as Mogwai.

This is a silly tutorial because it's like 5 minutes to learn how to drive a car, but none-the-less, this is a how to make a plugin, with a functional example. I even include community quirkiness standards, such as preventing window scope variable pollution.

This ^ is an ugly idea, but it can be done!

There is a steep learning curve, because the source lacks a good function manual, but get your feet wet. I don't know how else to describe it. It seems like an ocean or river, but it's just a glass of water. Technically it's not even called a "source" because it's a script that doesn't get compiled.

This step can't be explained any better than: Go, play!

After several hours of analyzing and tweaking the game js files, you should have a good idea of where to inject your javascript. This is an example. It's a silly plugin, but it functions none-the-less.

* @plugindesc Gives Game Messages a Drop Shadow
* @author Mogwai "Jake Jilg"
* @param Example Shadow Color
* @desc Set the text shadow color with CSS colors.
* Default: rgba(0,0,0,0.7)
* @default rgba(0,0,0,0.7)
* Example Game Messages Drop Shadow Plugin

// this is popular: having your own var scope for all your plugins
// so as not to pollute the window scope and other plugins.
if(typeof window.jakesPluginScope === "undefined")
    window.jakesPluginScope = {};

// like my: immediately-invoked function expression IIFE?
// this is also the popular community standard:
// run your plugin in an anonymous container
    var jps = window.jakesPluginScope;
    // now ^ a small function scope variable
    // every window variable we use
    jps.dropShadow = {};
    // this ^ is all the variables of this plugin

    jps.dropShadow.param = PluginManager.parameters('ExamplePluginDropShadow');
    jps.dropShadow.backgroundColor = jps.dropShadow.param["Example Shadow Color"];
    // this ^ is how to get a user parameters from above
    // the more simple the parameter, the better me thinks

    // this v is the proper way to alias a function
    Bitmap.prototype._drawTextOutline = function(text, tx, ty, maxWidth){
        var context = this._context;
        context.fillStyle = jps.dropShadow.backgroundColor || "rgba(0,0,0,0.7)";
        context.fillText(text, tx - 3, ty + 3, maxWidth);
        context.strokeStyle = jps.dropShadow.backgroundColor || "rgba(0,0,0,0.7)";
        context.strokeText(text, tx - 3, ty + 3, maxWidth);
        // this ^ is ours
        DrawTextOutlineAlias.apply(this, arguments);
        // this ^ is an alias to theirs
})(Bitmap.prototype._drawTextOutline); // <- this passed as an argument, to alias (as many as you need)

Read the comments in this ^. It's the bulk of my tutorial.

Have a good scripting!

1-star tutorial written by 4-star scripter

If you think I'm dumb, I'm not writing for you. I wrote this for myself, to remind me I've got to convert all my old plugins to the community quirks format, because those old scripts are taking heat on the forum right now about breaking other scripts, and I am banned and cannot defend them.

Proudly NOT powered by any monopoly blogging platform, but many great thanks to Chromium/Mozilla DevTools, MAMP/Apache, and Notepad++/TextWrangler because they did all the real work here. I, Jake Jilg am just a designer.
Blogs & Blogs
    • Blog under construction.
    • Blog coming soon.
    • Blog under construction.