Resetting Character Position Upon Loading Game

TheChatotMaestro

doesn't know what she's doing
Veteran
Joined
Oct 27, 2017
Messages
43
Reaction score
1
First Language
English
Primarily Uses
RMMV
Is there a way to make sure that whenever you load your game, no matter what you were doing or where you saved, you always start off in the same spot? (I don't want to make a save block, I want saving to still be a menu option.)
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
248
Reaction score
76
First Language
English
Primarily Uses
RMVXA
I'm certain it's possible considering there are methods to set up a character's starting position and that I did make a game that loads a switch from loading. I'll have to relook at the code, though.

Ideally, I would put
Code:
module DataManager
def self.reload_map_if_updated
  if $game_system.version_id != $data_system.version_id
   $game_map.setup(your_map_id)
   $game_player.moveto(your_player_x, your_player_y)
  end
end
end
I'll have to check if that method is used anywhere else, but generally, you want to replace the map id/player x and y with your values. Since it seems that objects are loaded at this point, you might be able to use $game_variables[1] and such to reassign your loading positions.

Ah, right, if you want to identify the three variables in question:
-x and y should be positions by tiles. You should easily find this information by mousing over the map interface in your editor.
-map id is the default name of your map, but I think the window header or somewhere will also say what the id is. Please note that the id shows as 001 but you want to put down 1.
 
Last edited:

TheChatotMaestro

doesn't know what she's doing
Veteran
Joined
Oct 27, 2017
Messages
43
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm certain it's possible considering there are methods to set up a character's starting position and that I did make a game that loads a switch from loading. I'll have to relook at the code, though.

Ideally, I would put
Code:
module DataManager
def self.reload_map_if_updated
  if $game_system.version_id != $data_system.version_id
   $game_map.setup(your_map_id)
   $game_player.moveto(your_player_x, your_player_y)
  end
end
end
I'll have to check if that method is used anywhere else, but generally, you want to replace the map id/player x and y with your values. Since it seems that objects are loaded at this point, you might be able to use $game_variables[1] and such to reassign your loading positions.

Ah, right, if you want to identify the three variables in question:
-x and y should be positions by tiles. You should easily find this information by mousing over the map interface in your editor.
-map id is the default name of your map, but I think the window header or somewhere will also say what the id is. Please note that the id shows as 001 but you want to put down 1.
Where would I put this code block? Under 'initialize module'? I think that's where it goes, but I don't want to mess it up.
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
248
Reaction score
76
First Language
English
Primarily Uses
RMVXA
Scripts made by other people tend to go under (Materials) in scripts or something like that. It's generally where the list says (Insert Script here) or to be more technically, between all the scripts that make up the default engine and the script that runs the engine. Pretty much where all new scripts go.

But generally, you should avoid rewriting the default scripts, which is why you put this snippet where new scripts go so that this part will run instead of the default method.
 

TheChatotMaestro

doesn't know what she's doing
Veteran
Joined
Oct 27, 2017
Messages
43
Reaction score
1
First Language
English
Primarily Uses
RMMV
Oh, okay, thank you! Glad I didn't go ahead and put it where I thought it went, haha.
I'll let you know how it goes!
 

TheChatotMaestro

doesn't know what she's doing
Veteran
Joined
Oct 27, 2017
Messages
43
Reaction score
1
First Language
English
Primarily Uses
RMMV
I put it in, and added the map ID (001) and the coordinates (008, 012) where they go, but it gave me an error message that said 'invalid octal digit'.
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
248
Reaction score
76
First Language
English
Primarily Uses
RMVXA
I think I just said this, but if you're reading the id (001), you're supposed to put in the number (1). In this case, you need to put in 1, 8 and 12 , not 001, 008 and 012.

Because how Ruby reads numbers is that 001 is an octal, which is something I don't know but I'm guessing that's a binary code. The point is, 001 != 1, and our maps and x/y uses 1, not 001.
 

TheChatotMaestro

doesn't know what she's doing
Veteran
Joined
Oct 27, 2017
Messages
43
Reaction score
1
First Language
English
Primarily Uses
RMMV
I think I just said this, but if you're reading the id (001), you're supposed to put in the number (1). In this case, you need to put in 1, 8 and 12 , not 001, 008 and 012.

Because how Ruby reads numbers is that 001 is an octal, which is something I don't know but I'm guessing that's a binary code. The point is, 001 != 1, and our maps and x/y uses 1, not 001.
Oh, right! Thank you! Sorry about missing that bit...
I fixed that, and the playtest ran, but when I continued a save, it started just where it was saved...
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
248
Reaction score
76
First Language
English
Primarily Uses
RMVXA
Apologies. With Destiny 2 out, I keep forgetting to check RPG Maker. I had hoped that the DataManager snippet could do this...Ah, it seems that I left in the original condition to check on versions. Anyway, here's the new snippet to replace the current one:

Code:
module DataManager
def self.reload_map_if_updated
   $game_map.setup(1)
   $game_player.moveto(8, 12)
end
end
The default version of this would update the map and position only for new versions of the game. Here, we're always loading a specific position.
 
Last edited:

TheChatotMaestro

doesn't know what she's doing
Veteran
Joined
Oct 27, 2017
Messages
43
Reaction score
1
First Language
English
Primarily Uses
RMMV
That worked perfectly! Thank you!
 

Latest Threads

Latest Posts

Latest Profile Posts

Going live at 2pm EST
Today is the day! I will be productive in game dev work! I will - *gets distracted by cat playing with her toy mouse* Awww <3
Whelp. I tried to be productive.
Decided to work on Fandom Scouts today. I've decided that instead of using the generic "scrolling text" event that MV has (I'm using MV for FS, not MZ) I'll use the movie option. I'm still trying to find a way to get Premiere Pro to output the compatible format though. If anyone can give me some help, it would be greatly appreciated!
Barthdry wrote on tln143's profile.
Hello tln143 Welcome to the RPG Maker Forum. We wish you enjoy and make good rpg games
Barthdry wrote on 00cassiesmells's profile.
Hello 00casiemells Welcome to the RPG Maker Forum. We wish you enjoy and make good rpg games

Forum statistics

Threads
109,037
Messages
1,041,521
Members
141,523
Latest member
Zereitzu
Top