Post: #1little Edit of the cursor world map system of azrit

Hello folks. Since nobody is helping me in other forums Im in need to ask you... :( Im using the world map system of azrith007
http://www.mediafire.com/?tvbn3pjhvq4pdzb here you can download it
Its a system for selecting places in a world map.

I need a little edit on the cursor map system of azrith. (demo is above)
The script can only use a picture of 640x480. But I want someone to edit the script so that it is possible to use a picture of 1500x1500. Of course not every part of the picture should be seen on the screen. I also should be able to go beyond the screen borders, which is not possible in demo. For example if I usa a picture of 1500x1500 it is not possible ot go beyond the borders of the screen which should be.

I'll of course credit you
It was easy enough to make the background and icon move when the cursor was at the edge of the map. The map will always be at 0,0 when you open it. So I engineered a way to have the current selection centered.

*Also fixed a problem with the description display when it's too close to the top of the screen.
*added some notes to explain how to set locations as unlocked since that doesn't appear to be a functional.
otherwise set all the locations as 'true' and you shouldn't have any problems.

The only thing you need to input besides setting the locations is the map scrolling limitation. In the section with the up, down, left, right inputs (after line 50) I left a note next to a number to prevents the user from scrolling the map past a certain coordinate and off into infinity. I can only guess the scrolling down and right limitations for you map might be.
i.e you can scroll up until the top edge of the map (the map background's y coordinate) hits 240 (the center of the screen). You can change that to 0 if you don't want the top edge to leave the top of the screen, however this won't stop the centering mechanism from showing the map edges if the selected location is too close .

  1.  
  2.  
  3.  
  4. module LMAP
  5.  
  6.   #Map Graphic Name
  7.   Map_Name = "Map/map"
  8.  
  9.   #Cursor Info
  10.   Cursor_Name = "Map/selection"
  11.   #Max Number of frames in an animation
  12.   Frame_Count = 4
  13.   #Glowing Selection?(will fade in and out)
  14.   Glowing_Selection = true
  15.  
  16.   Locations = []
  17.   # Location.push([map_id, tele_x, tele_y, unlocked?, map_x, Map_y, Map_icon])
  18.   Locations.push([3, 5, 5, true, 360, 230, "move_05"])
  19.   Locations.push([2, 5, 5, true, 220, 340, "move_06"])
  20.   Locations.push([4, 5, 5, true, 320, 160, "move_07"])
  21.   Locations.push([1, 5, 5, true, 480, 160, "move_04"])
  22.   Locations.push([5, 5, 5, false, -20, 0, "move_03"])
  23.   Locations.push([1, 5, 5, false, 280, 200, "move_02"])
  24.   #To set a location as unlocked use the event command script and enter:
  25.   #     LMAP::Locations[*][3] = true
  26.   #     * is the Location's postion in the location array (the list above)
  27.   # Arrays start with 0. So to change the last location in this list to true
  28.   # you would enter: LMAP::Locations[5][3] = true
  29.   #
  30.   #If the player is on a map that isn't a listed location then the map cursor
  31.   #will appear in the the corner of the map.
  32.   #If the player is on a map that isn't unlocked then the icon will be invisible
  33.   #and not selectable but it will still be marked with the current location icon.
  34.   #
  35.   #If 2 locations share the same map id then the Current Location Icon will
  36.   #mark the last of the 2. Above there are two locations using map_id 1.
  37.   #There is currently no way for there to be 2 current location icons.
  38.  
  39.   Map_Info = {}
  40.   #Map_Info[map_id] = "Description"
  41.   # adding a \n will cause the text to break to the next line
  42.   # This includes The Location Description
  43.   Map_Info[1] = "This is a Castle"
  44.   Map_Info[2] = "This is an Oasis"
  45.   Map_Info[3] = "A rich forest, filled with herbs, \nand minerals alike. \nAs well as beasts."
  46.   Map_Info[4] = "Map 004 lol"
  47.   Map_Info[5] = "Tower"
  48.  
  49.  
  50. end
  51. #==============================================================================
  52. # ** Scene_ViewMap
  53. #------------------------------------------------------------------------------
  54. #  This class performs game end screen processing.
  55. #==============================================================================
  56.  
  57. class Scene_ViewMap
  58.   #--------------------------------------------------------------------------
  59.   # * Main Processing
  60.   #--------------------------------------------------------------------------
  61.   def main
  62.    
  63.     @speed = 8
  64.    
  65.     @back = Sprite.new
  66.     @back.bitmap = RPG::Cache.picture(LMAP::Map_Name)
  67.    
  68.    
  69.     # Make command window
  70.     @command_window = Window_Help.new
  71.     @command_window.x = 0
  72.     @command_window.y = 480-@command_window.height
  73.     @command_window.opacity = 0
  74.    
  75.     @map_help = Sprite.new
  76.     @map_help.bitmap = RPG::Cache.picture("Map/map_help")
  77.     @map_help.y = 98
  78.    
  79.     @map_description = Sprite.new
  80.     @map_description.bitmap = RPG::Cache.picture("Map/map_info")
  81.     @map_description.opacity = 0
  82.    
  83.     @map_desc = Window_Map_Description.new
  84.     @map_desc.opacity = 0
  85.     @map_desc.visible = false
  86.     @map_desc.z = 150
  87.     @map_description.z = @map_desc.z - 1
  88.    
  89.     @viewport1 = Viewport.new(0, 0, 640, 480)
  90.     @cursor = Map_Cursor.new(@viewport1)
  91.    
  92.    
  93.     @ico = []
  94.    
  95.     for i in 0...$game_system.locations.size
  96.     #if $game_system.unlocked?(i) == true
  97.       @ico[i] = Sprite.new
  98.       @ico[i].bitmap = RPG::Cache.icon("#{$game_system.loc_icon(i)}")
  99.       @ico[i].x = $game_system.cord(i, 0)
  100.       @ico[i].y = $game_system.cord(i, 1)
  101.       if $game_system.unlocked?(i) == false
  102.         @ico[i].visible = false
  103.       end
  104.       if $game_map.get_map == $game_system.map_id(i)
  105.         @cursor.x = @ico[i].x-8
  106.         @cursor.y = @ico[i].y+4
  107.         @cl = Sprite.new
  108.         @cl.bitmap = RPG::Cache.picture("Map/current_location")
  109.         @cl.x = @ico[i].x
  110.         @cl.y = @ico[i].y-24
  111.       end
  112.     #end
  113.   end
  114.     center_cursor_A
  115.     @index = 0
  116.     @snap = false
  117.     @float = false
  118.     @wait = 0
  119.     @ani_index = 0
  120.     # Execute transition
  121.     Graphics.transition
  122.     # Main loop
  123.     loop do
  124.       # Update game screen
  125.       Graphics.update
  126.       # Update input information
  127.       Input.update
  128.       # Frame Update
  129.       update
  130.       # Abort loop if screen is changed
  131.       if $scene != self
  132.         break
  133.       end
  134.     end
  135.     # Prepare for transition
  136.     Graphics.freeze
  137.     # Dispose of window
  138.     @command_window.dispose
  139.     @cursor.dispose
  140.     @map_help.dispose
  141.     @back.dispose
  142.     @map_desc.dispose
  143.     @cl.dispose if @cl != nil
  144.     @map_description.dispose
  145.     for i in @ico
  146.       if i != nil
  147.       i.dispose
  148.       end
  149.     end
  150.     # If switching to title screen
  151.     if $scene.is_a?(Scene_Title)
  152.       # Fade out screen
  153.       Graphics.transition
  154.       Graphics.freeze
  155.     end
  156.   end
  157.  
  158.   def center_cursor_A #Current location is centered on Open
  159.     xdist = 320 - @cursor.x
  160.     ydist = 240 - @cursor.y  
  161.     @cursor.x += xdist
  162.     @cursor.y += ydist
  163.     @back.x += xdist
  164.     @back.y += ydist
  165.     if @cl != nil
  166.       @cl.x += xdist
  167.       @cl.y += ydist
  168.     end
  169.     for i in [email hidden]
  170.       if $game_system.unlocked?(i) == true
  171.         @ico[i].x += xdist
  172.         @ico[i].y += ydist
  173.       end
  174.     end
  175.   end
  176.   def center_cursor_B #Scrolls map to snapped location
  177.     xdist = 320 - @cursor.x
  178.     ydist = 240 - @cursor.y
  179.     easing = 40
  180.     @cursor.x += xdist/easing
  181.     @cursor.y += ydist/easing
  182.     @back.x += xdist/easing
  183.     @back.y += ydist/easing
  184.     if @cl != nil
  185.       @cl.x += xdist/easing
  186.       @cl.y += ydist/easing
  187.     end
  188.     for i in [email hidden]
  189.       if $game_system.unlocked?(i) == true
  190.         @ico[i].x += xdist/easing
  191.         @ico[i].y += ydist/easing
  192.       end
  193.     end
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # * Frame Update
  197.   #--------------------------------------------------------------------------
  198.   def update
  199.     # Update command window
  200.     @command_window.update
  201.     @map_desc.update
  202.     @cursor.update
  203.     @cl.update if @cl != nil
  204.     @map_help.update
  205.     @map_description.update
  206.    
  207.     for i in [email hidden]
  208.      if $game_system.unlocked?(i) == true
  209.       if @cursor.x.between?(@ico[i].x-(@cursor.width/2), @ico[i].x+(@cursor.width/2)) and @cursor.y.between?(@ico[i].y-(@cursor.height/2), @ico[i].y+(@cursor.height/2))
  210.         @command_window.set_text("#{$game_map.list_name($game_system.map_id(i))}", 1)
  211.         if @snap == true
  212.           @index = i
  213.           @cursor.x = @ico[i].x-8
  214.           @cursor.y = @ico[i].y+4
  215.           center_cursor_B #eases cursor to center of screen
  216.           @map_help.opacity += 20
  217.           @map_desc.visible = true
  218.           @map_description.opacity += 20
  219.           @map_desc.x = @cursor.x - @map_desc.width
  220.           @map_desc.set_text("#{LMAP::Map_Info[$game_system.map_id(i)]}")
  221.           if @cursor.y >= 240
  222.             if @map_desc.y <= 480-@map_desc.height
  223.             @map_desc.y = @cursor.y - @map_desc.height/2
  224.             elsif @map_desc.y > 480-@map_desc.height
  225.             @map_desc.y = 480-@map_desc.height
  226.             end
  227.           else
  228.             if @map_desc.y >= 0
  229.             #@map_desc.y = @cursor.y - @map_desc.height/2
  230.             @map_desc.y = @map_desc.height/2 #fixed display
  231.             elsif @map_desc.y > 480-@map_desc.height
  232.             @map_desc.y = 0
  233.             end
  234.           end
  235.         @map_description.x = @map_desc.x+4
  236.         @map_description.y = @map_desc.y-32
  237.        
  238.         end
  239.       end
  240.      end
  241.     end
  242.    
  243.     if @wait < 5
  244.     @wait += 1
  245.   else
  246.     @float = !@float
  247.     @wait = 0
  248.   end
  249.    
  250.     if @float == true
  251.       @cl.y += 1 if @cl != nil
  252.     else
  253.       @cl.y -= 1 if @cl != nil
  254.     end
  255.    
  256.    
  257.  
  258.   if @cursor.y >= 240
  259.     @command_window.y = 0
  260.     @map_help.y = 98-415
  261.   elsif @cursor.y < 240
  262.     @command_window.y = 480-@command_window.height
  263.     @map_help.y = 98
  264.   end
  265.  
  266.   if @snap == false
  267.     @command_window.set_text("", 1)
  268.     @map_desc.visible = false
  269.   end
  270.  
  271.   if @map_desc.visible == false
  272.     @map_help.opacity -= 20
  273.     @map_description.opacity -= 20
  274.   end
  275.    
  276.  
  277.   if Input.press?(Input::UP) or Input.press?(Input::DOWN) or Input.press?(Input::LEFT) or Input.press?(Input::RIGHT)
  278.     @snap = false
  279.      else
  280.     @snap = true
  281.   end
  282.  
  283.   if Input.press?(Input::UP)
  284.     if @cursor.y >= 0
  285.       @cursor.y -= @speed
  286.     elsif @back.y <= 240  #top edge won't scroll past
  287.       @cursor.y += 1
  288.       @back.y += @speed
  289.       @cl.y += @speed if @cl != nil
  290.       for i in [email hidden]
  291.         if $game_system.unlocked?(i) == true
  292.         @ico[i].y += @speed
  293.         end
  294.       end
  295.     else
  296.       @cursor.y += 1
  297.     end
  298.    end
  299.    
  300.   if Input.press?(Input::DOWN)
  301.     if @cursor.y <= [email hidden]
  302.       @cursor.y += @speed
  303.     elsif @back.y >= -1500 #Top edge won't scroll past
  304.       @cursor.y -= 1
  305.       @back.y -= @speed
  306.       @cl.y -= @speed if @cl != nil
  307.       for i in [email hidden]
  308.         if $game_system.unlocked?(i) == true
  309.         @ico[i].y -= @speed
  310.         end
  311.       end
  312.     else
  313.       @cursor.y -= 1
  314.     end
  315.    end
  316.    
  317.   if Input.press?(Input::LEFT)
  318.     if @cursor.x >= 0
  319.       @cursor.x -= @speed
  320.     elsif @back.x <= 320 #Left edge won't scroll past
  321.       @cursor.x += 1
  322.       @back.x += @speed
  323.       @cl.x += @speed if @cl != nil
  324.       for i in [email hidden]
  325.         if $game_system.unlocked?(i) == true
  326.         @ico[i].x += @speed
  327.         end
  328.       end
  329.     else
  330.       @cursor.x += 1
  331.     end
  332.    end
  333.  
  334.   if Input.press?(Input::RIGHT)
  335.     if @cursor.x <= [email hidden]
  336.       @cursor.x += @speed
  337.     elsif @back.x >= -1500 #Left edge won't scroll past
  338.       @cursor.x -= 1
  339.       @back.x -= @speed
  340.       @cl.x -= @speed if @cl != nil
  341.       for i in [email hidden]
  342.         if $game_system.unlocked?(i) == true
  343.         @ico[i].x -= @speed
  344.         end
  345.       end
  346.       @cursor.x -= 1      
  347.     end
  348.    end
  349.    
  350.     # If B button was pressed
  351.     if Input.trigger?(Input::B)
  352.       # Play cancel SE
  353.       $game_system.se_play($data_system.cancel_se)
  354.       # Switch to menu screen
  355.       $scene = Scene_Menu.new(5)
  356.       return
  357.     end
  358.    
  359.     # If C button was pressed
  360.     if Input.trigger?(Input::C)
  361.      
  362.        if $game_system.unlocked?(@index) == true
  363.         $game_system.se_play($data_system.escape_se)
  364.         $game_temp.player_new_map_id = $game_system.map_id(@index)
  365.         $game_temp.player_new_x = $game_system.tele_cords(@index)[0]
  366.         $game_temp.player_new_y = $game_system.tele_cords(@index)[1]
  367.         $game_temp.player_new_direction = 2
  368.         $game_temp.player_transferring = true
  369.         $game_map.setup($game_temp.player_new_map_id)
  370.         # Set up player position
  371.         $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  372.         # Set player direction
  373.         case $game_temp.player_new_direction
  374.         when 2  # down
  375.           $game_player.turn_down
  376.         when 4  # left
  377.           $game_player.turn_left
  378.         when 6  # right
  379.           $game_player.turn_right
  380.         when 8  # up
  381.           $game_player.turn_up
  382.         end
  383.         # Straighten player position
  384.         $game_player.straighten
  385.         $scene = Scene_Map.new
  386.         end
  387.      
  388.       return
  389.     end
  390.    
  391.   end
  392. end
  393.  
  394.  
  395. #==============================================================================
  396. # ** Game_System_EDIT
  397. #------------------------------------------------------------------------------
  398. #  This class handles data surrounding the system. Backround music, etc.
  399. #  is managed here as well. Refer to "$game_system" for the instance of
  400. #  this class.
  401. #==============================================================================
  402.  
  403. class Game_System
  404.   #--------------------------------------------------------------------------
  405.   # * Public Instance Variables
  406.   #--------------------------------------------------------------------------
  407.   attr_accessor :locations
  408.   alias map_ini_sys initialize
  409.   #--------------------------------------------------------------------------
  410.   # * Object Initialization
  411.   #--------------------------------------------------------------------------
  412.   def initialize
  413.     map_ini_sys
  414.     @locations = []
  415.     for i in 0...LMAP::Locations.size
  416.       @locations.push(LMAP::Locations[i])
  417.     end
  418.   end
  419.  
  420.   def map_id(n)
  421.     return @locations[n][0]
  422.   end
  423.  
  424.   def add_location(n)
  425.     return @locations[n][3] = true
  426.   end
  427.  
  428.   def remove_location(n)
  429.     return @locations[n][3] = false
  430.   end
  431.  
  432.   def cord(n, v)
  433.     return @locations[n][4+v]
  434.   end
  435.  
  436.   def tele_cords(n)
  437.     return [@locations[n][1], @locations[n][2]]
  438.   end
  439.  
  440.   def loc_icon(n)
  441.     return @locations[n][6]
  442.   end
  443.  
  444.   def unlocked?(n)
  445.     if @locations[n][3] == true
  446.       return true
  447.     elsif @locations[n][3] == false
  448.       return false
  449.     end
  450.   end
  451.  
  452. end
  453.  
  454. #===================================================
  455. # Game Map Edit
  456. #===================================================
  457. class Game_Map
  458.  def name
  459.    $map_infos[@map_id]
  460.  end
  461.  
  462.  def get_map
  463.    return @map_id
  464. end
  465.  
  466.  def list_name(n)
  467.    $map_infos[n]
  468.  end
  469. end
  470.  
  471. class Scene_Title
  472.    $map_infos = load_data("Data/MapInfos.rxdata")
  473.    for key in $map_infos.keys
  474.      $map_infos[key] = $map_infos[key].name
  475.    end
  476. end
  477.  
  478.  
  479. #==============================================================================
  480. # ** Map_Cursor
  481. #------------------------------------------------------------------------------
  482. #  This sprite is used to display the cursor for the world map.
  483. #==============================================================================
  484.  
  485. class Map_Cursor < RPG::Sprite
  486.   #--------------------------------------------------------------------------
  487.   # * Public Instance Variables
  488.   #--------------------------------------------------------------------------
  489.   #--------------------------------------------------------------------------
  490.   # * Object Initialization
  491.   #     viewport  : viewport
  492.   #     character : character (Game_Character)
  493.   #--------------------------------------------------------------------------
  494.   def initialize(viewport)
  495.     super(viewport)
  496.    
  497.     @frame = 0
  498.     @wait = 0
  499.     @frame_count = LMAP::Frame_Count
  500.     @glow = false
  501.     update
  502.   end
  503.  
  504.   def height
  505.     return @ch
  506.   end
  507.  
  508.   def width
  509.     return @cw
  510.   end
  511.  
  512.   #--------------------------------------------------------------------------
  513.   # * Frame Update
  514.   #--------------------------------------------------------------------------
  515.   def update
  516.     super
  517.    
  518.     if @wait < 2
  519.       @wait += 1
  520.     else
  521.       @wait = 0
  522.       @frame += 1 if @frame < @frame_count
  523.       @frame = 0 if @frame >= @frame_count
  524.     end
  525.    
  526.     if LMAP::Glowing_Selection == true
  527.       if @glow == false
  528.         self.opacity -= 5 if self.opacity > 120
  529.         @glow = true if self.opacity <= 120
  530.       else
  531.         self.opacity += 5
  532.         @glow = false if self.opacity >= 255
  533.       end      
  534.     end
  535.    
  536.     # Remember tile ID, file name, and hue
  537.     self.bitmap = RPG::Cache.picture(LMAP::Cursor_Name)
  538.     @cw = bitmap.width / @frame_count
  539.     @ch = bitmap.height
  540.     self.ox = 0
  541.     self.oy = 0
  542.     self.src_rect.set(0+@cw*@frame, 0, @cw, @ch)
  543.     # Set visible situation
  544.     self.visible = true
  545.     # Set sprite coordinates
  546.     self.z = 120
  547.     # Set opacity level, blend method, and bush depth
  548.     self.blend_type = 0
  549.     self.bush_depth = 0
  550.   end
  551. end
  552.  
  553. #==============================================================================
  554. # ** Window_Map_Description
  555. #------------------------------------------------------------------------------
  556. #  This window shows skill and item explanations along with actor status.
  557. #==============================================================================
  558.  
  559. class Window_Map_Description < Window_Base
  560.   #--------------------------------------------------------------------------
  561.   # * Object Initialization
  562.   #--------------------------------------------------------------------------
  563.   def initialize
  564.     super(0, 0, 200, 200)
  565.     self.contents = Bitmap.new(width-32, height - 32)
  566.   end
  567.   #--------------------------------------------------------------------------
  568.   # * Set Text
  569.   #  text  : text string displayed in window
  570.   #  align : alignment (0..flush left, 1..center, 2..flush right)
  571.   #--------------------------------------------------------------------------
  572.   def set_text(text, align = 0, color = normal_color)
  573.     # If at least one part of text and alignment differ from last time
  574.     if text != @text or align != @align
  575.       # Redraw text
  576.      
  577.      
  578.     self.contents.clear
  579.     self.contents.font.color = color
  580.     self.contents.font.size = 15
  581.     x = y = 0
  582.     @cursor_width = 0
  583.     # Indent if choice
  584.     if $game_temp.choice_start == 0
  585.       x = 8
  586.     end
  587.       # Control text processing
  588.  
  589.       # Get 1 text character in c (loop until unable to get text)
  590.       while ((c = text.slice!(/./m)) != nil)
  591.         # If \\
  592.         if c == "\000"
  593.           # Return to original text
  594.           c = "\\"
  595.         end
  596.         # If new line text
  597.         if c == "\n"
  598.           # Update cursor width if choice
  599.           if y >= $game_temp.choice_start
  600.             @cursor_width = [@cursor_width, x].max
  601.           end
  602.           # Add 1 to y
  603.           y += 1
  604.           x = 0
  605.           # Indent if choice
  606.           if y >= $game_temp.choice_start
  607.             x = 8
  608.           end
  609.           # go to next text
  610.           next
  611.         end
  612.         # Draw text
  613.         self.contents.draw_text(4 + x, self.contents.font.size * y, 40, self.contents.font.size, c)
  614.         # Add x to drawn text width
  615.         x += self.contents.text_size(c).width
  616.       end
  617.       @text = text
  618.       @align = align
  619.     end
  620.     self.visible = true
  621.   end
  622. end
  623.  
Expand to see the code.
First of all let me thank you for your great work.


I have two problems left yet.

1. If I open the scene map you can still see the black background but I only want to see the map itself not also the black background. You can even go beyond the map which should not be possible.
Pictures: Image
Or:
http://www.directupload.net/file/d/3725 ... ke_png.htm

2. I really didint understood the unlock location command.
Can you explain me what does the
  1. LMAP::Locations[5][3] = true
Expand to see the code.
5 and the 3 in this code stands for? Especially the 3 because you didint do so in your instructions. I'd like to know that.
But thank you really much so far and in advance.
keep it up!
1. Right, you'll have to set a limit. Something like scroll if @back.x >= -(1500 - 640). But you'll need a margin of error because it's moving at a variable rate. So you can stop it from moving after a certain point but it's possible it'll already be a few pixels too far when it stops. And like I said I've added an automatic centering, so keep locations away from the boarders. Or add a stylish trim if you can't help it.
edit: I suppose I could have it rebound if it goes past it's borders but this was only suppose to be a simple edit.

2.The locations are pushed into an array: Locations = [A,B,C,D]. And each one is it's own array of data so A represents [ID,X,Y,false,blah, blah]
So if you wanted to set A as unlocked you'd need to refer to it's location index in the array, and then the position index of the item inside that that you want to change. This would be a lot easier to explain if it was a hash instead of an array but I didn't create it.
So basically it would look like this
[ [#,#,#,false,#], [#,#,#,false,#], [#,#,#,false,#] ]
LMAP::Locations[0][3] = true
Or talk it backwards "Set true index 3 of index 0 in locations "
Okay I understood the unlock method now. Thanks so far :))

But let me return to the black borders. Im reallya newbie on script and I dont trust myself to edit a script on my own...
Can't you just edit the script like you did before and post it? If I edit the script I'll ruin it anyway.

EDIT:

I managed to edit it on my own:

do you think this is right? And will it have a effect on the location system??

  1. if Input.press?(Input::UP)
  2.     if @cursor.y >= 0
  3.       @cursor.y -= @speed
  4.     elsif @back.y <= -1  #top edge won't scroll past
  5.       @cursor.y += 1
  6.       @back.y += @speed
  7.       @cl.y += @speed if @cl != nil
  8.       for i in [email hidden]
  9.         if $game_system.unlocked?(i) == true
  10.         @ico[i].y += @speed
  11.         end
  12.       end
  13.     else
  14.       @cursor.y += 1
  15.     end
  16.    end
  17.    
  18.   if Input.press?(Input::DOWN)
  19.     if @cursor.y <= [email hidden]
  20.       @cursor.y += @speed
  21.     elsif @back.y >= -1010 #Top edge won't scroll past
  22.       @cursor.y -= 1
  23.       @back.y -= @speed
  24.       @cl.y -= @speed if @cl != nil
  25.       for i in [email hidden]
  26.         if $game_system.unlocked?(i) == true
  27.         @ico[i].y -= @speed
  28.         end
  29.       end
  30.     else
  31.       @cursor.y -= 1
  32.     end
  33.    end
  34.    
  35.   if Input.press?(Input::LEFT)
  36.     if @cursor.x >= 0
  37.       @cursor.x -= @speed
  38.     elsif @back.x <= -5 #Left edge won't scroll past
  39.       @cursor.x += 1
  40.       @back.x += @speed
  41.       @cl.x += @speed if @cl != nil
  42.       for i in [email hidden]
  43.         if $game_system.unlocked?(i) == true
  44.         @ico[i].x += @speed
  45.         end
  46.       end
  47.     else
  48.       @cursor.x += 1
  49.     end
  50.    end
  51.  
  52.   if Input.press?(Input::RIGHT)
  53.     if @cursor.x <= [email hidden]
  54.       @cursor.x += @speed
  55.     elsif @back.x >= -855 #Left edge won't scroll past
  56.       @cursor.x -= 1
  57.       @back.x -= @speed
  58.       @cl.x -= @speed if @cl != nil
  59.       for i in [email hidden]
  60.         if $game_system.unlocked?(i) == true
  61.         @ico[i].x -= @speed
  62.         end
  63.       end
  64.       @cursor.x -= 1      
  65.     end
  66.    end
Expand to see the code.
Btw. what do I need to change if I want to you a picture of 1600x1600 map of instead 1500x1500.

Do I need to change some of the settings?
After line 286 is where the arrow inputs are.
There are conditions that will stop the map from scrolling past a certain point.
pressing "up" moves everything down; increasing the Y coordinate
elsif @back.y <= 240 #top edge won't scroll past
Try replacing 240 with 0

pressed down moves everything up on screen. Decreasing the Y coordinate into a negative range.
elsif @back.y >= -1010 #Top edge won't scroll past
Try using -1120 (thats -1600 would put it off screen so add the screen height 480)

pressing left moves everything right. X coordiants
elsif @back.x <= -5 #Left edge won't scroll past
try 0

pressing right moves everything left into the negative X range
elsif @back.x >= -855 #Left edge won't scroll past
try -960 (thats -1600 + the screen width 640)

edit: But other then that. No, I don't think you'll need to change anything. It'll draw the whole picture regardless of it's size.
Sorry to disturb you once again but I found a bug which makes me not able to use this script like it should be.

After a game is loaded new locations won't show up even if they are added withhin the script call after the loading....
LMAP::Locations[1][3] = true

The Game only shows new locations if they are added within a normal game. But when I load a game which I saved before and I add locations these won't show up.

Any Ideas to fix that?
I'm not sure I understand. Are you specifying the correct location number?
  1.  Locations = []
  2.   # Location.push([map_id, tele_x, tele_y, unlocked?, map_x, Map_y, Map_icon])
  3.   Locations.push([3, 5, 5, true, 360, 230, "move_05"])
  4.   Locations.push([2, 5, 5, true, 220, 340, "move_06"])
  5.   Locations.push([4, 5, 5, true, 320, 160, "move_07"])
  6.   Locations.push([1, 5, 5, true, 480, 160, "move_04"])
  7.   Locations.push([5, 5, 5, false, -20, 0, "move_03"])
  8.   Locations.push([1, 5, 5, false, 280, 200, "move_02"])
Expand to see the code.


remember the locations are set in an array, so they are numbered starting at 0.
5 and 6 in this list are locked. So the line
LMAP::Locations[6][3] = true
LMAP::Locations[7][3] = true
would unlock them. It stays unlocked after you save and will stay that way unless you locked it "= false". But it sounds like you want a location to be unlocked across all save files. That doesn't make sense. That'd be like finding an end-game item, saving, then loading an earlier save at the beginning of the game and expecting it to still be in your inventory. It doesn't work like that, save files are separate.
ok. ok. I think I see what you're saying now.
You created more locations in the script. But you're old save file doesn't know that. It's just like if the player was Fighter01, you saved. Then you went into the database and changed the sprite to Figher02. It'll still be using Fighter01 when you load the game again.

This is why you should regularly start fresh with a new save. You're going miss all sorts of bugs if you keep playing with the same old save file. Haha, trust me. I've worked with guys who don't realize how broken their game is because they used the same save file for like a year.
I also thought about that but it cannot be true because I started a new game and saved it.
After I loaded it I used add more locations thru the call script I mean not the main scripts. But they didint show up in the world map.
It seems like loaded games cant add another locations which makes it not useable :((

ps. You can try it in your own: Make a new game and save it. Afterwards Load the file and try to unlock some locations with a callscript. They won't show up. They only show up when the game is started regular without loading a file. But WHEN you load a file and try to unlock locations it won't work. Thats my problem.

Edit: I've prepared a demo for you.
first talk to basil and look at the map. Don't talk to the guy next to him because hes the who who can unlock locations. Then save it and close it. Now load it and talk to the other guy. Normally he would unlock a location but due the fact that you loaded the file the new locations won't show up...

Now start the game normal and talk to the other guy and now to basil and the location will be unlocked. Unlocking locations doesnt work once you loaded a game. thats my problem.

demo link with your edited script
Azrith cursor map coyotecraft.rar
I figured it out. There are 2 location lists. Locations and @locations. @locations being the list the game works with.
I didn't see this before, but there was a method to unlock/lock a location.

The script call you should be using is. $game_system.add_location(n)
n being the location number. You can hide it using $game_system.remove_location(n)

^It basically does the same thing I had you doing before except it targets the other location list.
You should correct the instructions I wrote. In case you forget or pass it on to someone else.
Thank you very much I've some question left so far:

1. So basicly both do the same thing? Do I need to use both commands in order to unlock a location or only the last command?
2. So if I want to unlock this location here: LMAP::Locations[1][3] = true
I would need to use $game_system.add_location(1) right?
Just use
$game_system.add_location(n)

But remember, if there were 8 locations when you saved. And you create 2 more while editing you'll have to make a new save file. That old save file will only remember 8 locations.
I would rewrite the whole thing to be more dynamic. But that would be too much work for a minor inconvenience.
Allow me to ask a question again.

Everything works fine so far. But theres one probem left.

The picture/window where the name of the current location is shown overlaps with the icons of the locations activated. Normally the Icons of the locations should be under the window where the location name is shown. I hope you got my point.. :))
Can you fix that?
I think I understand.
You need to set a z coordinate. That title bar is made of 2 parts, the graphic and the text.
Add
@map_help.z = 140
@command_window.z = 150

under line 88. There should be other Z settings for Map descriptions. Just plug it in there. That should keep the title bar above the icons.
I put both below line 88 and I get an error whenever I open the worldmap system.

  1. def main
  2.    
  3.     @speed = 8
  4.     @map_help.z = 140   #newadding
  5.     @command_window.z = 150 #newadding
Expand to see the code.



http://www.directupload.net/file/d/3824 ... gs_png.htm
like this
Image
Hey coyotecraft, I wanted to say thanks for being so helpful! It's community members like you that keep me coming here. I was also having difficulties adding locations with this script until I read your posts. One error that I can't seem to work around, is that the order in which locations are added can cause the script to crash.
Quote:
Locations = []
  # Location.push([map_id, tele_x, tele_y, unlocked?, map_x, Map_y, Map_icon])
  Locations.push([1, 5, 5, false, 360, 230, "move_05"]) #Map A
  Locations.push([2, 5, 5, false, 220, 340, "move_06"]) #Map B
  Locations.push([3, 5, 5, false, 320, 160, "move_07"]) #Map C

For example, all three locations are locked by default when the game loads, which works fine. However, if location B is unlocked and added to the map before location A is unlocked and added, then the script gives this error:

Quote:
line 175: NoMethodError occurred.
undefined method 'x' for nil:NilClass

(I just realized 175 will be different lines depending on the # of locations, but here's the line it was referencing:
  1. if @cursor.x.between?(@ico[i].x-(@cursor.width/2), @ico[i].x+(@cursor.width/2)) and @cursor.y.between?(@ico[i].y-(@cursor.height/2), @ico[i].y+(@cursor.height/2))
Expand to see the code.



I know you've stated that this isn't exactly efficiently scripted, but do you think there's any work around to solve this problem? The way it is now, it'd work fine in a game with linear progression, but in an open world game this script wouldn't function properly. Thanks in advance!
hmmm. I can't replicate the problem.
Are you using this to add locations?
$game_system.add_location(n)

That line error is in a loop in the update method
for i in 0...@ ico.size
meaning for each location, "i", it checks if the cursor is close enough to snap to a location icon. But the no method error suggest that one of the locations doesn't have an X coordinate for the cursor to snap to. Or maybe it's trying to snap to a location that's not unlocked and therefore not on the map. I sorta recall fixing that but I can't remember what all I changed.

My update method might look different then yours. Tell me, does the line above 175 have
if $game_system.unlocked?(i) == true
No, my script didn't have that line, but I've added that and it seems to have solved the issue. The script ended up crashing again when the map was closed, so I also had to add
Quote:
if $game_system.unlocked?(i) == true
right above
Quote:
ico.dispose
After that, everything things worked fine, you solved my problem. Thanks so much for the help, I really appreciate it.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=78404