Draw_map(dont know what else to call it)Version:1
By: Plague180
Introduction
This script allows u to press m on the key board(or any other letter if u want)and call a picture from your picture folder called map.png. i know this might seem over simple(or there might be a easier way), but my freind wanted me to post it for him, and i hope some one else could use this little peice of code. let me know, even if its negitive. Go navy!
Demo
http://www.megaupload.com/?d=K4MF5Q59
Script
Cybersam's input script(required)
Scene_Map Edit
Scene_Draw_Map
Instructions
plug and play :) just put the scripts in order(input, Scene_map, Scene_Draw_Map) above main and under Scene_map(original)
Compatibility
i have not had any probelms with it, but i think it may have issues with some custom menus.
since i change the update for scene map i guess it could cause problems, but i dont think it will because all i did was make it check for the letter "m" being pressed
Credits and Thanks
Cybersam for the input script
By: Plague180
Introduction
This script allows u to press m on the key board(or any other letter if u want)and call a picture from your picture folder called map.png. i know this might seem over simple(or there might be a easier way), but my freind wanted me to post it for him, and i hope some one else could use this little peice of code. let me know, even if its negitive. Go navy!
Demo
http://www.megaupload.com/?d=K4MF5Q59
Script
Cybersam's input script(required)
- #==============================================================================
- # Keyboard Input Module
- #----------------------------------------------------------------------------
- # Script by Cybersam
- #==============================================================================
- module Input
- @keys = []
- @pressed = []
- Mouse_Left = 1
- Mouse_Right = 2
- Mouse_Middle = 4
- Back= 8
- Tab = 9
- Enter = 13
- Shift = 16
- Ctrl = 17
- Alt = 18
- Esc = 27
- Space = 32
- Numberkeys = {}
- Numberkeys[0] = 48 # => 0
- Numberkeys[1] = 49 # => 1
- Numberkeys[2] = 50 # => 2
- Numberkeys[3] = 51 # => 3
- Numberkeys[4] = 52 # => 4
- Numberkeys[5] = 53 # => 5
- Numberkeys[6] = 54 # => 6
- Numberkeys[7] = 55 # => 7
- Numberkeys[8] = 56 # => 8
- Numberkeys[9] = 57 # => 9
- Numberpad = {}
- Numberpad[0] = 45
- Numberpad[1] = 35
- Numberpad[2] = 40
- Numberpad[3] = 34
- Numberpad[4] = 37
- Numberpad[5] = 12
- Numberpad[6] = 39
- Numberpad[7] = 36
- Numberpad[8] = 38
- Numberpad[9] = 33
- Letters = {}
- Letters["A"] = 65
- Letters["B"] = 66
- Letters["C"] = 67
- Letters["D"] = 68
- Letters["E"] = 69
- Letters["F"] = 70
- Letters["G"] = 71
- Letters["H"] = 72
- Letters["I"] = 73
- Letters["J"] = 74
- Letters["K"] = 75
- Letters["L"] = 76
- Letters["M"] = 77
- Letters["N"] = 78
- Letters["O"] = 79
- Letters["P"] = 80
- Letters["Q"] = 81
- Letters["R"] = 82
- Letters["S"] = 83
- Letters["T"] = 84
- Letters["U"] = 85
- Letters["V"] = 86
- Letters["W"] = 87
- Letters["X"] = 88
- Letters["Y"] = 89
- Letters["Z"] = 90
- Fkeys = {}
- Fkeys[1] = 112
- Fkeys[2] = 113
- Fkeys[3] = 114
- Fkeys[4] = 115
- Fkeys[5] = 116
- Fkeys[6] = 117
- Fkeys[7] = 118
- Fkeys[8] = 119
- Fkeys[9] = 120
- Fkeys[10] = 121
- Fkeys[11] = 122
- Fkeys[12] = 123
- Collon = 186 # => \ |
- Equal = 187 # => = +
- Comma = 188 # => , <
- Underscore = 189 # => - _
- Dot = 190 # => . >
- Backslash = 191 # => / ?
- Lb = 219
- Rb = 221
- Quote = 222 # => '"
- #-------------------------------------------------------------------------------
- USED_KEYS = [Mouse_Left, Mouse_Right, Mouse_Middle]
- #-------------------------------------------------------------------------------
- module_function
- #--------------------------------------------------------------------------
- def triggered?(key)
- Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(key) & 0x01 == 1
- end
- #--------------------------------------------------------------------------
- def check(key)
- Win32API.new("user32","GetAsyncKeyState",['i'],'i').call(key) & 0x01 == 1
- end
- #--------------------------------------------------------------------------
- def pressed?(key)
- return true unless Win32API.new("user32","GetKeyState",['i'],'i').call(key).between?(0, 1)
- return false
- end
- #--------------------------------------------------------------------------
- def mouse_update
- @used_i = []
- for i in USED_KEYS
- x = check(i)
- if x == true
- @used_i.push(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- def self.C
- self.trigger?(C)
- end
- #--------------------------------------------------------------------------
- def self.B
- self.trigger?(B)
- end
- #--------------------------------------------------------------------------
- def self.A
- self.trigger?(A)
- end
- #--------------------------------------------------------------------------
- def self.Down
- self.trigger?(DOWN)
- end
- #--------------------------------------------------------------------------
- def self.Up
- self.trigger?(UP)
- end
- #--------------------------------------------------------------------------
- def self.Right
- self.trigger?(RIGHT)
- end
- #--------------------------------------------------------------------------
- def self.Left
- self.trigger?(LEFT)
- end
- #--------------------------------------------------------------------------
- def self.Anykey
- if A or B or C or Down or Up or Right or Left
- return true
- else
- return false
- end
- end
- #--------------------------------------------------------------------------
- end
Expand to see the code.
Scene_Map Edit
- #==============================================================================
- # ** Scene_Map
- #------------------------------------------------------------------------------
- # This class performs map screen processing.
- #==============================================================================
- class Scene_Map
- CALL_KEY = Input::Letters["M"]#used to choose which key calls the map
- def update
- # Loop
- loop do
- # Update map, interpreter, and player order
- # (this update order is important for when conditions are fulfilled
- # to run any event, and the player isn't provided the opportunity to
- # move in an instant)
- $game_map.update
- $game_system.map_interpreter.update
- $game_player.update
- # Update system (timer), screen
- $game_system.update
- $game_screen.update
- # Abort loop if player isn't place moving
- unless $game_temp.player_transferring
- break
- end
- # Run place move
- transfer_player
- # Abort loop if transition processing
- if $game_temp.transition_processing
- break
- end
- end
- # Update sprite set
- @spriteset.update
- # Update message window
- @message_window.update
- # If game over
- if $game_temp.gameover
- # Switch to game over screen
- $scene = Scene_Gameover.new
- return
- end
- # If returning to title screen
- if $game_temp.to_title
- # Change to title screen
- $scene = Scene_Title.new
- return
- end
- # If transition processing
- if $game_temp.transition_processing
- # Clear transition processing flag
- $game_temp.transition_processing = false
- # Execute transition
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- # If showing message window
- if $game_temp.message_window_showing
- return
- end
- # If encounter list isn't empty, and encounter count is 0
- if $game_player.encounter_count == 0 and $game_map.encounter_list != []
- # If event is running or encounter is not forbidden
- unless $game_system.map_interpreter.running? or
- $game_system.encounter_disabled
- # Confirm troop
- n = rand($game_map.encounter_list.size)
- troop_id = $game_map.encounter_list[n]
- # If troop is valid
- if $data_troops[troop_id] != nil
- # Set battle calling flag
- $game_temp.battle_calling = true
- $game_temp.battle_troop_id = troop_id
- $game_temp.battle_can_escape = true
- $game_temp.battle_can_lose = false
- $game_temp.battle_proc = nil
- end
- end
- end
- # If B button was pressed
- if Input.trigger?(Input::B)
- # If event is running, or menu is not forbidden
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- # Set menu calling flag or beep flag
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- end
- end
- # If debug mode is ON and F9 key was pressed
- if $DEBUG and Input.press?(Input::F9)
- # Set debug calling flag
- $game_temp.debug_calling = true
- end
- # If player is not moving
- unless $game_player.moving?
- # Run calling of each screen
- if $game_temp.battle_calling
- call_battle
- elsif $game_temp.shop_calling
- call_shop
- elsif $game_temp.name_calling
- call_name
- elsif $game_temp.menu_calling
- call_menu
- elsif $game_temp.save_calling
- call_save
- elsif $game_temp.debug_calling
- call_debug
- end
- end
- if Input.pressed?(CALL_KEY) #draws the map
- $scene = Scene_Draw_Map.new("map.png")
- end
- end
- end
Expand to see the code.
Scene_Draw_Map
- class Scene_Draw_Map
- def initialize(name)
- name = name.to_s
- @sprite = Sprite.new
- @sprite.bitmap = RPG::Cache.picture(name)
- end
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- # Execute transition
- Graphics.transition
- # Main loop
- loop do
- # Update game screen
- Graphics.update
- # Update input information
- Input.update
- # Frame update
- update
- # Abort loop if screen is changed
- if $scene != self
- break
- end
- end
- # Prepare for transition
- Graphics.freeze
- end
- def update
- # If B button was pressed
- if Input.trigger?(Input::B)
- # Play cancel SE
- $game_system.se_play($data_system.cancel_se)
- # Switch to menu screen
- $scene = Scene_Map.new
- return
- end
- end
- end
Expand to see the code.
Instructions
plug and play :) just put the scripts in order(input, Scene_map, Scene_Draw_Map) above main and under Scene_map(original)
Compatibility
i have not had any probelms with it, but i think it may have issues with some custom menus.
since i change the update for scene map i guess it could cause problems, but i dont think it will because all i did was make it check for the letter "m" being pressed
Credits and Thanks
Cybersam for the input script