RPG Maker MV / MZ Script Call List

● ARCHIVED · READ-ONLY
Started by Archeia 569 posts Page 28 of 29 View original ↗
  1. i hope it is correct place for this question.

    What code should be entered into the conditional branch so that the condition is returned true if a certain variable is equal to or a multiple of five (5, 10, 15, 20, 25, etc.)?
  2. $gameVariables.value(x) % 5 === 0
  3. ydoolb said:
    What code should be entered into the conditional branch
    no need for a script, the modulo operator (%) is part of control variable.

    just have the variable mod 5 with a second control variable command, then check the result against zero in the conditional branch
  4. How would I write a script if I have a variable and I want the game to turn on the switch that has the ID that matches that variable's current value?

    For example: Variable 1 currently has a value of 8, so i want the game to turn on the switch with the "8" ID

    And then I also want to have this in a coditional branch as well (in a seperate event), so the game would be checking if the switch with the ID that matches the valu of variable 1 is on, so again as an example, checking if switch "8" is on since "8" is the current value of variable 1.

    Hope i'm making sense. Any help would be greatly appreciated :D
  5. CalebHatesYou said:
    How would I write a script if I have a variable and I want the game to turn on the switch that has the ID that matches that variable's current value?

    For example: Variable 1 currently has a value of 8, so i want the game to turn on the switch with the "8" ID

    And then I also want to have this in a coditional branch as well (in a seperate event), so the game would be checking if the switch with the ID that matches the valu of variable 1 is on, so again as an example, checking if switch "8" is on since "8" is the current value of variable 1.

    Hope i'm making sense. Any help would be greatly appreciated :D

    Check the file in the first page of this post, there are a lot of useful instructions there!
    For this thing you need, page "Event pages Script Call"

    check this part:
    Captura de pantalla -2024-09-02 11-37-03.png

    So you need
    $gameVariables.value(1) -> gives you the value of variable 1
    $gameSwitches.setValue(3, true); -> sets the switch 3 to true
    if you replace the "3" with what gives you the value of the variable

    $gameSwitches.setValue($gameVariables.value(1), true); -> This changes to true the switch with number of whatever number is in variable 1

    Then, to check in conditional branches is the same but using the method to read the value

    $gameSwitches.value($gameVariables.value(1));

    Just adding this last line in the script field of conditional branch should work
  6. It's me again. Would someone be able to help me figure out how to have a conditional branch that checks if the value of one variable is 1 higher than another?

    for example I want an event to only trigger if the value of Variable A is equal to the value of variable B +1, so like...

    If Variable A's current value is 6, the event will trigger if Variable B's current value is 7 (because 6 +1 is 7)
  7. CalebHatesYou said:
    Would someone be able to help me figure out how to have a conditional branch that checks if the value of one variable is 1 higher than another?

    for example I want an event to only trigger if the value of Variable A is equal to the value of variable B +1
    you can have a variable C, set its value to variable B, add 1 to C, and then have your conditional branch be if A is equal to C

    CalebHatesYou said:
    If Variable A's current value is 6, the event will trigger if Variable B's current value is 7 (because 6 +1 is 7)
    you meant if B is 5? your last example is if A = B+1. this would be if A+1=B
  8. CalebHatesYou said:
    It's me again. Would someone be able to help me figure out how to have a conditional branch that checks if the value of one variable is 1 higher than another?
    Just to point it out, this has nothing to do with the Script Call List document, so it's really not a relevant place for the question. There's another thread for simple JavaScript questions, although you really don't need to use code for this at all.
  9. CalebHatesYou said:
    It's me again. Would someone be able to help me figure out how to have a conditional branch that checks if the value of one variable is 1 higher than another?

    for example I want an event to only trigger if the value of Variable A is equal to the value of variable B +1, so like...

    If Variable A's current value is 6, the event will trigger if Variable B's current value is 7 (because 6 +1 is 7)

    Hi,
    for conditional branches which should contain math
    you can use this:
    1731391253718.png
    $gameVariables.value(ID_A) == $gameVariables.value(ID_B)+1

    just replace ID_A and ID_B with the numbers of the IDs of your used variables
    example Variable A is #0010 and Variable B is #0011 then it would be
    $gameVariables.value(10) == $gameVariables.value(11)+1

    ---
    So @ATT_Turan it belongs truly in this Script Call List document,
    because it is a second method of using script calls.
    IF someone is still on MV then this method becomes very important,
    because the scriptcall-window has only 11 lines .. so with this method you can
    split it in many (not all) cases.
    ---

    @CalebHatesYou - You mentioned you want to trigger an event
    if you mean by this, that a MapEvent should show up and run,
    then make two Eventpages in this MapEvent,
    the first Eventpage of this two make it
    - without an Image
    - trigger PARALLEL
    - this IF Condition
    - when this IF Condition is true then set a selfswitch "true"
    the second Eventpage of this two make it
    - with this selfswitch as showupcondition
    - ... with all the stuff as usual ...

    You All have a nice time
    Nafraju
  10. is there a way to find the sum for a single parameter of all members currently in the party? eg. i want to get the sum of all agi in the entire party
  11. DecastarDaDumy said:
    is there a way to find the sum for a single parameter of all members currently in the party? eg. i want to get the sum of all agi in the entire party
    This is not really a question pertaining to the script call list - it has nothing to do with RPG Maker-specific functions, it's just math in JavaScript.

    Code:
    $gameParty.members().reduce((total, actor) => total += actor.agi)
  12. ATT_Turan said:
    This is not really a question pertaining to the script call list - it has nothing to do with RPG Maker-specific functions, it's just math in JavaScript.

    Code:
    $gameParty.members().reduce((total, actor) => total += actor.agi)
    my bad. should've asked for it in the "javascript questions that don't deserve a thread" thread lol

    thanks anyways
  13. Is there a way to use a range in a scrpt call? I'm looking to use "actor.forgetSkill(skillId);" to make the player forget multiple skills at once, but I don't know how to add a range for the skill ID
  14. you can put it in a loop
    Code:
    for (var i = 50; i <= 60; i++) actor.forgetSkill(i);
    and thatll forget every skill from 50 to 60
  15. (@Robro33 - small typo: you've written 1++ instead of i++.)
  16. caethyril said:
    you've written 1++ instead of i++
    Thanks!
    that one happens more often than id like to admit :guffaw:
  17. ydoolb said:
    i hope it is correct place for this question.

    What code should be entered into the conditional branch so that the condition is returned true if a certain variable is equal to or a multiple of five (5, 10, 15, 20, 25, etc.)?
    Robro33 said:
    $gameVariables.value(x) % 5 === 0

    This is very useful! I'm using it to create a day/night system in battles where the time of day changes based on a condition that checks if a variable is equal to or a multiple of a number. For the most part, it works well, and I'm still tinkering with it. :LZSsmile:

    --------------------------------------------------------------------------------------------------

    Moreover, I have a different question.

    I'm working on a skill that uses luck to calculate a chance to grant the actor another action. It assigns the actor's Luck to a variable and then several conditions happen:
    If the actor's luck is above 70, a second variable calculates a chance between 1 and 100 and if that variable is greater or equal to 79, then the actor gets to act again (in other words, it has a 21% chance of being able to act again.)

    If the actor's luck is above 60, a second variable calculates a chance between 1 and 100 and if that variable is greater or equal to 82, then the actor gets to act again (in other words, it has a 18% chance of being able to act again.)

    And so on and so forth based on different luck stat amounts. There could very well be other issues, but for now I want to test things one at a time, starting with the script that Control Variable uses to assign the Actor's luck to a variable.

    I'm using $gameParty.leader().param(7) to test this with the party leader's luck stat, but eventually I want to make Control Variable assign the luck of any actor using it to the variable. What is the correct script I should use?

    This is the common event that plays after the skill in question is used.

    Second Wind Based on Luck Stat Test.jpg
  18. Magenta-Fantasies said:
    This is very useful! I'm using it to create a day/night system in battles where the time of day changes based on a condition that checks if a variable is equal to or a multiple of a number. For the most part, it works well, and I'm still tinkering with it. :LZSsmile:

    --------------------------------------------------------------------------------------------------

    Moreover, I have a different question.

    I'm working on a skill that uses luck to calculate a chance to grant the actor another action. It assigns the actor's Luck to a variable and then several conditions happen:
    If the actor's luck is above 70, a second variable calculates a chance between 1 and 100 and if that variable is greater or equal to 79, then the actor gets to act again (in other words, it has a 21% chance of being able to act again.)

    If the actor's luck is above 60, a second variable calculates a chance between 1 and 100 and if that variable is greater or equal to 82, then the actor gets to act again (in other words, it has a 18% chance of being able to act again.)

    And so on and so forth based on different luck stat amounts. There could very well be other issues, but for now I want to test things one at a time, starting with the script that Control Variable uses to assign the Actor's luck to a variable.

    I'm using $gameParty.leader().param(7) to test this with the party leader's luck stat, but eventually I want to make Control Variable assign the luck of any actor using it to the variable. What is the correct script I should use?

    This is the common event that plays after the skill in question is used.
    If you're using action sequences I'd assign the user's ID to a variable in the beginning of the setup sequence and have your script reference that when checking the actors stat, but I'm not sure how to do it without action sequences sorry.
  19. Magenta-Fantasies said:
    I'm working on a skill that uses luck to calculate a chance to grant the actor another action.
    Assuming it's battle-only and you want to refer to the luck of the subject (i.e. user):

    BattleManager._subject.luk
    (.luk is just a shorthand for .param(7).)

    If you actually want to get the action target instead, that can be more complicated. You seem to be using MZ, though, so you can make use of its "Last Action Data", as seen in Control Variables -> Game Data. Assuming this skill is for actors only:

    $gameActors.actor($gameTemp.lastActionData(4)).luk
    ($gameTemp.lastActionData(4) is the script call equivalent of Last -> Target Actor ID.)
  20. caethyril said:
    Assuming it's battle-only and you want to refer to the luck of the subject (i.e. user):

    BattleManager._subject.luk

    (.luk is just a shorthand for .param(7).)

    If you actually want to get the action target instead, that can be more complicated. You seem to be using MZ, though, so you can make use of its "Last Action Data", as seen in Control Variables -> Game Data. Assuming this skill is for actors only:

    $gameActors.actor($gameTemp.lastActionData(4)).luk

    ($gameTemp.lastActionData(4) is the script call equivalent of Last -> Target Actor ID.)
    BattleManager._subject.luk didn't work, but $gameActors.actor($gameTemp.lastActionData(4)).luk did! Thank you! :LZSproud: