Jump to content
Rpg²S Forum
  • 0

Hud in mappa ?


Rhapsody95
 Share

Question

Salve ragazzi sto cercando un Plugin per MV.

Mi servirebbe qualcosa che mi mostri una hud con lo stato dell' eroe (HP,MP,EXP). e ovviamente magari il nome.

Attualmente ho già installato una hud sulla destra con solamente l' oro =)

 

Grazie in anticipo regà!

 

TUTTO SOLAMENTE SULLA MAPPA !

Edited by Rhapsody95
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Questo non pare male in quanto a personalizzazione.

^ ^

(\_/)
(^ ^) <----coniglietto rosso, me!
(> <)


Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^

http://i.imgur.com/KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^

http://i.imgur.com/FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^

REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^

  Reveal hidden contents

 

Link to comment
Share on other sites

  • 0

Tieni, il buon vecchio Mog è fortissimo con le HUD!!

Actor HUD

 

Uso anchio questa HUD ;)

Edited by LastChaos

http://i46.tinypic.com/11r6sxu.jpg

 

Prova la Demo VXAce del mio gioco RPG: Dark Core! Dura ben 5-6 ore, potresti divertirti! Ci ho lavorato per ben 2 anni! aiutami a migliorarlo ancora! Clicca QUI per vedere nel dettaglio tutte le centinaia di Features del progetto. Clicca QUI se vuoi scaricare la Demo!

Opening 3D Cinematografica Dark Core

Trailer Dark Core

Seguimi su FB e guarda i video su YT!

Link to comment
Share on other sites

  • 0
Vorrei approfondire l'argomento se mi è concesso. Perché creare un hud è davvero semplice

cioè si può procedere in tre stili:


1. usi delle iconset cioè immagini esterne da printare a schermo.

2. disegni con il codice delle barre minimali direttamente sulla mappa, nulla di troppo complesso.

3. disegni le immagini più complesse come quelle raffigurate dalle iconset ma senza usare file esterni, disegni direttamente con il JavaScript.


Qui vi mostrerò solo i primi due stili, partendo appunto da:

STILE 1:

  Reveal hidden contents

Creiamo un oggetto che conterrà al suo interno tutte le funzionalità che vorremmo attribuirgli:


(function() {
// Crea un nuovo sprite per la HUD function CustomHUD() {
this.initialize.apply(this, arguments);
};
CustomHUD.prototype = Object.create(Sprite.prototype); CustomHUD.prototype.constructor = CustomHUD; CustomHUD.prototype.initialize = function() {
Sprite.prototype.initialize.call(this); // Il resto del codice...
};
CustomHUD.prototype.update = function() {
Sprite.prototype.update.call(this); // Il resto del codice...
};
})();

Adesso dentro dobbiamo inserirgli le funzioni:

CustomHUD è una sottoclasse di Sprite, che è la classe madre che gestisce tutti gli sprite presenti in RPG Maker MV.


ATTENZIONE per i niubbi, Sprite non sono le immagini in sé.

Gli Sprite sono degli oggetti fatti apposta per ospitare le immagini, i bitmap.. i disegni. Le bitmap invece sono gli oggetti che ospitano le finestre. Poi c'è la tela ma vabbè non voglio andare fuori tema.


Ad ogni modo, questo concetto è molto utile se si vuole imparare a fare ste cose. :)


Comunque come prima funzione si crea lo strumento initialize che serve per annotare, elencare, ideare, creare tutti gli oggetti grafici (appunto Gli Sprite) che ospiteranno a loro interno

le icone, i font dei testi per identificare gli HP, gli MP, gli EXP da raggiungere e quelli mancanti e altro...



CustomHUD.prototype = Object.create(Sprite.prototype);
CustomHUD.prototype.constructor = CustomHUD;
CustomHUD.prototype.initialize = function() {
Sprite.prototype.initialize.call(this);
// Imposta il nome dell'eroe this._actorName = "";
// Imposta le icone per l'HP, MP e EXP
this._hpIcon = new Sprite(ImageManager.loadSystem("IconSet"));
this._hpIcon.setFrame(96, 0, 32, 32);
this._mpIcon = new Sprite(ImageManager.loadSystem("IconSet")); this._mpIcon.setFrame(128, 0, 32, 32);
this._expIcon = new Sprite(ImageManager.loadSystem("IconSet")); this._expIcon.setFrame(192, 32, 32, 32);
// Imposta i testi per l'HP, MP e EXP this._hpText = new Sprite(new Bitmap(100, 32));
this._mpText = new Sprite(new Bitmap(100, 32));
this._expText = new Sprite(new Bitmap(100, 32));
// Imposta la posizione dei vari elementi this._hpIcon.x = 0; this._hpIcon.y = 0;
this._mpIcon.x = 0;
this._mpIcon.y = 32; this._expIcon.x = 0;
this._expIcon.y = 64;
this._hpText.x = 32;
this._hpText.y = 0;
this._mpText.x = 32;
this._mpText.y = 32; this._expText.x = 32; this._expText.y = 64;

// Aggiungi tutti gli elementi alla HUD this.addChild(this._hpIcon); this.addChild(this._mpIcon); this.addChild(this._expIcon); this.addChild(this._hpText); this.addChild(this._mpText); this.addChild(this._expText);
// Aggiorna la HUD
this.update();
};

Dopo aver ideato gli oggetti (Sprite) e oggetti (bitmap) che ospiteranno le grafiche dell'Hud

Si gioca con loro in modo da sperimentare su di loro condizioni

cicli, altre funzioni di interazione.


Spiego meglio con un esempio:

Poniamo il caso che io creo l'oggetto acqua. Nel metodo inizialize si assegna appunto un valore di inizio associato a questo oggetto acqua. Neutralità...


Con il seguente strumento update invece ci sbizzarriamo e ci divertiamo con il giocare con gli oggetti ideati prima.


Ad esempio possiamo creare un oggetto concettuale acqua appunto che associamo ad un evento globale e facciamo in modo che ogni volta che l'eroe ha sete e beve, la barra della sete si ricarica.

ecc... Veramente in update potete divertirvi a sperimentare.


Adesso vi mostro però, tornando in tema cosa accade:


CustomHUD.prototype.update = function() {
Sprite.prototype.update.call(this);

// Ottieni l'eroe attivo
var actor = $gameParty.leader();

// Aggiorna il nome dell'eroe
if (this._actorName !== actor.name()) {
this._actorName = actor.name();
this._hpText.bitmap.drawText(actor.name(), 0, 0, 100, 32, "left");
}

// Aggiorna l'HP dell'eroe
this._hpText.bitmap.drawText(actor.hp + "/" + actor.mhp, 0, 0, 100, 32, "right");

// Aggiorna il MP dell'eroe
this._mpText.bitmap.drawText(actor.mp + "/" + actor.mmp, 0, 0, 100, 32, "right");

// Aggiorna l'EXP dell'eroe
this._expText.bitmap.drawText(actor.currentExp() + "/" + actor.nextRequiredExp(), 0, 0, 100, 32, "right");
};

La funzione $gameParty.leader(); della classe Sprite e richiamata qui all'occorrenza ci servirà per evidenziare l'eroe. Ossia l'oggetto leader appunto che il party segue e che sta in testa, occupa posizione 1.

Viene verificato se i suoi parametri iniziali sono attivi e se lo sono valuta se i parametri ad essi associati sono cambiare. Se lo sono esegue l'aggiornamento dei nuovi dati di gioco.

FINE STILE 1



STILE 2

  Reveal hidden contents

QUESTO LO PREFERISCO.

0 immagini esterne, ma tutte le grafiche minimali vengono disegnate tramite codice JavaScript


Pensate sia difficile? No per niente e ora ve lo dimostro:


Stesso iter: vogliamo creare degli oggetti che rappresenteranno HP, MP, EXP, (esempio). E vogliamo che questi appaiano in alto da qualche parte in mappa.


Creiamo l'oggetto CustomHUD e dentro di esso il metodo inizialize:



function CustomHUD() {
this.initialize.apply(this, arguments);
}




function CustomHUD() {
this.initialize.apply(this, arguments);
}

CustomHUD.prototype = Object.create(Sprite.prototype);
CustomHUD.prototype.constructor = CustomHUD;

CustomHUD.prototype.initialize = function() {
Sprite.prototype.initialize.call(this);

this._hpBar = new Sprite(new Bitmap(200, 20));
this._hpBar.bitmap.fillRect(0, 0, 200, 20, '#ff0000');
this._hpBar.x = 10;
this._hpBar.y = 10;

this._mpBar = new Sprite(new Bitmap(200, 20));
this._mpBar.bitmap.fillRect(0, 0, 200, 20, '#0000ff');
this._mpBar.x = 10;
this._mpBar.y = 40;

this._expBar = new Sprite(new Bitmap(200, 20));
this._expBar.bitmap.fillRect(0, 0, 200, 20, '#00ff00');
this._expBar.x = 10;
this._expBar.y = 70;

this.addChild(this._hpBar);
this.addChild(this._mpBar);
this.addChild(this._expBar);

SceneManager._scene.addChild(this);
};

var customHud = new CustomHUD();


Tramite la classe bitmap abbiamo creato tre barre di colore differente proprio per differenziare i tre parametri.

Rosso = HP

Blu = MP

Verde = EXP

un classico.


Con questa prassi potrete crearne di altre. Tanto la tecnica è la stessa.


E poi in update inserite la ciccia.

E per ciccia intendo tipo questa:


CustomHUD.prototype.update = function() {
Sprite.prototype.update.call(this);

var actor = $gameParty.leader();

this._hpBar.scale.x = actor.hp / actor.mhp;
this._mpBar.scale.x = actor.mp / actor.mmp;

if (actor.currentExp() >= actor.nextLevelExp()) {
actor.levelUp();
this.refresh();
}
};

CustomHUD.prototype.refresh = function() {
var actor = $gameParty.leader();

this._expBar.scale.x = (actor.currentExp() - actor.currentLevelExp()) / (actor.nextLevelExp() - actor.currentLevelExp());
};

FINE STILE 2



Ora facciamo una reunion tanto per avere tutte le due possibilità a portata di :


  Reveal hidden contents



//=============================================================================
// CustomHud.js
//=============================================================================

/*:
* @author Massimo Bivona
* @plugindesc Custom HUD Plugin - Allows you to use icons or bitmap graphics for HP, MP, and EXP gauges on the map. Also includes options to customize position, size, transparency, and visibility. Use the plugin parameters to choose between iconset and bitmap graphics. Note that only one style can be used at a time.
*
* @param Use Iconset
* @desc Whether to use the iconset graphic for HP, MP, and EXP gauges. 1 for yes, 0 for no.
* @type number
* @min 0
* @max 1
* @default 1
*
* @param HP Icon Index
* @desc The index of the HP icon in the iconset graphic.
* @type number
* @min 0
* @default 162
* @parent Use Iconset
*
* @param MP Icon Index
* @desc The index of the MP icon in the iconset graphic.
* @type number
* @min 0
* @default 163
* @parent Use Iconset
*
* @param EXP Icon Index
* @desc The index of the EXP icon in the iconset graphic.
* @type number
* @min 0
* @default 164
* @parent Use Iconset
*
* @param HP X Position
* @desc The X position of the HP gauge on the map.
* @type number
* @default 0
* @min -9999
* @max 9999
*
* @param HP Y Position
* @desc The Y position of the HP gauge on the map.
* @type number
* @default 0
* @min -9999
* @max 9999
*
* @param MP X Position
* @desc The X position of the MP gauge on the map.
* @type number
* @default 0
* @min -9999
* @max 9999
*
* @param MP Y Position
* @desc The Y position of the MP gauge on the map.
* @type number
* @default 30
* @min -9999
* @max 9999
*
* @param EXP X Position
* @desc The X position of the EXP gauge on the map.
* @type number
* @default 0
* @min -9999
* @max 9999
*
* @param EXP Y Position
* @desc The Y position of the EXP gauge on the map.
* @type number
* @default 60
* @min -9999
* @max 9999
*
* @param Gauge Width
* @desc The width of the HP, MP, and EXP gauges.
* @type number
* @default 200
* @min 1
* @max 9999
*
* @param Gauge Height
* @desc The height of the HP, MP, and EXP gauges.
* @type number
* @default 20
* @min 1
* @max 9999
*
* @param Gauge Transparency
* @desc The transparency of the HP, MP, and EXP gauges. 0 is fully transparent, 255 is fully opaque.
* @type number
* @default 192
* @min 1
* @max 9999
*
* @param Hide Gauge with Key
* @desc The key that can be
* pressed to hide the HP, MP, and
* EXP gauges on the map. Leave
* blank to disable this feature.
* @type combo
* @option
* @default
* @help CustomHud.js
* This plugin allows you to use
* either iconset graphics or
* bitmap graphics to
* display the HP, MP, and EXP
* gauges on the map. You can
* customize the
* position, size, transparency, and
* visibility of these gauges using
* the plugin parameters.
*
* Plugin Command:
* ShowCustomHud # Displays the
* custom HUD on the map.
* HideCustomHud # Hides the
* custom HUD on the map.
*/

(function() {

// Get plugin parameters
var params = PluginManager.parameters('CustomHud');
var useIconset = Number(params['Use Iconset'] || 1);
var hpIconIndex = Number(params['HP Icon Index'] || 162);
var mpIconIndex = Number(params['MP Icon Index'] || 163);
var expIconIndex = Number(params['EXP Icon Index'] || 164);
var hpX = Number(params['HP X Position'] || 0);
var hpY = Number(params['HP Y Position'] || 0);
var mpX = Number(params['MP X Position'] || 0);
var mpY = Number(params['MP Y Position'] || 30);
var expX = Number(params['EXP X Position'] || 0);
var expY = Number(params['EXP Y Position'] || 60);
var gaugeWidth = Number(params['Gauge Width'] || 200);

var gaugeHeight = Number(params['Gauge Height'] || 20);
var gaugeTransparency = Number(params['Gauge Transparency'] || 192);
var hideKey = params['Hide Gauge with Key'] || '';

// Create CustomHUD class
function CustomHUD() {
this.initialize.apply(this, arguments);
};

// Set CustomHUD prototype
CustomHUD.prototype = Object.create(Sprite.prototype);
CustomHUD.prototype.constructor = CustomHUD;

// Initialize CustomHUD object
CustomHUD.prototype.initialize = function() {
Sprite.prototype.initialize.call(this);

// Create bitmap graphics for HP, MP, and EXP gauges
this._hpBitmap = new Bitmap(gaugeWidth, gaugeHeight);
this._mpBitmap = new Bitmap(gaugeWidth, gaugeHeight);
this._expBitmap = new Bitmap(gaugeWidth, gaugeHeight);

// Set HP gauge color to red
this._hpBitmap.fillRect(0, 0, gaugeWidth, gaugeHeight, '#ff0000');

// Set MP gauge color to blue
this._mpBitmap.fillRect(0, 0, gaugeWidth, gaugeHeight, '#0000ff');

// Set EXP gauge color to yellow
this._expBitmap.fillRect(0, 0, gaugeWidth, gaugeHeight, '#ffff00');

// Create sprites for HP, MP, and EXP gauges
if (useIconset) {
this._hpGauge = new Sprite(ImageManager.loadSystem('IconSet'));
this._mpGauge = new Sprite(ImageManager.loadSystem('IconSet'));
this._expGauge = new Sprite(ImageManager.loadSystem('IconSet'));

// Set icon index for HP gauge
this._hpGauge.setFrame(hpIconIndex % 16 * 32, Math.floor(hpIconIndex / 16) * 32, 32, 32);

// Set icon index for MP gauge
this._mp.Gauge.setFrame(mpIconIndex % 16 * 32, Math.floor(mpIconIndex / 16) * 32, 32, 32);

// Set icon index for EXP gauge
this._expGauge.setFrame(expIconIndex % 16 * 32, Math.floor(expIconIndex / 16) * 32, 32, 32);

// Set opacity for HP, MP, and EXP gauges
this._hpGauge.opacity = gaugeTransparency;
this._mpGauge.opacity = gaugeTransparency;
this._expGauge.opacity = gaugeTransparency;
} else {
this._hpGauge = new Sprite(this._hpBitmap);
this._mpGauge = new Sprite(this._mpBitmap);
this._expGauge = new Sprite(this._expBitmap);

// Set opacity for HP, MP, and EXP gauges
this._hpGauge.opacity = gaugeTransparency;
this._mpGauge.opacity = gaugeTransparency;
this._expGauge.opacity = gaugeTransparency;
}

// Set position for HP, MP, and EXP gauges
this._hpGauge.x = hpX;
this._hpGauge.y = hpY;
this._mpGauge.x = mpX;
this._mpGauge.y = mpY;
this._expGauge.x = expX;
this._expGauge.y = expY;

// Add HP, MP, and EXP gauges to CustomHUD object
this.addChild(this._hpGauge);
this.addChild(this._mpGauge);
this.addChild(this._expGauge);

// Set initial values for HP, MP, and EXP gauges
this._hp = $gameParty.leader().hp;
this._mp = $gameParty.leader().mp;
this._exp = $gameParty.leader().exp;
this._maxHp = $gameParty.leader().mhp;
this._maxMp = $gameParty.leader().mmp;
this._maxExp = $gameParty.leader().nextLevelExp();

// Update CustomHUD object
CustomHUD.prototype.update = function() {
Sprite.prototype.update.call(this);

// Update HP gauge
var hpRate = this._hp / this._maxHp;
this._hpBitmap.clearRect(0, 0, gaugeWidth, gaugeHeight);
this._hpBitmap.fillRect(0, 0, gaugeWidth * hpRate, gaugeHeight, '#ff0000');

// Update MP gauge
var mpRate = this._mp / this._maxMp;
this._mpBitmap.clearRect(0, 0, gaugeWidth, gaugeHeight);
this._mpBitmap.fillRect(0, 0, gaugeWidth * mpRate, gaugeHeight, '#0000ff');

// Update EXP gauge
var expRate = this._exp / this._maxExp;
this._expBitmap.clearRect(0, 0, gaugeWidth, gaugeHeight);
this._expBitmap.fillRect(0, 0, gaugeWidth * expRate, gaugeHeight, '#ffff00');
};

// Create CustomHUD object
var customHud = new CustomHUD();

// Add CustomHUD object to map scene
Scene_Map.prototype.createCustomHud = function() {
this.addChild(customHud);
};

// Call createCustomHud function when map scene is created
var _Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function() {
_Scene_Map_createAllWindows.call(this);
this.createCustom;
// Add hideCustomHud function to map scene
Scene_Map.prototype.hideCustomHud = function() {
customHud.visible = false;
};

// Add showCustomHud function to map scene
Scene_Map.prototype.showCustomHud = function() {
customHud.visible = true;
};

// Add toggleCustomHud function to map scene
Scene_Map.prototype.toggleCustomHud = function() {
customHud.visible = !customHud.visible;
};

// Add updateCustomHud function to map scene
Scene_Map.prototype.updateCustomHud = function() {
customHud.update();
};

// Add hideCustomHud function to map scene
Scene_Map.prototype.hideCustomHud = function() {
customHud.visible = false;
};

// Add showCustomHud function to map scene
Scene_Map.prototype.showCustomHud = function() {
customHud.visible = true;
};

// Add toggleCustomHud function to map scene
Scene_Map.prototype.toggleCustomHud = function() {
customHud.visible = !customHud.visible;
};

// Add updateCustomHud function to map scene
Scene_Map.prototype.updateCustomHud = function() {
customHud.update();
};

// Add refreshCustomHud function to map scene
Scene_Map.prototype.refreshCustomHud = function() {
customHud.refresh();
};

// Call createCustomHud function and add customHud to update and refresh lists
var _Scene_Map_createSpriteset = Scene_Map.prototype.createSpriteset;
Scene_Map.prototype.createSpriteset = function() {
_Scene_Map_createSpriteset.call(this);

this.createCustomHud();
this._spriteset._updateCustomHudSprites.push(customHud);
this._spriteset._refreshCustomHudSprites.push(customHud);
};

// Add CustomHud to Spriteset_Map
var _Spriteset_Map_createUpperLayer = Spriteset_Map.prototype.createUpperLayer;
Spriteset_Map.prototype.createUpperLayer = function() {
_Spriteset_Map_createUpperLayer.call(this);
this.addChild(customHud);
};

// Add hideCustomHud function to Scene_Battle
Scene_Battle.prototype.hideCustomHud = function() {
customHud.visible = false;
};

// Add showCustomHud function to Scene_Battle
Scene_Battle.prototype.showCustomHud = function() {
customHud.visible = true;
};

// Add refreshCustomHud function to Scene_Battle
Scene_Battle.prototype.refreshCustomHud = function() {
customHud.refresh();
};

// Call createCustomHud function and add customHud to update and refresh lists
var _Scene_Battle_createSpriteset = Scene_Battle.prototype.createSpriteset;
Scene_Battle.prototype.createSpriteset = function() {
_Scene_Battle_createSpriteset.call(this);

this.createCustomHud();
this._spriteset._updateCustomHudSprites.push(customHud);
this._spriteset._refreshCustomHudSprites.push(customHud);
};

// Add CustomHud to Spriteset_Battle
var _Spriteset_Battle_createUpperLayer = Spriteset_Battle.prototype.createUpperLayer;
Spriteset_Battle.prototype.createUpperLayer = function() {
_Spriteset_Battle_createUpperLayer.call(this);
this.addChild(customHud);
};

})();

FINE.



Spero di aver risolto la richiesta e anche essere riuscito a spiegare qualche nozione di ciò che ho appreso analizzando gli script e le librerie di base del RPGMMV.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...