JavaScript questions that don't deserve their own thread

ZServ

Veteran
Veteran
Joined
Jun 16, 2014
Messages
260
Reaction score
71
Primarily Uses
1. I used to have a bookmark of a Google Doc that had script call equivalents of every Event Command. Does someone have that doc on them? Because it'd possibly give me the information I'd need to figure out my actual question on my own.

2. Specifically, right now I need it to figure out how to perform Set Movement Routes through scripting. Like I want to move a map event x tiles downwards. Doing it through eventing means re-issuing single Set Movement Routes, which introduces a slight stutter as the event needs to be given its next movement route each time it completes a step, which is undesirable.

Here you go

Is there a way to draw the battle commands (Attack, Guard, Magic, etc) horizontally as opposed to vertically?
 

Resonance

Veteran
Veteran
Joined
Oct 25, 2015
Messages
43
Reaction score
6
First Language
English
Thanks.

And it's likely that the battle commands window has a function that defines its max columns as 1. If you change that to a number larger than 1, and reduce the max rows to 1(?), it should start functioning properly immediately.

Then the problem is it won't be displaying properly, so you'd have to resize/reposition that window, and possibly others.
 

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
165
Reaction score
57
First Language
English
Primarily Uses
A little help with this. I'm using this for a passive state in order to have the player change graphics based on their armor. This is tacked on the main armor and from there it checks the helmet, shield and weapon types. Basically using this as the anchor.

Here is the script

<Custom Passive Condition>
//Checks if actor has mail coif and crossbow equipped
if user.hasWeapon($dataWeapons[53]) && user.hasArmor($dataArmors[134]) {
var charName = '&PV1-MCMailleChoifXbow';
var charIndex = 0;
//Checks if actor has Zweihander and coif equipped
} else if user.hasWeapon($dataWeapons[52]) && user.hasArmor($dataArmors[134]) {
var charName = '&PV1-MCMailleChainmailCoifZweihander';
var charIndex = 0;
//Checks if actor has coif and handgonne equipped
} else if user.hasWeapon($dataWeapons[51]) && user.hasArmor($dataArmors[134]) {
var charName = '&PV1-MCMailleCoifArquebus';
var charIndex = 0;
//Checks if Longsword and Heather Shield are equipped
} else if user.hasWeapon($dataWeapons[61]) && user.hasArmor($dataArmors[125]) && user.hasArmor($dataArmors[134]) {
var charName = '&PV1-MCMailleChainCoifLongSwordHeatherhield';
var charIndex = 0;
//Checks if only Longsword is equipped
} else if user.hasWeapon($dataWeapons[61] && user.hasArmor($dataArmors[134]) {
var charName = '&PV1-MCMailleChainCoifLongSwordNoShield';
var charIndex = 0;
//Checks if none of those are equipped
} else if user.hasArmor($dataArmors[134]) {
var charName = '&PV1-Commander';
var charIndex = 0;
}
//Checks if actor has kettle helmet equipped and xbow
if user.hasWeapon($dataWeapons[53]) && user.hasArmor($dataArmors[135]) {
var charName = '&PV1-MCMailleKettleXbow';
var charIndex = 0;
//Checks if actor has Zweihander and coif equipped
} else if user.hasWeapon($dataWeapons[52]) && user.hasArmor($dataArmors[135]) {
var charName = '&PV1-MCMailleKettleHelmZweihander';
var charIndex = 0;
//Checks if actor has coif and handgonne equipped
} else if user.hasWeapon($dataWeapons[51]) && user.hasArmor($dataArmors[135]) {
var charName = '&PV1-MCMailleKettleHelmArquebus';
var charIndex = 0;
//Checks if Longsword and Heather Shield are equipped
} else if user.hasWeapon($dataWeapons[61]) && user.hasArmor($dataArmors[125]) && user.hasArmor($dataArmors[135]) {
var charName = '&PV1-MCMailleKettleHelmLongSwordHeatherhield';
var charIndex = 0;
//Checks if only Longsword is equipped
} else if user.hasWeapon($dataWeapons[61]) && user.hasArmor($dataArmors[135]) {
var charName = '&PV1-MCMailleKettleHelmLongSwordNoShield';
var charIndex = 0;
//Checks if none of those are equipped
} else if user.hasArmor($dataArmors[135]) {
var charName = '&PV1-Commander';
var charIndex = 0;
}
// Changes the character image to the setting applied from above.
user.setCharacterImage(charName, charIndex);
// Refreshes the user's appearance.
user.refresh();
}
</Custom Passive Condition>

However no matter what I do I always run into an error.
Right now I'm running into an unexpected identifier.
 
Last edited:

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,158
Reaction score
10,731
First Language
Czech
Primarily Uses
RMMV
@HasdrubalBarca if you want to use the if command, the syntax works like this.

if (x == y && z == a){
code
}else if (x==y && z==a) {
code
}else {
code
}
You are missing brackets in every if command, no wonder you'll run into unexpected identifier.
 

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
165
Reaction score
57
First Language
English
Primarily Uses
Whoa. It totally worked, man :)
Thanks a lot for the help, I'd been stumped for hours on that :kaoswt2:
But hey, I'm totally new to it. Still trying to break it down. Gotta start somewhere.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,158
Reaction score
10,731
First Language
Czech
Primarily Uses
RMMV
Not a problem, I tend to forget the brackets a lot too, because neither Python nor Ruby uses them.... But then no wonder I run into unexpected identifiers :D
 

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
165
Reaction score
57
First Language
English
Primarily Uses
Ran into one more small problem.
The "var charName = x" command isn't working. I copied that from Yanfly's actor transformation vid. Is there anyway to fix that?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,158
Reaction score
10,731
First Language
Czech
Primarily Uses
RMMV
var charName = x... What was the x? I mean the exact form.
If you want to read a file name, you need to implement it as a string, so "HaroldSSJ", so the filename must be in '' or "". Then you have to have the corresponding file in your facesets folder as well, otherwise it will do nothing, since "HaroldSSJ" would return undefined.
 

HasdrubalBarca

Veteran
Veteran
Joined
Feb 4, 2015
Messages
165
Reaction score
57
First Language
English
Primarily Uses
For example
var charName = '&PV1-MCMailleKettleHelmLongSwordNoShield';
var charIndex = 0;
The above would be defined if the actor is wearing specific equipment.
So at the end of the code it would use the variable defined there
user.setCharacterImage(charName, charIndex);
But it did nothing. I didn't define a faceset but I don't think it's needed since just typing
user.setCharacterImage('&PV1-MCMailleKettleHelmLongSwordNoShield', 0); makes it work.

So here's an example of trying it out via script call event:

if ($gameActors.actor(1).hasArmor($dataArmors[134]) && $gameActors.actor(1).hasWeapon($dataWeapons[53])){
var charName = '&PV1-MCMailleKettleHelmLongSwordNoShield';
var charIndex = 0;
} else {
var charName = '&PV1-MCMailleKettleHelmArquebus';
var charIndex = 0;
}
$gameActors.actor(1).setCharacterImage(charName, charIndex);
$gamePlayer.refresh;

In which nothing happens. However setting it up like this does

if ($gameActors.actor(1).hasArmor($dataArmors[134]) && $gameActors.actor(1).hasWeapon($dataWeapons[53])){
$gameActors.actor(1).setCharacterImage('&PV1-MCMailleKettleHelmLongSwordNoShield', 0);
$gamePlayer.refresh;
} else {
$gameActors.actor(1).setCharacterImage('&PV1-MCMailleKettleHelmLongSwordNoShield', 0);
$gamePlayer.refresh;
}

The above works fine.
It's really not a major problem, it's pretty minor. However I'm asking in case I do need it for future tinkering.
 

Raijinn

YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET
Veteran
Joined
May 20, 2017
Messages
261
Reaction score
252
First Language
Bahasa, English
Primarily Uses
N/A
I seriously hope that this doesn't get treated as spam.
I've posted this before in the RMMV section but someone told me to post this here.

I am currently in the middle of making a game, and I thought of everything, from battle systems to the story.
Now, there's something I want to have in battle. Kinda dumb but.....

I want elemental weaknesses to gives states. An example of this is from the Persona series, when the enemy is hit with it's weakness it gives them the state "Down." How do I achieve that in RMMV?

If there's a plugin for this, would you send me the link? I've looked everywhere but still no luck

Thanks
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,158
Reaction score
10,731
First Language
Czech
Primarily Uses
RMMV
@HasdrubalBarca Frankly, I don't know. It does the same to me, even though according to the console it checks out.

@Raijinn this is actually pretty easy. I use Yanfly passive states and Yanfly element core. Then to each class, which has its' own elemental weaknesses, I set a state, because I was going to work with states in the future anyway.
So for example I have a state 13 designated as Fire mage.
Then it's quite easy.
Then simply place this to <Target action> (if you use Yanfly battle engine):
if (target.isStateAffected(13) {
target.addState(whatever you want to add)
}
 

Raijinn

YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET
Veteran
Joined
May 20, 2017
Messages
261
Reaction score
252
First Language
Bahasa, English
Primarily Uses
N/A
@HasdrubalBarca Frankly, I don't know. It does the same to me, even though according to the console it checks out.

@Raijinn this is actually pretty easy. I use Yanfly passive states and Yanfly element core. Then to each class, which has its' own elemental weaknesses, I set a state, because I was going to work with states even in the future.
So for example I have a state 13 designated as Fire mage.
Then its' quite easy.
if (target.isStateAffected(13) {
target.addState(whatever you want to add)
}
Does this work with enemies too?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,158
Reaction score
10,731
First Language
Czech
Primarily Uses
RMMV
@Raijinn Since enemies can also be state affected, it works with enemies too. This is why I like working with states, they are more flexible.
 

Raijinn

YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET
Veteran
Joined
May 20, 2017
Messages
261
Reaction score
252
First Language
Bahasa, English
Primarily Uses
N/A
@Raijinn Since enemies can also be state affected, it works with enemies too. This is why I like working with states, they are more flexible.
I'm sort of new to this whole RPGMAKER thing, could you explain the code for me?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,158
Reaction score
10,731
First Language
Czech
Primarily Uses
RMMV
Poison, burn, sleep, silence, paralyze, weakness, knockout... These are very basic examples of states. With the right functionality a state can have pretty much any effects, either positive, negative or neutral. Or you can even use states just as markers for important things.
For example if someone is weak against ice, he can have a state that only says "weak against ice" and you can use this state to work with further, because it's more convenient to work with states than with object properties (which is a javascript thing).
If you're new to RPG maker, I'd suggest you play with the engine before trying to create anything specific, to get to know it. Only when you're comfortable with it, then jump to creating projects. Otherwise you'll just get stuck.
 

Raijinn

YEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEET
Veteran
Joined
May 20, 2017
Messages
261
Reaction score
252
First Language
Bahasa, English
Primarily Uses
N/A
Poison, burn, sleep, silence, paralyze, weakness, knockout... These are very basic examples of states. With the right functionality a state can have pretty much any effects, either positive, negative or neutral. Or you can even use states just as markers for important things.
For example if someone is weak against ice, he can have a state that only says "weak against ice" and you can use this state to work with further, because it's more convenient to work with states than with object properties (which is a javascript thing).
If you're new to RPG maker, I'd suggest you play with the engine before trying to create anything specific, to get to know it. Only when you're comfortable with it, then jump to creating projects. Otherwise you'll just get stuck.

OH I SEE, SO THE WEAKNESS IS ACTUALLY A STATE. I see, theoritically it works. But I was wondering if other than that, you could code the formula on the skills instead?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,158
Reaction score
10,731
First Language
Czech
Primarily Uses
RMMV
Weakness isn't actually a state, weakness is a parameter modifying damage by a percentage. But you can create a state that shows up only for characters that have a certain weakness. It's just easier to work with the state than with the actual weakness, because this weakness is less flexible than a state.
Yes, you can code the formula on the skills using the notebox, if you have the right plugins. But it's better to learn things one after another instead of rushing to advanced things.
 

Artomes

Veteran
Veteran
Joined
Jun 3, 2016
Messages
57
Reaction score
16
First Language
English
Primarily Uses
N/A
Does anybody know a way to show a window for the attack and guard command? Like the way skills do. I want the attack command to show the
base hit chance of the attack.
 

Resonance

Veteran
Veteran
Joined
Oct 25, 2015
Messages
43
Reaction score
6
First Language
English
Is there somewhere in the scripts that makes regular map sprites pan along with the _display coordinates? My personally added sprites all stay static relative to the screen, but I want them to stay attached to particular map coordinates.

I'm about to manually move them whenever the .scrollDirection functions are called, but I have a feeling that's the hacky solution to something that might already be provided elsewhere.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
952
Reaction score
603
First Language
English
Primarily Uses
RMMV
Does anyone know how to set scrolling text to show on a certain X co-ordinate? It looks like it always uses 0 as the start position of the window. Using Yanfly's message core plugin I can set the main message window to be smaller than the actual screen width, and it automatically centers it, but the scrolling text window is unaffected. My project is widescreen, but I want all the text to be centered in a 4:3 aspect ratio in the middle of the screen, if possible.

I was looking through the core scripts, but I can't seem to figure out where it decides the x position for the scrolling text block. Thanks in advance.
 

Latest Threads

Latest Profile Posts

So before I inevitably start a new project to reorganize myself (I will make sure to save important info dw), I will make an external list of what I want in the final database.
Although a lot of things are still not finished, I can't delay the early access date.
It's her birthday. :kaojoy:
Have you ever been truly comfortable? This weekend I experienced it for the first time in my 33 years on this planet. Try to get comfy, friends.
Every once in a while I check to see if my planned game titles are taken or trademarked. Still okay. I plan to take my time for the sake of quality, but at the same time it feels like a race against some hidden dev out there who also plans to publish or register the same title.
Who else here likes frogs? I sure do like them squishy beings! :rwink:

froggy.png

Forum statistics

Threads
117,193
Messages
1,105,356
Members
153,323
Latest member
dfsdfsd546545fgsd
Top