Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Converting a Script into a Plug-In

Hey, folks-

I have been using RPG Maker MV for little over a month now and am at the point where I am trying to add a HUD to my game.

I adapted an RPG Maker VX ACE tutorial by a user named Pixii, and came up with the following, simple script:

JavaScript:
Number.prototype.roundTo = function(num) {
    var xBuff = this%num;
    if (xBuff <= (num/2)) {
        return this-xBuff;
    } else {
        return this+num-xBuff;
    }
}
var calcHP = ($gameActors.actor(1).hp * 112) / $gameActors.actor(1).mhp;
var pSuffix = calcHP.roundTo(4);
var pName = "zhud_hp_" + pSuffix;
var xTopRight = (Graphics.boxWidth * 0.75);
$gameScreen.showPicture(1, pName, 0, xTopRight, 3, 100, 100, 255, 0);
I am currently running it as a Parallel Process using a plug-in written by Pivoo called Pv_Scriptlets, but I fear that this method is very heavy on the computer's processor and may cause lag in gameplay.

Is there any way that this can be adapted to work as its own plug-in? Would doing so mean better game performance?

I tried to figure it out for myself, watching SRDude's How to Make a Plugin in RPG Maker MV YT tutorials, but even after referencing the RPGMakerMV Library- I cannot figure out which pre-existing function I should manipulate and override (is it Scene_Base.update()?).

In, my mind-

  1. I need to find the Library function that initially draws everything in the scene, as well as the function that monitors the character's HP.
  2. I also need to modify the script that I have to find the dimensions (width/height) of the image that I am displaying as the HUD, so that it's position on the screen can be determined in relation to those measurements.

I am using an ABS system so I do not need any information about a Battle HUD, just one that appears on the map.

I was excited to find a Google search result called RMMV Plugin Scripting Tutorials (Beginner to Advanced): Tutorial 34 - Variable HUD by Soulpour777, only to find that the video is unavailable because "the uploader has closed their YouTube account".

So, I am wondering if anybody could help and/or point me in the right direction?

Thanks in advance!
 
Top