LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

EVENTALIST
EVENTALIST
#1 Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile

Sample HUD Plugin Script





Description:





This plugin out lines the basis for creating a custom HUD in RMMV either it be Scene_Map over lay or Scene_Battle.

Screen Shots:







Script:



Showing information on map in a window.
Code:
//================================================================================
// SimpleHUD.js
//================================================================================
/*: @author Mr_Wiggles
 *   Date: 10/28/15
 *   Version: 1.0
 * -------------------------------------------------------------------------------
 * @plugindesc Just a simple HUD script to get the ball rolling.
 *
 *
 * @help This plugin is a simple HUD script to show what the bases are for doing such
 * in the user of the plugin games. You can use the event command 'HUD' with the
 * following arguments:
 *   'show' = show HUD; Example 'HUD hide'
 *   'hide' = hide HUD; Example 'HUD show'
 */ //============================================================================
//--------------------------------------------------------------------------------
// Auto run: Sets plugin items that are user defined in RMMV.
//--------------------------------------------------------------------------------
(function() {
  //------------------------------------------
  var parameters = PluginManager.parameters('SimpleHUD'); // Define plugin name.
  // Set interactive variable settings to show in plugin manager.
  //var opacitySetting = String(parameters['Opacity'] || 255);
  //------------------------------------------
  // Define plugin commands that are called from event task.
  //------------------------------------------
  // set alias for Game_Interpreter_pluginCommand
  var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
  Game_Interpreter.prototype.pluginCommand = function(command, args) {
    _Game_Interpreter_pluginCommand.call(this, command, args); // calls alias
    // add in custom flags for your plugin.
    if (command === 'HUD') {
      switch (args[0]) {
      case 'hide':
        break;
      case 'show':
        SoundManager.playOk();
        break;
      }
    }
  };
//--------------------------------------------------------------------------------
// Scene_Map Additions/Edits
//--------------------------------------------------------------------------------
  //------------------------------------------
  // map update loop
  //------------------------------------------
  var _Scene_Map_pluginHUD_update = Scene_Map.prototype.update;
  Scene_Map.prototype.update = function() {
    if (this._HUDWindow) {
      this._HUDWindow.update
    } else {
      this._HUDWindow = new Window_HUD(0,0);
      this.addWindow(this._HUDWindow); // *parent function
      //throw new Error('Got to window adding!');
    };
    _Scene_Map_pluginHUD_update.call(this);
  };
  //------------------------------------------
  // Dispose of HUD window when scene is not map.
  //------------------------------------------
  var _Scene_Map_pluginHUD_stop = Scene_Map.prototype.stop;
  Scene_Map.prototype.stop = function() {
    this._HUDWindow.close(); // Dispose of window. *parent function
    _Scene_Map_pluginHUD_stop.call(this);
  };
//--------------------------------------------------------------------------------
// Window HUD
//--------------------------------------------------------------------------------
  function Window_HUD() { // Set function call initialize before object is created.
    this.initialize.apply(this, arguments);
  }
  // Inherit parrent class functions.
  Window_HUD.prototype = Object.create(Window_Base.prototype);
  Window_HUD.prototype.constructor = Window_HUD;
  // class variables
  //------------------------------------------
  // Initialize Window HUD object
  //------------------------------------------
  Window_HUD.prototype.initialize = function(x, y) {
    Window_Base.prototype.initialize.call(this, x, y, 256, 256); // *super()
    this._updateWait = 0;
    this.refresh(); // refresh window contients.
    this.activate(); // *@active = true
  };
  //------------------------------------------
  // Update HUD
  //------------------------------------------
  Window_HUD.prototype.update = function() {
    Window_Base.prototype.update.call(this); // *super()
    // throw new Error('Got to update!');
    if (this._updateWait <= 0) {
       this.refresh();
       this._updateWait = 10;
    } else {
      this._updateWait--; // subtract 1 each time called.
    }
    // SoundManager.playOk();
   };
  //------------------------------------------
  // Refresh HUD if changed
  //------------------------------------------
  Window_HUD.prototype.refresh = function() {
    if (this.contents) {
      if ($gameParty != null) {
        var actor = $gameParty.leader() // set to actor one (player sprite)
        //var actor = $gameParty.allMembers(1);
        //var actor = $gameParty.members(1)
        //throw new Error('Got this far! ' + actor._name);
      }
      var lineHeight = this.lineHeight();
      this.contents.clear();
      if (actor) { // check to make sure Game_Party has
        // enough time/ there is a party member to find in Party.
        this.drawActorName(actor, 0, 0, 100);
        this.drawActorHp(actor, 0, 32, 100);
        this.drawActorMp(actor, 0, 64, 100);
        //throw new Error('Got this far! ' + actor._name);
      }
    } else { // you have to check to make sure the object has been
      // added into the GC.
      SoundManager.playBuzzer();
    }
  };
 //================================================================================
})(); // End of plugin block.

Showing simple information over enemy battler sprites during battle:

Code:
//================================================================================
// EnemyDebug.js
//================================================================================
/*: @author Mr_Wiggles
 *   Date: 11/1/15
 *   Version: 1.0
 * -------------------------------------------------------------------------------
 * @plugindesc This plugin shows extra information on the enemy when battling.
 *
 * @help PIXI.js http://pixijs.github.io/docs/PIXI.Sprite.html
 */ //============================================================================
//--------------------------------------------------------------------------------
// Auto run: Sets plugin items that are user defined in RMMV.
//--------------------------------------------------------------------------------
(function() {
//--------------------------------------------------------------------------------
// Sprite_Enemy
//--------------------------------------------------------------------------------
  var _Sprite_Battler_debug_init = Sprite_Battler.prototype.initialize;
  Sprite_Battler.prototype.initialize = function(battler) {
    _Sprite_Battler_debug_init.call(this, battler);
    this._debugStartTimer = 10;
  };
  //------------------------------------------
  var _Sprite_Enemy_debug_update = Sprite_Enemy.prototype.update;
  Sprite_Enemy.prototype.update = function() {
    _Sprite_Enemy_debug_update.call(this);
    if (!BattleManager._phase === 'battleEnd' || this._enemy.isDead()) {
      if (this._debugWindow) {
        //SoundManager.playOk();
        this._debugWindow.close();
      };
    }
    if (this.bitmap.isReady()) {
      if (this._debugWindow) {
        this._debugWindow.update();
      } else if (this._debugStartTimer <= 0) { // if window was not made create window.
        this._debugWindow = new Window_Enemy_Debug();
        this._debugWindow.move(0 - (this.bitmap.width / 4) - 50, 0 - (this.bitmap.height) - 50, 200, 200);
        this._debugWindow.setBattler(this._battler);
        this.addChild(this._debugWindow);
      } else {
        this._debugStartTimer--;
      }
    }
  };
//--------------------------------------------------------------------------------
// Window Enemy Debug // Look at base File:rpg_core.js Line#(4974)
//--------------------------------------------------------------------------------
  function Window_Enemy_Debug() { // Set function call initialize before object is created.
    this.initialize.apply(this, arguments);
  }
  // Inherit parrent class functions.
  Window_Enemy_Debug.prototype = Object.create(Window_Base.prototype);
  Window_Enemy_Debug.prototype.constructor = Window_Enemy_Debug;
  // class variables
  //------------------------------------------
  // Initialize Window HUD object
  //------------------------------------------
  Window_Enemy_Debug.prototype.initialize = function() {
    Window_Base.prototype.initialize.call(this, 0, 0, 232, 232); // *super()
    this.opacity = 0;
    this._updateWait = 0;
    this.refresh();
    this.activate(); // *@active = true
  };
  //------------------------------------------
  Window_Enemy_Debug.prototype.setBattler = function(battler) {
    this._battler = battler;
  };
  //------------------------------------------
  // Update HUD
  //------------------------------------------
  Window_Enemy_Debug.prototype.update = function() {
    Window_Base.prototype.update.call(this); // *super()
    // throw new Error('Got to update!');
    if (this._updateWait <= 0) {
       this.refresh();
       this._updateWait = 10;
    } else {
      this._updateWait--;
    }
   };
  //------------------------------------------
  // Refresh HUD if changed
  //------------------------------------------
  Window_Enemy_Debug.prototype.refresh = function() {
    if (this.contents && this._battler) {
      //SoundManager.playOk();
      var lineHeight = this.lineHeight();
      this.contents.clear();
      var color1 = this.hpGaugeColor1();
      var color2 = this.hpGaugeColor2();
      var rate = this._battler.hpRate();
      // File:rpg_objects.js Line#(2113)
      this.drawGauge(0, 0, 150, rate, color1, color2);
      this.drawText(this._battler.name(), 0, 0, 150, 'center');
      var color1 = this.mpGaugeColor1();
      var color2 = this.mpGaugeColor2();
      var rate = this._battler.mpRate();
      this.drawGauge(0, 10, 150, rate, color1, color2);
    } else {
      //SoundManager.playBuzzer();
    }
  };
//================================================================================
})(); // End of plugin block.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#2 Re: Simple HUD Plugin
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
OMG! You have opened the doors to the realm of customized HUDs for RPG Maker MV!

here's a screenshot for your OP ^


this is well done, from the invoking of your function, the initialize/update loop, to the disposal when change of scene. Thanks for sharing, this is a time saver and a study guide for all of us trying to break RMMV's default mold.

Fact! out of all of the pre-order plug-ins, and the one's that had surfaced throughout the first week since RPG Maker MV's launch... at the moment, I believe this is the only HUD plugin that's out there for RMMV on one single javascript file!

simple and effective, I'm sure it's only going to get more advanced and awesome +




Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#3 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
I forgot to include a screen shot of what it looked like. Thanks Smile
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#4 Re: Simple HUD Plugin
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
question, how do you find the names for your functions and parameters? for example I'm looking to add exp but
Code:
this.drawActorExp(actor, x, y, 100);
doesn't work.

I was able to get the face graphic to work for I studied the rpg_windows script in the js folder and found
Code:
this.drawActorFace

also gold, there's $gameparty.gold, drawcurrency, etc.. which to use, where to find??

here's how it's looking so far...
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
Active Member
Active Member
#5 Re: Simple HUD Plugin
Loading

handy333

Active Member
Active Member
Active Member
profile
Looks like you two got your hands on a copy. I'm getting there.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#6 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
G@MeF@Ce wrote:question, how do you find the names for your functions and parameters? for example I'm looking to add exp but
Code:
this.drawActorExp(actor, x, y, 100);
doesn't work.

Try one of the alternate variable settings that are commented out above that line, you have to define the variable actor to an object container "Game_Actor". In Game_Party file "rpg_objects.js" around line#(4763) is where you see Game_Party's members data pile. One of the listed methods bellow should do it.

Code:
var actor = $gameParty.leader() // set to actor one (player sprite)
var actor = $gameParty.allMembers(id);
var actor = $gameParty.members(id)

id = actor position in Game_Party object handler. # range number (1 to party max or 4)

I think that would be how you would choose a different actor then the leader.
G@MeF@Ce wrote:
also gold, there's $gameparty.gold, drawcurrency, etc.. which to use, where to find??
For gold and such like that you can use the built in filter option for drawing text instead of ".drawText(*args)":
Code:
this.drawTextEx(text, X pos, Y pos)
The filters are found in file "rpg_windows.js" around line#(279) they are the same as the ones when showing in game windows FYI. Also look at ones on line#(364).

Code:

G/        : Show party gold.
/V[id]   : Show variable value using number (id)
/N[id]   : Show actor name using number (id)
/P[id]   : Show party actor name using number (id)

example:
  this.drawTextEx("G/", X pos, Y pos) // will draw gold text + extra

Or you could mimic how Window_Gold in file "rpg_windows.js" around line#(1507) does it in the window class.

Code:

this.drawCurrencyValue($gameParty.gold(), TextManager.currencyUnit, X pos, Y pos, width);

There are many options, id use either ".drawCurrencyValue(*args)" or ".drawTextEx(*args)"


There is also ".drawGauge" it can draw things like Health bars.
Code:
this.drawGauge(x, y, width, rate, color1, color2)
The argument "rate" I believe is a float, percentage (0.0 - 1.0) (0% - 100%).
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#7 Re: Simple HUD Plugin
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
here's what I got so far:

I'm going to need more practice, I've become used to javascript and HTML5,
javascript and RMMV is a whole new story for me to read, so studying the scripts and reading the help file will help me step up my code game +

still very impressed with your power of code, I look forward to every plugin you script, if you ever run out of ideas, I got a list 8P
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#8 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
It's funny you should say that, i was going to look at writing another shortly after i convert my Noob Made Extractor from reading Ruby to reading Java. Its almost done just a little more debugging and I'll be posting it. Where is the list at? Smile
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#9 Re: Simple HUD Plugin
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
oh I'm gonna need that noob extractor, looking forward to using it!

here's a list ~> Cool
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#10 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#11 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Posted another script in the first post. It shows how to make a basic Enemy HUD to show when battling. Makes test fights easier being able to see the HP and MP an enemy has.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#12 Re: Simple HUD Plugin
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
@wiggles - I would of posted a screenshot but it's not working for me :/

I tried a new project, just that plug in, both regular and side view battle, nothing appears... didnt get a chance to look at the code, but I will after dinner +

It's supposed to display in battle right?

Also this new development has got me excited for... a mini hero hud, a smash button meter, a variable hud over events, you know me I love huds!

Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#13 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
I may have made changes to the script so i re-posted it with my current working version.

EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#14 Re: Simple HUD Plugin
Loading

G@MeF@Ce

Administrator
Administrator
Administrator
profile
too cool for school, another plugin that works and looks like a charm +

You are really getting the hang of this at an amazing rate!
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#15 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
Thanks Very Happy I'm crash coursing when ever I get the chance. :p
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#16 Re: Simple HUD Plugin
Loading

handy333

Active Member
Active Member
Active Member
profile
Well I got the trial. I thought it would be easier for me to code in javascript because I'm used to it from unity. I never understood how to use rgss. Now I'm back to square one. I'm just trying to make a new scene on the title screen.

Other than that MV is really fun to use.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#17 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
handy333 wrote:I never understood how to use rgss. Now I'm back to square one. I'm just trying to make a new scene on the title screen.

Other than that MV is really fun to use.

You should check out Noob Extractor Java Version

It maps all the RGSS classes and allows you to make comments as descriptions all read in one place.


You can also use this template i put together for laying out a new scene that uses a window class.
http://gameface101.playogame.com/t2036-sample-plugin-script

Then edit Scene_Title to call it with SceneManager.goto(Scene_Name).
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#18 Re: Simple HUD Plugin
Loading

handy333

Active Member
Active Member
Active Member
profile
mr_wiggles wrote:
handy333 wrote:I never understood how to use rgss. Now I'm back to square one. I'm just trying to make a new scene on the title screen.

Other than that MV is really fun to use.

You should check out Noob Extractor Java Version

It maps all the RGSS classes and allows you to make comments as descriptions all read in one place.


You can also use this template i put together for laying out a new scene that uses a window class.
http://gameface101.playogame.com/t2036-sample-plugin-script

Then edit Scene_Title to call it with SceneManager.goto(Scene_Name).

...you lost me at the extractor.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
EVENTALIST
EVENTALIST
#19 Re: Simple HUD Plugin
Loading

mr_wiggles

EVENTALIST
 EVENTALIST
EVENTALIST
profile
the extractor is an RMXP program that reads and compiles Java code into an organized fashion showing all the built in classes and each one of the variables and functions each of those classes has. (You said you needed help with learning RGSS, that program will map all of it for you.)

Secondly, you can take a look at the sample scene i put together for use as a template and write your own code in place of the samples given in that plugin script. You wanted to add a scene to Title, so that would be how you make the scene. Then you'll just have to alias a few things with Scene_Title and you'll be able to call your custom scene like you where talking about. Smile
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#20 Re: Simple HUD Plugin
Loading

handy333

Active Member
Active Member
Active Member
profile
I was trying to piece together how they have the Javascript in MV. Its like its rgss with a new name to me. I been gave up on rgss. When I try to learn it, a new version shows up.

I'll take a look at your plugin. It should help with what I'm trying to start.
Active Member
Show Signature


Active Member
http://projectrisingsun.weebly.com/ http://soundcloud.com/handyfox http://www.youtube.com/channel/UCkBX7ZxqoXslAtqsdrmsn_w
#21 Re: Simple HUD Plugin
Loading

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled