Is there a way to append a '%' sign to the value of MP gauges? I'm using Visustella plugins.
JavaScript questions that don't deserve their own thread
Javascript/Plugin SupportPer the first post in this thread, it's intended for asking for help learning JavaScript, not with specific plugins.
There aren't plugin parameters in the menu core or battle status or whatever you're using that determine the layout?
Oops. Sorry.
I'm trying to find the setting but if it does have any, I can't seem to find it. I'm also playing around with Sprite_Gauge, but some of the functions are obfuscated. I'll start a thread for this. Sorry again.
In the default engine, the function is
Code:
Sprite_Gauge.prototype.drawValue = function() {
const currentValue = this.currentValue();
const width = this.bitmapWidth();
const height = this.textHeight();
this.setupValueFont();
this.bitmap.drawText(currentValue, 0, 0, width, height, "right");
};
So you would simply change the last line to have
currentValue + '%'If VisuStella's plugins overwrite that, then there's either an area for it in the plugin parameters or their code is obfuscated and there's not much anyone else can say.
Yup, they overwritten it. And can't seem to find the plugin parameters for this.
I noticed the same… one can only guess what the “new” function name is… but perhaps the MV YEP plugins can provide some insight?
what do you use to check the player's x and y screen position in a script? I can only find the code for the map one
Also, those are functions: you'd call them with
Note that those values are available without scripting:
(), e.g. $gamePlayer.screenX().Note that those values are available without scripting:
- Control Variables -> Game Data -> Character -> Screen X|Y.
Hello. I'm creating a fairly complex menu system using events and images, but I'm stuck on a problem. Is there a way to temporarily disable the navigation system in the status menu using pageup and pagedown? I mean changing the party member in the status menu using pageup and pagedown. I would like the player to be unable to do this while accessing the status menu from my custom system, however, I want the player to be able to do this when they access the status menu from the standard RPG Maker menu.
In other words, I'm looking for a scriptcall that disables pageup and pagedown, and another scriptcall to enable them. I've looked through the list of script calls, but haven't found anything.
Thanks in advance.
In other words, I'm looking for a scriptcall that disables pageup and pagedown, and another scriptcall to enable them. I've looked through the list of script calls, but haven't found anything.
Thanks in advance.
Youre making the windows yourself right? you could use a game switch in whatever function youve bound the 'pageup/down' handlers to to not function when its on, no?
otherwise, to remove a handler you could try
and
or whatever youre already doing within that scene to add it back - window being a reference to the active window and assuming youre running this off the scene
otherwise, to remove a handler you could try
Code:
delete window._handlers['pageup']
Code:
window.setHandler('pagedown', this.nextActor.bind(this));
@Robro33 Thanks for your answer, but it didn't work. I got the following error message:
"Cannot convert undefined or null to object"
I forgot to mention that I use RPG Maker MZ and I don't know if that makes a difference.
Also, I failed to mention that both my custom menu and the default RPG Maker menu access the default status screen. From my custom menu, I use the following script call to access the status screen:
$gameParty.setMenuActor($gameParty.members()[1]);
SceneManager.push(Scene_Status);
As you can see, I'm accessing the status menu for the second party member. The first is an invisible character used only to make my custom menu work. It's only when accessing the status screen from my custom menu that I don't want the player to be able to use pageup and pagedown to navigate to other party members.
"Cannot convert undefined or null to object"
I forgot to mention that I use RPG Maker MZ and I don't know if that makes a difference.
Also, I failed to mention that both my custom menu and the default RPG Maker menu access the default status screen. From my custom menu, I use the following script call to access the status screen:
$gameParty.setMenuActor($gameParty.members()[1]);
SceneManager.push(Scene_Status);
As you can see, I'm accessing the status menu for the second party member. The first is an invisible character used only to make my custom menu work. It's only when accessing the status screen from my custom menu that I don't want the player to be able to use pageup and pagedown to navigate to other party members.
The core status scene cannot process event commands, e.g. script calls. Making a blanket ban on certain inputs, and storing the banned inputs for later reinstatement, is relatively complicated.
Just edit the
The simplest and cleanest solution for this problem is like Robro suggested: a plugin that blocks the "next/previous actor" response when, say, a switch is on. E.g. (untested):
JavaScript:
/*:
* @target MV MZ
* @plugindesc Disable changing actor in menu when a switch is on.
* @author Caethyril
* @url https://forums.rpgmakerweb.com/posts/1481918/
* @help Free to use and/or modify for any project, no credit required.
*/
;void (function() {
"use strict";
/** Next/prev actor is blocked when this switch is on. @type {number} */
const SWITCH_ID = 123;
/** @returns {boolean} `true` iff next/prev menu actor is allowed. */
const isOk = function() {
return !$gameSwitches.value(SWITCH_ID); // "switch is off"
};
const alias_next = Scene_MenuBase.prototype.nextActor;
Scene_MenuBase.prototype.nextActor = function() {
if (isOk()) alias_next.apply(this, arguments);
};
const alias_prev = Scene_MenuBase.prototype.previousActor;
Scene_MenuBase.prototype.previousActor = function() {
if (isOk()) alias_prev.apply(this, arguments);
};
})();
SWITCH_ID number as needed~@caethyril
Thanks for your answer and your code, but unfortunately the game crashes without any error message when I press pageup and pagedown with the switch on.
Thanks for your answer and your code, but unfortunately the game crashes without any error message when I press pageup and pagedown with the switch on.
OK I just tested and it soft-locks for me (stops responding to key-presses). If it actually crashed your game instead (showed an error and/or closed the game app), then I don't know what's going on.
It's because I forgot to re-enable the window after handling input. Second attempt:
It's because I forgot to re-enable the window after handling input. Second attempt:
JavaScript:
/*:
* @target MV MZ
* @plugindesc Disable changing status actor when a switch is on.
* @author Caethyril
* @url https://forums.rpgmakerweb.com/posts/1481927/
* @help Free to use and/or modify for any project, no credit required.
*/
;void (function() {
"use strict";
/** Next/prev actor is blocked when this switch is on. @type {number} */
const SWITCH_ID = 123;
/** @returns {boolean} `true` iff next/prev menu actor is allowed. */
const isOk = function() {
return !$gameSwitches.value(SWITCH_ID); // "switch is off"
};
const alias_next = Scene_MenuBase.prototype.nextActor;
Scene_MenuBase.prototype.nextActor = function() {
if (isOk())
alias_next.apply(this, arguments);
else
this.onActorChange();
};
const alias_prev = Scene_MenuBase.prototype.previousActor;
Scene_MenuBase.prototype.previousActor = function() {
if (isOk())
alias_prev.apply(this, arguments);
else
this.onActorChange();
};
})();
@caethyril
It worked perfectly! Thank you so much sir! I don't know what I would do without this community!
It worked perfectly! Thank you so much sir! I don't know what I would do without this community!
thank you
How do I run a function if a target is hit with an elemental skill that is weak to (elemental rate > 100%)?
if youre using a plugin that lets you run code during an action's execution like visustella's battle core or Tyran's Eval Tags, Game_Actions have a calcElementRate() function that returns the element rate for the action itself. You'd give it the skill's target as an argument and see if it's value is greater than 1
Good night. Is there a easy way to make every attack in battle to cause a permanent decrease in Max HP calculated on 25% of the damage received? I.E. A green slime attacks my protagonist causing 100 damage, so imediately the protagonist lose 25 max HP. I searched on the forum and found this damage formula:
x = a.atk * 4 - b.def * 2; b.add_param(0, -x / 4); x
But it didn't work, maybe because it was on a thread of RPG Maker VX Ace, and I use MZ.
Then, ChatGPT gave me this:
var damage = a.atk * 4 - b.def * 2; b._maxHp -= damage * 0.25; b._hp = Math.min(b._hp, b._maxHp); return damage;
But it also didn't work.
It is possible to achieve it on damage formula alone or do I need a plugin? Thanks in advance.
x = a.atk * 4 - b.def * 2; b.add_param(0, -x / 4); x
But it didn't work, maybe because it was on a thread of RPG Maker VX Ace, and I use MZ.
Then, ChatGPT gave me this:
var damage = a.atk * 4 - b.def * 2; b._maxHp -= damage * 0.25; b._hp = Math.min(b._hp, b._maxHp); return damage;
But it also didn't work.
It is possible to achieve it on damage formula alone or do I need a plugin? Thanks in advance.
Original thread: https://forums.rpgmakerweb.com/threads/javascript-questions-that-dont-deserve-their-own-thread.46341/