JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 125 of 171 View original ↗
  1. Yesss!!! Thank you, you sent me on the right path there. Finally traced the stack and found where that height gets set (YEP_BattleWindowStatus --> Window_BattleStatus.prototype.itemHeight)
    ).
    Overriding it directly for Window_BattleActor did what I wanted:
    Code:
    Window_BattleActor.prototype.itemHeight = function() {
        return WHATEVER_YOU_WANT
    };
  2. I am trying to make a nested Show Choices / Jump to Label character creation menu. In it, there is a page for Clothing and Equipment. This needs to work for four actors. I am working on how to discard the items when characters come back around to the same Clothing or Equipment menu options. Is there a script call for discarding an item from a specific actor's specific equipped slot? I didn't see any on this list. There is somewhat of a fix using the event commands, but I could see that causing problems with multiple actors (see picture). How will the game know which equipped item to discard if the equipment was already selected by another character?
  3. bookco said:
    I didn't see any on this list.
    I don't know how thoroughly you looked, but what you linked to is just the tab of code to replicate event commands.

    If you go to the first tab, Script Calls, and click on the Equipment category, you'll find:
    Screenshot 2023-06-22 161628.png
  4. ATT_Turan said:
    I don't know how thoroughly you looked, but what you linked to is just the tab of code to replicate event commands.

    If you go to the first tab, Script Calls, and click on the Equipment category, you'll find:
    View attachment 266481
    Oops, lol. Thanks again. I was actually looking at the Actors page wondering why it wasn't on there.
  5. I'm looking for a topic where I ask about checking an event self switch (if it's ON or OFF). It's been some time I'm away from script programming on MV and the code below (inside a Conditional Branch) doesn't seem to be working.

    Code:
    $gameSelfSwitches.value([$gameMap.this,0005,'A']) == true

    Basically, I want to know if a certain event self switch is activated, so I can do a certain event to behave based on this fact.
  6. Try dropping the leading zeros and $gameMap._mapId
  7. AquaEcho said:
    Try dropping the leading zeros and $gameMap._mapId

    Didn't worked. The event still behave as if the chest I created was never opened.
  8. The default plugin gives you the answer to your question.

    EDIT
    JavaScript:
    let key = [$gameMap.mapId(), 5, "A"];
  9. Try dropping the == true

    This should work as a script call
    $gameSelfSwitches.value([$gameMap.mapId(), 5, 'A'])
  10. AquaEcho said:
    Try dropping the == true

    This should work as a script call
    $gameSelfSwitches.value([$gameMap.mapId(), 5, 'A'])

    mapID() is not a function is what it says. So far, I thought it should be something like:

    JavaScript:
    if $gameSelfSwitches.value([$gameMap._mapID,5,'A']) == true {
        // Do this
    }

    But with the Conditional Branch doing the "If Else" work.
  11. kyonides said:
    The default plugin gives you the answer to your question.

    EDIT
    JavaScript:
    let key = [$gameMap.mapId(), 5, "A"];

    JavaScript:
    let key = [$gameMap.mapId(), 5, "A"];
    if ( $gameSelfSwitches.value(key) ) {
      // Fall asleep or watch a terrible movie! :o
    }

    And here's the proof that function gotta exist.
    JavaScript:
    Game_Interpreter.prototype.setup = function(list, eventId) {
        this.clear();
        this._mapId = $gameMap.mapId();
        this._eventId = eventId || 0;
        this._list = list;
        Game_Interpreter.requestImages(list);
    };
  12. CleanWater said:
    mapID() is not a function is what it says.
    It should be Id not ID
  13. CleanWater said:
    So far, I thought it should be something like:
    JavaScript:
    if $gameSelfSwitches.value([$gameMap._mapID,5,'A']) == true {
        // Do this
    }
    As @AquaEcho said, it's not ID. Also, you have incorrect syntax for your conditional. JavaScript expects
    if (condition)
    and you're missing the parentheses.

    It will work if you do:
    Code:
    if ($gameSelfSwitches.value([$gameMap.mapId(),5,'A']) == true)
    or, since you're checking against a boolean value and the condition is already looking for a boolean value, you can simply do:
    Code:
    if ($gameSelfSwitches.value([$gameMap.mapId(),5,'A']))

    You have to be more careful with your specifics, every character you type in code matters.
  14. kyonides said:
    JavaScript:
    let key = [$gameMap.mapId(), 5, "A"];
    if ( $gameSelfSwitches.value(key) ) {
      // Fall asleep or watch a terrible movie! :o
    }

    And here's the proof that function gotta exist.
    JavaScript:
    Game_Interpreter.prototype.setup = function(list, eventId) {
        this.clear();
        this._mapId = $gameMap.mapId();
        this._eventId = eventId || 0;
        this._list = list;
        Game_Interpreter.requestImages(list);
    };

    Fine, people. Pretend I don't exist and I never told anybody how to define a condition there. :p
  15. kyonides said:
    Fine, people. Pretend I don't exist and I never told anybody how to define a condition there. :p
    No offense, I didn't read all of the posts back up the page. I just looked at his most recent post, where it was still wrong. And while you absolutely did it correctly, you didn't specifically point out the error with the parentheses :wink: so I clarified.
  16. Guys, just to let you know...

    With the Conditional Branch, I used the:
    JavaScript:
    ($gameSelfSwitches.value([$gameMap.mapId(),5,'A'])) == true

    For some reason, I really forgot how to properly write this piece of code. Many thanks @ATT_Turan, @kyonides and @AquaEcho for reminding me of this!

    To close the chest again:
    JavaScript:
    $gameSelfSwitches.setValue([$gameMap.mapId(),5,'A']) = false;

    But this one is not working.
  17. FYI, neither of those is correct.

    CleanWater said:
    With the Conditional Branch, I used the:
    JavaScript:
    ($gameSelfSwitches.value([$gameMap.mapId(),5,'A'])) == true
    You still do not have the conditional properly enclosed in parentheses the way I typed it for you. It might work because as I showed in my second example you'll get the correct evaluation even without the operator "== true", but in this case that's extra code at the end of the line doing nothing.

    CleanWater said:
    To close the chest again:
    JavaScript:
    $gameSelfSwitches.setValue([$gameMap.mapId(),5,'A']) = false;
    That's also incorrect. You can't set a function equal to something, and you're missing an argument. The correct syntax is
    Code:
    $gameSelfSwitches.setValue([$gameMap.mapId(), 5, "A"], false)
  18. Now it worked perfectly @ATT_Turan, many thanks!
  19. Simple question: how do I make the Luck/LUK stat have a greater impact on whether states are applied? (I am dealing with low stat values, in the range from 8-30.)

    I found this bit of code in rmmz_objects.js:
    JavaScript:
    Game_Action.prototype.lukEffectRate = function(target) {
        return Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0);
    };

    Does this seriously mean that there's a 0.1% modifier to the equation, and that if I increase that 0.001, I will see a greater likelihood that a subject's LUK impacts a state? Or is it more complicated than that?

    I would change it and test it myself, but having knowledge of what is happening at this spot in the code is more important than trying to observe and measure a small handful of trial runs with the modifier at 0.01 or even 0.1.
  20. Yeap, with the default setup you'd just get that 0.1% of a chance (multiplied by the LUK stat), a very low one indeed.