Underdocker

Warper
Member
Joined
Mar 18, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMVX
I am working on my first game in RPG Maker VX.

I have a scene where an event - an NPC - starts at Location 1. After speaking with him, a control switch is turned on, and the NPC will move to Location 2 using a Move Route. This continues in the same manner with Locations 3, 4, etc.

This works fine, unless the player decides to leave the screen. If the player leaves in the middle of this "tour" around the screen and then returns, the event appears to move back to its original location (1), but then tries to execute the Move Route from where it left off, causing the NPC to get stuck and never finish the scene.

Is there a way to set the NPC's location when the player first enters the screen, while also allowing the NPC to move around to each stop? I tried using a parallel process/autorun event to directly set the X/Y coordinates, but that interrupted the NPC's movement.

Is there a better way to set up this scene?

Thank you for your help.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,203
Reaction score
14,681
First Language
English
Primarily Uses
RMMV
You should have one event for each location. Probably use a variable rather than switches, and increment it by 1 AFTER each move route is completed. Then have the conditions on each event so that it is visible when the variable is a certain number (0 for the first position, 1 for the second, 2 for the third, etc), and not visible when it's lower or higher.
 

Underdocker

Warper
Member
Joined
Mar 18, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMVX
Thank you for your response, Shaz. Unfortunately, I'm not quite sure how to make your solution work.

1) How do I increment a variable after a move route is complete? I have the option to set a switch at the end of a move route, but I don't see a way to set a variable.
2) I'm not sure how I can use multiple events for a single NPC. Suppose the NPC starts at location (1,1), then moves right 10 tiles to (11,1). If I have an invisible event waiting at location (11,1), then the NPC will not move onto that tile during the move route (since another event is already there). I could move the NPC 9 tiles to the right, then turn it "off" and turn "on" the event at (11,1), but then the NPC would appear to teleport that last tile, correct? Please let me know if there is a good way to get this to work.

FYI, I did eventually get this scene to work the way I expected using a single event with switches, and a separate event running a parallel process to set the event's coordinates. I had messed up my conditional logic on the parallel process originally, which is why it was not working for me. I can stick with this solution, but if there is a better way to do it with multiple events then I would love to learn how.

Thanks for your help.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
950
Reaction score
498
First Language
English
Primarily Uses
RMMV
1) How do I increment a variable after a move route is complete? I have the option to set a switch at the end of a move route, but I don't see a way to set a variable.
The button right under Control Switches is Control Variables. Choose your variable number, Add 1.
2) I'm not sure how I can use multiple events for a single NPC. Suppose the NPC starts at location (1,1), then moves right 10 tiles to (11,1). If I have an invisible event waiting at location (11,1), then the NPC will not move onto that tile during the move route (since another event is already there).
That's not correct for several reasons.
1) If your second, invisible event has the priority Below Characters (which it should, since you don't want an invisible wall), your event will move onto it just fine.
2) If there was some reason they would conflict, in your Move Route you'd use the button Through On to move through impassable things.

So you would just move the event to its location (where the second event is) and increment your variable; the first event will have a page with the condition of that variable at that value to become invisible and inactive, the second event will have a page with that same condition to gain the graphics of your NPC and have the next section of your event on it.
 

Thefirelion

Eventer
Veteran
Joined
Mar 25, 2017
Messages
120
Reaction score
41
First Language
Spanish
Primarily Uses
RMVXA
Thank you for your response, Shaz. Unfortunately, I'm not quite sure how to make your solution work.

1) How do I increment a variable after a move route is complete? I have the option to set a switch at the end of a move route, but I don't see a way to set a variable.
2) I'm not sure how I can use multiple events for a single NPC. Suppose the NPC starts at location (1,1), then moves right 10 tiles to (11,1). If I have an invisible event waiting at location (11,1), then the NPC will not move onto that tile during the move route (since another event is already there). I could move the NPC 9 tiles to the right, then turn it "off" and turn "on" the event at (11,1), but then the NPC would appear to teleport that last tile, correct? Please let me know if there is a good way to get this to work.
For #1: after the movement, call a script in the move route event option at the end: $game_variables[x] += 1 or whatever you want.
x = id of the variable that you want use.

For #2: before the collition set the event to move "through on" and at the end "through off" in the same move route.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
950
Reaction score
498
First Language
English
Primarily Uses
RMMV
For #2: before the collition set the event to move "through on" and at the end "through off" in the same move route.
Just as a note...there's no reason to turn through off if the next thing that happens is the event switching to a new page.
 

Underdocker

Warper
Member
Joined
Mar 18, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMVX
Thanks again for your help. I understand most of what you have explained.

The only thing that is not working for me is the script command in the Move Route. Here is the command I am using:
$game_variables[0012] += 1

That does not seem to be updating the variable as expected.
I've also tried:
$game_variables[12] += 1
$game_variables[0012: Test 01] += 1

...but no luck.

Is there something wrong with the syntax?
 

Thefirelion

Eventer
Veteran
Joined
Mar 25, 2017
Messages
120
Reaction score
41
First Language
Spanish
Primarily Uses
RMVXA
$game_variables[12] += 1
This is the correct syntax, make a npc with the command event "script call" putting this and create a message commamd event with: \v[12] to see if the value of the variable changed.

I don't have vx, but vx ace syntax shouldn't be that different.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
32,566
Reaction score
8,159
First Language
German
Primarily Uses
RMMV
never use leading zeroes in ID numbers, because in programming that is a flag for different number systems.
for example 0x stands for hexadezimal numbers, 0x12 would be decimal 18
and 00 is often interpreted as octal, so 0012 is decimal 10
 

Latest Threads

Latest Profile Posts

Hey everyone! No Studio Blue RPG Maker Critiques Stream today! But you can always check the playlist for old streams you've missed!

I ran out of paper sheets to draw, so I guess I'm forced to do digital for a while now...
x778xt8.jpg

Still haven0t found a colouring style that I like :kaoswt:
woods.pngshop.jpgboss.jpgRoom.png

Mapping is becoming so much easier!
FirestormNeos wrote on Neikoku's profile.
the cat in your profile picture is adorable

Forum statistics

Threads
111,440
Messages
1,061,124
Members
144,805
Latest member
AnarchyJas
Top