SetMoveMoute Script for Event [solved]

Discussion in 'RPG Maker MV' started by Nilom, May 3, 2019.

Thread Status:
Not open for further replies.
  1. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    Hello everyone!

    I'm seaching the forums and google up and down to find a working script command for moving events with a parralel process common event.

    What does not work in my case is everything with " this. ". Because I absolutely need the script call to be in a parallel process.

    Before I just used a non parallel common event and the drag and drop "Set Movement Route" command with "This Event".

    [​IMG]

    I called this common event within the actor events, so I could use "This Event".

    [​IMG]

    But I realized that it has to be a parallel process. Otherwise the players can not use items or skills on their turn. (Bear in mind that it is not a conventional game. The Player Character will not be used for movement. Only events of the players avatars.)


    And what I also highly want to avoid are gigantic blocks of "if x ..... then move event.ID(x)". They would form gigantic blocks in my project and if I want to edit something I have to change all of it, sooo many commands.


    What I instead try to do is using move route script commands. I found them in this thread.


    Game_Character.prototype.processMoveCommand = function(command) {
    var gc = Game_Character;
    var params = command.parameters;
    switch (command.code) {
    case gc.ROUTE_END:
    this.processRouteEnd();
    break;
    case gc.ROUTE_MOVE_DOWN:
    this.moveStraight(2);
    break;
    case gc.ROUTE_MOVE_LEFT:
    this.moveStraight(4);
    break;
    case gc.ROUTE_MOVE_RIGHT:
    this.moveStraight(6);
    break;
    case gc.ROUTE_MOVE_UP:
    this.moveStraight(8);
    break;
    case gc.ROUTE_MOVE_LOWER_L:
    this.moveDiagonally(4, 2);
    break;
    case gc.ROUTE_MOVE_LOWER_R:
    this.moveDiagonally(6, 2);
    break;
    case gc.ROUTE_MOVE_UPPER_L:
    this.moveDiagonally(4, 8);
    break;
    case gc.ROUTE_MOVE_UPPER_R:
    this.moveDiagonally(6, 8);
    break;
    case gc.ROUTE_MOVE_RANDOM:
    this.moveRandom();
    break;
    case gc.ROUTE_MOVE_TOWARD:
    this.moveTowardPlayer();
    break;
    case gc.ROUTE_MOVE_AWAY:
    this.moveAwayFromPlayer();
    break;
    case gc.ROUTE_MOVE_FORWARD:
    this.moveForward();
    break;
    case gc.ROUTE_MOVE_BACKWARD:
    this.moveBackward();
    break;
    case gc.ROUTE_JUMP:
    this.jump(params[0], params[1]);
    break;
    case gc.ROUTE_WAIT:
    this._waitCount = params[0] - 1;
    break;
    case gc.ROUTE_TURN_DOWN:
    this.setDirection(2);
    break;
    case gc.ROUTE_TURN_LEFT:
    this.setDirection(4);
    break;
    case gc.ROUTE_TURN_RIGHT:
    this.setDirection(6);
    break;
    case gc.ROUTE_TURN_UP:
    this.setDirection(8);
    break;
    case gc.ROUTE_TURN_90D_R:
    this.turnRight90();
    break;
    case gc.ROUTE_TURN_90D_L:
    this.turnLeft90();
    break;
    case gc.ROUTE_TURN_180D:
    this.turn180();
    break;
    case gc.ROUTE_TURN_90D_R_L:
    this.turnRightOrLeft90();
    break;
    case gc.ROUTE_TURN_RANDOM:
    this.turnRandom();
    break;
    case gc.ROUTE_TURN_TOWARD:
    this.turnTowardPlayer();
    break;
    case gc.ROUTE_TURN_AWAY:
    this.turnAwayFromPlayer();
    break;
    case gc.ROUTE_SWITCH_ON:
    $gameSwitches.setValue(params[0], true);
    break;
    case gc.ROUTE_SWITCH_OFF:
    $gameSwitches.setValue(params[0], false);
    break;
    case gc.ROUTE_CHANGE_SPEED:
    this.setMoveSpeed(params[0]);
    break;
    case gc.ROUTE_CHANGE_FREQ:
    this.setMoveFrequency(params[0]);
    break;
    case gc.ROUTE_WALK_ANIME_ON:
    this.setWalkAnime(true);
    break;
    case gc.ROUTE_WALK_ANIME_OFF:
    this.setWalkAnime(false);
    break;
    case gc.ROUTE_STEP_ANIME_ON:
    this.setStepAnime(true);
    break;
    case gc.ROUTE_STEP_ANIME_OFF:
    this.setStepAnime(false);
    break;
    case gc.ROUTE_DIR_FIX_ON:
    this.setDirectionFix(true);
    break;
    case gc.ROUTE_DIR_FIX_OFF:
    this.setDirectionFix(false);
    break;
    case gc.ROUTE_THROUGH_ON:
    this.setThrough(true);
    break;
    case gc.ROUTE_THROUGH_OFF:
    this.setThrough(false);
    break;
    case gc.ROUTE_TRANSPARENT_ON:
    this.setTransparent(true);
    break;
    case gc.ROUTE_TRANSPARENT_OFF:
    this.setTransparent(false);
    break;
    case gc.ROUTE_CHANGE_IMAGE:
    this.setImage(params[0], params[1]);
    break;
    case gc.ROUTE_CHANGE_OPACITY:
    this.setOpacity(params[0]);
    break;
    case gc.ROUTE_CHANGE_BLEND_MODE:
    this.setBlendMode(params[0]);
    break;
    case gc.ROUTE_PLAY_SE:
    AudioManager.playSe(params[0]);
    break;
    case gc.ROUTE_SCRIPT:
    eval(params[0]);
    break;
    }
    };


    But no matter what I try I can not get this to work. I have to say that although I can understand the logic behind some basic code I am totally new to JavaScript and it's architecture.
    I understand that the code above is a switch but I do not understand the "command.code" part. In Game Maker I used switches with normal variables.

    I tried to do something like this:

    But obviously it did not work. How can I call this switch in the correct way?

    When I use $gameMap.event(variable).moveStraight(2) in a script call without anything else it kinda works but it is quite buggy. The game doesn't wait until the movement is finished and sometimes the event will not move at all and instead spin like crazy.

    I guess I would need something like this

    var moveRoute =
    {
    "list":[{"code":0,"parameters":[]}],
    "repeat":true,
    "skippable":false,
    "wait":false
    };
    $gameMap.event(eventId).forceMoveRoute(moveRoute);

    But that is just an "doing nothing infinite loop" found here. Could someone translate me the script for normal movement? I'm too dumb. Thanks! :biggrin:
     
    Last edited: May 3, 2019
    #1
  2. bazrat

    bazrat Pixel Game Maker MV Veteran

    Messages:
    237
    Likes Received:
    162
    First Language:
    English
    Primarily Uses:
    Other
    ive done a similar thing with a CBS, and instead of using This Event in the CE movement routes, in every map i had the same event that would correlate with the command. I don't know if that makes sense but basically we will say i had Event 1 that I wanted moved was the same premade event in every map. That way I made sure the CE would have a proper Event 1 to move in every map.

    I realize my way is probably more complicated and inefficient, but it worked. i had like 60 preplanned events for this CBS by the way xD
    good times

    This wouldn't work if its a spawned event, for obvious reasons
     
    #2
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,970
    Likes Received:
    11,632
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    If you call a common event using the Common Event command, 'this' is the event that it's being called from. Why can't you use 'this'? If you can use 'Move Route > This Event' then you can use 'this'. It has nothing to do with whether it's a parallel process or not.

    Perhaps you should explain WHAT you're trying to do (elaborate on "move events around") rather than how you're trying to do it, which might make it easier to understand why you can/can't use a certain approach.
     
    #3
    caethyril likes this.
  4. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,320
    Likes Received:
    822
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    The command codes are numbers; they just get matched against named constants, cf rpg_objects.js:
    Code:
    Game_Character.ROUTE_END               = 0;
    Game_Character.ROUTE_MOVE_DOWN         = 1;
    Game_Character.ROUTE_MOVE_LEFT         = 2;
    Game_Character.ROUTE_MOVE_RIGHT        = 3;
    Game_Character.ROUTE_MOVE_UP           = 4;
    Game_Character.ROUTE_MOVE_LOWER_L      = 5;
    Game_Character.ROUTE_MOVE_LOWER_R      = 6;
    Game_Character.ROUTE_MOVE_UPPER_L      = 7;
    Game_Character.ROUTE_MOVE_UPPER_R      = 8;
    Game_Character.ROUTE_MOVE_RANDOM       = 9;
    Game_Character.ROUTE_MOVE_TOWARD       = 10;
    Game_Character.ROUTE_MOVE_AWAY         = 11;
    Game_Character.ROUTE_MOVE_FORWARD      = 12;
    Game_Character.ROUTE_MOVE_BACKWARD     = 13;
    Game_Character.ROUTE_JUMP              = 14;
    Game_Character.ROUTE_WAIT              = 15;
    Game_Character.ROUTE_TURN_DOWN         = 16;
    Game_Character.ROUTE_TURN_LEFT         = 17;
    Game_Character.ROUTE_TURN_RIGHT        = 18;
    Game_Character.ROUTE_TURN_UP           = 19;
    Game_Character.ROUTE_TURN_90D_R        = 20;
    Game_Character.ROUTE_TURN_90D_L        = 21;
    Game_Character.ROUTE_TURN_180D         = 22;
    Game_Character.ROUTE_TURN_90D_R_L      = 23;
    Game_Character.ROUTE_TURN_RANDOM       = 24;
    Game_Character.ROUTE_TURN_TOWARD       = 25;
    Game_Character.ROUTE_TURN_AWAY         = 26;
    Game_Character.ROUTE_SWITCH_ON         = 27;
    Game_Character.ROUTE_SWITCH_OFF        = 28;
    Game_Character.ROUTE_CHANGE_SPEED      = 29;
    Game_Character.ROUTE_CHANGE_FREQ       = 30;
    Game_Character.ROUTE_WALK_ANIME_ON     = 31;
    Game_Character.ROUTE_WALK_ANIME_OFF    = 32;
    Game_Character.ROUTE_STEP_ANIME_ON     = 33;
    Game_Character.ROUTE_STEP_ANIME_OFF    = 34;
    Game_Character.ROUTE_DIR_FIX_ON        = 35;
    Game_Character.ROUTE_DIR_FIX_OFF       = 36;
    Game_Character.ROUTE_THROUGH_ON        = 37;
    Game_Character.ROUTE_THROUGH_OFF       = 38;
    Game_Character.ROUTE_TRANSPARENT_ON    = 39;
    Game_Character.ROUTE_TRANSPARENT_OFF   = 40;
    Game_Character.ROUTE_CHANGE_IMAGE      = 41;
    Game_Character.ROUTE_CHANGE_OPACITY    = 42;
    Game_Character.ROUTE_CHANGE_BLEND_MODE = 43;
    Game_Character.ROUTE_PLAY_SE           = 44;
    Game_Character.ROUTE_SCRIPT            = 45;
    So if necessary you can construct and apply a move route via script call with something like this:
    Code:
    var cMove = { code: Game_Character.ROUTE_MOVE_RANDOM, parameters: [] };
    var cEnd = { code: Game_Character.ROUTE_END, parameters: [] };
    var cList = [cMove, cEnd];
    var route = { list: cList, repeat: true, skippable: false, wait: false };
    var eventId = 5;
    $gameMap.event(eventId).forceMoveRoute(route);
    That aside, while I'm not sure what your goal is, I wonder if you really need a parallel event for it. Have you considered an autorun event with a branch to check "is (menu button) pressed"? :kaoswt2:
    Code:
    ◆If:Button [Cancel] is pressed down
      ◆Open Menu Screen
      ◆
    :End
     
    #4
    Nilom likes this.
  5. Andar

    Andar Veteran Veteran

    Messages:
    28,729
    Likes Received:
    6,604
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @XZINED
    As with the other posters here I think you got something wrong and need to take a step back to explain what exacty you want to have instead of how you think you could do that unknown "it".
    That is especially because nothing in the partial screenshots should stop the commands from working as intended, so the cause of your problem is probably outside the data you've given.

    Please explain the purpose of the structure and give full screenshots for us to see - as said above some of your commands are rather strange to use.

    Additional info:
    "Set move route" is a command that creates an independent process of the main game loop, a process that is independent of the event where the command is placed. There are good reasons why that is done - as you said yourself giving a direct move command will rarely work, especially because each object can have only one move route and giving another move command always deletes the previous command.

    Most likely there is a better way to create what you want if you just explain that, especially because a direct move command like you want would cause extreme problems in the main game loop.
     
    #5
  6. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    Thank you for your replies! They are all appreciated. :smile:

    Sadly that's not true. I already explained that I had to change this system. If I switch the common event to parallel process it can not be called by events and be referenced with "this" anymore. Sure, events can turn the paralell process switch on, but these are not directly called by the events anymore. And if I let an event turn the paralell switch on and call the common event then I have two instances of that common event running at the same time, messing everything up. I tried this already.


    That is exactly what I do. Events with the IDs from 1-8 are reserved for the players in every level. It is not too hard to setup, I think. In return powerful things can be done, like $gameMap.event($turn_number).moveStraight(2) or "if $gameMap.event($turn_number).terrainTag() == X do...".

    [​IMG]

    Notice the ID on the upper left, the name and the note. ID:001 = player 1. ID:002 = player 2 etc . Before I had all of these player events call the main common event in every turn, so the players event could be used with "this". But that's a very dirty way to do and it also causes problems with item usage or other events on the map needing to run parallel.


    Sorry I should have mentioned that this was my old attempt, which worked flawlessly, except that I could not use interactive items (which call common events) during the players turns. I need this to be a parallel process now, as otherwise these items events will be only called after the "end phase" of the turn. When the loop breaks.


    Okay I will explain my game and what I try to do. Although I'm pretty sure that there isn't much of another option for me.


    The first important information is, that it is a turn based boardgame. There is no moving around with a normal Character. The whole movement of ALL events will be handled by common events. (Except for some decorative stuff in the background, like animals)

    I splittet my common events in different "controllers" that I call "phases". In this way I can read the "code/commands" better and I can edit the whole thing a lot better. The main common event that will handle the game session is "Phase Controller". It will call other common events as needed, depending on the current situation. For example after pressing Enter it will call "Dice Phase". Or when two players collide it will call the "Battle Phase".

    [​IMG]

    I need to be able to handle player turns. I need to be able to handle the automated movement of their avatar-events, depending on what they diced. Everything just worked fine, except that while this whole "Phase Controller" common event was not a parallel process, items could not be used in the intended way. Well, they could, but as I said their execution was on the end of turn. Even if they were used on the start of the turn. Because the Phase controller needs to be in a loop, obviously. I should mention that most of the items will call common events, for example to swap locations with another player (common event #20). So they are not only just "heal x".

    So now that I pulled my pants off, I'm pretty sure that I still need script commands for moving the player events around within the phase controller and it's "sub phases/common events". It would be silly to build gigantic blocks of "if turn 1... move event 1" "if turn 2... move event 2".. etc. . The phases will be pretty complex.


    Yay! I guess these are pretty handy. Thank you.

    Something like this was exactly what I was looking for! Thank you. I will try out if I can use this. o_O:smile:


    Thanks again for all your input! If anyone has more ideas, they are well appreciated. :smile:
     
    Last edited: May 4, 2019
    #6
  7. Andar

    Andar Veteran Veteran

    Messages:
    28,729
    Likes Received:
    6,604
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    unfortunately you didn't answer my questions, you only continued to explain how you want to do something, not what.
    the "what" would be "I want to make a boardgame where the player controls multiple events as playing pieces" or something like that, just with more details.

    You already did two things that are extremely bad for a lot of reasons and should only be done if you know exactly what you're doing:

    1) you should only call common events that are set to trigger=none, you should never call common events that are set to parallel process.
    that has a lot of reasons and is the cause why "this" no longer works correctly as well as risking timing problems and a lot of other things

    2) you placed a loop inside a parallel process (which also automatically loops)
    By the way - that was why I wanted the full common event to see what the loop is and how to disable it without loosing function.

    I still think that you piled on a lot of code that is more complex than really neccessary, and that you could make everything much easier than having loops inside parrallel processes and similiar things.
    But to realy help, we need to know what that should do and not how it should do it.
    What are the options and functions that should be available to the player?
    How many events should the player control and what should he be able to do with them?
    That and similiar things are the questions you should answer, so that we can check how else to handle things without such crazy constructs.
     
    #7
  8. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    So in short you say the devs behind RPG Maker should totally remove parallel processes because you think they are very bad and should never be used..?

    I explained why I think that I need it to be a parallel process. And it should not be too hard to mind wrap my explanataion.


    Okay so I further dumb down the explanation of my project:

    - Boardgame
    - Turn based
    - Maximum of 4-8 players
    - Dice and variables/stats determine the movepoints
    - Player Events move automatically the number of movepoints that they have for their turn
    - Player Events trigger other events depending on the board-fields they step on

    With attaching the Game Flow I hope that it is clear what the game is about and what my "code/commands" need to do. The problem is only with the movement phase (marked red). Everything else works just fine with script commands like $gameMap.event($turn_number).terrainTag() etc. .

    [​IMG]


    Perhaps now that I turned the common event from call to parallel process I should remove the loop, I guess. I didn't modify all of the event commands yet. I just started this process and noticed that there is no clear answered topic on movement script commands with RPG Maker MV.


    And no offense, but if any one of these other topics would have been answered somehow usefully, instead of questioning all of the topic creators attempts (and kinda trying to make them look dumb), I would have not been in the need to ask their same question again.
     
    #8
  9. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,654
    Likes Received:
    14,417
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    What Andar is saying that you should look at topics with similar issues that isn't as complicated as yours, basically a K.I.S.S. method. Usually an issue lies at the most simplest thing. Also remember that not everyone in this forum is a primary English speaker. Tone is hard to determine in written form. So take all of them as a grain of salt and try not to be offended if they ask you ""obvious"" things. It's just basic troubleshooting process.
     
    #9
    caethyril likes this.
  10. Andar

    Andar Veteran Veteran

    Messages:
    28,729
    Likes Received:
    6,604
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    no, parallel processes are vital - they just need to be used correctly. Too many people don't understand how they work and use them where they cause more problems than not.
    If you're interested, you should follow the link to the "bughunting" tutorial in my signature to learn more.

    Question:
    Is that in the diagram the ONLY time the player can use skills or items?
    From what you said before you placed the common event on parallel because otherwise the player could not use items, but if that is the structure then you should do something entirely else.

    You DON'T need a parallel process for the entire loop, you need to break up the process loop at the moment of the player decision.
    The player can decide to do any of three things: throw dice, use item or use skill.
    Make the "Throw Dice" into a skill that starts the game processing, and use loops or parallel processes only to handle all pieces between Dice Phase and End Turn
    I hope that hint is enough to point you to the structure that will allow you to continue without placing everything into an eternal loop/parallel, because I don't have time to develop it for you - the important part is that at the moment of player decision none of the events needs to be processed, especially not if the player itself does not exist as a piece and is invisible control only.
     
    #10
    caethyril likes this.
  11. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    I was quite a bit offended by the such crazy constructs statement. I've put a lot of thought and work into this.


    Indeed. I realized the only reason why I have the loop inside the phase controller is to check the keys pressed. I could instead call the phase controller from the dice sprite/button.

    But it would be cool though to have background characters (animals etc.) continue their routes while the players characters move along the board. Is this possible without a parallel process? It is a small detail but I would prefer it rather than everything being freezed when players move.


    For now I'd say yes. In the battles they can use skills too, but only combat related skills. I'm not sure if further game design development could require an "end of turn" item/skill usage possibility, though. But for this case I already have a solution. ("End turn" button)


    I never requested that. Thanks for your hints though.


    If anyone has a working solution for handling movement in script commands I would highly appreciate it. Cause even without using a parallel process I would find it much cleaner that way. :smile:
     
    #11
  12. Andar

    Andar Veteran Veteran

    Messages:
    28,729
    Likes Received:
    6,604
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    yes and no
    that specifically is the reason why the move routes are not working inside your original structure - the set move route command creates an independent game process outside the event exactly to allow NPCs to move while the player controls the party.
    And more specifically that is what autonomous movement is intended for.

    It only doesn't work yet because your loops had disabled that part of regular movement, but if you manage the corrections mentioned then you should be able to use custom autonomous movement again for background animations and animal movement and so on.
    Unfortunately that will only be usable to you if it doesn't need special handling on a board - as soon as you need checks and changes, autonomous movement is no longer usable. But if you can use it, then custom autonomous movement is a lot better than a parallel set movement route command.
     
    #12
  13. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    Bump.

    Why doesn't the "wait" part work for this commands? This is the only issue that I have with the various "move route by script commands" attempts that I find all over forums. The code just will not wait until the actual character/event finished its movement, even when their codes have the wait command in them.
     
    #13
  14. Andar

    Andar Veteran Veteran

    Messages:
    28,729
    Likes Received:
    6,604
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I already explained it above - the set moveroute command creates a new object in the gameloop, and all wait are relative to their objects.
    Which means that you need to use the internal wait of the moveroute to have it wait, and that can't be programmed from the outside. Using a wait from outside the move route will wait the process that is outside (your phase controller).

    a wait always make the object it belongs to wait for the specific cycles of the game loop - you cannot give a wait for another object.
    And since the set move route command always overwrites previous move routes, you need to set the internal wait at the moment you create the move route - giving it later will just erase any commands that have not yet been executed from the previous move route.

    That is part of the most elementary game loop in the engine, and to change that you'll need a rather complex plugin for rewriting a big part of it.
     
    #14
    Nilom likes this.
  15. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,320
    Likes Received:
    822
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Ah, yep, I forgot that the "wait" route property is only checked in the corresponding interpreter function like Andar says (command205). :kaoslp:

    For scripted move routes you can specify the wait mode manually instead (this is probably a better way to go about it anyway):
    Code:
    var cMove = { code: Game_Character.ROUTE_MOVE_RANDOM };
    var cEnd = { code: Game_Character.ROUTE_END };
    var cList = [cMove, cEnd];
    var route = { list: cList, repeat: false, skippable: false };
    this._character = $gameMap.event(4);
    this._character.forceMoveRoute(route);
    this.setWaitMode('route');
    Then the interpreter will check the wait mode every frame, see it's set to 'route', and check whether the character stored under its _character property is still moving or not. :)

    Note that since the interpreter processes each command as a single entity, if you want the wait to apply before the next line of script then you need to start a new script command for it. The wait will only apply between event commands. :kaoswt:
     
    #15
    Nilom likes this.
  16. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    Awesome!!! THAT finally worked! Thank you Andar for reminding caethyril about the interpreter thing and thank you caethryl for providing the proper script. I think this exact script should be pinned somewhere. While googling there is only confusion and wrong scripts in the threads. And the owner of this handy script commands summary should update the movement route reference with this.



    I just have a short question about multiple commands in one route and about params. For example I want to set stepping animation on and change the opacity back to 255. Where do I put this "255" param in? And did I do the cList extension right or do I need to start and copy this code for every single movement command? :eswt::biggrin:

     
    #16
  17. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,320
    Likes Received:
    822
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Any move command with parameters just needs assigning to the parameters array for that command, e.g.
    Code:
    var cWait = { code: Game_Character.ROUTE_WAIT, parameters: [60] };
    var cOpA = { code: Game_Character.ROUTE_CHANGE_OPACITY, parameters: [128] };
    var cOpB = { code: Game_Character.ROUTE_CHANGE_OPACITY, parameters: [255] };
    var cEnd = { code: Game_Character.ROUTE_END };
    var cList = [cWait, cOpA, cWait, cOpB, cEnd];
    var route = { list: cList, repeat: false, skippable: false };
    this._character = this.character(0);
    this._character.forceMoveRoute(route);
    this.setWaitMode('route');
    I did a few things differently with this example: the move route is assigned to character(0), i.e. "This Event", and the route itself waits 60 frames, changes the opacity to 128 (50%), then waits another 60 frames before changing the opacity to 255 (100%). You can see the parameters in the associated array for each command~ :kaothx:

    This approach is handy for making stuff that's tedious to do in the editor, e.g. a smooth fade-in/out effect. ^_^
     
    #17
    Nilom likes this.
  18. Nilom

    Nilom Veteran Veteran

    Messages:
    178
    Likes Received:
    39
    First Language:
    German
    Primarily Uses:
    RMMV
    Ah I see and understand now. :)

    Awesome! You made the script even better. :D

    That will come in handy. Thread solved.
     
    #18
  19. Kes

    Kes Global Moderators Global Mod

    Messages:
    21,119
    Likes Received:
    10,722
    First Language:
    English
    Primarily Uses:
    RMVXA

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #19
Thread Status:
Not open for further replies.

Share This Page