@caethyril Thank you very much. You've been really helpful as always.
RPG Maker MV / MZ Script Call List
● ARCHIVED · READ-ONLY
-
-
Hi,
I this excel-fileRPG MAKER MV _ MZ Script Calls.xlsxtab "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 thenotetagof 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 -
The data is, as it says, events. Game_Event Objects.// $gameMap.eventsXy(7, 8)[/CODE]
? What data are in this array ?
? How can I read this data out [Array to string(s)] ?
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")) -
It's also on the main sheet, Events at Position. The note there mentions that it is an array of
Game_Eventobjects, like Turan says.
Game_Eventhas aneventmethod 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:Or to get an array of the names of all events on that tile:$gameMap.eventsXy(x, y).some(e => e.event().name === "DOG")
JavaScript:$gameMap.eventsXy(x, y).map(e => e.event().name) -
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 -
You can use similar logic to convert any array of objects into an array of values corresponding to one of those objects' properties. The
mapmethod is JavaScript knowledge:
...or you could just use a standardforloop.
The "$dataEvent" objects have various other properties likemetaandpages. For details of the properties on database records you can check the Database sheet of this document:
Getting from theGame_Eventto the$dataEventis 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].] -
How can I get this damageformula as a string
for example Skill 0001 form the database
into a javascript variable ?
Nafraju -
View attachment 250719
How can I get this damageformula as a string
for example Skill 0001 form the database
into a javascript variable ?
Nafraju
Or to get out the value of this damageformular in a variable
when NO BATTLE is running. -
As I mentioned, database records are documented on the Database tab of the Reference sheet:
$dataSkills[1].damage.formula -
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?
-
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?It returns the class object. If I remember correctly, every class has an _id member variable.
-
Use the same thing you did, just add ._classId to the end.
-
To get an actor's current class ID, you can either:pedagogyLike Poryg implied,
actor.currentClass()returns an entry from the$dataClassesarray. These are technically anonymous objects (parsed directly from JSON) but the Script Call List notes them as$dataClassfor 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.
- Get the ID of their current class object, e.g.
$gameParty.members()[0].currentClass().id - Get their "private" class ID directly from the
Game_Actor, e.g.
$gameParty.members()[0]._classId
- Via the console - press F8 during playtest, select the Console tab, and type:
-
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. -
@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, use1instead of0, etc. :kaohi: -
@caethyril Brilliant. Thank you.
-
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); }
TryingJavaScript:I get the remark that it's not a function, andthis.setWaitMode('balloon')JavaScript: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.this._waitCount = 59 -
you can't, because wait doesn't work that way.but now I'm a little lost how I can force it to wait out the balloon animation.
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). -
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);