赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 6 |
经验 | 71075 |
最后登录 | 2017-9-1 |
在线时间 | 1752 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 575
- 在线时间
- 1752 小时
- 注册时间
- 2008-11-7
- 帖子
- 1431
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
在游戏中 依然 可以编辑地图 目前我只测试地图 其他 还没试 编辑好 保存 按F7键 就可以加载到场景- =begin
- #===============================================================================
- Title: Test Edit
- Author: Tsukihime
- Date: Mar 9, 2013
- --------------------------------------------------------------------------------
- ** Change log
- Mar 9, 2013
- - Initial release
- --------------------------------------------------------------------------------
- ** Terms of Use
- * Free to use in commercial/non-commercial projects
- * No real support. The script is provided as-is
- * Will do bug fixes, but no compatibility patches
- * Features may be requested but no guarantees, especially if it is non-trivial
- * Credits to Tsukihime in your project
- * Preserve this header
- --------------------------------------------------------------------------------
- ** Description
-
- This script allows you to edit your game while testplaying the project.
- You can also reload data by pressing a button.
-
- Currently you can only reload the map.
-
- --------------------------------------------------------------------------------
- ** Usage
-
- Press F7 to reload the map.
- Any changes that were made in the editor and saved will be applied.
- --------------------------------------------------------------------------------
- ** Credits
-
- Based on FenixFyreX's test & play for VX
- #===============================================================================
- =end
- $imported = {} if $imported.nil?
- $imported["TH_TestEdit"] = true
- #===============================================================================
- # ** Configuration
- #===============================================================================
- module TH
- module Test_Edit
-
- Reload_Map_Button = :F7
- Reload_All_Button = :F8
-
- Excluded_Files = []
- #===============================================================================
- # ** Rest of script
- #===============================================================================
- #---------------------------------------------------------------------------
- # Reload almost everything. Based on FenixFyre's reload code
- #---------------------------------------------------------------------------
- def self.reload_all
- for file in (Dir.entries("Data") - [".", "..", *Excluded_Files])
- next if (file.include?("Map"))
- basename = File.basename(file, ".*").downcase!
- next if (basename == "scripts")
- eval("$data_#{basename} = load_data('Data/#{file}')")
- end
- end
-
- def self.reload_map
- $game_map.editplay_reload_map if SceneManager.scene_is?(Scene_Map)
- end
- end
- end
- class Game_Map
- def editplay_reload_map
- setup(@map_id)
- $game_player.center($game_player.x, $game_player.y)
- @need_refresh = true
- SceneManager.scene.editplay_reload_map
- end
- end
- class Scene_Map < Scene_Base
-
- def editplay_reload_map
- @spriteset.refresh_characters
- end
- end
- module SceneManager
- class << self
- alias :th_editplay_run :run
- end
-
- #-----------------------------------------------------------------------------
- #-----------------------------------------------------------------------------
- def self.run
- attach_console
- th_editplay_run
- end
-
- #-----------------------------------------------------------------------------
- # You always want a console.
- #-----------------------------------------------------------------------------
- def self.attach_console
- # Get game window text
- console_w = Win32API.new('user32','GetForegroundWindow', 'V', 'L').call
- buf_len = Win32API.new('user32','GetWindowTextLength', 'L', 'I').call(console_w)
- str = ' ' * (buf_len + 1)
- Win32API.new('user32', 'GetWindowText', 'LPI', 'I').call(console_w , str, str.length)
-
- # Initiate console
- Win32API.new('kernel32.dll', 'AllocConsole', '', '').call
- Win32API.new('kernel32.dll', 'SetConsoleTitle', 'P', '').call('RGSS3 Console')
- $stdout.reopen('CONOUT$')
-
- # Sometimes pressing F12 will put the editor in focus first,
- # so we have to remove the program's name
- game_title = str.strip
- game_title.sub! ' - RPG Maker VX Ace', ''
-
- # Set game window to be foreground
- hwnd = Win32API.new('user32.dll', 'FindWindow', 'PP','N').call(0, game_title)
- Win32API.new('user32.dll', 'SetForegroundWindow', 'P', '').call(hwnd)
- end
- end
- module Input
- class << self
- alias :th_editplay_update :update
- end
-
- def self.update
- TH::Test_Edit.reload_map if press?(TH::Test_Edit::Reload_Map_Button)
- TH::Test_Edit.reload_all if press?(TH::Test_Edit::Reload_All_Button)
- th_editplay_update
- end
- end
- #-------------------------------------------------------------------------------
- # Dispose original testplay process, make a new one
- #-------------------------------------------------------------------------------
- if ($TEST || $DEBUG)
- Thread.new {
- system("Game.exe debug")
- }
- sleep(0.01)
- exit
- end
复制代码 |
|