Game Dev Contest
Join in on the Game Development contest with over $300 in prizes!
Banner Creation Contest!
Help the community out by creating your own version of the banner, and potentially having that as the main banner!
Resources
Check out our resources :D
Upgrade your account
Help out the community, and keep the website running and fully up to date by donating! :D

Converting a Script into a Plug-In

GO TO ADMIN PANEL > ADD-ONS AND INSTALL ABSTRACT SIDEBAR TO SEE FORUMS AND SIDEBAR

p0_boy

NPC
Joined
Mar 25, 2019
Messages
8
Points
2
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