RPG Maker MV / MZ Script Call List

kewitt

Villager
Member
Joined
Feb 9, 2015
Messages
26
Reaction score
5
First Language
kewitt
Primarily Uses
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:

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
@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:

kewitt

Villager
Member
Joined
Feb 9, 2015
Messages
26
Reaction score
5
First Language
kewitt
Primarily Uses
@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.
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
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%
 

SumRndmDde

Follower of RNGesus
Veteran
Joined
Jul 30, 2013
Messages
225
Reaction score
428
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?
 

Jimbawa

Warper
Member
Joined
Nov 1, 2015
Messages
2
Reaction score
1
First Language
Eng-Fr
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
 

SumRndmDde

Follower of RNGesus
Veteran
Joined
Jul 30, 2013
Messages
225
Reaction score
428
First Language
English
Primarily Uses
RMMV
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?
 

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
@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}); 

 

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.
 

RockEsper

Villager
Member
Joined
Jul 10, 2012
Messages
19
Reaction score
6
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:

Seacliff

RPG Maker Mastermind
Veteran
Joined
Nov 8, 2012
Messages
3,016
Reaction score
1,172
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).
 

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
@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:

metronome

Veteran
Veteran
Joined
Aug 21, 2014
Messages
338
Reaction score
144
First Language
English (Sure!)
Primarily Uses
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.
 

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
@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:

skyshadow235

Villager
Member
Joined
Oct 25, 2015
Messages
21
Reaction score
1
First Language
English
Primarily Uses
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
 

Blithe

The One
Veteran
Joined
Feb 4, 2015
Messages
41
Reaction score
31
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?
 

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
@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:

metronome

Veteran
Veteran
Joined
Aug 21, 2014
Messages
338
Reaction score
144
First Language
English (Sure!)
Primarily Uses
@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~~
 
Last edited by a moderator:

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
@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:

Alphamega

Veteran
Veteran
Joined
Aug 13, 2015
Messages
32
Reaction score
1
First Language
English
Hi guys. I'm looking for a way to add a state within the formula of an item. Any ideas?
 

metronome

Veteran
Veteran
Joined
Aug 21, 2014
Messages
338
Reaction score
144
First Language
English (Sure!)
Primarily Uses
@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~
 
Last edited by a moderator:

Latest Threads

Latest Profile Posts

Still alive! Totally did not finish in time for the Jam (boy that's late) but tl;dr of the last half a year is Work term -> Covid Lockdown -> Sick... again -> Full time Employment. Game stuff has been on hiatus but got a new graphics tablet so hopefully updates again soon. =D
Going on hiatus. Won't be back until mid October.:LZSoops:
Just read the English lyrics for Despacito. Ramen aint innocent no more! :kaodes:
Well today was blown away with nothing to show for it. I made a new character to my game who I was going to have a protection mechanic where he protects my main character randomly unless it's a critical, and no matter what, to check if an attack received will be critical, means checking the apply method. This means rewriting the entire method and I refused to do that.

Forum statistics

Threads
115,316
Messages
1,088,882
Members
149,961
Latest member
MrSunshine
Top