moveStraight two times

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
Hello, could you please advise if there was an easy Javascript option to make an event move twice or more (without coordinates, or RPGMaker MV standard interface)?


A simple script executes the second line immediately (that is logically for JS): 


event1 = $gameMap.event(1);
event1.moveStraight(2);
event1.moveStraight(2);


I've already considered setTimeout or setInterval with if-s (presented below). It works, but I would like to learn a simpler option if there is any.


event1 = $gameMap.event(1);
event1.moveStraight(2);
var moveInterval;
moveInterval = setInterval(function()
    {
        if(event1.isMoving() == false)
        {
           event1.moveStraight(2);
           clearInterval(moveInterval);
        }
      }, 100
);


Many thanks in advance!
 
Last edited by a moderator:

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
452
Reaction score
158
First Language
Not English
Primarily Uses
N/A
$gameMap.event(x).moveForward();
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
The way move routes work is that the next move will not be executed until the first move has finished.  You lose that when trying to execute the commands directly in script.  If you want to simulate a move route with multiple steps, the best/easiest way is to actually create a move route.  Give it the list of commands to run, then apply it to the target.
 

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
$gameMap.event(x).moveForward();
Unfortunately, this works the same as moveStraight. Moreover, unlike moveStraight, it does not work if I trigger the Action-Button event that I want to move, although it works for any other event, including Action-Button ones.

The way move routes work is that the next move will not be executed until the first move has finished.
Thank you for the insight, but (if I understood correctly what you mean by 'move routes') I want to avoid RPGMaker Event Commands for a case of multiple event moving simultaneously or with different timings. It is far convenient to use multiple plugin commands in 1 event than dealing with several event windows.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
As far as making multiple events move, you can do that from a single event.  The Set Move Route command has a dropdown where you can select which event (or the player) you want to move.  You don't have to deal with several event windows, and we try to discourage that.


Can you explain what you are trying to achieve, and why you are doing it in script rather than events?  It may be that what you want to do can very easily be done with event commands, and if not, I'll at least have some background to be able to guide you further (ie - providing the logic to build a move route and apply it to one or more events, via script).
 

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
In fact, I completely forgot about the dropdown that selects an event/player!!! Of course, that is not what I planned, but may be a simpler solution.


In addition, as I see, I should also uncheck 'Wait for completion' if I want Event2 to move simultaneously with Event1.


Thank you very much for reminding!
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Spot on!  Sometimes we can get so focussed on scripts that we forget, or don't discover, all the things the engine is quite capable of doing without them :)
 

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
Well, this method brought some issues with it.


I have several Plugin Commands in the Contents of the event,  something like:

Set Movement Route: This Event


                                    Move Down


Plugin Command: C1


Plugin Command: C2


Plugin Command: C3
If I set the 2nd movement route after these commands, the program does not wait for their execution, but moves the models immediately after the 1st route (actually, any inMaker command[balloons, choices, music, etc.] is executed immediately, despite Plugin Commands)


Is there a function to wait for command execution in the event Contents, other than looping a check of some permitting variable or placing 'wait' after each P-command?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Depends what your plugin commands are.  What the plugin is.  Whether it's set to do any waiting while the functions are running.  Can't really tell with what you've provided - if you need specific help you need to provide specific information, not something ambiguous like you have.  A screenshot of the event with those commands visible will be much more helpful.
 

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
Well, that's a bit complex to explain.


Sending the below commands into Contents result in sequential portions of text that appear after each other on clicking. The function simply aids in this.


The main reason for those commands is to have easy time with translation, i.e. use CAT-tools (e.g., SDL Studio) that are able to catch strings in a Javascript file.


So, if I send any in-Maker command after several plugin-commands, those additional commands are executed instantly during the first plugin-command in a list.
 
Last edited by a moderator:

Yurii

Villager
Member
Joined
Apr 10, 2016
Messages
21
Reaction score
2
Primarily Uses
Just to resolve the above issue.


Execution of the Event Command that follow our Plugin Command can be stopped by simply setting Speed in "Set Movement Route" with Wait for Completion ticked.


E.g.: 

Plugin Command : nameOfOurCommand


Set Movement Route : Player (Wait)


        Speed : 4


Plugin Command : nameOfOurCommand2


Set Movement Route : Player (Wait)


        Speed : 4


Set Movement Route : Player (Wait)


        anythingElse
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,455
Members
137,821
Latest member
Capterson
Top