Move route script call

Discussion in 'Learning Javascript' started by Dinamic Creates, Mar 9, 2018.

  1. Dinamic Creates

    Dinamic Creates Project Stealth | Project Dungeon Trios Veteran

    Messages:
    69
    Likes Received:
    24
    Location:
    México
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Hello everyone, I'm wondering, how are we supposed to use the move route script calls?
    It seems I have to create a moveRoute variable/object and then send it through a character (event, player) function, but I have no idea on how to define this variable. I can't find anything related to a "moveRoute" type definition or something like that.

    The thing I'm trying to attempt is forcing a character (an event that represents an enemy) move route and use the repeat option for it to cycle eternally, I want it to be generic (this script call is actually inside a common event), so theres no way to do it with conventional eventing.


    I hope I explained my issue clearly, thanks for your time.
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,570
    Likes Received:
    11,272
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    What calls the common event? If it's an event that has a Common Event command in it, you can use a Move Route command and select This Event from the drop-down.

    The only time you would need to script the entire move route is if you don't know in advance which event it will apply to, or if you're going to apply it to many events and don't want to set each one up individually (though you could just set up the first one then copy/paste and edit each one just to change the target/subject).
     
    #2
  3. Dinamic Creates

    Dinamic Creates Project Stealth | Project Dungeon Trios Veteran

    Messages:
    69
    Likes Received:
    24
    Location:
    México
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Yeah, I have done that with other common events and it works flawlessly.. it's like... stacks?

    But, this is a Button Command Event (Yanfly). When you press 'C' on the map, the player attacks from a distance to an enemy event, my script looks for an event with a specific notetag in the appropiate range, and if it finds it, then the enemy gets killed. Since I'm using the Event Chase Player plugin from Yanfly as well, there was a bug that made the dead enemies keep following you (even if they wont attack).

    I fixed it by changing the way I was doing it. I'm looking for optimization and easy modification, so I don't want to include too much on each event. I had to add another page to each enemy event with a selfswitch that turns on when you kill them. It is fine since I can choose the enemy dead graphic as well.

    I would like to know how to do it by script calls, and it would be nice because I can't find this anywhere on the web.
    I don't really need it anymore, but if anyone can share something about move route script calls, that would be rad.

    Thanks Shaz:)
     
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,570
    Likes Received:
    11,272
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Create a new map with a single event. Put the move route in that event and save it. Go and look at your Mapxxx.json file and see what the move route looks like. You'll see it's an object with a number of properties, and one of those is the list of movement commands which is an array of other objects.

    You can build this object yourself via script commands. Just make sure it has all the same properties as the one you created using event commands. When you're ready to apply it to an event, it's something like event.forceMoveRoute(moveRouteObject).
     
    #4
    Dinamic Creates likes this.
  5. Dinamic Creates

    Dinamic Creates Project Stealth | Project Dungeon Trios Veteran

    Messages:
    69
    Likes Received:
    24
    Location:
    México
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Wow! Having the move route definition for each event in their respective map json files makes a lot of sense, lol.
    Now I will try to play with this. I can't thank you enough!

    Yeah, I got the lines I wanted and it works like a charm ♥.

    Code:
    var moveRoute =
    {
     "list":[{"code":0,"parameters":[]}],
     "repeat":true,
     "skippable":false,
     "wait":false
    };
    $gameMap.event(eventId).forceMoveRoute(moveRoute);
    
    For future reference to anyone who finds this post, this is how to insert the "doing nothing infinite loop" move route to a event in a script call.

    For any other move route, it seems the most confortable way to do it is defining it on a map like Shaz said, and getting the equivalent lines.
     
    Last edited: Mar 11, 2018
    #5
  6. Shaz

    Shaz Veteran Veteran

    Messages:
    37,570
    Likes Received:
    11,272
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    EVERYTHING you do in events is defined in the map json files for MV. You've just got to interpret all the numbers.
     
    #6

Share This Page