RPG Maker MV / MZ Script Call List

● ARCHIVED · READ-ONLY
Started by Archeia 569 posts Page 5 of 29 View original ↗
  1. I have an item that changes the leader of the parties EXP but I don't want it to show a level up when it happens.

    $gameParty.leader().gainExp($gameVariables.value(5),false)

    Still shows a level up message.  Am I doing something wrong?

    I know there should be away to do this because the in editor change exp has a check box for it.
  2. @kewitt You need to do it using .changeExp instead, .gainExp is hardcoded to show the message (your second parameter is ignored). The only other option is to redefine a method or write your own (which usually means writing a plugin).
  3. NoInkling said:
    @kewitt You need to do it using .changeExp instead, .gainExp is hardcoded to show the message (your second parameter is ignored). The only other option is to redefine a method or write your own (which usually means writing a plugin).
    Thank you.  After testing this simplifies a few things I had been tryng to do.

    .changeExp sets it to a set amount.  So I ended up getting current EXP and adding it to the random amount the item gives.  But no more level up message so all good.
  4. Hi if I want  to use script in conditional branch to check if hero hp is above certain % how the command should be

    something like that ?
     

    $gameActors.actor(1).Hp >= 30%
  5. Can someone explain to me how to create a "Sound Object" and how it can be used to play a Sound Effect?
  6. SumRndmDde said:
    Can someone explain to me how to create a "Sound Object" and how it can be used to play a Sound Effect?
    You save your sound.file into your Games/project1/audio/(whatever type of sound file you want : bgm, se, me).

    Then run a play sound event or set it up as default bgm for your map.

    please note that based on the help info in MV, you need both .ogg AND .m4a audio format to run the client on android/iOS.

    You can convert audio .mp3 files into .ogg via VLC and many web-based converters are available for .mp3 to .m4a
  7. Jimbawa said:
    You save your sound.file into your Games/project1/audio/(whatever type of sound file you want : bgm, se, me).

    Then run a play sound event or set it up as default bgm for your map.

    please note that based on the help info in MV, you need both .ogg AND .m4a audio format to run the client on android/iOS.

    You can convert audio .mp3 files into .ogg via VLC and many web-based converters are available for .mp3 to .m4a
    Um sorry, that wasn't what I was talking about. 

    I meant how to do it with script calls.

    Sound Object: { name: filename, volume: n, pitch: n, pan: n }AudioManager.playSe( refer to sound object above );
    How do I get this to work so that I can call a specific file name to play a Sound Effect?
  8. @SumRndmDde I think the easiest way is just to create the object on the fly (unless the sound you want is already in database -> system -> sounds). There doesn't seem to be a class for it (just an unhelpful AudioManager.makeEmptyAudioObject method).

    AudioManager.playSe({name: "Applause1", volume: 90, pitch: 100, pan: 0}); 

     

    LynX said:
    Hi if I want  to use script in conditional branch to check if hero hp is above certain % how the command should be

    something like that ?
     

    $gameActors.actor(1).Hp >= 30%
    $gameActors.actor(1).hp / $gameActors.actor(1).mhp * 100 >= 30That's the easiest way unless I'm missing something, seems like one of those things that should have a method built in.
  9. I need to make a variable store a character's TP. I know I'd use $gameVariables.setValue(variable, value); but what would go in the 'value' portion?

    Nevermind. Got it. It'd be $gameActors.actor(1).tp
  10. Is there a script call that can check to location of an actor within the party?

    For example, if actor 2 was in the third location in the party, when I do a script call checking the third party location, it would return 2 (or 1, if Actor 1 is 0).
  11. @Seacliff

    Code:
    $gameParty._actors[x - 1]           // Where x is the position in the party (array is 0-indexed so we minus 1)                                    // Returned actor ID is the same as the database (i.e. actor 1 is 1)// If you want the actor itself, not just the ID:$gameParty.members()[x - 1] // or$gameParty.allMembers()[x - 1]      // Won't ignore non-participating members if called in battle, otherwise same as above// or$gameParty.battleMembers()[x - 1]   // Only battle members (works outside battle)
  12. Before there was script call to count how many number of certain item in player's possession for VX ACE:

    # Amount of Items in Inventory$game_variables[n] = $game_party.item_number($data_items[n])# Example Usage: Amount of Potions in Inventory is going to be displayed Variable 1$game_variables[1] = $game_party.item_number($data_items[1])# Amount of Weapons in Inventory$game_variables[n] = $game_party.item_number($data_weapons[n])# Amount of Armors in Inventory$game_variables[n] = $game_party.item_number($data_armors[n])
    So....what is the script call for the same thing in RPGMV?

    And then....how do you do variable calculation in RPGMV?

    Let's say I want to add V[1] and V[10] and put the result in V[11].....

    Thanks.
  13. @metronome 

    Code:
    $gameParty.numItems($dataItems[n])$gameParty.numItems($dataWeapons[n])$gameParty.numItems($dataArmors[n])// or$gameParty._items[n]$gameParty._weapons[n]$gameParty._armors[n]// Get a variable:$gameVariables.value(n)// Set a variable:$gameVariables.setValue(n, value)// Your example: add V[1] and V[10] and put the result in V[11]:$gameVariables.setValue(11, $gameVariables.value(1) + $gameVariables.value(10))// or if that's a bit tough to read and you're able to use multiple lines:var temp = $gameVariables.value(1) + $gameVariables.value(10);$gameVariables.setValue(11, temp);
  14. Help please,
          I'm trying to make a simple battle message display but it keeps giving me a
    "Syntax error unexpected token <"      This is the code I used
    'use strict'
    class Scene_Battle

    attr_accessor:log_window
    end

    Scene_Manager.scene.log_window.add_text("Fire Force is still active")
    Scene_Manager.scene.log_window.wait_and_clear

    I added 'use strict' because of a previous error telling me I couldn't use class outside of strict mode
  15. Can someone please tell me if there is a way, via script call, to play an animation in battle against one of the party members?

    I see that there's this one: $gameTroop.members()[enemyIndex].startAnimation(animationId, true/false, delayN); for showing an animation on one of the enemies on the battle screen.

    Is there an equivalent call for displaying animations against the party or can this one be used to accomplish that?
  16. @skyshadow235 You appear you be trying to use Ruby/RGSS, while MV uses JavaScript. Your syntax is completely off.

    @Blithe You can just call the same method on an actor object:

    // For a specific character:$gameActors.actor(id).startAnimation(animationId, mirror, delay) // Where mirror is true/false as you mentioned// For all characters in battle:this.iterateActorIndex(-1, function(actor) { actor.startAnimation(animationId, mirror, delay);});For a character in a certain position, see my post further up the page.
  17. NoInkling said:
    @metronome

    $gameParty.numItems($dataItems[n])$gameParty.numItems($dataWeapons[n])$gameParty.numItems($dataArmors[n])// or$gameParty._items[n]$gameParty._weapons[n]$gameParty._armors[n]// Get a variable:$gameVariables.value(n)// Set a variable:$gameVariables.setValue(n, value)// Your example: add V[1] and V[10] and put the result in V[11]:$gameVariables.setValue(11, $gameVariables.value(1) + $gameVariables.value(10))// or if that's a bit tough to read and you're able to use multiple lines:var temp = $gameVariables.value(1) + $gameVariables.value(10);$gameVariables.setValue(11, temp);
    Hi! Thanks for the reply. This is pretty helpful and I think it should be in the script call command list ~~

    And there is another question:

    Let's say if I want to sum all of the variables from -let's say- V[1] to V[1000] and then put the sum result in V[1001].

    Is there any script call for that in RMMV?

    In RMVA, there is the SUM function (something like for i = 1 to i = 1000, do sum)*

    And while I am on this, I would also want to know what is the script call to set all the variable in the game?

    Thanks~~
  18. @metronome: Couldn't find anything built in to help unfortunately, but this is how I'd do it the plain JavaScript way:

    var sum = $gameVariables._data.filter(function(val, i) { return i >= 1 && i <= 100;}).reduce(function(currentSum, val) { return currentSum + val;}, 0);$gameVariables.setValue(101, sum);Nowhere near as nice as it would be in Ruby unfortunately. You could squish it all into one line if you really had to:

    $gameVariables.setValue(101, $gameVariables._data.filter(function(val,i){return i>=1 && i<=100}).reduce(function(sum,val){return sum+val},0))Edit:

    A shorter-looking alternative (no difference, except maybe performance?):

    Code:
    var sum = $gameVariables._data.reduce(function(currentSum, val, i) {  return i >= 1 && i <= 100 ? currentSum + val : currentSum;}, 0);$gameVariables.setValue(101, sum);// or$gameVariables.setValue(101, $gameVariables._data.reduce(function(sum,val,i){return i>=1 && i<=100 ? sum+val : sum}, 0))
  19. Hi guys. I'm looking for a way to add a state within the formula of an item. Any ideas?
  20. NoInkling said:
    @metronome: Couldn't find anything built in to help unfortunately, but this is how I'd do it the plain JavaScript way:

    var sum = $gameVariables._data.filter(function(val, i) { return i >= 1 && i <= 100;}).reduce(function(currentSum, val) { return currentSum + val;}, 0);$gameVariables.setValue(101, sum);Nowhere near as nice as it would be in Ruby unfortunately. You could squish it all into one line if you really had to:

    $gameVariables.setValue(101, $gameVariables._data.filter(function(val,i){return i>=1 && i<=100}).reduce(function(sum,val){return sum+val},0))Edit:

    A shorter-looking alternative (no difference, except maybe performance?):

    var sum = $gameVariables._data.reduce(function(currentSum, val, i) { return i >= 1 && i <= 100 ? currentSum + val : currentSum;}, 0);$gameVariables.setValue(101, sum);
    Hi,

    thanks for the reply.

    Using the js function you provided, I did script call to -let's say- sum all the item from item 1 to item 100 in party possession using codes below:

    $gameVariables.setValue(101, $gameParty.numItems(function(val,i){return i>=1 && i<=100}).reduce(function(sum,val){return sum+val},0))And it returns with Syntax Error: undefined is not a function hmmmm.

    may be I should set all the variables to 0 first right when the game starts?

    EDIT:

    I think the code I provided is wrong, I forgot that after $gameParty.numItems it should be (dataSomething), not a (function).

    And btw,

    the codes you provided me comes with error: unexpected tokens.

    You are putting too many semicolons perhaps?

    And this one:

    $gameVariables.setValue(101, $gameVariables._data.reduce(function(sum,val,i){return i>=1 && i<=100 ? sum+val : sum}, 0))Always returns me 0 no matter what.......

    Thanks~