Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=======================================================
- # Lune World Map (Templeton Map Mod)
- # Original Author: Raizen
- # Modifications: William Couillard (cooliebk18@yahoo.com)
- # Contact: www.centrorpg.com
- # Compatibility: RMVXAce
- #=======================================================
- # Adds a world map to your game, to be viewed.
- # Call Script: SceneManager.call(Scene_Templeton_Map)
- #=======================================================
- module MAPVOCAB
- SHOP_TITLE = "Shopping" # Title of Shops Window
- SHOP1_NAME = "Inn" # Name of Shop #1
- SHOP2_NAME = "Item Shop" # Name of Shop #2
- SHOP3_NAME = "Weapons" # Name of Shop #3
- SHOP4_NAME = "Armor" # Name of Shop #4
- SHOP5_NAME = "Accessory" # Name of Shop #5
- SHOP6_NAME = "Magic" # Name of Shop #6
- SHOP7_NAME = "Synthesis" # Name of Shop #7
- end
- #============================================================================
- module Templeton_Map
- # World Map Filename
- Map_Name = "TempletonMap"
- # Cursor Filename
- Map_Cursor = "Cursor2"
- # Cursor's X offset
- Cursor_X = 24
- # Cursor's Y offset
- Cursor_Y = -6
- Map_Info = Array.new
- # Create locations on your world map below using these instructions
- # "Name" => 'Map Image Name', (The filename of the map image )
- # "Switch" => Switch ID, (ID of the switch used to unlock location)
- # "Position" => [X, Y], (Position of location icon on world map )
- # "Icon" => 'Map Icon', (Filename of map location icon )
- # "Desc" => 'Description', (Line 1 of map description )
- # "Desc2" => 'Description' (Line 2 of map description )
- # "Shop1" => true/false, (Shows SHOP1 as either true or false )
- # "Shop2" => true/false, (Shows SHOP2 as either true or false )
- # "Shop3" => true/false, (Shows SHOP3 as either true or false )
- # "Shop4" => true/false, (Shows SHOP4 as either true or false )
- # "Shop5" => true/false, (Shows SHOP5 as either true or false )
- # "Shop6" => true/false, (Shows SHOP6 as either true or false )
- # "Shop7" => true/false (Shows SHOP7 as either true or false )
- #=========================================================================
- # Map_Info[0]
- #=========================================================================
- Map_Info[0] =
- {
- "Name" => 'Home Village',
- "Switch" => 1,
- "Position" => [206, 315],
- "Icon" => 'MapMarker',
- "Desc" => 'This is your hometown.',
- "Desc2" => 'Nothing cool ever happens here.',
- "Shop1" => true, # Inn
- "Shop2" => true, # Item Shop
- "Shop3" => true, # Weapons Shop
- "Shop4" => true, # Armor Shop
- "Shop5" => true, # Accessories Shop
- "Shop6" => false, # Magic Shop
- "Shop7" => false # Synthesis Shop
- }
- #=========================================================================
- # Map_Info[1]
- #=========================================================================
- Map_Info[1] =
- {
- "Name" => 'Training Cave',
- "Switch" => 1,
- "Position" => [220, 323],
- "Icon" => 'MapMarker',
- "Desc" => 'This is where everyone goes to train.',
- "Desc2" => 'It\'s full of weak slimes.',
- "Shop1" => false, # Inn
- "Shop2" => false, # Item Shop
- "Shop3" => false, # Weapons Shop
- "Shop4" => false, # Armor Shop
- "Shop5" => false, # Accessories Shop
- "Shop6" => false, # Magic Shop
- "Shop7" => false # Synthesis Shop
- }
- #===========================================================================
- # End of script
- #===========================================================================
- end
- #===========================================================================
- # Cache Module
- #===========================================================================
- module Cache
- #--------------------------------------------------------------------------
- # * Cache
- #--------------------------------------------------------------------------
- def self.world_map(filename)
- load_bitmap("Graphics/World Map/", filename)
- end
- end
- #==============================================================================
- # ** Scene_Templeton_Map
- #==============================================================================
- class Scene_Templeton_Map < Scene_ItemBase
- #--------------------------------------------------------------------------
- # * start
- #--------------------------------------------------------------------------
- def start
- super
- @get_index = 0
- $templeton_map_info = Array.new
- Templeton_Map::Map_Info.each {|map| $templeton_map_info.push(map) if $game_switches[map['Switch']]}
- create_category_window
- create_map_window
- create_shop_window
- end
- #--------------------------------------------------------------------------
- # * create_category_window
- #--------------------------------------------------------------------------
- def create_category_window
- @help_window = Window_Help_MapT.new
- @help_window.viewport = @viewport
- @category_window = Window_MapListT.new
- @category_window.viewport = @viewport
- @category_window.y = @help_window.height
- @help_window.z = @category_window.z = 400
- @category_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # * create_map_window
- #--------------------------------------------------------------------------
- def create_map_window
- @item_window = Window_ShowMapT.new
- @item_window.viewport = @viewport
- @category_window.item_window = @item_window
- end
- #--------------------------------------------------------------------------
- # * create_shop_window
- #--------------------------------------------------------------------------
- def create_shop_window
- @shop_window = Window_ShowShopsT.new
- @shop_window.viewport = @viewport
- @shop_window.z = 400
- @shop_window.y = @help_window.height + @category_window.height
- end
- #--------------------------------------------------------------------------
- # * update
- #--------------------------------------------------------------------------
- def update
- super
- @item_window.refresh(@category_window.index) unless $templeton_map_info == []
- @help_window.refresh(@category_window.index) unless $templeton_map_info == []
- @shop_window.refresh(@category_window.index) unless $templeton_map_info == []
- end
- #--------------------------------------------------------------------------
- # * Category [Confirm]
- #--------------------------------------------------------------------------
- def on_category_ok
- @item_window.activate
- @item_window.select_last
- end
- #--------------------------------------------------------------------------
- # * Item [Confirm]
- #--------------------------------------------------------------------------
- def on_item_ok
- $game_party.last_item.object = item
- determine_item
- end
- #--------------------------------------------------------------------------
- # * Item [Cancel]
- #--------------------------------------------------------------------------
- def on_item_cancel
- @item_window.unselect
- @category_window.activate
- end
- #--------------------------------------------------------------------------
- # * play_se_for_item
- #--------------------------------------------------------------------------
- def play_se_for_item
- Sound.play_use_item
- end
- #--------------------------------------------------------------------------
- # * use_item
- #--------------------------------------------------------------------------
- def use_item
- super
- @item_window.redraw_current_item
- end
- def terminate
- super
- @shop_window.dispose
- @help_window.dispose
- @item_window.dispose
- @category_window.dispose
- end
- end
- #==============================================================================
- # ** Window_MapListT
- #==============================================================================
- class Window_MapListT < Window_Command
- include Templeton_Map
- #--------------------------------------------------------------------------
- # * Public instance variables
- #--------------------------------------------------------------------------
- attr_reader :item_window
- #--------------------------------------------------------------------------
- # * initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0)
- end
- #--------------------------------------------------------------------------
- # * window_width
- #--------------------------------------------------------------------------
- def window_width
- 256
- end
- def window_height
- Graphics.height - fitting_height(2) - fitting_height(5)
- end
- #--------------------------------------------------------------------------
- # * process_ok
- #--------------------------------------------------------------------------
- def process_ok
- if current_item_enabled?
- Sound.play_ok
- Input.update
- deactivate
- call_ok_handler
- else
- Sound.play_buzzer
- end
- end
- #--------------------------------------------------------------------------
- # * col_max
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # * update
- #--------------------------------------------------------------------------
- def update
- super
- end
- #--------------------------------------------------------------------------
- # * make_command_list
- #--------------------------------------------------------------------------
- def make_command_list
- for i in 0...$templeton_map_info.length
- command = $templeton_map_info[i]['Name']
- add_command(command, nil)
- end
- end
- #--------------------------------------------------------------------------
- # * item_window
- #--------------------------------------------------------------------------
- def item_window=(item_window)
- @item_window = item_window
- update
- end
- end
- #==============================================================================
- # ** Window_ShowShopsT
- #==============================================================================
- class Window_ShowShopsT < Window_Base
- include Templeton_Map
- #--------------------------------------------------------------------------
- # * Object initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, window_width, window_height)
- end
- #--------------------------------------------------------------------------
- # * window_width
- #--------------------------------------------------------------------------
- def window_width
- 256
- end
- #--------------------------------------------------------------------------
- # * window_height
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height - 272
- end
- #--------------------------------------------------------------------------
- # * disabled_color
- #--------------------------------------------------------------------------
- def disabled_color
- text_color(7)
- end
- #--------------------------------------------------------------------------
- # * refresh
- #--------------------------------------------------------------------------
- def refresh(index)
- unless index == nil
- self.contents.clear
- change_color(system_color)
- draw_text(0, 24 * 0, Graphics.width, 24, MAPVOCAB::SHOP_TITLE, 0)
- change_color(normal_color)
- if $templeton_map_info[index]['Shop1'] == true
- change_color(normal_color)
- draw_text(0, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP1_NAME, 0)
- else
- change_color(disabled_color)
- draw_text(0, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP1_NAME, 0)
- end
- if $templeton_map_info[index]['Shop2'] == true
- change_color(normal_color)
- draw_text(window_width / 2, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP2_NAME, 0)
- else
- change_color(disabled_color)
- draw_text(window_width / 2, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP2_NAME, 0)
- end
- if $templeton_map_info[index]['Shop3'] == true
- change_color(normal_color)
- draw_text(0, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP3_NAME, 0)
- else
- change_color(disabled_color)
- draw_text(0, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP3_NAME, 0)
- end
- if $templeton_map_info[index]['Shop4'] == true
- change_color(normal_color)
- draw_text(window_width / 2, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP4_NAME, 0)
- else
- change_color(disabled_color)
- draw_text(window_width / 2, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP4_NAME, 0)
- end
- if $templeton_map_info[index]['Shop5'] == true
- change_color(normal_color)
- draw_text(0, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP5_NAME, 0)
- else
- change_color(disabled_color)
- draw_text(0, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP5_NAME, 0)
- end
- if $templeton_map_info[index]['Shop6'] == true
- change_color(normal_color)
- draw_text(window_width / 2, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP6_NAME, 0)
- else
- change_color(disabled_color)
- draw_text(window_width / 2, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP6_NAME, 0)
- end
- if $templeton_map_info[index]['Shop7'] == true
- change_color(normal_color)
- draw_text(0, 24 * 4, window_width - 24, 24, MAPVOCAB::SHOP7_NAME, 0)
- else
- change_color(disabled_color)
- draw_text(0, 24 * 4, window_width - 24, 24, MAPVOCAB::SHOP7_NAME, 0)
- end
- end
- end
- end
- #==============================================================================
- # ** Window_ShowMapT
- #==============================================================================
- class Window_ShowMapT < Window_Base
- include Templeton_Map
- #--------------------------------------------------------------------------
- # * Object initialization
- #--------------------------------------------------------------------------
- def initialize
- super(256, fitting_height(2) - 12, window_width, window_height)
- self.opacity = 0
- @x = 0
- @y = 0
- @nx = 0
- @ny = 0
- @cursor = Sprite.new
- @cursor.bitmap = Cache.world_map(Map_Cursor)
- @icon = Sprite.new
- @icon.z = 201
- @cursor.z = 200
- @bitmap = Cache.world_map(Map_Name)
- refresh(0) unless $templeton_map_info == []
- end
- def draw_horz_line(y)
- line_y = y + line_height / 2 - 1
- contents.fill_rect(0, line_y, contents_width, 2, line_color)
- end
- #--------------------------------------------------------------------------
- # * window_width
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width - 256
- end
- #--------------------------------------------------------------------------
- # * window_height
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height - fitting_height(2) + 24
- end
- #--------------------------------------------------------------------------
- # * line_color
- #--------------------------------------------------------------------------
- def line_color
- color = normal_color
- color.alpha = 48
- color
- end
- #--------------------------------------------------------------------------
- # * refresh
- #--------------------------------------------------------------------------
- def refresh(index)
- self.contents.clear
- @x += 10 if @x <= $templeton_map_info[index]['Position'][0] - window_width/2
- @x -= 10 if @x >= $templeton_map_info[index]['Position'][0] - window_width/2
- @y += 10 if @y <= $templeton_map_info[index]['Position'][1] - window_height/2
- @y -= 10 if @y >= $templeton_map_info[index]['Position'][1] - window_height/2
- @cursor.x = @x + 126 + Cursor_X - @nx + window_width/2
- @cursor.y = @y + fitting_height(2) + 24 + Cursor_Y - @ny + window_height/2
- unless @index == index
- @index = index
- @icon.bitmap = Cache.world_map($templeton_map_info[index]['Icon'])
- end
- @icon.x = $templeton_map_info[index]['Position'][0] + 160 - @nx
- @icon.y = $templeton_map_info[index]['Position'][1] + 80 - @ny
- if @x > @bitmap.width + 24 - window_width
- @nx = @bitmap.width + 24 - window_width
- elsif @x < 0
- @nx = 0
- else
- @nx = @x
- end
- if @y > @bitmap.height + 24 - window_height
- @ny = @bitmap.height + 24 - window_height
- elsif @y < 0
- @ny = 0
- else
- @ny = @y
- end
- rect = Rect.new(@nx, @ny, self.width , self.height)
- contents.blt(0, 0, @bitmap, rect)
- end
- #--------------------------------------------------------------------------
- # * dispose
- #--------------------------------------------------------------------------
- def dispose
- super
- @icon.bitmap.dispose
- @icon.dispose
- @cursor.bitmap.dispose
- @cursor.dispose
- end
- end
- #==============================================================================
- # ** Window_Help_MapT
- #==============================================================================
- class Window_Help_MapT < Window_Base
- include Templeton_Map
- #--------------------------------------------------------------------------
- # * Object initialization
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, Graphics.width, fitting_height(2))
- refresh(nil)
- end
- #--------------------------------------------------------------------------
- # * refresh
- #--------------------------------------------------------------------------
- def refresh(index)
- unless index == nil
- self.contents.clear
- draw_text(0, -12, Graphics.width, fitting_height(1), $templeton_map_info[index]['Desc'], 0)
- draw_text(0, 12, Graphics.width, fitting_height(1), $templeton_map_info[index]['Desc2'], 0)
- end
- end
- #==============================================================================
- end # of script
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement