thenerdmansion

Graphic Design/Complex Eventer
Veteran
Joined
Jan 5, 2015
Messages
203
Reaction score
49
First Language
Spanish
Primarily Uses
N/A
Hi all, I am using the Visustella main menu core plugin and this is what the code looks like for what the main menu is being asked to show for the portion of information that I am trying to show.

JavaScript:
// Place Gauges
sx += 180;
sy = rect.y + ((rect.height - (gaugeLineHeight * ($dataSystem.optDisplayTp ? 3 : 2))) / 2) - 2;
this.placeGauge(actor, "hp", sx, sy);
this.placeGauge(actor, "mp", sx, sy + gaugeLineHeight);
if ($dataSystem.optDisplayTp) this.placeGauge(actor, "tp", sx, sy + (gaugeLineHeight * 2));
sx += 160;

I already tried to replace the letters tp wit xp and exp but that didn't work. I'm no expert in Javascript unfortunately.

I want to change it show that is shows an exp bar for reaching the next level instead of the tp bar. Can anyone help me please?
2021-05-04 (4).png
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,168
Reaction score
640
First Language
English
Primarily Uses
RMMV
Is that code in the VisuStella plugin? You'd have to search for the placeGauge function to see if it has the option to display experience, it may have to be coded separately.

You've already read the plugin documentation to see if it says anything about this?
 

thenerdmansion

Graphic Design/Complex Eventer
Veteran
Joined
Jan 5, 2015
Messages
203
Reaction score
49
First Language
Spanish
Primarily Uses
N/A
I've looked through and read everything in their online documentation and the plugin options itself. To the best of my knowledge the rpg maker engine itself doesn't provide an exp bar by default either so I am thinking some js coding will need to be build.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,168
Reaction score
640
First Language
English
Primarily Uses
RMMV
I Googled "RPG Maker exp gauge" and found this plugin.

It's for MV, so it won't work with your VisuStella plugin, but you can read the code and it should be pretty much the same.
 

thenerdmansion

Graphic Design/Complex Eventer
Veteran
Joined
Jan 5, 2015
Messages
203
Reaction score
49
First Language
Spanish
Primarily Uses
N/A
HEEEEY!!! We're on the same page, looks like we've been looking at the same thing haha. I downloaded the js and since I am using MZ I forced it into the fossil program to work with the MZ engine but it doesn't seem to be working unfortunately :(. I won't give up.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
797
Reaction score
642
First Language
English
Primarily Uses
RMMV
Mz's default gauge placement is remarkably nonflexible.


I wrote this for status menu core compatibility, it should work for your purpose as well.
Code:
	Fossil.AddSprite_GaugeCurrentValueXP= Sprite_Gauge.prototype.currentValue;

		
	Sprite_Gauge.prototype.currentValue = function() 
	{
		//if we see a number assume it's a parameter id
		if(typeof(this._statusType)=='number')
		{
			//and return it
			return SceneManager._scene._infoWindow._actor.param(this._statusType) //Math.round(SceneManager._scene._infoWindow.calcParamRate(this._statusType)*this._largestParam)
		}
		if (this._battler) 
		{
			switch (this._statusType) 
			{
				case "xp":
					return Math.floor(100*Window_StatusInfo.prototype.actorCurrentExpRate(this._battler));
				case "xp2":
					return Math.floor(100*Window_StatusInfo.prototype.actorExpRate(this._battler));
			}
		}
		return Fossil.AddSprite_GaugeCurrentValueXP.call(this)
	};

Try replacing 'mp' with 'xp' again after adding that function.

Code:
this.placeGauge(actor, "xp", sx, sy + gaugeLineHeight);

EDIT: wait a sec that relies on yanfly's code to calcualte xp for next level. Give me a sec


EDIT2:
checked RMMZ_objects. the functions we want to invoke are probably the next level xp and the current exp
Code:
Game_Actor.prototype.currentExp = function() {
    return this._exp[this._classId];
};

Game_Actor.prototype.nextLevelExp = function() {
    return this.expForLevel(this._level + 1);
};

so to avoid using yanfly's code, just divide one by the other and do something like this

Code:
	var AddSprite_GaugeCurrentValueXP= Sprite_Gauge.prototype.currentValue;

		
	Sprite_Gauge.prototype.currentValue = function() 
	{

		if (this._battler) 
		{
			switch (this._statusType) 
			{
				case "xp":
					return this._battler.currentExp();
			}
		}
		return AddSprite_GaugeCurrentValueXP.call(this)
	};


	var AddSprite_GaugeCurrentMaxValueXP =Sprite_Gauge.prototype.currentMaxValue;
	Sprite_Gauge.prototype.currentMaxValue = function() 
	{
		if (this._battler) 
		{

			switch (this._statusType) 
			{
				case "xp":
					return this._battler.nextLevelExp();
			}
		}
		return AddSprite_GaugeCurrentMaxValueXP.call(this);
	};
 
Last edited:

thenerdmansion

Graphic Design/Complex Eventer
Veteran
Joined
Jan 5, 2015
Messages
203
Reaction score
49
First Language
Spanish
Primarily Uses
N/A
Ohhh, that was a strong tease hahaha, I am super super glad for your help though. I shall be patient. I've updated to the latest fossil plugin too if that helps.

Edit: Will I add this code as a plugin or should I paste it as part of the code in my main post? sorry for my questions ^^;
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
797
Reaction score
642
First Language
English
Primarily Uses
RMMV
yeah try adding
Code:
	var AddSprite_GaugeCurrentValueXP= Sprite_Gauge.prototype.currentValue;

		
	Sprite_Gauge.prototype.currentValue = function() 
	{

		if (this._battler) 
		{
			switch (this._statusType) 
			{
				case "xp":
					return this._battler.currentExp();
			}
		}
		return AddSprite_GaugeCurrentValueXP.call(this)
	};


	var AddSprite_GaugeCurrentMaxValueXP =Sprite_Gauge.prototype.currentMaxValue;
	Sprite_Gauge.prototype.currentMaxValue = function() 
	{
		if (this._battler) 
		{

			switch (this._statusType) 
			{
				case "xp":
					return this._battler.nextLevelExp();
			}
		}
		return AddSprite_GaugeCurrentMaxValueXP.call(this);
	};

as a plugin, then change the mp gauge to xp, and we'll see where I typoed
 

thenerdmansion

Graphic Design/Complex Eventer
Veteran
Joined
Jan 5, 2015
Messages
203
Reaction score
49
First Language
Spanish
Primarily Uses
N/A
My brooooo, I see an exp gauge :D!!!
I've tested it an it's working as intended. The only issue is
the exp bar never goes below half because you always retain the exp that you've already earned I am guessing?
Instead of going back to zero to begin the next level.
I don't think the visustella menu is respecting the fact that it's an exp bar either. The words aren't next to it saying XP.
I might have to place the plugin in a different order.
2021-05-07.png
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
797
Reaction score
642
First Language
English
Primarily Uses
RMMV
okay, try this:

for the maximum, use .nextLevelExp() minus .currentLevelExp()
for the current use .currentExp() minus .currentLevelExp()

and to add the label:
Code:
	var AddSprite_GaugeLabelXP=Sprite_Gauge.prototype.label;
	Sprite_Gauge.prototype.label = function() {
		switch (this._statusType) 
		{
			case "xp":
			case "xp2":
				return TextManager.expA 
		}
		return AddSprite_GaugeLabelXP.call(this);
	};
 

thenerdmansion

Graphic Design/Complex Eventer
Veteran
Joined
Jan 5, 2015
Messages
203
Reaction score
49
First Language
Spanish
Primarily Uses
N/A
Mann, you're a life saver and I'm almost in tears. Thank you so much for your help :D
The menu looks exactly as I wanted it in my head :D!!

I am still trying to figure out where to place the

.nextLevelExp() minus .currentLevelExp()
.currentExp() minus .currentLevelExp()

but I'm already super greatful :D!


2021-05-07 (2).png


EDIT: I wasn't able to figure to figure it out sorry :I.
with using
.nextLevelExp() minus .currentLevelExp()
.currentExp() minus .currentLevelExp()

2021-05-07 (3).png
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,168
Reaction score
640
First Language
English
Primarily Uses
RMMV
I am still trying to figure out where to place the

.nextLevelExp() minus .currentLevelExp()
.currentExp() minus .currentLevelExp()


EDIT: I wasn't able to figure to figure it out sorry :I.
He told you where to put it in the code he already gave you. Replace return this._battler.currentExp(); with return this._battler.currentExp()-this._battler.currentLevelExp();
And, similarly, replace return this._battler.nextLevelExp(); with return this._battler.nextLevelExp()-this._battler.currentLevelExp();
 

thenerdmansion

Graphic Design/Complex Eventer
Veteran
Joined
Jan 5, 2015
Messages
203
Reaction score
49
First Language
Spanish
Primarily Uses
N/A
THANK YOU SO MUCH!!!
You are both super amazing :D!!!!

This thread has been solved :D!
 

Latest Threads

Latest Posts

Latest Profile Posts

Is it unusual to think your own music is strange? xD I honestly don't know if I'm gonna use any of them :p
I've been keeping my cards fairly close to my chest, but Team Muxedo Task is proud to present the first offering for our contest entry: the title screen background.1624496085488.png
I love work placement programs. Part of it is to get a resume done by a "professional" even though I use a portfolio in my profession.
I'm not sure this is the right place to write on but I'm having some problem with adding tileset. Can someone please help me with this?

Forum statistics

Threads
112,507
Messages
1,068,796
Members
146,186
Latest member
miwrky
Top