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.)
Resetting Character Position Upon Loading Game
RPG Maker VXAce SupportI'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
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.
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
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.
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.
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.
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!
I'll let you know how it goes!
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'.
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.
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...
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:
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.
Code:
module DataManager
def self.reload_map_if_updated
$game_map.setup(1)
$game_player.moveto(8, 12)
end
end
That worked perfectly! Thank you!
Original thread: https://forums.rpgmakerweb.com/threads/resetting-character-position-upon-loading-game.86789/