- Joined
- Aug 2, 2015
- Messages
- 169
- Reaction score
- 26
- First Language
- English
- Primarily Uses
Well, this is what's going on here.
I'm making, or was making, a plugin that changed the way the map name window works, you know, the one that appears when you change maps showing you the name of the actual map. So now it changes color and displays an icon.
So now using notetags for each map you can change the colors and icon the map will show, so it's prettier and you can identify things like the difficulty of the map, also the name isn't centered anymore and the width was enlarged so the text won't shrink anymore.
I'm posting this plugin here because I finally understood that if I didn't stop making it, It would've taken me days to finish it (I'm very slow at this). I wanted to finish it and share it in the forums, but I gave up when I tried many times to make parameters linked to variables but for some reason it always lead to errors. I couldn't make the parameters work no matter what, and I already made a plugin with parameters that worked.
So if anyone is interested in making a plugin of this kind, take this "thing" and maybe your work will be easier, also if you're a beginner in JS you will probably be able to modify this plugin and use it in your game as it is, I mean, it's completely functional.
This is how it looks like:
And here is the code, explained with notes:
I hope this is useful for someone.
Maybe I'll improve it in a way that's good enough to release, but for now I'll use it as an edit for my game and move on to the next one being the effect to enter battle or animated loading screens...
I'm making, or was making, a plugin that changed the way the map name window works, you know, the one that appears when you change maps showing you the name of the actual map. So now it changes color and displays an icon.
So now using notetags for each map you can change the colors and icon the map will show, so it's prettier and you can identify things like the difficulty of the map, also the name isn't centered anymore and the width was enlarged so the text won't shrink anymore.
I'm posting this plugin here because I finally understood that if I didn't stop making it, It would've taken me days to finish it (I'm very slow at this). I wanted to finish it and share it in the forums, but I gave up when I tried many times to make parameters linked to variables but for some reason it always lead to errors. I couldn't make the parameters work no matter what, and I already made a plugin with parameters that worked.
So if anyone is interested in making a plugin of this kind, take this "thing" and maybe your work will be easier, also if you're a beginner in JS you will probably be able to modify this plugin and use it in your game as it is, I mean, it's completely functional.
This is how it looks like:
And here is the code, explained with notes:
function Window_MapName() { this.initialize.apply(this, arguments);}//////////////////////////////////////////////////////////////////////////////////////////////////////////// Here, diffColor1 and diffColor2 are the gradient colors, diffIcon is the icon that appears before// the text, and diffColorText is the text color. You will set the notetags (DIFF0, DIFF1, etc) here and// define the changes of each one of them.//////////////////////////////////////////////////////////////////////////////////////////////////////////Window_Base.prototype.diffColor1 = function() { if($dataMap.note =='DIFF0'){ return 'rgba(255, 96, 233, 160)'; } if($dataMap.note =='DIFF1'){ return 'rgba(0, 0, 0, 0.6)'; }};Window_Base.prototype.diffColor2 = function() { if($dataMap.note =='DIFF0'){ return 'rgba(255, 191, 247, 0)'; } if($dataMap.note =='DIFF1'){ return 'rgba(0, 0, 0, 0.6)'; }};Window_Base.prototype.diffIcon = function() { if($dataMap.note =='DIFF0'){ return 224; } if($dataMap.note =='DIFF1'){ return 115; }};Window_Base.prototype.diffTextColor = function() { if($dataMap.note =='DIFF0'){ return 2; } if($dataMap.note =='DIFF1'){ return 4; }};//////////////////////////////////////////////////////////////////////////////////////////////////////////Window_MapName.prototype = Object.create(Window_Base.prototype);Window_MapName.prototype.constructor = Window_MapName;Window_MapName.prototype.initialize = function() { var wight = this.windowWidth(); var height = this.windowHeight(); Window_Base.prototype.initialize.call(this, 0, 0, wight, height); this.opacity = 0; this.contentsOpacity = 0; this._showCount = 0; this.refresh();};//////////////////////////////////////////////////////////////////////////////////////////////////////////// This line here modifies the width of the map name, I changed it to a bigger number so the name of the// map doesn't shrink if it's too large.//////////////////////////////////////////////////////////////////////////////////////////////////////////Window_MapName.prototype.windowWidth = function() { return 700;};//////////////////////////////////////////////////////////////////////////////////////////////////////////Window_MapName.prototype.windowHeight = function() { return this.fittingHeight(1);};Window_MapName.prototype.update = function() { Window_Base.prototype.update.call(this); if (this._showCount > 0 && $gameMap.isNameDisplayEnabled()) { this.updateFadeIn(); this._showCount--; } else { this.updateFadeOut(); }};Window_MapName.prototype.updateFadeIn = function() { this.contentsOpacity += 16;};Window_MapName.prototype.updateFadeOut = function() { this.contentsOpacity -= 16;};Window_MapName.prototype.open = function() { this.refresh(); this._showCount = 150;};Window_MapName.prototype.close = function() { this._showCount = 0;};//////////////////////////////////////////////////////////////////////////////////////////////////////////// I added the icon and the color of the text here in the marked lines//////////////////////////////////////////////////////////////////////////////////////////////////////////Window_MapName.prototype.refresh = function() { this.contents.clear(); if ($gameMap.displayName()) { var width = this.contentsWidth(); var diffTextColor = this.diffTextColor(); //ADDED var diffIcon = this.diffIcon(); //ADDED this.drawBackground(0, 0, width, this.lineHeight()); this.drawIcon(diffIcon, 0, 0); //ADDED this.changeTextColor(this.textColor(diffTextColor)); //ADDED this.drawText($gameMap.displayName(), 42, 0); //MODIFIED X BECAUSE OF THE ICON, ALSO REMOVED THE 'center' this.resetTextColor(); //ADDED }};//////////////////////////////////////////////////////////////////////////////////////////////////////////Window_MapName.prototype.drawBackground = function(x, y, width, height) { var color1 = this.diffColor1(); // EDITED FROM dimColor1/2 to diffColor1/2 so they don't var color2 = this.diffColor2(); // change the originals in rpg_windows this.contents.gradientFillRect(x, y, width / 2, height, color2, color1); this.contents.gradientFillRect(x + width / 2, y, width / 2, height, color1, color2);};
Maybe I'll improve it in a way that's good enough to release, but for now I'll use it as an edit for my game and move on to the next one being the effect to enter battle or animated loading screens...
