RPG Maker MV / MZ Script Call List

● ARCHIVED · READ-ONLY
Started by Archeia 569 posts Page 12 of 29 View original ↗
  1. Hey all, I'm awful at this Javascript stuff. I'm using a custom replace guard plugin, and I just need to know how to check to see if a switch is on or not. If the switch is on, it should pull up id = 301, otherwise, it should pull up id = 2. Thanks for the help!

    Spoiler
    <Custom Replace Guard>
      if $gameSwitches.value(375); {
        id = 301;
      } else {
        id = 2;
      }
    </Custom Replace Guard>



    EDIT: Figured it out. If anyone is wondering how it's done, this is how I did it:

    Spoiler
    <Custom Replace Guard>
    if ($gameSwitches.value(375))
    {id=302}else{id=2}
    </Custom Replace Guard>
  2. Hello, everyone. I have been trying to use script calls to link actor #11's stat parameters to an enemy stat parameters. Here is what I have so far, but it's not working.


    newValueATK = $gameActors.actor(11).param[2];
    $gameTroop.members(1)[1].param[2] = newValueATK;


    I figured that I might be able to just reword some of it and it would work, but it's not, so I'm asking if anyone might know a way to get this to work.


    I was trying to directly connect Actor #11's attack parameter to the first enemy in Troops #1 to change the first enemy in Troops #1's attack parameter into the amount that Actor #11 has. I'm trying to use this script call outside of battle, so that the battle is ready just before the player actually has to fight the battle. However, when I try to run the event the will crash and give me this,


    TypeError


    Cannot read property 'param' of undefined


    I'm assuming that it is $gameTroop.members(1)[1].param[2] = newValueATK; However, I'm not sure what to do to get this to work the way that I want it to.


    Edit:


    I just tried to use the script call during battle and got this message:


    TypeError


    Cannot read property 'param' of undefined


    Instead of using the script call in an event on the map outside of battle I put the script call in the troop section.


    I set the conditions to '


    turn 0'' and Span 'Battle'


    I even tried the Span at 'Turn'


    I got the TypeError message both ways.


    Edit #2:
    I got it working. I ended up having to use the script call during the battle instead of on the map just before the battle. Unfortunationly that means I will have to change my plans for my game just a little, but luckily not by much

    The script that I ended up using with script call during a battle is:

    a = $gameActors.actor(actorID).param[parameterID];
    b = $gameTroop.members()[troopmemberID];
    b.addParam(2, a);

    With this I managed to link an 1 parameter of 1 enemy with 1 parameter of an actor.

    First I change the parameter of the actor that I'm using before the battle and during the battle the enemy(ies) that are linked that actor will have the parameters that they share changed.

    Edit #3:

    Sorry, I tried it once and it seemed to work, but it only brought the enemy's attack to 0. I couldn't increase it, but I think that I might be onto the right track. I'm just missing something to allow it to link up with an actor's parameters. Not sure how to make it work, but this is what I have so far.

    {In a Troop Event}

    b = $gameTroop.members()[0];
    b.addParam(2, n);

    If you exchange the "n" with 20 it will add 20 to the attack parameter of the first enemy of the troop.
    If you exchange the "n" with -20 it will subtract 20 from the attack parameter of the first enemy of the troop.

    Now I just need to figure out how to replace "n" with the value of actor(11)'s attack parameter.


    Edit #4:

    I got it to work by using variables.

    #1: Make an event
    #2: Go to CONTROL VARIABLES and set a variable to GAME DATE, ACTOR, "Pick an actor", "Pick a parameter".
    #3: Create a SCRIPT CALL in a TROOP EVENT, in the DATABASE using the following script:

    b = $gameTroop.members()[EnemyID];
    v = $gameVariables.value(variableID)
    b.addParam(ParameID, v);
    b.addParam(ParamID, -#);

    Change EnemyID with,
    0 = First Enemy
    1 = Second Enemy
    2 = Third Enemy
    3 = Fourth Enemy
    4 = Fifth Enemy
    6 = Seventh Enemy
    8 = Eighth Enemy

    (Please note that I found out that if, you replace EnemyID with an enemy number that is not in the troop then the game will crash.)
    (Example: if the battle troop has only two enemies in it and you replace EnemyID with 2 it will think that you are trying to change the a parameter of the third enemy that does not exist and it will come back with an error.)

    Change VariableID with any variable that you have connected to an actor's parameter with.

    Change ParamID with,
    0 = MaxHP
    1 = MaxMP
    2 = ATTACK
    3 = DEFENSE
    4 = MAGIC ATTACK
    5 = MAGIC DEFENSE
    6 = AGILITY
    7 = LUCK

    Change -# with the enemies base parameter value for the parameter that you are trying to change.
    Due to the "- sign" it will subtract that value that you change the "# sign" into from the enemy's parameter that you are changing.
    Just remember to leave the "- sign" just before the number or you will not subtract that number from the enemy's parameter.
    Example: If the enemy's attack parameter for example is 1 and you are changing the enemy's attack parameter with the actor's attack parameter then you will change the -# with -1, so that it will subtract 1 for the enemy therefore, making the enemy's attack parameter truly equally the actor's parameter.

    #4:
    Remember to while on the Troop screen in the Database to set the troop event with this script call to have
    Conditions: Turn 0

    With this the event will run at the beginning of the battle.

    #5: Remember to change the parameter that you want to change of the actor that you have connected to the variable that you're using before the battle or before the script call.
    (If you just change the level of the actor that is connected to the variable that you're using it will automatically change the parameters of the actor.)


    Thank you everyone for the help. I hope that this helps someone else who was also trying to work out this issue.
  3. I think it should be .param(2) since .param is a function.. I'm not sure if it's possible to do .param(2) = value though, at least in ace that doesn't work, not sure for MV. This might be false though, assuming the error that you got was from the second line, not the first. 

    I'm trying to use this script call outside of battle



    By default, $gameTroop's members (or the whole $gameTroop at all) doesn't exist until you're in battle so there's no way for you to edit the parameters outside of battle. Assuming the error was for the 2nd line of code, this should explain why the error was 


    " Cannot read property 'param' of undefined "


    Which means the object in which you tried to call param from is undefined, meaning  $gameTroop.members(1)[1] is undefined


    You might to do this using a troop event for Troop 1 instead, and set it to Battle - Turn 0 so that it only runs once, and during the very start.
  4. @Hunor

    Hunor said:
    newValueATK = $gameActors.actor(11).param[2];
    $gameTroop.members(1)[1].param[2] = newValueATK;

    $gameTroop.members(1)[1].param[2] looks suspect to me. Have you tried $gameTroop.members()[1].param[2] ?

    @Engr. Adiktuzmiko, According to the script call list, brackets are appropriate for .param. I believe it's actually an array of values, not a function.
  5. Window_ActorCommand.prototype.makeCommandList = function() {
    if (this._actor) {
    this.addAttackCommand();
    this.addSkillCommands();
    this.addGuardCommand();
    this.addItemCommand();
    };

    I think I have been just working all day and my brain is hurting. I'm just trying to set it so if (actor != 4) {this.addItemCommand();}
    Pretty much I have an actor that is a creature and can't use items. My problem is I can't remember the syntax to check who the battle actor is or something. This is just one of those small lame things that should be easy to do. I'm just tired.
  6. Very good, thank you.
  7. I need some help here. I'm having a error in the game.

    "$game_map is not defined"

    What does this even mean? Please help!!
  8. Is this a result from calling some code from this Script Call list? If not you will likely need to put it into a new thread.

    If it is a result from calling it, could you please show us what you are trying to call? Otherwise no one will be able to help.
  9. This is great and all but not really what I'm looking for.
    These scripts can easily be done by basic eventing.
    I'm looking for more battle related scripts with return values like:
    $gameTroop.aliveMembers().length > 0
    target.isStateAffected()
    user.isStateAffected()

    Scripts that can help store database id
    (State id, Skill id, enemy id, troop id)

    You know, the kind of codes that you can use "if else" statements on...
  10. Is there a script call for the damage taken?
  11. Does anyone here know what the script call for changing an entire Troop's state all at once is? The Master Script Call List seems to only list how to do it for individual enemies.
  12. I wonder,
    Is there a way to input a screen relative position into variables?
  13. Shiroi Akuma said:
    Is there a script call for the damage taken?
    What exactly do you mean by that? Showing damage taken? Or like that a character gets inflicted damage by a script?
  14. Uh...I want to increase/decrease enemy's parameter (eg. ATK, AGI, etc) using variables during the battle, but I can't find the way to do it through battle event commands, so I suspect it needs script calls to make that happens.

    So how do I increase/decrease enemy's parameters using variables during battle (using script call)?
    Thanks
  15. metronome said:
    Uh...I want to increase/decrease enemy's parameter (eg. ATK, AGI, etc) using variables during the battle, but I can't find the way to do it through battle event commands, so I suspect it needs script calls to make that happens.

    So how do I increase/decrease enemy's parameters using variables during battle (using script call)?
    Thanks
    $gameActors.actor(actorId).addParam(paramId, n);
    Negative n if you wish the actor to lose stats. Params: 0-MaxHP, 1-MaxMP, 2-ATK, 3-DEF, 4-MAT, 5-MDEF, 6-AGI, 7-LUK

    Copied directly from the help file. Simply put, create a battle event with this script call.
  16. Poryg said:
    $gameActors.actor(actorId).addParam(paramId, n);
    Negative n if you wish the actor to lose stats. Params: 0-MaxHP, 1-MaxMP, 2-ATK, 3-DEF, 4-MAT, 5-MDEF, 6-AGI, 7-LUK

    Copied directly from the help file. Simply put, create a battle event with this script call.

    Hi,
    Thanks for your reply

    That script call can not be used to increase/decrease enemy's parameter. I think it can only be used on non-enemy character (that's why you need the actor ID).
  17. metronome said:
    Hi,
    Thanks for your reply

    That script call can not be used to increase/decrease enemy's parameter. I think it can only be used on non-enemy character (that's why you need the actor ID).
    Sorry. I misread it :)
    Frankly, I don't know for sure if this will work.
    $gameTroop.members()[enemyID].addParam(paramId, n);
    It's an adaptation from VX Ace, where it works well. But I cannot make it work in MV somehow... Maybe you can still use yanfly's plugin though.

    EDIT: Ok, clarified, it works perfectly. It just isn't compatible with Yanfly's plugin, it seems. So if you use Yanfly's plugins, edit the stats through notetags. Otherwise feel free to use this script call :)
  18. Poryg said:
    Sorry. I misread it :)
    Frankly, I don't know for sure if this will work.
    $gameTroop.members()[enemyID].addParam(paramId, n);
    It's an adaptation from VX Ace, where it works well. But I cannot make it work in MV somehow... Maybe you can still use yanfly's plugin though.

    EDIT: Ok, clarified, it works perfectly. It just isn't compatible with Yanfly's plugin, it seems. So if you use Yanfly's plugins, edit the stats through notetags. Otherwise feel free to use this script call :)

    Hi,

    thanks for your reply.
    I haven't checked it, but could you tell me which Yanfly plugin that script call isn't compatible with? The YEP_BattleEngineCore?

    And then about the [enemyID], does it start from "0" or "1"?

    And while you are on it, I have been searching for a way to set some variables to (let's say) "0" and set some switches to off using script call, but I can't seem to find them here.

    I saw
    $gameSwitches.setValue(num, true/false); --->to set a certain switch off
    and
    $gameVariables.setValue(var, value); ---> to set a certain variable to a certain value
    I believe they have something to do with these 2 script calls.

    Other than that, thanks for the answer. I will tell you what happened once I tested your answers.
  19. metronome said:
    Hi,

    thanks for your reply.
    I haven't checked it, but could you tell me which Yanfly plugin that script call isn't compatible with? The YEP_BattleEngineCore?

    And then about the [enemyID], does it start from "0" or "1"?

    And while you are on it, I have been searching for a way to set some variables to (let's say) "0" and set some switches to off using script call, but I can't seem to find them here.

    I saw
    $gameSwitches.setValue(num, true/false); --->to set a certain switch off
    and
    $gameVariables.setValue(var, value); ---> to set a certain variable to a certain value
    I believe they have something to do with these 2 script calls.

    Other than that, thanks for the answer. I will tell you what happened once I tested your answers.
    That script call isn't compatible with any scripts that modify monster stats and use their own variables. This is how you can bypass the rpg maker mv stats limits. Since the YEP_CoreEngine itself manipulates the enemy stats, it's safe to say it's not compatible with Yanfly engine as a whole.

    As for enemy id, it has already been mentioned on this forum page. You start with Zero.

    And yes, these two commands are the correct script commands.
    If you want to find more script comands, I recommend you to bookmark the first page of this forum topic, because there is the link to all these script calls.