JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 40 of 171 View original ↗
  1. Resonance said:
    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?
  2. 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.
  3. 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.
  4. @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.
  5. 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.
  6. 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
  7. 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?
  8. 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.
  9. 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.
  10. 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
  11. @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)
    }
  12. Poryg said:
    @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?
  13. @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.
  14. Poryg said:
    @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?
  15. 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.
  16. Poryg said:
    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?
  17. 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.
  18. 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.
  19. 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.
  20. 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.