RPG Maker MV / MZ Script Call List

● ARCHIVED · READ-ONLY
Started by Archeia 569 posts Page 24 of 29 View original ↗
  1. @caethyril Thank you very much. You've been really helpful as always.
  2. 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
  3. Nafraju said:
    // $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"))
  4. 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)
  5. THANK YOU:
    caethyril said:
    $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"

    var gottenNameOfEventOnTileXy = $gameMap.eventsXy(x, y).map(e => e.event().name);


    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
  6. 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].]
  7. 1673745837262.png

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

    Nafraju
  8. Nafraju said:
    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.
  9. As I mentioned, database records are documented on the Database tab of the Reference sheet:

    $dataSkills[1].damage.formula
    screenshot.png
  10. 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?
  11. It returns the class object. If I remember correctly, every class has an _id member variable.
  12. Poryg said:
    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?
  13. Use the same thing you did, just add ._classId to the end.
  14. pedagogy
    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:
  15. 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.
  16. @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:
  17. 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.
  18. werzque said:
    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).
  19. 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);