RPG Maker MV Script Call List

Discussion in 'RPG Maker MV' started by Archeia, Oct 24, 2015.

  1. kewitt

    kewitt Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    kewitt
    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.
     
    Last edited by a moderator: Nov 3, 2015
    #81
  2. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    @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).
     
    Last edited by a moderator: Nov 3, 2015
    #82
  3. kewitt

    kewitt Villager Member

    Messages:
    26
    Likes Received:
    5
    First Language:
    kewitt
    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.
     
    #83
    NoInkling likes this.
  4. LynX

    LynX Veteran Veteran

    Messages:
    81
    Likes Received:
    7
    Location:
    Poland
    First Language:
    Polish
    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%
     
    #84
  5. SumRndmDde

    SumRndmDde Follower of RNGesus Veteran

    Messages:
    224
    Likes Received:
    410
    Location:
    an alternate dimension.
    First Language:
    English
    Primarily Uses:
    RMMV
    Can someone explain to me how to create a "Sound Object" and how it can be used to play a Sound Effect?
     
    #85
  6. Jimbawa

    Jimbawa Warper Member

    Messages:
    2
    Likes Received:
    1
    First Language:
    Eng-Fr
    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
     
    #86
  7. SumRndmDde

    SumRndmDde Follower of RNGesus Veteran

    Messages:
    224
    Likes Received:
    410
    Location:
    an alternate dimension.
    First Language:
    English
    Primarily Uses:
    RMMV
    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?
     
    #87
  8. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    @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}); 

     

    $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.
     
    #88
    LynX likes this.
  9. RockEsper

    RockEsper Villager Member

    Messages:
    19
    Likes Received:
    5
    First Language:
    English
    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
     
    Last edited by a moderator: Nov 4, 2015
    #89
  10. Seacliff

    Seacliff RPG Maker Mastermind Veteran

    Messages:
    2,935
    Likes Received:
    1,046
    Location:
    RPG Maker Forums
    First Language:
    Yes
    Primarily Uses:
    RM2k
    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).
     
    #90
  11. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    @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)
     
    Last edited by a moderator: Nov 5, 2015
    #91
  12. metronome

    metronome Veteran Veteran

    Messages:
    348
    Likes Received:
    142
    First Language:
    English (Sure!)
    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.
     
    #92
  13. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    @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);
     
    Last edited by a moderator: Nov 5, 2015
    #93
    metronome likes this.
  14. skyshadow235

    skyshadow235 Villager Member

    Messages:
    21
    Likes Received:
    1
    First Language:
    English
    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
     
    #94
  15. Blithe

    Blithe The One Veteran

    Messages:
    41
    Likes Received:
    31
    Location:
    Orlando
    First Language:
    English
    Primarily Uses:
    RMMV
    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?
     
    #95
  16. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    @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.
     
    Last edited by a moderator: Nov 6, 2015
    #96
  17. metronome

    metronome Veteran Veteran

    Messages:
    348
    Likes Received:
    142
    First Language:
    English (Sure!)
    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~~
     
    Last edited by a moderator: Nov 6, 2015
    #97
  18. NoInkling

    NoInkling Veteran Veteran

    Messages:
    39
    Likes Received:
    9
    First Language:
    English
    @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))
     
    Last edited by a moderator: Nov 6, 2015
    #98
  19. Alphamega

    Alphamega Veteran Veteran

    Messages:
    32
    Likes Received:
    1
    First Language:
    English
    Hi guys. I'm looking for a way to add a state within the formula of an item. Any ideas?
     
    #99
  20. metronome

    metronome Veteran Veteran

    Messages:
    348
    Likes Received:
    142
    First Language:
    English (Sure!)
    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~
     
    Last edited by a moderator: Nov 6, 2015

Share This Page