Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: R5GAMER on March 13, 2015, 12:34:18 pm

Title: [Solved] RMX-OS -> Save MAP[map_id, X,Y]
Post by: R5GAMER on March 13, 2015, 12:34:18 pm
Hello!!

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

[map_id] + [x,y]
Title: Re: RMX-OS -> Save MAP[map_id, X,Y]
Post by: 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.
Title: Re: RMX-OS -> Save MAP[map_id, X,Y]
Post by: R5GAMER on March 16, 2015, 09:26:04 am
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
Title: Re: RMX-OS -> Save MAP[map_id, X,Y]
Post by: ForeverZer0 on March 16, 2015, 04:39:23 pm
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.
Title: Re: RMX-OS -> Save MAP[map_id, X,Y]
Post by: KK20 on March 16, 2015, 06:36:01 pm
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
Title: Re: RMX-OS -> Save MAP[map_id, X,Y]
Post by: R5GAMER on March 16, 2015, 09:15:21 pm
i have this error ..

(http://gohproject.free.fr/fzefzefzq.png)
Title: Re: RMX-OS -> Save MAP[map_id, X,Y]
Post by: KK20 on March 16, 2015, 09:29:46 pm
Must be script placement. I'm assuming that none of those scripts listed in the error have anything to do with my code.