[Solved] RMX-OS -> Save MAP[map_id, X,Y]

Started by R5GAMER, March 13, 2015, 12:34:18 pm

Previous topic - Next topic

R5GAMER

March 13, 2015, 12:34:18 pm Last Edit: March 17, 2015, 11:35:12 pm by R5GAMER
Hello!!

I want to know in RMX-OS how can save of the map.
exemply :

[map_id] + [x,y]
..........________
....'/,-Y"............."~-.
..l.Y.......................^.
./\............................_\
i.................... ___/"...."\
|.................../"...."\ .....o!
l..................].......o !__../
.\..._..._.........\..___./......"~\
..X...\/...\.....................___./
.(. \.___......_.....--~~".....~`-.           
....`.Z,--........./.....................\
.......\__....(......../.........._____)
...........\.........l......../---~~" /
............Y.......\................../
............|........"x_____.^
............|.....................\
............j.....................Y

PhoenixFire

Need a bit more information than that; where do you plan to use the information after you've saved it? Is it being used where the other players will need access to the saved information as well? Is it being pushed by the client to the server and stored in the database? Note: most of these questions I'm just pulling out of thin air, and may not even matter, but you need to kinda let people know what you're trying to do. Otherwise, you might get answers that won't help you at all. I mean, I could tell you yes, you can have it save to a text file in a sub-folder in the game folder; that might not be what you're looking for though.
Quote from: Subsonic_Noise on July 01, 2011, 02:42:19 amNext off, how to create a first person shooter using microsoft excel.

Quote from: Zeriab on September 09, 2011, 02:58:58 pm<Remember when computers had turbo buttons?

R5GAMER

March 16, 2015, 09:26:04 am #2 Last Edit: March 16, 2015, 09:53:16 am by R5GAMER
Quote from: PhoenixFire on March 13, 2015, 02:47:06 pm
Need a bit more information than that; where do you plan to use the information after you've saved it? Is it being used where the other players will need access to the saved information as well? Is it being pushed by the client to the server and stored in the database? Note: most of these questions I'm just pulling out of thin air, and may not even matter, but you need to kinda let people know what you're trying to do. Otherwise, you might get answers that won't help you at all. I mean, I could tell you yes, you can have it save to a text file in a sub-folder in the game folder; that might not be what you're looking for though.


I apologize for not detailing my request more thoroughly. So first of all, as everyone knows I am currently developing a monster hunter like.  For now everything is perfect except for a few details on which
I am working on. I am asking for a lot of help in order to try to free some tasks I am struggling with. For this particular request, I am going to detail what I need, first RMX-OS uses an automatic backup system,
this backup system (see code below) uses if I understand correctly a sort container, which holds various information as for example (items, argents etc ..)
it also saves the precise location on a map (MAP_ID, X, Y) which later transmits it to the server which  wisely keeps it in the database. However, I refuse it to back up in anything else than the main map.
I'll give you an example:
The player1 in MAP 1 (Main Map) accept the quest and goes in his mission in MAP2 (secondary Map) If he gets disconnected or if he turns off the game or anything else, I want in any case the backup to not save on MAP2 (secondary Map) but on the MAP 1 (Main Map).
In summary, I would like it to only load in the MAP1 and not on any other map ..

Spoiler: ShowHide

    #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # Save Data
   # - see the documentation to learn how to set up which data is being saved
   #   by RMX-OS.
   #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   # save container variable definitions
   SAVE_CONTAINERS = [
       '$game_system',
       '$game_party',
       '$game_actors',
       '$game_map',
       '$game_player',
       'Graphics.frame_count'
   ]
   # general save data setup
   SAVE_DATA['Graphics.frame_count'] = []
   SAVE_DATA[Game_System] = ['@timer', '@timer_working', '@menu_disabled']
   SAVE_DATA[Game_Party] = ['@gold', '@steps', '@actors', '@items',
       '@weapons', '@armors']
   SAVE_DATA[Game_Actors] = ['@data']
   SAVE_DATA[Game_Map] = ['@map_id']
   SAVE_DATA[Game_Player] = ['@x', '@y', '@real_x', '@real_y',
       '@character_name', '@encounter_count']
   SAVE_DATA[Game_Actor] = ['@actor_id', '@name', '@character_name',
       '@character_hue', '@class_id', '@weapon_id', '@armor1_id',
       '@armor2_id', '@armor3_id', '@armor4_id', '@level', '@exp', '@skills',
       '@hp', '@sp', '@states', '@maxhp_plus', '@maxsp_plus', '@str_plus',
       '@dex_plus', '@agi_plus', '@int_plus']
   # for all classes that must have default arguments specified
   CREATION_DATA[Game_Actor] = '1'
 
 end


OR

Spoiler: ShowHide

  #----------------------------------------------------------------------------
 # Sets up the map data for a loaded game. In case the game of a newly
 # registered user, a new game will be started.
 #----------------------------------------------------------------------------
 def load_game
   # if game was loaded
   if $game_map.map_id != 0
     # setup map and player
     $game_map.setup($game_map.map_id)
     $game_player.center($game_player.x, $game_player.y)
   else
     # start a new game
     $game_party.setup_starting_members
     $game_map.setup($data_system.start_map_id)
     $game_player.moveto($data_system.start_x, $data_system.start_y)
   end
   # prepare everything for starting the game
   $game_party.refresh
   $game_player.refresh
   $game_map.autoplay
   $game_temp.entering_map = true
   $game_map.update
   $network.game_loaded = true
 end
..........________
....'/,-Y"............."~-.
..l.Y.......................^.
./\............................_\
i.................... ___/"...."\
|.................../"...."\ .....o!
l..................].......o !__../
.\..._..._.........\..___./......"~\
..X...\/...\.....................___./
.(. \.___......_.....--~~".....~`-.           
....`.Z,--........./.....................\
.......\__....(......../.........._____)
...........\.........l......../---~~" /
............Y.......\................../
............|........"x_____.^
............|.....................\
............j.....................Y

ForeverZer0

Would it not be possible to simply save the array of data into an existing game variable? I am not familiar with rmx-os, but this seems like a simple solution to me.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

KK20

March 16, 2015, 06:36:01 pm #4 Last Edit: March 16, 2015, 06:49:32 pm by KK20
That seemed easy enough. Give it a shot.

class Scene_Loading < Scene_Network

 # Map ID that will act as the main map for the player to always load to
 MAIN_MAP_ID = 1
 # Defines (x,y) map coordinate the player will start at on MAIN_MAP_ID
 START_X = 10
 START_Y = 7
 # If the player disconnected on these map IDs, they will load on that map and not be sent to MAIN_MAP_ID
 EXCLUDE_MAP_IDS = [1, 2, 3]

 #----------------------------------------------------------------------------
 # Sets up the map data for a loaded game. In case the game of a newly
 # registered user, a new game will be started.
 #----------------------------------------------------------------------------
 def load_game
   # if game was loaded
   if $game_map.map_id != 0
     # setup map and player
     if EXCLUDE_MAP_IDS.include?($game_map.map_id)
       $game_map.setup($game_map.map_id)
       $game_player.center($game_player.x, $game_player.y)
     else # Player will teleport to main map at default location
       $game_map.setup(MAIN_MAP_ID)
       $game_player.moveto(START_X, START_Y)
     end
   else
     # start a new game
     $game_party.setup_starting_members
     $game_map.setup($data_system.start_map_id)
     $game_player.moveto($data_system.start_x, $data_system.start_y)
   end
   # prepare everything for starting the game
   $game_party.refresh
   $game_player.refresh
   $game_map.autoplay
   $game_temp.entering_map = true
   $game_map.update
   $network.game_loaded = true
 end
end

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

R5GAMER

..........________
....'/,-Y"............."~-.
..l.Y.......................^.
./\............................_\
i.................... ___/"...."\
|.................../"...."\ .....o!
l..................].......o !__../
.\..._..._.........\..___./......"~\
..X...\/...\.....................___./
.(. \.___......_.....--~~".....~`-.           
....`.Z,--........./.....................\
.......\__....(......../.........._____)
...........\.........l......../---~~" /
............Y.......\................../
............|........"x_____.^
............|.....................\
............j.....................Y

KK20

Must be script placement. I'm assuming that none of those scripts listed in the error have anything to do with my code.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!