JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 166 of 171 View original ↗
  1. I'd suggest one of these:
    1. "True iff the leader is not restricted AND there is some non-leader alive member who is not restricted":

      const leader = $gameParty.leader(); !leader.isRestricted() && $gameParty.aliveMembers().some(actor => actor !== leader && !actor.isRestricted())
      (I've used Array#some here, which terminates early if it finds a match.)

    2. "True iff the leader is not restricted AND the total number of non-restricted alive members is 2 or more":

      !$gameParty.leader().isRestricted() && $gameParty.aliveMembers().reduce((total, actor) => !actor.isRestricted ? total + 1 : total, 0) >= 2
      (I've used Array#reduce here to avoid creating a new array.)
  2. Is there a way to change the cursor color of the title command via script? All other commands remain the same.
  3. SolemnGravity said:
    Is there a way to change the cursor color of the title command via script? All other commands remain the same.
    depends if its a sprite and which plugin.

    if its the default mouse, than not exactly as each pc uses their own mouse,
    so it can be different than default if they choose so.

    however, if you use a plugin, than yes, its very doable as you can target
    the title scene only, leaving the other alone for default cursor.
  4. How can I display images from any folder created within the project?
  5. Eternidade_1 said:
    How can I display images from any folder created within the project?
    "show picture" doesn't work? where is the folder?
  6. A folder inside the img folder, for example the "HUD SLOT" image. img.png
  7. colocar dentro da pasta img.png

    And then? What is the command or script to display an image from the "Hud Slot" folder?
  8. Dark_Ansem said:
    Event command "show picture"
    Something like this?

    // Access the game variables
    var folder = $gameVariables.value(1);
    var hairId = $gameVariables.value(2);

    // Construct the full file path (Ex: "02_Elfo/Cabelo_5")
    var filename = folder + '/Cabelo_' + hairId;

    // Call the 'Show Picture' command using the constructed path
    // Parameters: Picture ID, Filename, Origin, X Position, Y Position, Opacity
    $gameScreen.showPicture(
    1, // Screen Image ID
    filename, // The constructed file path (with subfolder)
    0, // Origin: 0=Top Left, 1=Center
    300, // X Position (in pixels)
    300, // Y Position (in pixels)
    100, 100, // X and Y Scale
    255, // Opacity
    0 // Blend Mode
    );
  9. Eternidade_1 said:
    Something like this?

    // Access the game variables
    var folder = $gameVariables.value(1);
    var hairId = $gameVariables.value(2);

    // Construct the full file path (Ex: "02_Elfo/Cabelo_5")
    var filename = folder + '/Cabelo_' + hairId;

    // Call the 'Show Picture' command using the constructed path
    // Parameters: Picture ID, Filename, Origin, X Position, Y Position, Opacity
    $gameScreen.showPicture(
    1, // Screen Image ID
    filename, // The constructed file path (with subfolder)
    0, // Origin: 0=Top Left, 1=Center
    300, // X Position (in pixels)
    300, // Y Position (in pixels)
    100, 100, // X and Y Scale
    255, // Opacity
    0 // Blend Mode
    );
    No i meant literally the event Command show picture from the menu can you not use it?
  10. Dark_Ansem said:
    No i meant literally the event Command show picture from the menu can you not use it?
    Don't try something like this. I don't know if it works.

    Option 1: Use the Native "Show Picture" Command (With a Workaround)
    This is the simplest, code-free way to test your subfolder, but it requires a little "cheating" in the editor:

    Create a Temporary "Reference File":

    Create an empty or generic image file and save it directly to the img/pictures/ folder (without a subfolder). For example: img/pictures/TEMP_TEST.png.

    Use the "Show Picture" Command:

    Open your event and the "Show Picture..." command.

    Click the selection button (...) and choose your temporary file, TEMP_TEST.

    Manually Edit the Name in the Text Field:

    After selecting the temporary file, the name TEMP_TEST will appear in the text field.

    Now, manually replace this name with your subfolder path + actual file name.

    Example: If you selected TESTE_TEMP, replace it with: 02_Elfo/Cabelo_Long_01 (assuming your image is in img/pictures/02_Elfo/).

    Test: Run the game. MV will attempt to load the new path you entered.
  11. Eternidade_1 said:
    How can I display images from any folder created within the project?
    Keep it simple and use the picture folder. If you must use a different folder for whatever reason, you can try this.

    Let's use Picture 2 for this and a few lines of code for the script call (note: you should be able to use the event command as well - just leave the image as a blank):

    JavaScript:
    const filepath = 'img/doodads/Trees/Tree2.png';
    const picId = 2;
    $gameScreen.showPicture(picId, '', 1, 408, 312, 100, 100, 255, 0);
    SceneManager._scene._spriteset._pictureContainer.children[picId - 1].bitmap =
      ImageManager.loadNormalBitmap(filePath, 0);
    1759084190363.png

    This will show Picture 2 as a blank template and then load the bitmap through the image manager. The child container is index 1 (which is for Picture 2). For this filepath, you will now be able to use any extension supported by the browser/nwjs (.png, .webp, .jpeg, etc. - not sure how apng and gif performs).

    That being said, you need to specify the complete path with extension and you will probably need to be on the map scene map since you are referencing the spriteset and picture container.

    Edit: If you need to keep the picture in memory, you chould use reserveNormalBitmap instead. Here is a good read regarding load, reserve, and request:
    ImageManager: Load vs Reserve vs Request
  12. Is there a way to discourage the player from using spread damage skills?
  13. K_Bowman said:
    Is there a way to discourage the player from using spread damage skills?
    i wouldnt really call that a "JS question" unless by spread damage, you dont mean an all enemies scope skill, and that you are talking about something from a plugin - in which case, its not a question that "doesnt deserve its own thread"

    but to answer... make them do less damage? raise the cost? lower Acc? lower effect odds? theres no single correct way. just differentiate them from your single target skills somehow in a way that you feel fits your game
  14. K_Bowman said:
    Is there a way to discourage the player from using spread damage skills?
    You mean, beyond upping the MP/TP cost and lowering damage?
  15. I'm using AKEA for MZ, is there a way to show the current States affecting the enemies in SV Battle, apart from giving them a separate pose?
  16. Jonneixx said:
    I'm using AKEA for MZ, is there a way to show the current States affecting the enemies in SV Battle, apart from giving them a separate pose?
    Please take a moment to read before posting. As per the first post of this thread:
    1760399871069.png
  17. Canned_Dinosaur said:
    Please take a moment to read before posting. As per the first post of this thread:
    View attachment 351229
    I'm sorry, I was under the impression that this function didn't exist as part of the standalone AKEA plugin, and therefore was asking if people could point me towards another plugin that would be able to achieve this (showing current enemy states) while being compatible with AKEA, rather than assisting me with getting AKEA itself working. If that is already an existing function that I'm just missing so far, I Apologise.
  18. Jonneixx said:
    and therefore was asking if people could point me towards another plugin that would be able to achieve this
    Which is exactly why I advise you to create a thread, as it is not a "JavaScript question".