RPG Maker MV / MZ Script Call List

DCF

Villager
Member
Joined
Feb 6, 2014
Messages
24
Reaction score
16
First Language
English
Anyone know the script call to return the current map id?
 

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
Script call to change location of an event:

$gameMap.event(this._eventId).locate(x,y)

$gameMap.event(this._eventId).setPosition(x,y)

For the direction it should face:

$gameMap.event(this._eventId).setDirection(direction)

direction: 2 = down, 4 = left, 6 = right, 8 = up
If you just want the ID (map events only) you should probably use the getter method that they provide. Currently it just returns this._eventId so no difference, just a coding consistency thing:

this.eventId()

Either way here's a shortcut for getting the current event rather than doing $gameMap.event(this.eventId()) every time (once again map events only, does not work in a movement route context):

this.character()

In the movement route editor, this on its own will refer to whatever thing you're moving, so you can just do this.locate(x,y) etc.

Cool aside:

You can set $gamePlayer._x and $gamePlayer._y directly to a non-integer value (like 8.5) to get sub-tile movement. Same for events. Will make the object incapable of normal movement and uninteractable until coords are returned back to whole numbers, and it will have no walking animations while moving, among a bunch of other side-effects.
 
Last edited by a moderator:

girogore

Warper
Member
Joined
Jun 19, 2014
Messages
1
Reaction score
0
First Language
English
Primarily Uses
When I try   $gameInterpreter.wait(10);  it errors with: "$gameInterpreter is not defined". Am I missing a step?
 

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
First i wanna thank Archeia for this awesome list. Thank you!  :D

And this is my little question:

I tryed using $gameParty.leader.id === 0 to find the first member in the party but it didnt work. Can anyone please tell me what i did wrong?
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,002
First Language
English
Primarily Uses
RMVXA
@rpglover88

I think I read on one of the threads that the index now begins with 1, not 0.

Does anyone know the equivalent of this script call?

turn_towards_character($game_map.events[18])

Thank you.
 

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
I already tryed that too but it didnt work either. :/

Edit:

@ksjp17: In the list of script calls, check below line 160. Im not really good with stuff like this but maybe $gameMap.events()[eventId].isTurningTowardCharacter() would work?
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,002
First Language
English
Primarily Uses
RMVXA
That might work if it were an NPC turning towards another, but it is the player who is turning towards an event - and it is that action for which there is no Event Command in the set move route.  Using your suggestion, I tried to make it for the player and tried this

$gamePlayer.isTurningTowardCharacter($gameMap.events()[18])

but that gives the the error message

type error

undefined is not a function

I think that part of the problem is that I believe the structure "is[something]" asks a question e.g. checking a conditional, rather than making the command for something to happen.
 
Last edited by a moderator:

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
Shoot... :( I guess we have to wait until somebody else helps us then. Sorry i couldnt help you friend. :/
 

wizaerd

Veteran
Veteran
Joined
Mar 13, 2012
Messages
219
Reaction score
28
First Language
English
Primarily Uses
I have a question about one of the script calls that accepts an array as a parameter... Is it possible to call it with a literal array specified as the parameter, or do I need to create an array parameter somehow within the script call itself?

$gameSelfSwitches.setValue(key, true/false);

 

where key = [mapId, eventId, A-D]
 

leandrobdm

Warper
Member
Joined
Oct 29, 2015
Messages
1
Reaction score
0
First Language
Portuguese
I tryed using $gameParty.leader.id === 0 to find the first member in the party but it didnt work. Can anyone please tell me what i did wrong?
If you're trying to find the id of the first member in your party, i think you should use $gameParty.members()[1]._actorId

When I try   $gameInterpreter.wait(10);  it errors with: "$gameInterpreter is not defined". Am I missing a step?
I'm getting the same error here. Seems like $gameInterpreter does not exist. Does someone know the correct script call for "Wait"?
 

rpglover88

Rpg & Anime Maniac
Veteran
Joined
May 12, 2013
Messages
169
Reaction score
24
First Language
French
Primarily Uses
It works better than before (I can talk to the npc w/o getting an error message lol) but its still not what i need. Ill try to explain what i want to do with the script call. Heres an exemple:

The party found a locked treasure chest but the current party leader is a gunner. When the gunner interacts with the locked chest, a message saying "This treasure chest is locked. Only a master thief can unlock it!" will pop up. If i change the formation of the party and i put the 3rd character (the master thief) in the party as party leader and interact with the chest again, a message saying "The master thief unlocked the chest! The party received 100000G"

Thats the kind of thing im trying to do. When i used the script call you wrote above, both messages poped up one after the other. :/
 

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
When I try   $gameInterpreter.wait(10);  it errors with: "$gameInterpreter is not defined". Am I missing a step?
I'm getting the same error here. Seems like $gameInterpreter does not exist. Does someone know the correct script call for "Wait"?
this.wait(10);// remember that the argument is in frames not secondsIn an event context, "this" is an instance of GameInterpreter. I don't think it gets assigned its own global variable. Note that I don't think this will work in the movement route editor because "this" refers to the thing being moved in that context (see my post further up).

That might work if it were an NPC turning towards another, but it is the player who is turning towards an event - and it is that action for which there is no Event Command in the set move route.  Using your suggestion, I tried to make it for the player and tried this

$gamePlayer.isTurningTowardCharacter($gameMap.events()[18])

but that gives the the error message

type error

undefined is not a function

I think that part of the problem is that I believe the structure "is[something]" asks a question e.g. checking a conditional, rather than making the command for something to happen.
$gamePlayer.turnTowardCharacter($gameMap.event(18));// Or if the current event is the one you want to player to turn towards:$gamePlayer.turnTowardCharacter(this.character());I emplore everyone to learn to use the developer console (F8), there you can try out methods to your hearts content. If you wanna look through the methods on $gamePlayer for instance, just type "$gamePlayer." (notice the dot) and a list of all its available methods should pop up (it's far easier than trudging through the code itself). If you want to see the definition for a method, in order to see the parameters it takes or what it does, just select that method and press enter a couple of times (e.g. "$gamePlayer.turnTowardCharacter"). If you want to call it to test it out, just use parentheses like normal (e.g. "$gamePlayer.turnTowardCharacter(...)"). Unlike Ruby, parens make all the difference in JS.

Edit:

The party found a locked treasure chest but the current party leader is a gunner. When the gunner interacts with the locked chest, a message saying "This treasure chest is locked. Only a master thief can unlock it!" will pop up. If i change the formation of the party and i put the 3rd character (the master thief) in the party as party leader and interact with the chest again, a message saying "The master thief unlocked the chest! The party received 100000G"
See image attachment: master_thief.PNG

You could also just use $gameParty.leader()._classId, I just don't like using underscore properties if there are methods available, in this case I think it's fine though because it's more efficient than going through another object. If you wanna use the actor ID instead of the class ID, replace it with $gameParty.leader().actorId() OR $gameParty._actors[0] (another shortcut, slightly less self-explanatory though).

You could dynamically put the class name in your messages etc, that's just the most basic implementation.

Anyway, I'm not sure if this thread is the place for this type of question :p
 
Last edited by a moderator:

DCF

Villager
Member
Joined
Feb 6, 2014
Messages
24
Reaction score
16
First Language
English
Hmm, still running into trouble generating a script in the movement route context that flips a self switch associated with the moving event.

From the earlier help in this thread I'm at:

$gameSelfSwitches.setValue([$gameMap.mapId(),$gameMap.event(this.eventId()),"A"], true);

I also attempted NoInkling's recommended this.character() shortcut and it crashed the playtest for "TypeError undefined is not a function"

This is probably fairly straightforward but I'm new to this particular scripting language/data structure so any assistance would be appreciated.

Thanks!

-DCF
 

NoInkling

Veteran
Veteran
Joined
Oct 2, 2015
Messages
39
Reaction score
10
First Language
English
Primarily Uses
Hmm, still running into trouble generating a script in the movement route context that flips a self switch associated with the moving event.

From the earlier help in this thread I'm at:

$gameSelfSwitches.setValue([$gameMap.mapId(),$gameMap.event(this.eventId()),"A"], true);

I also attempted NoInkling's recommended this.character() shortcut and it crashed the playtest for "TypeError undefined is not a function"

This is probably fairly straightforward but I'm new to this particular scripting language/data structure so any assistance would be appreciated.

Thanks!

-DCF
You almost got it:

$gameSelfSwitches.setValue([$gameMap.mapId(), this.eventId(), 'A'], true)The second array element is just an ID, not an object. If you did want the event object you would just use "this" on its own from the movement route editor.

this.character() only works from within the normal event command context, not in a movement route one. The above command should work in both contexts though (even though "this" refers to something different in each one), though I'm not sure why someone would use it over a standard event command unless they were in an auto-movement route like you are.
 
Last edited by a moderator:

DavidFoxfire

Veteran
Veteran
Joined
Feb 28, 2014
Messages
224
Reaction score
44
Primarily Uses
I need to find out the script call to find out whatever an actor is in the party.  Similar to this:

if (''Actor 1 is in the party'') {    

    do stuff;

}

I also need to have a variable set to an actor's level, like this:

var a = "Actor 1's Level"

I need the script call for both of these.  Thanks in advance.
 
Last edited by a moderator:

Gekko-Ni

Warper
Member
Joined
Apr 7, 2014
Messages
4
Reaction score
0
First Language
German
I don't get it.

How to show a picture?

i tried:

$gameScreen.showPicture(1, 001.png, 0, 0, 0, 100, 100, 255, 0)

but nothing happens...

# position = [0] Top Left, [1] = Center
# blend type = [0] Normal, [1] Add, [2] Sub

:C
 

Leonard

Warper
Member
Joined
Oct 27, 2015
Messages
4
Reaction score
1
First Language
Spanish
@DavidFoxfire. I think you are looking for something like this:

var actor1Lvl=-1;$gameParty.allMembers().forEach(function(entry){  if(entry._actorId==1)    actor1Lvl=entry._level;});if(actor1Lvl!=-1){    //Do something with actor1Lvl.}else{    //Do something when actor1 is not in the party.}

@Gekko-Ni. You almost got it, the picture's name should be passed as a string and without file extension:

Code:
$gameScreen.showPicture(1, "001", 0, 0, 0, 100, 100, 255, 0);
Cheers!
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,512
Reaction score
12,002
First Language
English
Primarily Uses
RMVXA
@NoInkling

Thanks, that works perfectly.

On your suggestion of using the F8 console - which tab does one type such things in?  If I do it in the tab 'Console' I don't get the possibilities, instead I get

Uncaught SyntaxError: Unexpected token }

and the other tabs don't look at all promising for this.
 

DavidFoxfire

Veteran
Veteran
Joined
Feb 28, 2014
Messages
224
Reaction score
44
Primarily Uses
@DavidFoxfire. I think you are looking for something like this:

var actor1Lvl=-1;$gameParty.allMembers().forEach(function(entry){  if(entry._actorId==1)    actor1Lvl=entry._level;});if(actor1Lvl!=-1){    //Do something with actor1Lvl.}else{    //Do something when actor1 is not in the party.}
 I assume that 1 is the Character Number in the database.  If that's the case I'm good.

Now to find out what calls out the character's Level.
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

Can't believe my code from four years ago is still working! Did some expansions, and...
1635194553179.png
In related news, I may have an update for my old Extra status window plugin ready. That is, once I manage to sit down and update the documentation... and the demo project... :kaoswt:
How does one pronounce Godot? I've heard it pronounced a couple of different ways, and I genuinely don't know the proper way.
March 2020 ...
1635188823939.jpeg
... vs October 2021
You look like you had a rough day...Here, have a Baby Panda!

7 years of trying to plan this project... and it got an official plotline today. 7 years. I really just have no concept of order huh GHJGSJHGVGHASFH.

Forum statistics

Threads
116,072
Messages
1,095,509
Members
151,433
Latest member
Nanoql
Top