RPG Maker MV / MZ Script Call List

Nafraju

Regular
Regular
Joined
Mar 20, 2022
Messages
41
Reaction score
6
First Language
German
Primarily Uses
RMMV
Hi,
I this excel-file RPG MAKER MV _ MZ Script Calls.xlsx tab "map"

JavaScript:
$gameMap.eventsXy(x, y)


// Get an array of all events at (7, 8)
// $gameMap.eventsXy(7, 8)

? What data are in this array ?
? How can I read this data out [Array to string(s)] ?



Details Info:
Finally I want to get the .name()
and/or the notetag of this Event at (7, 8) ...
random moving Events on the map example CAT(s) and DOG(s)
if event.at(7, 8).name === "DOG" then ...

Please help me with this,
I am searching for that over 2 hours

Nafraju
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
11,218
Reaction score
9,180
First Language
English
Primarily Uses
RMMV
// $gameMap.eventsXy(7, 8)[/CODE]

? What data are in this array ?
? How can I read this data out [Array to string(s)] ?
The data is, as it says, events. Game_Event Objects.
Objects have a number of properties stored internally, so it's not a simple matter of just printing it all out.

If you want the name that you entered for the event in the editor, that's not immediately accessible here - that's stored in the Event database entry, not the Game_Event. You'd have to chain some function calls together.

This should tell you if there is any event named "DOG" on a tile:
Code:
if ($gameMap.eventsXy(x, y).some(event => $dataMap.events()[event.eventId()].name=="DOG"))
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,041
Reaction score
4,387
First Language
EN
Primarily Uses
RMMZ
It's also on the main sheet, Events at Position. The note there mentions that it is an array of Game_Event objects, like Turan says.

Game_Event has an event method to get its base event data, so you could use that instead (probably safer if you're using any event spawner/template plugins). E.g. Conditional Branch -> Script:
JavaScript:
$gameMap.eventsXy(x, y).some(e => e.event().name === "DOG")
Or to get an array of the names of all events on that tile:
JavaScript:
$gameMap.eventsXy(x, y).map(e => e.event().name)
 

Nafraju

Regular
Regular
Joined
Mar 20, 2022
Messages
41
Reaction score
6
First Language
German
Primarily Uses
RMMV
THANK YOU:
$gameMap.eventsXy(x, y).map(e => e.event().name)

exactly this I have searched
because now I can work with that name in a var ...

@Archeia PLEASE add this FOR the other people here
to that excel-file RPG MAKER MV _ MZ Script Calls.xlsx tab "map"

That shrinks my programming about 60%
because not I can organisie the MapEvent in Classes
an identify each by stringserach in there names :wink:

Nafraju



#event.name
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,041
Reaction score
4,387
First Language
EN
Primarily Uses
RMMZ
You can use similar logic to convert any array of objects into an array of values corresponding to one of those objects' properties. The map method is JavaScript knowledge:
...or you could just use a standard for loop.

The "$dataEvent" objects have various other properties like meta and pages. For details of the properties on database records you can check the Database sheet of this document:
Getting from the Game_Event to the $dataEvent is a little more complex. I guess I could properly document the actor, enemy, event, and troop "game -> database" methods, and consider adding some practical examples for calls that return an array.

The script call list is meant to cover common use cases, not every possibility. Note that you can press F8 during playtest to show the dev tools. On the Console tab, you can type something like this and press Enter:

$gameMap.eventsXy(8, 12)
That will show you the result, so you can see for yourself what the array contains~

[Edit: oh, it seems the base map event data structure isn't covered by the Reference sheet. Maybe just an oversight. You can still use the console, e.g. $gameMap.event(1).event() or $dataMap.events[1].]
 
Last edited:

Nafraju

Regular
Regular
Joined
Mar 20, 2022
Messages
41
Reaction score
6
First Language
German
Primarily Uses
RMMV
1673745837262.png

How can I get this damageformula as a string
for example Skill 0001 form the database
into a javascript variable ?

Nafraju
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,041
Reaction score
4,387
First Language
EN
Primarily Uses
RMMZ
As I mentioned, database records are documented on the Database tab of the Reference sheet:

$dataSkills[1].damage.formula
screenshot.png
 

LBGames

Regular
Regular
Joined
Mar 9, 2020
Messages
62
Reaction score
21
First Language
English
Primarily Uses
RMMV
What does $gameParty.members()[0].currentClass() actually return? I was hoping it would save the Class ID number, but a simple variable check (text message using \v[x]) returned (object Object) instead. Is there a way to save the Class ID number to a variable?
 

Poryg

Dark Lord of the Castle of Javascreeps
Regular
Joined
Mar 23, 2017
Messages
4,233
Reaction score
11,317
First Language
Czech
Primarily Uses
RMMV
It returns the class object. If I remember correctly, every class has an _id member variable.
 

LBGames

Regular
Regular
Joined
Mar 9, 2020
Messages
62
Reaction score
21
First Language
English
Primarily Uses
RMMV
It returns the class object. If I remember correctly, every class has an _id member variable.
Ok, so how do I get the class ID into a variable as a number?
 

Poryg

Dark Lord of the Castle of Javascreeps
Regular
Joined
Mar 23, 2017
Messages
4,233
Reaction score
11,317
First Language
Czech
Primarily Uses
RMMV
Use the same thing you did, just add ._classId to the end.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,041
Reaction score
4,387
First Language
EN
Primarily Uses
RMMZ
Like Poryg implied, actor.currentClass() returns an entry from the $dataClasses array. These are technically anonymous objects (parsed directly from JSON) but the Script Call List notes them as $dataClass for convenience.

You can check the properties on database objects:
  • Via the console - press F8 during playtest, select the Console tab, and type:

    $dataClasses[1]
    This'll show the properties of class ID 1 and their values: id, learnings, expParams, etc.

  • Via the Database tab of the Reference sheet, as I mentioned in my reply to someone else, immediately before your question.
To get an actor's current class ID, you can either:
  1. Get the ID of their current class object, e.g.

    $gameParty.members()[0].currentClass().id
  2. Get their "private" class ID directly from the Game_Actor, e.g.

    $gameParty.members()[0]._classId
Option 1 stands a better chance of compatibility with class-related plugins (e.g. subclasses) but otherwise they should both return the value you're seeking. :kaohi:
 

Kes

Regular
Regular
Joined
Aug 3, 2012
Messages
23,808
Reaction score
13,729
First Language
English
Primarily Uses
RMMZ
Is there a script call which is analogous to turn toward player in the set move route command,
but which tells the player to turn toward the followers?

I've tried messing around with the normal turn toward command, but that doesn't seem to work.

Thank you.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
5,041
Reaction score
4,387
First Language
EN
Primarily Uses
RMMZ
@Kes - you can combine "turn toward character" and "get follower", e.g. in a move route:

this.turnTowardCharacter($gamePlayer.followers().follower(0));
"Turn the character being moved towards the first player follower (i.e. second party member)." For the second follower, use 1 instead of 0, etc. :kaohi:
 

werzaque

Canned Dinosaur
Regular
Joined
May 30, 2023
Messages
400
Reaction score
227
First Language
EN/JP/NL
Primarily Uses
RMMZ
Is there any way to implement a wait in the script window of custom movement route? For example:

JavaScript:
if(some condition){
$gameTemp.requestBalloon(this,5); 
/*I want it to wait for 60 frames here*/
this.jump(DivX,DivY);
this.setMoveSpeed(4);
}

Trying
JavaScript:
this.setWaitMode('balloon')
I get the remark that it's not a function, and
JavaScript:
this._waitCount = 59
resolves AFTER the whole block is executed. I kind of get why it does that, but now I'm a little lost how I can force it to wait out the balloon animation.
 

Andar

Regular
Regular
Joined
Mar 5, 2013
Messages
39,321
Reaction score
11,492
First Language
German
Primarily Uses
RMMV
but now I'm a little lost how I can force it to wait out the balloon animation.
you can't, because wait doesn't work that way.

Everything is processed in a main game loop - event pages and move routes.

A wait basically tells the engine and that loop "skip processing this object for the next x loops"
In the case of simple action button events this is a wait to the player.
But it is also the reason why the wait reduces lag for parallel processes - the parallel processes get skipped for the number of loops.

But you have only one object in the gameloop for the entire move route, and that object gets the wait command, not any single line inside it.
The event commands actually do a lot behind the scenes to get everything timed correctly, and when using script commands all that behind-the-scenes bookkeeping falls to you as it it not automated there.

There should be ways to get what you want, but most likely you would have to create your own loop-objects to manipulate that, and that is knowledge too deep for me to even hin t on how it functions (I'm not that deep into the engine myself).
 

Bex

Regular
Regular
Joined
Aug 2, 2013
Messages
1,987
Reaction score
788
First Language
German
Primarily Uses
RMMZ
Try this one:
Code:
$gameTemp.requestBalloon(this.character(this._characterId = 1), 4);

It is with with help of Line 197 of the Scriptequivalents Thread.

Edit: Your Code Line seems not to work in my MZ. No Balloon is showing up.
Code:
$gameTemp.requestBalloon(this,5);
 
Last edited:

Latest Threads

Latest Profile Posts

Was sick with a fever... slowly getting better.
I HATE SEOs! I do not want to add Reddit to every single search in order to find helpful content posted by actual humans.
bandicam 2023-10-02 09-53-18-106.png
Yanka is one of my dearly loved characters. And not only because she can perform the look of "puss in boots")))) Spy, infiltrator, kind-hearted with a soft spot for one Crimson Knight.
Just completed another cutscene. Huge one for the story. I'm so enthusiastic about where this game is going.
Man, the enemies in the new Sonic Frontiers update are totally roided up. I wanted a little more difficulty myself, but Sonic Team turned the dial a bit too far.

At least the new tracks for roaming Ouranos Island as Amy, Knuckles, and Tails slap hard.

Forum statistics

Threads
134,985
Messages
1,252,623
Members
177,880
Latest member
titek21
Top