It's very possible, but to answer we should know what are those situation that change the check. Are they switch operated?
JavaScript questions that don't deserve their own thread
Javascript/Plugin SupportConditional branch -> script call.
($gameVariables.value(1) == $gameVariables.value(2) + 1) || ($gameVariables.value(1) ==
$gameVariables.value(2) - 1)
you can. you use a 3rd variable, set it to the 2nd, add or subtract 1, and then compare variable 1 to 3. even if you need to check other variables, you dont change the id of variable 3
I'm sorry, I should've been more specific. What I meant was I know how to do it without scripting, but since my particular project would then require way more variables than I want to work with, I needed to figure out how to achieve the same result through scripting.
Thank you! I know it's super simple, but I haven't learned JS yet and have little experience with RPG Maker in general. It works exactly how I needed 🙂
The script for checking the value of variables is
$gameVariables.value(variable ID)
E.g
EDIT: lol, sorry, replied without flipping the page.
EDIT2: you could also do this
$gameVariables.value(variable ID)
E.g
JavaScript:
$gameVariables.value(y) == $gameVariables.value(x) + 1
EDIT: lol, sorry, replied without flipping the page.
EDIT2: you could also do this
JavaScript:
Math.abs($gameVariables.value(y) - $gameVariables.value(x)) == 1
I've got a very stupid and honestly quite dumb question.. but for the life of me, i'm just not sure..
Which is which?
I'm adjusting the collapse animation for enemies.. and i'm kinda confused on which is which >_<
I assume 3 of them are Red Blue and Green, but i'm not sure which is the intensity..
setBlendColor([0, 100, 200, 255]);Which is which?
I'm adjusting the collapse animation for enemies.. and i'm kinda confused on which is which >_<
I assume 3 of them are Red Blue and Green, but i'm not sure which is the intensity..
These are R G B A, in that order.
Thankyou! Big prish!!
Sorry for taking so long to respond! I was super busy and couldn't check the forums lol
That would work, but the problem is my project has a lot of these variables, so doing it this way would triple the amount I would need for the game to run, and it would just be way too much of a hassle. I might end up using this for a different part of the project, but for now I'll continue with script calls.
Back again haha
I'm sure the answer is super simple, but I can't find it anywhere. I need an event to check whether its x position is equal to a variable, how can I do that?
I'm sure the answer is super simple, but I can't find it anywhere. I need an event to check whether its x position is equal to a variable, how can I do that?
Either in its event page
If: this.character(0).x == $gameVariables.value(12)
Or in a move route
if(this.x ==$gameVariables.value(12)){script you want to happen here}
Where 12 is the variable number
If: this.character(0).x == $gameVariables.value(12)
Or in a move route
if(this.x ==$gameVariables.value(12)){script you want to happen here}
Where 12 is the variable number
Here is an example of what you can use as a script condition. I've used variables id 2 and 4 here:
Math.abs($gameVariables.value(2) - $gameVariables.value(4)) <= 1
Math.abs turns the difference between the two variable values into a positive number, so -1 becomes +1.
Oh I was too late to answer.
I did not scroll down, sorry.
Don't worry about it, because your answer is actually useful for a different part of my project! I must have great luck to get a question answered without even asking it yet haha
Is there a way to get the last gold gained by the player?
If you're only adding gold via event commands then you can track it manually, using a variable.
Otherwise you would need a plugin, e.g. (untested):
JavaScript:
/*:
* @target MV MZ
* @plugindesc Adds script call: $gameParty.recentGold
* @author Caethyril
* @url https://forums.rpgmakerweb.com/posts/1507920
* @help Use in a Script field to get the most recent gold gain/loss:
* $gameParty.recentGold
* Gold gains/losses are grouped by:
* - Troop, for battle drops;
* - Item (either single or bulk transaction), for shops;
* - Command, for the Change Gold event command.
*
* Free to use and/or modify for any project, no credit required.
*/
;void (function() {
/** New identifier for "recent gold" property on `Game_Party`. */
const P = "recentGold";
// Patch - init value.
void (function(alias) {
Game_Party.prototype.initialize = function() {
alias.apply(this, arguments);
this[P] = 0;
};
})(Game_Party.prototype.initialize);
// Patch - update value.
void (function(alias) {
Game_Party.prototype.gainGold = function() {
const pre = this._gold;
alias.apply(this, arguments);
this[P] = this._gold - pre;
};
})(Game_Party.prototype.gainGold);
})();
JS Plugin Requests
forums.rpgmakerweb.com
Scripting is totally fine of course (in fact, I would recommend it over eventing here because of how unwieldy that could become, even if you set up a common event to call that runs the comparison instead of creating an if-else chain every time).
But I did want to flag that the method I showed you should not triple your number of variables, it should only add 3 (ComparisonVar, VIQ+1, and VIQ-1) on top of the ones you already have since those don't need to hold values permanently, just during a comparison check, so can be used repeatedly for all other variables.
Oh I'm sorry, I misunderstood. Other people on the forums and outside have recommended making two extra variables per original variable, so I must've assumed that's what you meant.
Hey everyone. Im using rpg maker mv and am currently attempting to find a way in battle to use one skill to interrupt another one. Basically if A uses the skill "Attack" and B tries to use the skill "Heal":
A attacks B first , then a log message is displayed "B got interrupted and cant heal" and then B doesnt heal, however if A doesnt use "Attack" then the log message is not displayed and the skill "Heal" heals the user ( B in this case ).
My first idea was to give the "Attack" skill a priority of 1000 so it always goes first and have "Attack" apply a status that has Seal Skill "Heal". And it mostly works as planned. A attacks , B takes damage , B gets sealed and cant use "Heal" - However it is not transparent for the player because I dont know how to display the log message. If I include it in "Attack" it triggers even if the attacked player doesnt use "Heal" and I cant include it in "Heal" because the skill gets sealed before resolving. Maybe a common event could help but Im not sure how to write it.
Im not even sure anymore if the idea of using seal skill even works to begin with or if I just need to rewrite how "Attack" and "Heal" work.
Im pretty new to rpg maker and would appreciate any help. Thanks in advance
A attacks B first , then a log message is displayed "B got interrupted and cant heal" and then B doesnt heal, however if A doesnt use "Attack" then the log message is not displayed and the skill "Heal" heals the user ( B in this case ).
My first idea was to give the "Attack" skill a priority of 1000 so it always goes first and have "Attack" apply a status that has Seal Skill "Heal". And it mostly works as planned. A attacks , B takes damage , B gets sealed and cant use "Heal" - However it is not transparent for the player because I dont know how to display the log message. If I include it in "Attack" it triggers even if the attacked player doesnt use "Heal" and I cant include it in "Heal" because the skill gets sealed before resolving. Maybe a common event could help but Im not sure how to write it.
Im not even sure anymore if the idea of using seal skill even works to begin with or if I just need to rewrite how "Attack" and "Heal" work.
Im pretty new to rpg maker and would appreciate any help. Thanks in advance
Hi, I'm trying to make a skill where it gives buffs to Character A, but after it expires, it gives debuffs to Character A, like a downside exhaustion effect.
Does anyone know what JavaScript I need to write under JS On Expire State, or know where I could find help on learning how to write it? Thanks!
Does anyone know what JavaScript I need to write under JS On Expire State, or know where I could find help on learning how to write it? Thanks!
Original thread: https://forums.rpgmakerweb.com/threads/javascript-questions-that-dont-deserve-their-own-thread.46341/