| 赞 | 17 |
| VIP | |
| 好人卡 | |
| 积分 | 23 |
| 经验 | |
| 最后登录 | 2024-6-23 |
| 在线时间 | 5539 小时 |
- 梦石
- 0
- 星屑
- 2310
- 在线时间
- 5539 小时
- 注册时间
- 2011-1-10
- 回帖
- 6353
  
|
发表于 2015-5-21 18:43:42
|
显示全部楼层
本帖最后由 H·H·Y 于 2015-5-21 18:54 编辑
以下是收集的脚本,先不管三七二十一全放上来了。
菜单类
[fold=跳过标题]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Scene_Title
- #==============================================================================
- # 脚本作者:朱仔メ龍 QQ:251724722
- # 脚本转载请保留以上信息
- #==============================================================================
- def main
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- $game_system = Game_System.new
- Graphics.frame_count = 0
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- $game_party.setup_starting_members
- $game_map.setup($data_system.start_map_id)
- $game_player.moveto($data_system.start_x, $data_system.start_y)
- $game_player.refresh
- $game_map.autoplay
- $game_map.update
- $scene = Scene_Map.new
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
-
复制代码 [/fold]
[fold=菜单血条]- #===============================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #===============================================================
- # ——————————————————————————————
- # HP/SP/EXPゲージ表示スクリプト Ver 1.00
- # 配布元?サポートURL
- # http://members.jcom.home.ne.jp/cogwheel/
- #===============================================================
- # ■ Game_Actor
- #--------------------------------------------------------
- # アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
- # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
- #==============================================================
- class Game_Actor < Game_Battler
- def now_exp
- return @exp - @exp_list[@level]
- end
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- end
- #==========================================================
- # ■ Window_Base
- #------------------------------------------------------------
- # ゲーム中のすべてのウィンドウのスーパークラスです。
- #============================================================
- class Window_Base < Window
- #--------------------------------------------------------
- # ● HP ゲージの描画
- #--------------------------------------------------
- # オリジナルのHP描画を draw_actor_hp_original と名前変更
- alias :draw_actor_hp_original :draw_actor_hp
- def draw_actor_hp(actor, x, y, width = 144)
- # 変数rateに 現在のHP/MHPを代入
- if actor.maxhp != 0
- rate = actor.hp.to_f / actor.maxhp
- else
- rate = 0
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(64, 0, 0, 192)
- color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
- color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
- # 変数spに描画するゲージの幅を代入
- if actor.maxhp != 0
- hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
- else
- hp = 0
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, hp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # オリジナルのHP描画処理を呼び出し
- draw_actor_hp_original(actor, x, y, width)
- end
- #--------------------------------------------------------------
- # ● SP ゲージの描画
- #------------------------------------------------------------
- # オリジナルのSP描画を draw_actor_sp_original と名前変更
- alias :draw_actor_sp_original :draw_actor_sp
- def draw_actor_sp(actor, x, y, width = 144)
- # 変数rateに 現在のSP/MSPを代入
- if actor.maxsp != 0
- rate = actor.sp.to_f / actor.maxsp
- else
- rate = 1
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(0, 64, 0, 192)
- color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
- color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
- # 変数spに描画するゲージの幅を代入
- if actor.maxsp != 0
- sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
- else
- sp = (width + plus_width) * rate_width / 100
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, sp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # オリジナルのSP描画処理を呼び出し
- draw_actor_sp_original(actor, x, y, width)
- end
- #--------------------------------------------------------
- # ● EXP ゲージの描画
- #----------------------------------------------------------
- # オリジナルのEXP描画を draw_actor_sp_original と名前変更
- alias :draw_actor_exp_original :draw_actor_exp
- def draw_actor_exp(actor, x, y, width = 204)
- # 変数rateに 現在のexp/nextexpを代入
- if actor.next_exp != 0
- rate = actor.now_exp.to_f / actor.next_exp
- else
- rate = 1
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(64, 0, 0, 192)
- color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
- color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
- # 変数expに描画するゲージの幅を代入
- if actor.next_exp != 0
- exp = (width + plus_width) * actor.now_exp * rate_width /
- 100 / actor.next_exp
- else
- exp = (width + plus_width) * rate_width / 100
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, exp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # オリジナルのEXP描画処理を呼び出し
- draw_actor_exp_original(actor, x, y)
- end
- #---------------------------------------------------------
- # ● ゲージの描画
- #-----------------------------------------------------
- def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- case align1
- when 1
- x += (rect_width - width) / 2
- when 2
- x += rect_width - width
- end
- case align2
- when 1
- y -= height / 2
- when 2
- y -= height
- end
- # 枠描画
- self.contents.fill_rect(x, y, width, height, color1)
- self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
- if align3 == 0
- if grade1 == 2
- grade1 = 3
- end
- if grade2 == 2
- grade2 = 3
- end
- end
- if (align3 == 1 and grade1 == 0) or grade1 > 0
- color = color3
- color3 = color4
- color4 = color
- end
- if (align3 == 1 and grade2 == 0) or grade2 > 0
- color = color5
- color5 = color6
- color6 = color
- end
- # 空ゲージの描画
- self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
- color3, color4, grade1)
- if align3 == 1
- x += width - gauge
- end
- # 実ゲージの描画
- self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
- color5, color6, grade2)
- end
- end
- #--------------------------------------------------------------
- # Bitmapクラスに新たな機能を追加します。
- #===================================================================
- class Bitmap
- #------------------------------------------------------------
- # ● 矩形をグラデーション表示
- # color1 : スタートカラー
- # color2 : エンドカラー
- # align : 0:横にグラデーション
- # 1:縦にグラデーション
- # 2:斜めにグラデーション(激重につき注意)
- #--------------------------------------------------------
- def gradation_rect(x, y, width, height, color1, color2, align = 0)
- if align == 0
- for i in x...x + width
- red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
- green = color1.green +
- (color2.green - color1.green) * (i - x) / (width - 1)
- blue = color1.blue +
- (color2.blue - color1.blue) * (i - x) / (width - 1)
- alpha = color1.alpha +
- (color2.alpha - color1.alpha) * (i - x) / (width - 1)
- color = Color.new(red, green, blue, alpha)
- fill_rect(i, y, 1, height, color)
- end
- elsif align == 1
- for i in y...y + height
- red = color1.red +
- (color2.red - color1.red) * (i - y) / (height - 1)
- green = color1.green +
- (color2.green - color1.green) * (i - y) / (height - 1)
- blue = color1.blue +
- (color2.blue - color1.blue) * (i - y) / (height - 1)
- alpha = color1.alpha +
- (color2.alpha - color1.alpha) * (i - y) / (height - 1)
- color = Color.new(red, green, blue, alpha)
- fill_rect(x, i, width, 1, color)
- end
- elsif align == 2
- for i in x...x + width
- for j in y...y + height
- red = color1.red + (color2.red - color1.red) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- green = color1.green + (color2.green - color1.green) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- blue = color1.blue + (color2.blue - color1.blue) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- alpha = color1.alpha + (color2.alpha - color1.alpha) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- color = Color.new(red, green, blue, alpha)
- set_pixel(i, j, color)
- end
- end
- elsif align == 3
- for i in x...x + width
- for j in y...y + height
- red = color1.red + (color2.red - color1.red) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- green = color1.green + (color2.green - color1.green) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- blue = color1.blue + (color2.blue - color1.blue) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- alpha = color1.alpha + (color2.alpha - color1.alpha) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- color = Color.new(red, green, blue, alpha)
- set_pixel(i, j, color)
- end
- end
- end
- end
- end
- #==================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==================================================================
复制代码 [/fold]
[fold=读书系统]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Interpreter
-
- BOOK_READING = 50 # 默认打开50开关后进入读书系统
-
- #--------------------------------------------------------------------------
- # ● 显示文章
- #--------------------------------------------------------------------------
- def command_101
- # 另外的文章已经设置过 message_text 的情况下
- if $game_temp.message_text != nil
- # 结束
- return false
- end
- # 设置信息结束后待机和返回调用标志
- @message_waiting = true
- $game_temp.message_proc = Proc.new { @message_waiting = false }
- # message_text 设置为 1 行
- $game_temp.message_text = @list[@index].parameters[0] + "\n"
- line_count = 1
- # 循环
- loop do
- # 下一个事件指令为文章两行以上的情况
- if $game_switches[BOOK_READING] and @list[@index+1].code == 101#阅读书刊报纸
- unless $game_temp.in_battle
- $scene.message_window.height = 320
- $scene.message_window.contents = Bitmap.new($scene.message_window.width - 32, $scene.message_window.height - 32)
- $scene.message_window.contents.font.size = 20
- $game_temp.message_text += @list[@index+1].parameters[0] +"\n"
- line_count+=1
- @index+=1
- end
- end
- if $game_switches[BOOK_READING]==false
- unless $game_temp.in_battle
- if $scene.message_window.height == 320
- $scene.message_window.height = 160
- $scene.message_window.contents = Bitmap.new($scene.message_window.width - 32, $scene.message_window.height - 32)
- $scene.message_window.contents.font.size = 22
- end
- end
- end
- if @list[@index+1].code == 401
- # message_text 添加到第 2 行以下
- $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
- line_count += 1
- # 事件指令不在文章两行以下的情况
- else
- # 下一个事件指令为显示选择项的情况下
- if @list[@index+1].code == 102
- # 如果选择项能收纳在画面里
- if @list[@index+1].parameters[0].size <= 4 - line_count
- # 推进索引
- @index += 1
- # 设置选择项
- $game_temp.choice_start = line_count
- setup_choices(@list[@index].parameters)
- end
- # 下一个事件指令为处理输入数值的情况下
- elsif @list[@index+1].code == 103
- # 如果数值输入窗口能收纳在画面里
- if line_count < 4
- # 推进索引
- @index += 1
- # 设置输入数值
- $game_temp.num_input_start = line_count
- $game_temp.num_input_variable_id = @list[@index].parameters[0]
- $game_temp.num_input_digits_max = @list[@index].parameters[1]
- end
- end
- # 继续
- return true
- end
- # 推进索引
- @index += 1
- end
- end
- end
- class Scene_Map
- attr_accessor :message_window
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 [/fold]
[fold=存档扩充]- # --------------------------------------------------------------------
- class Scene_File
- #——最大存档数量,一般我认为最多50足够了,20比较合适
- SAVEFILE_MAX = 10
- # -------------------
- def initialize(help_text)
- @help_text = help_text
- end
- # -------------------
- def main
- @spriteset = Spriteset_Map.new
- @help_window = Window_Help.new
- @help_window.opacity = 160
- @help_window.z = 500
- @help_window.set_text(@help_text)
- @savefile_windows = []
- @cursor_displace = 0
- for i in 0..3
- @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
- @savefile_windows[i].opacity = 160
- @savefile_windows[i].z = 500
- end
- @file_index = 0
- @savefile_windows[@file_index].selected = true
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @spriteset.dispose
- for i in @savefile_windows
- i.dispose
- end
- end
- # -------------------
- def update
- @help_window.update
- for i in @savefile_windows
- i.update
- end
- if Input.trigger?(Input::C)
- on_decision(make_filename(@file_index))
- $game_temp.last_file_index = @file_index
- return
- end
- if Input.trigger?(Input::B)
- on_cancel
- return
- end
- if Input.repeat?(Input::DOWN)
- if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
- if @file_index == SAVEFILE_MAX - 1
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace += 1
- if @cursor_displace == 4
- @cursor_displace = 3
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..3
- f = i - 2 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].opacity = 160
- @savefile_windows[i].z = 500
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index + 1)
- if @file_index == SAVEFILE_MAX
- @file_index = SAVEFILE_MAX - 1
- end
- for i in 0..3
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- return
- end
- end
- if Input.repeat?(Input::UP)
- if Input.trigger?(Input::UP) or @file_index > 0
- if @file_index == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- @cursor_displace -= 1
- if @cursor_displace == -1
- @cursor_displace = 0
- for i in @savefile_windows
- i.dispose
- end
- @savefile_windows = []
- for i in 0..3
- f = i - 1 + @file_index
- name = make_filename(f)
- @savefile_windows.push(Window_SaveFile.new(f, name, i))
- @savefile_windows[i].opacity = 160
- @savefile_windows[i].z = 500
- @savefile_windows[i].selected = false
- end
- end
- $game_system.se_play($data_system.cursor_se)
- @file_index = (@file_index - 1)
- if @file_index == -1
- @file_index = 0
- end
- for i in 0..3
- @savefile_windows[i].selected = false
- end
- @savefile_windows[@cursor_displace].selected = true
- return
- end
- end
- end
- # -------------------
- def make_filename(file_index)
- return "Save#{file_index + 1}.rxdata"
- end
- # -------------------
- end
-
- class Window_SaveFile < Window_Base
- # -------------------
- def initialize(file_index, filename, position)
- y = 64 + position * 104
- super(0, y, 640, 104)
- self.contents = Bitmap.new(width - 32, height - 32)
- @file_index = file_index
- @filename = "Save#{@file_index + 1}.rxdata"
- @time_stamp = Time.at(0)
- @file_exist = FileTest.exist?(@filename)
- if @file_exist
- file = File.open(@filename, "r")
- @time_stamp = file.mtime
- @characters = Marshal.load(file)
- @frame_count = Marshal.load(file)
- @game_system = Marshal.load(file)
- @game_switches = Marshal.load(file)
- @game_variables = Marshal.load(file)
- @total_sec = @frame_count / Graphics.frame_rate
- file.close
- end
- refresh
- @selected = false
- end
- end
- #==============================================================================
复制代码 [/fold]
[fold=存档覆盖提示]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #在覆盖存档的时候弹出对话框提示
- class Scene_Save < Scene_File
- # -----------------------------
- def initialize
- super("储存到哪一个进度")
- @confirm_window = Window_Base.new(120, 188, 400, 64)
- @confirm_window.contents = Bitmap.new(368, 32)
- string = "确定要覆盖这个进度吗?"
- @confirm_window.contents.font.name = "黑体"
- @confirm_window.contents.font.size = 24
- @confirm_window.contents.draw_text(4, 0, 368, 32, string)
- @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
- @confirm_window.visible = false
- @confirm_window.z = 1500
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @yes_no_window.x = 270
- @yes_no_window.y = 252
- @yes_no_window.z = 1500
- @mode = 0
- end
- # -----------------------------
- def on_decision(filename)
- if FileTest.exist?(filename)
- @confirm_window.visible = true
- @yes_no_window.visible = true
- @yes_no_window.active = true
- @mode = 1
- else
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Menu.new(4)
- end
- end
- # -----------------------------
- def update
- if @mode == 0
- super
- else
- @help_window.update
- @yes_no_window.update
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- if @yes_no_window.index == 0
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @confirm_window.visible = false
- filename = make_filename(@file_index)
- $game_system.se_play($data_system.save_se)
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- else
- $scene = Scene_Menu.new(4)
- end
- else
- @confirm_window.visible = false
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @mode = 0
- end
- end
- if Input.trigger?(Input::B)
- @confirm_window.visible = false
- @yes_no_window.visible = false
- @yes_no_window.active = false
- @yes_no_window.index = 1
- @mode = 0
- return
- end
- end
- end
- # -----------------------------
- def on_cancel
- $game_system.se_play($data_system.cancel_se)
- if $game_temp.save_calling
- $game_temp.save_calling = false
- $scene = Scene_Map.new
- return
- end
- $scene = Scene_Menu.new(4)
- end
- # -----------------------------
- def write_save_data(file)
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- $game_system.save_count += 1
- $game_system.magic_number = $data_system.magic_number
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- end
- end
- class Scene_File
- alias carol3_main main
- def main
- carol3_main
- if self.is_a?(Scene_Save)
- @confirm_window.dispose
- @yes_no_window.dispose
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 [/fold]
[fold=人物简介]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # 人物介绍 Ver. 1.1 作者: Claimh 翻译与修正:柳柳
- #------------------------------------------------------------------------------
- # http://www.k3.dion.ne.jp/~claimh/
- #==============================================================================
-
- #——功能简介:在状态页面按下回车键会进入人物介绍页面。
- #——如果想自行建立功能,使用$scene = Scene_Charactor.new(角色编号)即可
- #——如果自行建立了功能不想使用默认的切换,去掉217行以后的内容
-
- #——以下数组,如果人物超过8人,请自行继续添加(一般游戏没那么多主人公吧)
- #——如果想更改内容,比如把“体重”改为“智商”,请修改102-107行的文字内容
-
- # 从状态页面切换至人物介绍页面的按键
- CHENGE_KEY = Input::C
- #--------------------------------------------------------------------------
- # 人物年龄 (自定义)
- #--------------------------------------------------------------------------
- CHARA_AGE = ["17","16","??","??","??","??","15","15"]
- #--------------------------------------------------------------------------
- # 人物出生地
- #--------------------------------------------------------------------------
- CHARA_FROM = ["希腊","罗马","??","??","??","??","雷都","日本东京"]
- #--------------------------------------------------------------------------
- # 人物身高
- #--------------------------------------------------------------------------
- CHARA_H = ["170","160","??","??","??","??","162","165"]
- #--------------------------------------------------------------------------
- # 人物体重
- #--------------------------------------------------------------------------
- CHARA_W = ["60","50","??","??","??","??","46","53"]
- #--------------------------------------------------------------------------
- # 人物介绍,可以写多行
- #--------------------------------------------------------------------------
- # 人物1号介绍
- L1 = "RPG制作大师XP的标准主人公+形象代言人"
- L2 = "是一个外表不经世事、内心坚强无比的小伙子"
- L3 = ""
- L_SET1 = [L1, L2, L3] # 人物1号的数组
- # 人物2号介绍
- L1 = "RPG制作大师XP的1号女主角"
- L2 = "一个充满人性温情的女战士"
- L3 = ""
- L_SET2 = [L1, L2, L3] # 人物2号的数组
- # 人物3号介绍
- L1 = ""
- L2 = ""
- L3 = ""
- L_SET3 = [L1, L2, L3]
- # 人物4号介绍
- L1 = ""
- L2 = ""
- L3 = ""
- L_SET4 = [L1, L2, L3]
- # 人物5号介绍
- L1 = ""
- L2 = ""
- L3 = ""
- L_SET5 = [L1, L2, L3]
- # 人物6号介绍
- L1 = ""
- L2 = ""
- L3 = ""
- L_SET6 = [L1, L2, L3]
- # 人物7号介绍
- L1 = "充满冷酷的红魔法师"
- L2 = "11岁,父母阵亡后加入了杀手组织"
- L3 = "13岁,在一次行动失利中被抓到地牢严刑拷打长达半年"
- L4 = "14岁,一个人杀光所有蹂躏她的狱卒,独自踏上旅途"
- L_SET7 = [L1, L2, L3, L4]
- # 人物8号介绍
- L1 = "娇生惯养的贵族魔法师,从不懂人世艰难"
- L2 = "自以为实力天下第一"
- L3 = ""
- L_SET8 = [L1, L2, L3]
- # 人物介绍数组,如果不够继续添加。
- CHARA_INFO = [L_SET1,L_SET2,L_SET3,L_SET4,L_SET5,L_SET6,L_SET7,L_SET8]
- #==============================================================================
- # Window_Charactor
- #==============================================================================
- class Window_Charactor < Window_Base
- #--------------------------------------------------------------------------
- # actor : 初始化的角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 640, 480)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_battler_graphics(@actor, 100, 200)
- self.contents.font.color.set(255, 255,50)
- self.contents.draw_text(250, 10, 80, 32, "姓名")
- self.contents.draw_text(250, 50, 80, 32, "年龄")
- self.contents.draw_text(250, 90, 80, 32, "出生地")
- self.contents.draw_text(250, 130, 80, 32, "身高")
- self.contents.draw_text(250, 170, 80, 32, "体重")
- self.contents.font.color = normal_color
- draw_actor_name(@actor, 350, 10)
- draw_actor_age(@actor, 350, 50)
- draw_actor_from(@actor, 350, 90)
- draw_actor_height(@actor, 350, 130)
- draw_actor_weight(@actor, 350, 170)
- draw_actor_other(@actor, 50, 250)
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_battler_graphics(actor, x, y)
- battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)
- w = battler.width
- h = battler.height
- self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_actor_age(actor, x, y)
- self.contents.draw_text(x, y, 80, 32, CHARA_AGE[actor.id-1])
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_actor_from(actor, x, y)
- self.contents.draw_text(x, y, 180, 32, CHARA_FROM[actor.id-1])
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_actor_height(actor, x, y)
- self.contents.draw_text(x, y , 200, 32, CHARA_H[actor.id-1])
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_actor_weight(actor, x, y)
- self.contents.draw_text(x, y, 250, 32, CHARA_W[actor.id-1])
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_actor_other(actor, x, y)
- info = CHARA_INFO[actor.id-1]
- for i in 0...info.size
- self.contents.draw_text(x, y+32*i, 600, 32, info[i])
- end
- end
- end
- #==============================================================================
- # Scene_Charactor
- #==============================================================================
- class Scene_Charactor
- #--------------------------------------------------------------------------
- # actor_index :角色编号
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0, equip_index = 0)
- @actor_index = actor_index
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def main
- @actor = $game_party.actors[@actor_index]
- @status_window = Window_Charactor.new(@actor)
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(3)
- return
- end
- if Input.trigger?(Input::R)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Charactor.new(@actor_index)
- return
- end
- if Input.trigger?(Input::L)
- $game_system.se_play($data_system.cursor_se)
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- $scene = Scene_Charactor.new(@actor_index)
- return
- end
- end
- end
- #==============================================================================
- # Scene_Status
- #==============================================================================
- class Scene_Status
- alias update_chara update
- def update
- if Input.trigger?(CHENGE_KEY)
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Charactor.new(@actor_index)
- return
- end
- update_chara
- end
- end
-
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 [/fold]
[fold=任务系统]- 脚本内容
-
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #简略使用说明:
- #事件脚本输入 $任务 = "文字" 或 $支线 = "文字" 即可设定任务。
- #至于怎么完成任务……本喵忘记了……(~ ̄△ ̄)~
- #==============================================================================
- # Game_System
- #------------------------------------------------------------------------------
- # 添加内容
- #==============================================================================
- class Game_System
- attr_accessor :mission #现在执行的任务
- attr_accessor :partmission
- alias carol3_ini initialize
- def initialize
- carol3_ini
- @mission = ""
- @partmission = []
- end
- end
- #==============================================================================
- # ■ Scene_Title
- #------------------------------------------------------------------------------
- # 处理标题画面的类。
- #==============================================================================
- class Scene_Title
- alias carol3_title1 main
- def main
- $map_infos = load_data("Data/MapInfos.rxdata")
- for key in $map_infos.keys
- $map_infos[key] = $map_infos[key].name
- end
- $任务 = ""
- $支线 = nil
- $支线完成 = nil
- carol3_title1
- end
- end
- class Scene_Map
- alias carol3_update update
- def update
- carol3_update
- if $支线 != nil
- for i in 0...$game_system.partmission.size
- if $game_system.partmission[i] == $支线
- $支线 = nil
- break
- end
- end
- if $支线 != nil
- $game_system.partmission.push($支线)
- $支线 = nil
- end
- end
- if $支线完成 != nil
- for i in 0...$game_system.partmission.size
- if $game_system.partmission[i] == $支线完成
- $game_system.partmission.delete($game_system.partmission[i])
- break
- end
- end
- $支线完成 = nil
- end
- end
- end
- #==============================================================================
- # Window_MenuStatus
- #------------------------------------------------------------------------------
- # 显示菜单画面和同伴状态的窗口。
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化目标
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 480, 384)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.active = false
- self.index = -1
- @position = 0
- @count = 0
- @oldposition = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- x = 64
- y = i * 90
- actor = $game_party.actors[i]
- self.contents.font.size = 18
- draw_actor_active_graphic(actor, x - 40, y + 50)
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x + 144, y)
- draw_actor_level(actor, x, y + 25)
- draw_actor_state(actor, x + 90, y + 25)
- draw_actor_exp(actor, x, y + 50)
- draw_actor_hp(actor, x + 236, y + 25)
- draw_actor_sp(actor, x + 236, y + 50)
- end
- end
- #--------------------------------------------------------------------------
- # ● 绘制行走图
- #--------------------------------------------------------------------------
- def draw_actor_active_graphic(actor, x, y)
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- cw = bitmap.width / 4
- ch = bitmap.height / 4
- p = @position * cw
- src_rect = Rect.new(p, 0, cw, ch)
- self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index *90-5, self.width - 32, 90)
- end
- end
- def update
- super
- @count += 1
- @count %= 15
- if @count == 0
- @position = (@position + 1) % 4
- end
- if @position != @oldposition
- @oldposition = @position
- refresh
- end
- end
- end
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # 处理地图的类。包含卷动以及可以通行的判断功能。
- # 本类的实例请参考 $game_map 。
- #==============================================================================
- class Game_Map
- def name
- return $map_infos[@map_id]
- end
- end
- #==============================================================================
- # Window_RecordBook
- #------------------------------------------------------------------------------
- # 菜单界面表示信息的窗口
- #==============================================================================
- class Window_RecordBook < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(160, 384, 480, 480)
- self.contents = Bitmap.new(width - 32, height - 32)
- if $任务 == ""
- $任务 = $game_system.mission
- else
- $game_system.mission = $任务
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.font.size = 20
- cx = self.contents.text_size("现在地点").width + 24
- self.contents.draw_text(4, 0, cx, 24, "现在地点")
- self.contents.font.color = normal_color
- self.contents.draw_text(4 + cx, 0, 444 - cx, 24, $game_map.name.to_s)
- self.contents.font.color = system_color
- cx = self.contents.text_size("主线任务").width + 24
- self.contents.draw_text(4, 32, cx, 24, "主线任务")
- self.contents.font.color = Color.new(240,250,75,255)
- self.contents.draw_text(4 + cx, 32, 444 - cx, 24, $game_system.mission.to_s)
- self.contents.font.color = system_color
- cx = self.contents.text_size("支线任务").width + 24
- self.contents.draw_text(4, 96, cx, 24, "支线任务")
- self.contents.font.color = normal_color
- for i in 0...$game_system.partmission.size
- self.contents.draw_text(4 + cx, 96 + i * 32, 444 - cx, 24, $game_system.partmission[i].to_s)
- end
- end
- end
- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # 处理菜单画面的类。
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # menu_index : 命令光标的初期位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- @切换状态暂停 = ""
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成命令窗口
- s1 = " 使用物品"#$data_system.words.item
- s2 = " 使用技能"#$data_system.words.skill
- s3 = " 更改装备"#$data_system.words.equip
- s4 = " 查看状态"
- s5 = " 储存游戏"
- s6 = " 结束游戏"
- s7 = " 查看任务"
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
- @command_window.index = @menu_index
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- # 物品、特技、装备、状态无效化
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 存档无效
- @command_window.disable_item(4)
- end
- # 生成游戏时间窗口
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 0
- @playtime_window.y = 256
- # 生成金钱窗口
- @gold_window = Window_Gold.new
- @gold_window.x = 0
- @gold_window.y = 416
- # 生成状态窗口
- @status_window = Window_MenuStatus.new
- @status_window.x = 160
- @status_window.y = 0
- #—— 生成天书窗口
- @recordbook_window = Window_RecordBook.new
- @recordbook_window.z = 1000
- #—— 生成外边框窗口
- @outside_window = Window_Outside.new
- @outside_window.visible = true
- @outside_window.z = 1001
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @command_window.dispose
- @playtime_window.dispose
- @gold_window.dispose
- @status_window.dispose
- @outside_window.dispose
- @recordbook_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @command_window.update
- @playtime_window.update
- @gold_window.update
- @status_window.update
- # 命令窗口被激活的情况下: 调用 update_command
- if @command_window.active
- update_command
- return
- end
- # 状态窗口被激活的情况下: 调用 update_status
- if @status_window.active
- update_status
- return
- end
- if @outside_window.visible == false
- update_recordbook
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (命令窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_command
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换的地图画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 同伴人数为 0、存档、游戏结束以外的场合
- if $game_party.actors.size == 0 and @command_window.index < 4
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 命令窗口的光标位置分支
- case @command_window.index
- when 0 # 物品
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到物品画面
- $scene = Scene_Item.new
- when 1 # 特技
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 4 # 存档
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到存档画面
- $scene = Scene_Save.new
- when 5 # 游戏结束
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到游戏结束画面
- $scene = Scene_End.new
- when 6 # 查看任务
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @outside_window.visible = false
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (查看天书的情况下)
- #--------------------------------------------------------------------------
- def update_recordbook
- if @切换状态暂停 == "天书消失"
- if @recordbook_window.y < 384
- @recordbook_window.y +=64
- @status_window.y -= 16
- return
- else
- @切换状态暂停 = ""
- @outside_window.visible = true
- @command_window.active = true
- end
- else
- if @recordbook_window.y >0
- @recordbook_window.y -= 32
- @status_window.y += 8
- return
- else
- @status_window.visible = false
- if Input.trigger?(Input::B)
- @切换状态暂停 = "天书消失"
- $game_system.se_play($data_system.cancel_se)
- @status_window.visible = true
- return
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (状态窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_status
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 激活命令窗口
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置分支
- case @command_window.index
- when 1 # 特技
- # 本角色的行动限制在 2 以上的情况下
- if $game_party.actors[@status_window.index].restriction >= 2
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到特技画面
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换的装备画面
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到状态画面
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- end
- #==============================================================================
- # Window_Outside
- #------------------------------------------------------------------------------
- # 外边框窗口
- #==============================================================================
- class Window_Outside < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(160, 384, 480, 96)
- self.back_opacity = 0
- end
- end
- #==============================================================================
- # ■ Window_PlayTime
- #------------------------------------------------------------------------------
- # 菜单画面的系统时间表示
- #==============================================================================
- class Window_PlayTime < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 128)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.size = 18
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.font.color = text_color(6)
- time = Time.now
- text = time.strftime("%x %X")
- self.contents.draw_text(-2, 32, 130, 32, text, 2)
- @total_sec = Graphics.frame_count / Graphics.frame_rate
- hour = @total_sec / 60 / 60
- min = @total_sec / 60 % 60
- sec = @total_sec % 60
- text = sprintf("%02d:%02d:%02d", hour, min, sec)
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 160, 32, "日期与游戏时间")
- self.contents.draw_text(-2, 64, 130, 32, text, 2)
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- if Graphics.frame_count / Graphics.frame_rate != @total_sec
- refresh
- end
- end
- end
-
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 [/fold]
[fold=图片菜单][/fold]
[fold=物品分类]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ Harts_Window_ItemTitle
- #------------------------------------------------------------------------------
- # アイテム画面で、タイトルを表示するウィンドウ。
- #==============================================================================
- class Harts_Window_ItemTitle < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
- end
- end
- #==============================================================================
- # ■ Harts_Window_ItemCommand
- #------------------------------------------------------------------------------
- # アイテムの種別選択を行うウィンドウです。
- #==============================================================================
- class Harts_Window_ItemCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 64, 160, 288)
- self.contents = Bitmap.new(width - 32, height - 32)
- @item_max = 8
- @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- y = index * 32
- self.contents.draw_text(4, y, 128, 32, @commands[index])
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- case self.index
- when 0
- @text = @commands[0]
- when 1
- @text = @commands[1]
- when 2
- @text = @commands[2]
- when 3
- @text = @commands[3]
- when 4
- @text = @commands[4]
- when 5
- @text = @commands[5]
- when 6
- @text = @commands[6]
- when 7
- @text = @commands[7]
- end
- @help_window.set_text(@text)
- end
- end
- #==============================================================================
- # ■ Window_Item
- #------------------------------------------------------------------------------
- # アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
- #==============================================================================
- class Harts_Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(160, 0, 480, 416)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- # ● アイテム一覧設定
- # command : 選択中のコマンド
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- case command
- when 0
- for i in 1...$data_items.size
- if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- when 1
- for i in 1...$data_items.size
- if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
- @data.push($data_items[i])
- end
- end
- when 2
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- when 3
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 4
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 5
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 6
- for i in 1...$data_armors.size
- if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- when 7
- for i in 1...$data_items.size
- if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
- @data.push($data_items[i])
- end
- end
- end
- # 項目数が 0 でなければビットマップを作成し、全項目を描画
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 種類別アイテム数の取得
- #--------------------------------------------------------------------------
- def item_number
- return @item_max
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- #==============================================================================
- # ■ Harts_Scene_Item
- #------------------------------------------------------------------------------
- # アイテム画面の処理を行うクラスです。再定義
- #==============================================================================
- class Scene_Item
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- # タイトルウィンドウを作成
- @itemtitle_window = Harts_Window_ItemTitle.new
- #コマンドウィンドウを作成
- @itemcommand_window = Harts_Window_ItemCommand.new
- @command_index = @itemcommand_window.index
- #アイテムウィンドウを作成
- @itemlist_window = Harts_Window_ItemList.new
- @itemlist_window.active = false
- #ヘルプウィンドウを作成
- @help_window = Window_Help.new
- @help_window.x = 0
- @help_window.y = 416
- # ヘルプウィンドウを関連付け
- @itemcommand_window.help_window = @help_window
- @itemlist_window.help_window = @help_window
- # ターゲットウィンドウを作成 (不可視?非アクティブに設定)
- @target_window = Window_Target.new
- @target_window.visible = false
- @target_window.active = false
- # アイテムウィンドウ内容表示
- @itemlist_window.set_item(@command_index)
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @itemtitle_window.dispose
- @itemcommand_window.dispose
- @itemlist_window.dispose
- @help_window.dispose
- @target_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # ウィンドウを更新
- @itemtitle_window.update
- @itemcommand_window.update
- @itemlist_window.update
- @help_window.update
- @target_window.update
- if @command_index != @itemcommand_window.index
- @command_index = @itemcommand_window.index
- @itemlist_window.set_item(@command_index)
- end
- # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
- if @itemcommand_window.active
- update_itemcommand
- return
- end
- # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
- if @itemlist_window.active
- update_itemlist
- return
- end
- # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_itemcommand
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # メニュー画面に切り替え
- $scene = Scene_Menu.new(0)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # 選択中のコマンドのアイテムがない場合
- if @itemlist_window.item_number == 0
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # アイテムウィンドウをアクティブにする
- @itemcommand_window.active = false
- @itemlist_window.active = true
- @itemlist_window.index = 0
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_itemlist
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # アイテムウィンドウをアクティブにする
- @itemcommand_window.active = true
- @itemlist_window.active = false
- @itemlist_window.index = 0
- @itemcommand_window.index = @command_index
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # アイテムウィンドウで現在選択されているデータを取得
- @item = @itemlist_window.item
- # 使用アイテムではない場合
- unless @item.is_a?(RPG::Item)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 使用できない場合
- unless $game_party.item_can_use?(@item.id)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- # 効果範囲が味方の場合
- if @item.scope >= 3
- # ターゲットウィンドウをアクティブ化
- @itemlist_window.active = false
- @target_window.x = 304
- @target_window.visible = true
- @target_window.active = true
- # 効果範囲 (単体/全体) に応じてカーソル位置を設定
- if @item.scope == 4 || @item.scope == 6
- @target_window.index = -1
- else
- @target_window.index = 0
- end
- # 効果範囲が味方以外の場合
- else
- # コモンイベント ID が有効の場合
- if @item.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @item.common_event_id
- # アイテムの使用時 SE を演奏
- $game_system.se_play(@item.menu_se)
- # 消耗品の場合
- if @item.consumable
- # 使用したアイテムを 1 減らす
- $game_party.lose_item(@item.id, 1)
- # アイテムウィンドウの項目を再描画
- @itemlist_window.draw_item(@itemlist_window.index)
- end
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_target
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # アイテム切れなどで使用できなくなった場合
- unless $game_party.item_can_use?(@item.id)
- # アイテムウィンドウの内容を再作成
- @itemlist_window.refresh
- end
- # ターゲットウィンドウを消去
- @itemlist_window.active = true
- @target_window.visible = false
- @target_window.active = false
- @itemlist_window.set_item(@command_index)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # アイテムを使い切った場合
- if $game_party.item_number(@item.id) == 0
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # ターゲットが全体の場合
- if @target_window.index == -1
- # パーティ全体にアイテムの使用効果を適用
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- # ターゲットが単体の場合
- if @target_window.index >= 0
- # ターゲットのアクターにアイテムの使用効果を適用
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- # アイテムを使った場合
- if used
- # アイテムの使用時 SE を演奏
- $game_system.se_play(@item.menu_se)
- # 消耗品の場合
- if @item.consumable
- # 使用したアイテムを 1 減らす
- $game_party.lose_item(@item.id, 1)
- # アイテムウィンドウの項目を再描画
- @itemlist_window.draw_item(@itemlist_window.index)
- @itemlist_window.set_item(@command_index)
- end
- # ターゲットウィンドウの内容を再作成
- @target_window.refresh
- # 全滅の場合
- if $game_party.all_dead?
- # ゲームオーバー画面に切り替え
- $scene = Scene_Gameover.new
- return
- end
- # コモンイベント ID が有効の場合
- if @item.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @item.common_event_id
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- # アイテムを使わなかった場合
- unless used
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 [/fold]
[fold=物品颜色修改]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #
- # 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
- # 可以更改的种类包括物品、防具、特技、武器。
- #
- # 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
- # 数字为颜色编号,和对话框中的一样。
- # ——————————————————————————————————————
- module RPG
- class Skill
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Weapon
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Item
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name_color != nil ? name_color.to_i : 0
- end
- end
- class Armor
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def name_color_66RPG
- name_color = @description.split(/@/)[1]
- return name != nil ? name_color.to_i : 0
- end
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 描绘物品名
- # item : 物品
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y)
- if item == nil
- return
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.color = text_color(item.name_color_66RPG)
- self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Item
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- if item.is_a?(RPG::Item) and
- $game_party.item_can_use?(item.id)
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_EquipItem < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 项目的描绘
- # index : 项目符号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- case item
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.font.color = text_color(item.name_color_66RPG)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 描绘羡慕
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- # 获取物品所持数
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
- # 除此之外的情况设置为无效文字色
- if item.price <= $game_party.gold and number < 99
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
- end
- end
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_ShopSell < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目标号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- # 可以卖掉的显示为普通颜色、除此之外设置成无效文字颜色
- if item.price > 0
- self.contents.font.color = text_color(item.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- end
-
- # ——————————————————————————————————————
- # 本脚本原创自www.66rpg.com,转载请保留此信息
- # ——————————————————————————————————————
- class Window_Skill
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = text_color(skill.name_color_66RPG)
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == disabled_color ? 128 : 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
-
复制代码 [/fold]
战斗类
[fold=把逃跑加入到正常选项中]- #=======================================================================
- # ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息
- #-----------------------------------------------------------------------
- # 脚本功能:去掉战斗开始时候的 战斗/逃跑 的选择过程.
- # 脚本作者:后知后觉 2010-8-11 13:46:59
- # 使用方法:直接在 Main 前插入即可
- #=======================================================================
- class Window_PartyCommand < Window_Selectable
- def visible=(value)
- super(false)
- end
- def active=(value)
- super(false)
- end
- end
- class Scene_Battle
- alias hzhj_old_start_phase2 start_phase2
- def start_phase2
- hzhj_old_start_phase2
- if @phase == 2
- start_phase3
- end
- end
- end
- #=======================================================================
- # ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息
- #=======================================================================
复制代码 [/fold]
[fold=公共事件战斗特效][/fold]
[fold=技能熟练度]- #=====================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #====================================================================
- #====================================================================
- # ■ スキルアップデート Ver. 4.4.0 by Claimh
- #---------------------------------------------------------------
- # スキルごとにレベル制を導入する
- # 戦闘中にスキルを使用するほど、威力上昇、消費SP減少、命中率上昇
- #==============================================================
- module Skill_updata
- S_MIGHT = []
- S_COST = []
- S_HIT = []
- S_LEVEL = []
- S_INTER = []
- S_SLOPE = []
- S_ANIME = []
- S_ELEMENT = []
- S_STATE_P = []
- S_STATE_N = []
- #=============================================================
- # □ 自定义内容
- #==============================================================
- # 威力上升使用true/false
- SKILL_MIGHT_UP = true
-
- # SP消耗减少使用true/false
- SP_COST_DOWN = true
-
- # 命中率上升使用true/false
- SKILL_HIT_UP = true
-
- # 属性变化的使用true/false
- ELEMENT_CHANGE = true
-
- # 状态变化的使用true/false
- STATE_CHANGE = true
-
- # 显示特技等级上升true/false
- SHOW_SKILL_LV_UP = true
-
- # 等级上升的声效,不用的时候就=nil
- SKILLUP_SE = "056-Right02"
-
- # 菜单使用计数true/false
- MENU_COUNT = false
- # 升级所需次数
- UPDATA_INTERVAL = 1
-
- # 等级上限
- LEVEL_LIMIT = 20
- # 威力上升率(%%)
- MIGHT_RATE = 0.5
-
- # SP消耗减少率(%)
- COST_RATE = 3
-
- # 命中上升率(%)
- HIT_RATE = 1
- #-------------------------------------------------------------
- # 特别技能的详细设定,57和61号特技分别是十字斩和扫荡,大家最熟悉的两个招数
- #----------------------------------------------------------------
-
- # 界限水平
- # S_LEVEL[技艺ID]=[角色ID=>界限,…]
- S_LEVEL[57] = {1=>18, 2=>12, 3=>5, 4=>12, 5=>12, 6=>12, 7=>12, 8=>12}
- S_LEVEL[61] = {1=>12, 2=>18, 3=>15, 4=>12, 5=>12, 6=>12, 7=>12, 8=>12}
-
- # 技艺&actor威力上升率
- # S_MIGHT[技艺ID]=[角色ID=>威力上升率,…]
- S_MIGHT[57] = {1=>8, 2=>2, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- S_MIGHT[61] = {1=>2, 2=>8, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- # 技艺&actorSP消费减少率
- # S_COST[技艺ID]=[角色ID=>SP消费减少率,…]
- S_COST[57] = {1=>8, 2=>2, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- S_COST[61] = {1=>2, 2=>8, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
- # 技艺&actor命中率
- # S_HIT[技艺ID]=[角色ID=>命中上升率,…]
- S_HIT[57] = {1=>2, 2=>1, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1}
- S_HIT[61] = {1=>1, 2=>2, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1}
- #-----------------------------------------------------------------
- # 技能成长的具体调节
- #-----------------------------------------------------------------
- # 技艺的增长图形
- # 0:使用技艺一定回数的话提高水平
- # 1:技艺一定回数+每水平の使用提高水平
- SKILL_PATTERN = 0
-
- # 技艺水平上升间隔每(使用几回Lv提高)
- # ※没有设定的情况→基本设定被适应
- # S_INTER[技艺ID]=[actorID=>上升间隔,…]
- S_INTER[57] = {1=>5, 2=>8, 3=>8, 4=>8, 5=>8, 6=>8, 7=>8, 8=>8}
-
- # スキルレベル上昇の傾き(パターン1を使用する場合のみ必要)
- # ※設定がない場合は1となります。
- # S_SLOPE[スキルID] = [アクターID=>上昇の傾き, …]
- S_SLOPE[57] = {1=>5, 2=>8, 3=>8, 4=>8, 5=>8, 6=>8, 7=>8, 8=>8}
- #-------------------------------------------------------------
- # 技艺增长的话使之动画变化
- # 记录格式: S_ANIME[技艺ID] = [角色ID=>[[等级, 动画ID]], ・・・]
- #------------------------------------------------------------
- # 实施技艺增长的动画变化?
- USE_S_ANIME = true
-
- # 設定例
- # 1号角色,57号特技,lv5,lv10动画变化
- # 2号角色,Lv.11动画变化
- S_ANIME[57] = {1=>[[5, 69], [10, 70]], 2=>[[11, 70]]}
- #-------------------------------------------------------------------
- # 属性変化/状态変化
- #------------------------------------------------------------------
- # 属性変化
- # S_ELEMENT[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
- S_ELEMENT[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}
- # 状态変化+
- # S_STATE_P[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
- S_STATE_P[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}
- # 状态変化-
- # S_STATE_N[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
- S_STATE_N[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}
- #==================================================================
- # □ 自定义内容终了
- #==================================================================
- end
- class Game_Actor
- include Skill_updata
- attr_accessor :skill_use # スキル使用回数
- attr_accessor :skill_level # スキルレベル
- attr_accessor :skill_power # スキル威力更新値
- attr_accessor :skill_sp_cost # スキルSP消費更新値
- attr_accessor :skill_hit # スキル命中率
- attr_accessor :skill_up # レベルアップフラグ
- attr_accessor :skill_list # スキルEXPリスト
- alias skill_updata_init setup
- def setup(actor_id)
- skill_updata_init(actor_id)
- @skill_use = []
- @skill_level = []
- @skill_power = []
- @skill_sp_cost = []
- @skill_hit = []
- @skill_up = false
- @skill_list = []
- for id in 1...$data_skills.size
- @skill_use[id] = 0
- @skill_level[id] = 0
- @skill_power[id] = $data_skills[id].power
- @skill_sp_cost[id] = $data_skills[id].sp_cost
- @skill_hit[id] = $data_skills[id].hit
- @skill_list[id] = make_skill_list(id)
- end
- end
- #-------------------------------------------------------------
- # ● スキルEXP 計算
- #------------------------------------------------------------
- def make_skill_list(skill_id)
- interval = S_INTER[skill_id]
- up_interval = ( (interval != nil and interval[@actor_id] != nil) ? interval[@actor_id] : UPDATA_INTERVAL )
- slope = S_SLOPE[skill_id]
- up_slope = ( (slope != nil and slope[@actor_id] != nil) ? slope[@actor_id] : 1 )
- limit = S_LEVEL[skill_id]
- limit_lv = ( (limit != nil and limit[@actor_id] != nil) ? limit[@actor_id] : LEVEL_LIMIT )
- list = []
- list[0] = 0
- for lv in 1...limit_lv+1
- exp = 0
- case SKILL_PATTERN
- when 0
- exp = up_interval * lv
- when 1
- exp = list[lv-1] + up_slope * lv + up_interval
- end
- list[lv] = exp.truncate
- end
- return list
- end
- end
- class Game_Battler
- include Skill_updata
- #-----------------------------------------------------------------
- # ● スキルの効果適用
- # user : スキルの使用者 (バトラー)
- # skill : スキル
- #-------------------------------------------------------------
- alias skill_effect_update skill_effect
- def skill_effect(user, skill)
- up_flag = false
- if user.is_a?(Game_Actor) and ($scene.is_a?(Scene_Battle) or MENU_COUNT)
- skill_update_main(user, skill)
- skill_base = skill.dup
- # 威力上昇
- if SKILL_MIGHT_UP
- skill.power = user.skill_power[skill.id]
- end
- # 命中率上昇
- if SKILL_HIT_UP
- skill.hit = user.skill_hit[skill.id]
- end
- # 属性変化
- if ELEMENT_CHANGE and S_ELEMENT != []
- ele1 = S_ELEMENT[skill.id]
- if ele1 != nil and ele1[user.id] != nil
- ele2 = ele1[user.id]
- if ele2 != [] and ele2[user.skill_level[skill.id]] != nil
- skill.element_set = ele2[user.skill_level[skill.id]]
- end
- end
- end
- # ステート変化
- if STATE_CHANGE
- if S_STATE_P != []
- pst1 = S_STATE_P[skill.id]
- if pst1 != nil and pst1[user.id] != nil
- pst2 = pst1[user.id]
- if pst2 != nil and pst2[user.skill_level[skill.id]] != nil
- skill.plus_state_set = pst2[user.skill_level[skill.id]]
- # p skill.plus_state_set
- end
- end
- end
- if S_STATE_N != []
- nst1 = S_STATE_N[skill.id]
- if nst1 != nil and nst1[user.id] != nil
- nst2 = nst1[user.id]
- if nst1 != nil and nst2[user.skill_level[skill.id]] != nil
- skill.minus_state_set = nst2[user.skill_level[skill.id]]
- end
- end
- end
- end
- up_flag = true
- end
- ret = skill_effect_update(user, skill) # 原物
- if up_flag
- skill = skill_base
- # Miss時には後戻し
- if self.damage == "Miss"
- skill_use_recount(user, skill)
- end
- end
- return ret
- end
-
- #------------------------------------------------------------
- # ● スキルアップデータメイン
- #-------------------------------------------------------------
- def skill_update_main(actor, skill)
- # スキル使用回数のカウント
- actor.skill_use[skill.id] += 1
- # リミット取得
- limit = S_LEVEL[skill.id]
- s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
- # 書き換え限界到達
- if s_limit == false or actor.skill_level[skill.id] < s_limit
- # レベルアップ間隔取得
- interval = actor.skill_list[skill.id]
- # 書き換え回数到達
- if actor.skill_use[skill.id] == interval[actor.skill_level[skill.id]+1]
- # スキルレベル上昇
- actor.skill_level[skill.id] += 1
- actor.skill_up = true
- # 威力上昇 = 有効
- if SKILL_MIGHT_UP
- might = S_MIGHT[skill.id]
- might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
- # 補正値更新
- actor.skill_power[skill.id] += skill.power * might_rate / 100
- actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
- end
- # SP消費減少 = 有効
- if SP_COST_DOWN
- cost = S_COST[skill.id]
- cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
- actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
- actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
- # SP消費が0以下はありえない
- if actor.skill_sp_cost[skill.id] < 0
- actor.skill_sp_cost[skill.id] = 0
- end
- end
- # 命中率上昇 = 有効
- if SKILL_HIT_UP
- hit = S_HIT[skill.id]
- hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
- actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
- actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
- # 100以上はありえない
- if actor.skill_hit[skill.id] > 100
- actor.skill_hit[skill.id] = 100
- end
- end
- end
- end
- end
-
- #---------------------------------------------------------
- # ● 再カウント
- #------------------------------------------------------
- def skill_use_recount(actor, skill)
- if actor.skill_up
- actor.skill_level[skill.id] -= 1
- # 威力を再計算
- if SKILL_MIGHT_UP
- actor.skill_power[skill.id] = skill.power
- might = S_MIGHT[skill.id]
- might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
- for i in 1...actor.skill_level[skill.id]
- actor.skill_power[skill.id] += skill.power * might_rate / 100
- actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
- end
- end
- # SP消費再計算
- if SP_COST_DOWN
- actor.skill_sp_cost[skill.id] = skill.sp_cost
- cost = S_COST[skill.id]
- cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
- for i in 1...actor.skill_level[skill.id]
- actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
- actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
- end
- # SP消費が0以下はありえない
- if actor.skill_sp_cost[skill.id] < 0
- actor.skill_sp_cost[skill.id] = 0
- end
- end
- # 命中率再計算
- if SKILL_HIT_UP
- actor.skill_hit[skill.id] = skill.hit
- hit = S_HIT[skill.id]
- hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
- for i in 1...actor.skill_level[skill.id]
- actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
- actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
- end
- # 100以上はありえない
- if actor.skill_hit[skill.id] > 100
- actor.skill_hit[skill.id] = 100
- end
- end
- actor.skill_up = false
- end
- actor.skill_use[skill.id] -= 1
- end
- end
- #=================================================================
- # スキル成長によるアニメーション変化
- #=================================================================
- class Scene_Battle
- include Skill_updata
- #--------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
- #-----------------------------------------------------------
- alias update_phase4_step4_skillup update_phase4_step4
- def update_phase4_step4
- update_phase4_step4_skillup
- if @active_battler.is_a?(Game_Actor) and USE_S_ANIME
- s_anime = S_ANIME[@skill.id]
- # 設定がないなら無視
- if s_anime != nil and s_anime[@active_battler.id] != nil
- s_anime_set = s_anime[@active_battler.id]
- for i in 0...s_anime_set.size
- s_anime_def = s_anime_set[i]
- # 規定レベル以上
- if @active_battler.skill_level[@skill.id] >= s_anime_def[0]
- # 対象側アニメーション
- for target in @target_battlers
- target.animation_id = s_anime_def[1]
- end
- end
- end
- end
- end
- end
- end
- #=================================================================
- # 以下、レベルアップ表示部分(レベルアップ表示がいらないなら消してもOK)
- #=================================================================
- class Scene_Battle
- include Skill_updata
- if SHOW_SKILL_LV_UP
- #----------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
- #----------------------------------------------------------
- alias update_phase4_step2_skillup update_phase4_step2
- def update_phase4_step2
- if @active_battler.is_a?(Game_Actor)
- @active_battler.skill_up = false
- end
- @skillup = false
- update_phase4_step2_skillup # 原物
- end
- #-------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
- #-----------------------------------------------------------
- alias update_phase4_step3_skillup update_phase4_step3
- def update_phase4_step3
- if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up != false
- @skillup = true
- @skill_up_window = Window_Skillup.new(@active_battler)
- if SKILLUP_SE != nil
- Audio.se_play("Audio/SE/" + SKILLUP_SE)
- sleep(0.1)
- end
- end
- update_phase4_step3_skillup
- end
- #--------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
- #--------------------------------------------------------------
- alias update_phase4_step5_skillup update_phase4_step5
- def update_phase4_step5
- if @active_battler.is_a?(Game_Actor) and @skillup
- @skill_up_window.dispose
- @active_battler.skill_up = false
- @skillup = false
- end
- update_phase4_step5_skillup # 原物
- end
- #---------------------------------------------------------------
- # ● フレーム更新
- #----------------------------------------------------------------
- alias update_skillup update
- def update
- if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up and @skillup
- @skill_up_window.contents_opacity -= 4
- end
- update_skillup # 原物
- end
- end # if SHOW_SKILL_LV_UP
- end
- class Window_Skillup < Window_Base
- #--------------------------------------------------------------
- # ● オブジェクト初期化
- # actor : アクター
- #-------------------------------------------------------------
- def initialize(actor)
- super(actor.screen_x-140, 260, 250, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = 0
- self.contents.font.color = Color.new(255, 64, 0)
- self.contents.draw_text(80, 0, 150, 32, "LEVEL UP!")
- end
- end
- #====================================================================
- # 以下、再定義部分を含む(SP消費減少の機能がいらないなら消してもOK)
- #====================================================================
- class Window_Skill < Window_Selectable
- #----------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #-----------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- #-修正-----
- @actor.skill_level[skill.id] = 0 if @actor.skill_level[skill.id] == nil
- name_level = skill.name + "(Lv" + @actor.skill_level[skill.id].to_s + ")"
- self.contents.draw_text(x + 28, y, 204, 32, name_level, 0)
- @actor.skill_sp_cost[skill.id] = skill.sp_cost if @actor.skill_sp_cost[skill.id] == nil
- self.contents.draw_text(x + 232, y, 48, 32, @actor.skill_sp_cost[skill.id].to_s, 2)
- #----------
- end
- end
- class Scene_Skill
- #----------------------------------------------------------
- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
- #-------------------------------------------------------------
- def update_target
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- # ターゲットウィンドウを消去
- @skill_window.active = true
- @target_window.visible = false
- @target_window.active = false
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # SP 切れなどで使用できなくなった場合
- unless @actor.skill_can_use?(@skill.id)
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # ターゲットが全体の場合
- if @target_window.index == -1
- # パーティ全体にスキルの使用効果を適用
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- # ターゲットが使用者の場合
- if @target_window.index <= -2
- # ターゲットのアクターにスキルの使用効果を適用
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- # ターゲットが単体の場合
- if @target_window.index >= 0
- # ターゲットのアクターにスキルの使用効果を適用
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- # スキルを使った場合
- if used
- # スキルの使用時 SE を演奏
- $game_system.se_play(@skill.menu_se)
- #-----修正---------------------------------------------
- @actor.skill_sp_cost[@skill.id] = @skill.sp_cost if @actor.skill_sp_cost[@skill.id] == nil
- # SP 消費
- @actor.sp -= @actor.skill_sp_cost[@skill.id]
- #------------------------------------------------
- # 各ウィンドウの内容を再作成
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # 全滅の場合
- if $game_party.all_dead?
- # ゲームオーバー画面に切り替え
- $scene = Scene_Gameover.new
- return
- end
- # コモンイベント ID が有効の場合
- if @skill.common_event_id > 0
- # コモンイベント呼び出し予約
- $game_temp.common_event_id = @skill.common_event_id
- # マップ画面に切り替え
- $scene = Scene_Map.new
- return
- end
- end
- # スキルを使わなかった場合
- unless used
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- class Scene_Battle
- include Skill_updata
- #------------------------------------------------------
- # ● スキルアクション 結果作成
- #-------------------------------------------------------
- alias make_skill_action_result_skill_update make_skill_action_result
- def make_skill_action_result
- make_skill_action_result_skill_update
- # SP 消費
- if SP_COST_DOWN and @active_battler.is_a?(Game_Actor)
- @active_battler.sp += @skill.sp_cost
- @active_battler.sp -= @active_battler.skill_sp_cost[@skill.id]
- end
- end
- end
- class Game_Battler
- #--------------------------------------------------------
- # ● スキルの使用可能判定
- # skill_id : スキル ID
- #------------------------------------------------------
- alias skill_update_can_use? skill_can_use?
- def skill_can_use?(skill_id)
- ret = skill_update_can_use?(skill_id)
- if !ret and SP_COST_DOWN
- # SP が足りない場合は使用不可となった?
- if $data_skills[skill_id].sp_cost > self.sp
- if self.is_a?(Game_Actor)
- skill_sp_cost = self.skill_sp_cost[skill_id]
- if skill_sp_cost < self.sp
- ret = true
- end
- end
- end
- end
- return ret
- end
- end
- #===============================================================
- # イベントスクリプト操作
- #===============================================================
- class Interpreter
- include Skill_updata
- #-----------------------------------------------------------
- # ● スキルレベル設定(レベルセット)
- # actor_id : アクターID
- # skill_id : スキルID
- # level : 設定レベル
- #-----------------------------------------------------------
- def set_skill_level(actor_id, skill_id, level)
- actor = $game_actors[actor_id]
- skill = $data_skills[skill_id]
- # リミット取得
- limit = S_LEVEL[skill_id]
- s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
- if level > s_limit or level < 0
- return
- end
- # レベル
- actor.skill_level[skill.id] = level
- # 使用回数
- use_list = actor.skill_list[skill.id]
- actor.skill_use[skill.id] = use_list[level]
- # 威力を再計算
- if SKILL_MIGHT_UP
- actor.skill_power[skill.id] = skill.power
- might = S_MIGHT[skill.id]
- might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
- for i in 0...level
- actor.skill_power[skill.id] += skill.power * might_rate / 100
- actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
- end
- end
- # SP消費再計算
- if SP_COST_DOWN
- actor.skill_sp_cost[skill.id] = skill.sp_cost
- cost = S_COST[skill.id]
- cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
- for i in 0...level
- actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
- actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
- end
- # SP消費が0以下はありえない
- if actor.skill_sp_cost[skill.id] < 0
- actor.skill_sp_cost[skill.id] = 0
- end
- end
- # 命中率再計算
- if SKILL_HIT_UP
- actor.skill_hit[skill.id] = skill.hit
- hit = S_HIT[skill.id]
- hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
- for i in 0...level
- actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
- actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
- end
- # 100以上はありえない
- if actor.skill_hit[skill.id] > 100
- actor.skill_hit[skill.id] = 100
- end
- end
- end
-
- #---------------------------------------------------------
- # ● スキルレベル設定(レベルアップ)
- # actor_id : アクターID
- # skill_id : スキルID
- #--------------------------------------------------------
- def skill_level_up(actor_id, skill_id)
- actor = $game_actors[actor_id]
- set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]+1)
- end
-
- #-------------------------------------------------------
- # ● スキルレベル設定(レベルダウン)
- # actor_id : アクターID
- # skill_id : スキルID
- #--------------------------------------------------------
- def skill_level_down(actor_id, skill_id)
- actor = $game_actors[actor_id]
- set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]-1)
- end
- end
- #==================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==================================================================
复制代码 [/fold]
[fold=空手攻防][/fold]
[fold=图标战斗菜单]- #==========================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==========================================================================
- module Momo_IconCommand
- # 图标名称设定
- ATTACK_ICON_NAME = "001-Weapon01" # 攻撃
- SKILL_ICON_NAME = "044-Skill01" # 特技
- GUARD_ICON_NAME = "009-Shield01" # 防御
- ITEM_ICON_NAME = "032-Item01" # 物品
- # X坐标修正
- X_PLUS = -40
- # Y坐标修正
- Y_PLUS = -180
- # 选择时图标的动作
- # 0:静止 1:放大
- SELECT_TYPE = 0
- # 闪烁时光芒的颜色
- FLASH_COLOR = Color.new(255, 255, 255, 128)
- # 闪烁时间
- FLASH_DURATION = 10
- # 闪烁间隔
- FLASH_INTERVAL = 20
- # 是否写出文字的名称
- COM_NAME_DROW = true
- # 文字名称是否移动
- COM_NAME_MOVE = true
- # 文字内容
- ATTACK_NAME = "攻击" # 攻击
- SKILL_NAME = "特技" # 特技
- GUARD_NAME = "防御" # 防御
- ITEM_NAME = "物品" # 物品
- # 文字颜色
- COM_NAME_COLOR = Color.new(255, 255, 255, 255)
- # 文字坐标修正
- COM_NAME_X_PLUS = 0
- COM_NAME_Y_PLUS = 0
- end
- class Window_CommandIcon < Window_Selectable
- attr_accessor :last_index
- #------------------------------------------------------------------------
- # ● オブジェクト初期化
- #------------------------------------------------------------------------
- def initialize(x, y, commands)
- super(x, y, 32, 32)
- # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
- self.windowskin = RPG::Cache.windowskin("")
- @item_max = commands.size
- @commands = commands
- @column_max = commands.size
- @index = 0
- @last_index = nil
- @name_sprite = nil
- @sprite = []
- refresh
- end
- def dispose
- super
- for sprite in @sprite
- sprite.dispose unless sprite.nil?
- end
- @name_sprite.dispose unless @name_sprite.nil?
- end
- #------------------------------------------------------------------------
- # ● リフレッシュ
- #------------------------------------------------------------------------
- def refresh
- @name_sprite.dispose unless @name_sprite.nil?
- for sprite in @sprite
- sprite.dispose unless sprite.nil?
- end
- @name_sprite = nil
- draw_com_name if Momo_IconCommand::COM_NAME_DROW
- @sprite = []
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #------------------------------------------------------------------------
- # ● 項目の描画
- #------------------------------------------------------------------------
- def draw_item(index)
- @sprite[index] = Sprite_Icon.new(nil, @commands[index])
- @sprite[index].z = self.z + 1
- end
- def draw_com_name
- @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
-
- end
-
- # 更新
- def update
- super
- icon_update
- com_name_update if Momo_IconCommand::COM_NAME_DROW
- if move_index?
- @last_index = self.index
- end
- end
- # アイコンの更新
- def icon_update
- for i in 0...@sprite.size
- @sprite[i].active = (self.index == i)
- @sprite[i].x = self.x + i * 24
- @sprite[i].y = self.y + 0
- @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
- @sprite[i].visible = self.visible
- @sprite[i].update
- end
- end
- # コマンドネームの更新
- def com_name_update
- if move_index?
- @name_sprite.name = get_com_name
- end
- @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
- @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
- @name_sprite.z = self.z + 1
- @name_sprite.active = self.active
- @name_sprite.visible = self.visible
- @name_sprite.update
- end
- def get_com_name
- make_name_set if @name_set.nil?
- name = @name_set[self.index]
- name = "" if name.nil?
- return name
- end
- def make_name_set
- @name_set = []
- @name_set[0] = Momo_IconCommand::ATTACK_NAME
- @name_set[1] = Momo_IconCommand::SKILL_NAME
- @name_set[2] = Momo_IconCommand::GUARD_NAME
- @name_set[3] = Momo_IconCommand::ITEM_NAME
- end
- def move_index?
- return self.index != @last_index
- end
- def need_reset
- @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
- end
- end
- # アイコン用スプライト
- class Sprite_Icon < Sprite
- attr_accessor :active
- attr_accessor :icon_name
- #------------------------------------------------------------------------
- # ● オブジェクト初期化
- #------------------------------------------------------------------------
- def initialize(viewport, icon_name)
- super(viewport)
- @icon_name = icon_name
- @last_icon = @icon_name
- @count = 0
- self.bitmap = RPG::Cache.icon(@icon_name)
- self.ox = self.bitmap.width / 2
- self.oy = self.bitmap.height / 2
- @active = false
- end
- #------------------------------------------------------------------------
- # ● 解放
- #------------------------------------------------------------------------
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- super
- end
- #------------------------------------------------------------------------
- # ● フレーム更新
- #------------------------------------------------------------------------
- def update
- super
- if @icon_name != @last_icon
- @last_icon = @icon_name
- self.bitmap = RPG::Cache.icon(@icon_name)
- end
- if @active
- @count += 1
- case Momo_IconCommand::SELECT_TYPE
- when 0
- icon_flash
- when 1
- icon_zoom
- end
- @count = 0 if @count == 20
- else
- icon_reset
- end
- end
- def icon_flash
- if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
- self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
- end
- end
- def icon_zoom
- case @count
- when 1..10
- zoom = 1.0 + @count / 10.0
- when 11..20
- zoom = 2.0 - (@count - 10) / 10.0
- end
- self.zoom_x = zoom
- self.zoom_y = zoom
- end
- def icon_reset
- @count = 0
- self.zoom_x = 1.0
- self.zoom_y = 1.0
- end
- end
- # コマンドネーム用スプライト
- class Sprite_Comm_Name < Sprite
- attr_accessor :active
- attr_accessor :name
- attr_accessor :need_reset
- #------------------------------------------------------------------------
- # ● オブジェクト初期化
- #------------------------------------------------------------------------
- def initialize(viewport, name)
- super(viewport)
- @name = name
- @last_name = nil
- @count = 0
- @x_plus = 0
- @opa_plus = 0
- @need_reset = false
- @active = false
- self.bitmap = Bitmap.new(160, 32)
- end
- #------------------------------------------------------------------------
- # ● 解放
- #------------------------------------------------------------------------
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- super
- end
- #------------------------------------------------------------------------
- # ● フレーム更新
- #------------------------------------------------------------------------
- def update
- super
- if @active
- if need_reset?
- @need_reset = false
- @last_name = @name
- text_reset
- end
- move_text if Momo_IconCommand::COM_NAME_MOVE
- end
- end
- def move_text
- @count += 1
- @x_plus = [@count * 8, 80].min
- self.x = self.x - 80 + @x_plus
- self.opacity = @count * 25
- end
- def text_reset
- @count = 0
- @x_plus = 0
- self.bitmap.clear
- self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
- self.bitmap.draw_text(0, 0, 160, 32, @name)
- end
- def need_reset?
- return (@name != @last_name or @need_reset)
- end
- end
- class Scene_Battle
- #------------------------------------------------------------------------
- # ● プレバトルフェーズ開始
- #------------------------------------------------------------------------
- alias scene_battle_icon_command_start_phase1 start_phase1
- def start_phase1
- com1 = Momo_IconCommand::ATTACK_ICON_NAME
- com2 = Momo_IconCommand::SKILL_ICON_NAME
- com3 = Momo_IconCommand::GUARD_ICON_NAME
- com4 = Momo_IconCommand::ITEM_ICON_NAME
- @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
- @actor_command_window.y = 160
- @actor_command_window.back_opacity = 160
- @actor_command_window.active = false
- @actor_command_window.visible = false
- @actor_command_window.update
- scene_battle_icon_command_start_phase1
- end
- #------------------------------------------------------------------------
- # ● アクターコマンドウィンドウのセットアップ
- #------------------------------------------------------------------------
- alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
- def phase3_setup_command_window
- scene_battle_icon_command_phase3_setup_command_window
- # アクターコマンドウィンドウの位置を設定
- @actor_command_window.x = command_window_actor_x(@actor_index)
- @actor_command_window.y = command_window_actor_y(@actor_index)
- @actor_command_window.need_reset
- end
- def command_window_actor_x(index)
- $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
- end
- def command_window_actor_y(index)
- $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
- end
- end
- #==========================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==========================================================================
-
复制代码 [/fold]
[fold=相应武器才能施展的技能]- class Game_Actor
- WEAPONSKILL = []
- WEAPONSKILL[1] = 80#1号武器自带80号特技,根据需要自己添加修改
- WEAPONSKILL[2] = 70#2号武器自带70号特技
- alias oldsetup setup
- def setup(actor_id)
- oldsetup(actor_id)
- change_weapon_skill($data_actors[actor_id].weapon_id)
- end
- def forget_skill(skill_id)
- unless skill_id == @weapon_skill
- @skills.delete(skill_id)
- end
- end
- def learn_skill(skill_id)
- if skill_id == @weapon_skill
- @weapon_skill = nil
- return
- end
- if skill_id > 0 and not skill_learn?(skill_id)
- @skills.push(skill_id)
- @skills.sort!
- end
- end
- def change_weapon_skill(weapon_id)
- if @weapon_skill != nil
- @skills.delete(@weapon_skill)
- @weapon_skill = nil
- end
- unless skill_learn?(WEAPONSKILL[weapon_id]) or WEAPONSKILL[weapon_id] == nil
- learn_skill(WEAPONSKILL[weapon_id])
- @weapon_skill = WEAPONSKILL[weapon_id]
- end
- end
- def equip(equip_type, id)
- case equip_type
- when 0 # 武器
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(@weapon_id, 1)
- change_weapon_skill(id)
- @weapon_id = id
- $game_party.lose_weapon(id, 1)
- end
- when 1 # 盾
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor1_id], $data_armors[id])
- $game_party.gain_armor(@armor1_id, 1)
- @armor1_id = id
- $game_party.lose_armor(id, 1)
- end
- when 2 # 头
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor2_id], $data_armors[id])
- $game_party.gain_armor(@armor2_id, 1)
- @armor2_id = id
- $game_party.lose_armor(id, 1)
- end
- when 3 # 身体
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor3_id], $data_armors[id])
- $game_party.gain_armor(@armor3_id, 1)
- @armor3_id = id
- $game_party.lose_armor(id, 1)
- end
- when 4 # 装饰品
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor4_id], $data_armors[id])
- $game_party.gain_armor(@armor4_id, 1)
- @armor4_id = id
- $game_party.lose_armor(id, 1)
- end
- end
- end
- end
复制代码 [/fold]
其他
[fold=魔法商店]- #==============================================================================
- # ■ 本脚本源自www.66rpg.com,转载与使用请保留此信息
- #==============================================================================
- #——以下是一些自定义的内容
- $mShop_use_1 = "金钱" #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”
- $mShop_use_2 = "金" #——这项是购买魔法特技的货币单位,如“点”、“¥”
- $mShop_use_variable = 1 #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱
- $mShop_Window_Opacity = 200 #——这项是窗口透明度
- #==============================================================================
- # ■ Window_MGold
- #------------------------------------------------------------------------------
- # 显示金钱的窗口。
- #==============================================================================
- class Window_MGold < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 272, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0 , 240,32 ,$mShop_use_1)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, 240-contents.text_size($mShop_use_2).width-6, 32, $mShop_gold.to_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(0, 0, 240, 32, $mShop_use_2, 2)
- end
- end
- #==============================================================================
- # ■ Scene_MShop
- #------------------------------------------------------------------------------
- # 处理特技商店画面的类。
- #==============================================================================
- class Scene_MShop
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize(id)
- @id = id
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- screen = Spriteset_Map.new
- if $mShop_use_variable == 0
- $mShop_gold = $game_party.gold
- else
- $mShop_gold = $game_variables[$mShop_use_variable]
- end
- # 生成帮助窗口
- @help_window = Window_Help.new
- @help_window.opacity = $mShop_Window_Opacity
- # 生成金钱窗口
- @gold_window = Window_MGold.new
- @gold_window.x = 368
- @gold_window.y = 416
- @gold_window.opacity = $mShop_Window_Opacity
- # 生成购买窗口
- @buy_window = Window_MShopBuy.new(@id)
- @buy_window.active = true
- @buy_window.visible = true
- @buy_window.help_window = @help_window
- @buy_window.opacity = $mShop_Window_Opacity
- # 生成状态窗口
- @status_window = Window_MShopStatus.new
- @status_window.visible = true
- @status_window.active = false
- @status_window.opacity = $mShop_Window_Opacity
-
- #生成指令窗口
- @command_window = Window_Command.new(160,["学习","遗忘"])
- @command_window.x = 320
- @command_window.y = 240
- @command_window.z = 500
- @command_window.visible = false
- @command_window.active = false
- @command_window.opacity = $mShop_Window_Opacity
-
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @help_window.dispose
- #@mhelp_window.dispose
- @gold_window.dispose
- @buy_window.dispose
- @status_window.dispose
- @command_window.dispose
- screen.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @help_window.update
- #@mhelp_window.update
- @gold_window.update
- @buy_window.update
- @status_window.update
- @command_window.update
- # 购买窗口激活的情况下: 调用 update_buy
- if @buy_window.active
- update_buy
- return
- end
- if @status_window.active
- update_status
- return
- end
- if @command_window.active
- update_command
- return
- end
-
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新画面 (指令窗口激活的情况下)
- #--------------------------------------------------------------------------
- def update_command
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @status_window.index = -1
- @command_window.active = false
- @command_window.visible = false
- @buy_window.active = true
- return
- end
- if Input.trigger?(Input::C)
- if @command_window.index == 0
- if $game_party.actors[@status_window.index].skill_learn?(@skill.id) or @skill.price >$mShop_gold
- $game_system.se_play($data_system.cancel_se)
- return
- else
- $game_system.se_play($data_system.decision_se)
- if $mShop_use_variable == 0
- $game_party.gain_gold(-@skill.price)
- $mShop_gold -= @skill.price
- else
- $game_variables[$mShop_use_variable] -= @skill.price
- $mShop_gold -= @skill.price
- end
- $game_party.actors[@status_window.index].learn_skill(@skill.id)
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- @status_window.index = -1
- @buy_window.active = true
- @command_window.active = false
- @command_window.visible = false
- end
- elsif @command_window.index == 1
- if $game_party.actors[@status_window.index].skill_learn?(@skill.id) == false
- $game_system.se_play($data_system.cancel_se)
- return
- else
- $game_system.se_play($data_system.decision_se)
- if $mShop_use_variable == 0
- $game_party.gain_gold(@skill.price/2) #<-遗忘价格为学习的一半,/2的地方相同
- $mShop_gold += @skill.price/2
- else
- $game_variables[$mShop_use_variable] += @skill.price/2
- $mShop_gold += @skill.price/2
- end
- $game_party.actors[@status_window.index].forget_skill(@skill.id)
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- @status_window.index = -1
- @buy_window.active = true
- @command_window.active = false
- @command_window.visible = false
- end
- end
- return
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新画面 (购买窗口激活的情况下)
- #--------------------------------------------------------------------------
- def update_buy
- @status_window.skill = @buy_window.skill
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- return
- end
- if Input.trigger?(Input::C)
- @skill = @buy_window.skill
- if @skill == nil #or @skill.price > $mShop_gold
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @buy_window.active = false
- @status_window.index = 0
- @status_window.active = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (状态窗口激活的情况下)
- #--------------------------------------------------------------------------
- def update_status
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @status_window.active = false
- @status_window.index = -1
- @buy_window.active = true
- end
- if Input.trigger?(Input::C)
- @status_window.active = false
- @command_window.visible = true
- @command_window.active = true
- end
- end
- end
- #==============================================================================
- # ■ Window_MShopStatus
- #------------------------------------------------------------------------------
- # 特技商店画面、显示物品所持数与角色装备的窗口。
- #==============================================================================
- class Window_MShopStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(368, 64, 272, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.font.size = 18
- @skill = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- draw_actor_graphic(actor,12,80*i+64)
- self.contents.font.color = system_color
- self.contents.draw_text(44, 80*i, 240, 32, actor.name)
- self.contents.draw_text(0, 80*i , 240-20,32,"等级",2)
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 80*i, 240, 32, actor.level.to_s , 2)
- self.contents.font.color = system_color
- self.contents.draw_text(44, 80*i+22, 45, 32, $data_system.words.hp)
- self.contents.font.color = normal_color
- self.contents.draw_text(44, 80*i+22, 90, 32, actor.maxhp.to_s,2)
- self.contents.font.color = system_color
- self.contents.draw_text(150, 80*i+22, 45, 32, $data_system.words.sp)
- self.contents.font.color = normal_color
- self.contents.draw_text(150, 80*i+22, 90, 32, actor.maxsp.to_s,2)
- if actor.skill_learn?(@skill.id)
- self.contents.font.color = Color.new(255,255,255,128)
- self.contents.draw_text(44, 80*i+44, 196, 32, "⊙此项特技已经学习⊙",2)
- else
- self.contents.font.color = Color.new(255,255,0,255)
- self.contents.draw_text(44, 80*i+44, 240, 32, "★此项特技尚未学习★")
- end
- end
- @item_max = $game_party.actors.size
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 新的物品
- #--------------------------------------------------------------------------
- def skill=(skill)
- if @skill != skill
- @skill = skill
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
- end
- end
- end
- #==============================================================================
- # ■ Window_MShopBuy
- #------------------------------------------------------------------------------
- # 特技商店画面、浏览显示可以购买的商品的窗口。
- #==============================================================================
- class Window_MShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # shop_goods : 商品
- #--------------------------------------------------------------------------
- def initialize(id)
- super(0, 64, 368, 416)
- @id = id
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for skill_id in @id
- skill = $data_skills[skill_id]
- if skill != nil
- @data.push(skill)
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘羡慕
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- # 除此之外的情况设置为无效文字色
- if skill.price <= $mShop_gold
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
- self.contents.draw_text(x + 240, y, 88, 32, skill.price.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
- end
- #==============================================================================
- # ■ RPG原装定义
- #==============================================================================
- module RPG
- class Skill
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def price
- price = @description.split(/@/)[1]
- return price != nil ? price.to_i : 0
- end
- end
- end
复制代码 [/fold]
[fold=地图上显示伤害数值]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #
- # 使用方法:
- #
- # ★、对角色显示伤害,如下3步:
- #
- # 1、设置伤害内容:$game_player.damage = 数值
- # $game_player.damage = $game_variables[变量编号]
- # 注意:如果数值是负数,就变成补血的颜色了。
- #
- # 2、设置是否会心一击:$game_player.critical = true/false
- # 如果不是会心一击,就不用这一步了
- #
- # 3、释放伤害:$game_player.damage_pop = true
- #
- #
- # ★、对普通NPC和事件进行伤害,类似的3步:
- #
- # 1、设置伤害内容:$game_map.events[事件编号].damage = 数值
- # $game_map.events[事件编号].damage = $game_variables[变量编号]
- #
- # 2、设置是否会心一击:$game_map.events[事件编号].critical = true/false
- #
- # 3、释放伤害:$game_map.events[事件编号].damage_pop = true
- #
- # 注意,事件编号是事件的ID号,如果目标是“本事件”,那么在事件编号输入@event_id
- #
- #------------------------------------------------------------------------------
- # 预祝有人能早日做出华丽的ARPG来,别忘了到网站发布哦~
- #------------------------------------------------------------------------------
- class Sprite_Character < RPG::Sprite
- alias carol3_66RPG_damage_pop_update update
- def update
- carol3_66RPG_damage_pop_update
- if @character.damage_pop
- damage(@character.damage, @character.critical)
- @character.damage = nil
- @character.critical = false
- @character.damage_pop = false
- end
- end
- end
- class Game_Character
- attr_accessor :damage_pop
- attr_accessor :damage
- attr_accessor :critical
- alias carol3_66RPG_damage_pop_initialize initialize
- def initialize
- @damage_pop = false
- @damage = 0
- @critical = false
- carol3_66RPG_damage_pop_initialize
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 [/fold]
[fold=环状菜单]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # ————————————————————————————————————
- # ▼▲▼ XRXS_MP 6. 环形菜单 ▼▲▼
- # by 和希
- ###############################################################################
- # 环形菜单脚本(中文注释版)
- # writen by 和希
- # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- # ▽导入
- # 1.在脚本编辑器的Main的前一个位置进行插入操作,然后将本脚本复制到新的页里
- # 2.Window_RingMenu最开始的7个RPG::Cache.icon("") 的 "" 的中的图标作用在右边
- # 的说明里标注了分别是什么项目的,可以根据需要进行修改
- # (最下方禁止使用项目的图标建议使用类似“φ”的图标)
- # (译者按:就是原图标上多一个横杠或是斜杠的图片)
- # 3.类常量定义最下方的 SE_STARTUP = "" 的 "" 的中是打开菜单时的音效的名字
- #
- ###############################################################################
- #==============================================================================
- # ■ Window_RingMenu
- #------------------------------------------------------------------------------
- # 显示环形菜单画面
- #==============================================================================
- class Window_RingMenu < Window_Base
- #--------------------------------------------------------------------------
- # ○ 类常量定义
- # 这里定义的变量是整个Window_RingMenu类都可以用的常量
- # 所有变量名都是用大写,以区别其他变量
- #--------------------------------------------------------------------------
- # 打开菜单使用的帧数,数字越小打开菜单时速度越快
- STARTUP_FRAMES = 20
- # 切换选项时使用的帧数,数字越小切换选项速度越快
- MOVING_FRAMES = 5
- # 环的半径(单位:象素),数字越大环越大←本句为废话
- RING_R = 64
- # 定义各种图标,以便之后使用
- ICON_ITEM = RPG::Cache.icon("034-Item03") # 「道具」项目的图标
- ICON_SKILL = RPG::Cache.icon("044-Skill01") # 「特技」项目的图标
- ICON_EQUIP = RPG::Cache.icon("001-Weapon01") # 「装备」项目的图标
- ICON_STATUS = RPG::Cache.icon("050-Skill07") # 「状态」项目的图标
- ICON_SAVE = RPG::Cache.icon("038-Item07") # 「存储」项目的图标
- ICON_EXIT = RPG::Cache.icon("046-Skill03") # 「结束」项目的图标
- ICON_DISABLE= RPG::Cache.icon("") # 禁止使用项目的图标
- # 打开菜单时的音效
- SE_STARTUP = "056-Right02"
- # 定义各种状态时的赋值。
- # 译注:对于程序而言,个人感觉多此一举…不过的确方便了阅读
- MODE_START = 1 # 动画开始时
- MODE_WAIT = 2 # 待机中
- MODE_MOVER = 3 # 顺时针旋转(往右)
- MODE_MOVEL = 4 # 逆时针旋转(往左)
- #--------------------------------------------------------------------------
- # ○ 定义实例变量
- #--------------------------------------------------------------------------
- attr_accessor :index # ?
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize( center_x, center_y )
- super(0, 0, 640, 480)
- self.contents = Bitmap.new(width-32, height-32)
- self.opacity = 0
- self.back_opacity = 0
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = "状态"
- s5 = "储存"
- s6 = "结束"
- @commands = [ s1, s2, s3, s4, s5, s6 ]
- @item_max = 6
- @index = 0
- @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
- @disabled = [ false, false, false, false, false, false ]
- @cx = center_x - 16
- @cy = center_y - 16
- # 初始化动画
- setup_move_start
- # 刷新
- refresh
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- refresh
- end
-
- #--------------------------------------------------------------------------
- # ● 画面描绘(刷新)
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
-
- # 选择描绘方式
- case @mode
- when MODE_START
- refresh_start
- when MODE_WAIT
- refresh_wait
- when MODE_MOVER
- refresh_move(1)
- when MODE_MOVEL
- refresh_move(0)
- end
- # 指令名描绘
- rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
- self.contents.draw_text(rect, @commands[@index],1)
- end
-
- #--------------------------------------------------------------------------
- # ○ 画面生成
- #--------------------------------------------------------------------------
- def refresh_start
- d1 = 2.0 * Math::PI / @item_max
- d2 = 1.0 * Math::PI / STARTUP_FRAMES
- r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
- for i in 0...@item_max
- j = i - @index
- d = d1 * j + d2 * @steps
- x = @cx + ( r * Math.sin( d ) ).to_i
- y = @cy - ( r * Math.cos( d ) ).to_i
- draw_item(x, y, i)
- end
- @steps -= 1
- if @steps < 1
- @mode = MODE_WAIT
- end
- end
-
- #--------------------------------------------------------------------------
- # ○ 画面再描绘(待机时)
- #--------------------------------------------------------------------------
- def refresh_wait
- d = 2.0 * Math::PI / @item_max
- for i in 0...@item_max
- j = i - @index
- x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
- y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
- draw_item(x, y, i)
- end
- end
-
- #--------------------------------------------------------------------------
- # ○ 画面再描绘(旋转时)
- # mode : 旋转方向(0 : 逆时针旋转时,1 : 顺时针旋转时)
- #--------------------------------------------------------------------------
- def refresh_move( mode )
- d1 = 2.0 * Math::PI / @item_max
- d2 = d1 / MOVING_FRAMES
- d2 *= -1 if mode != 0
- for i in 0...@item_max
- # 以下便是那华丽的曲线公式
- j = i - @index
- d = d1 * j + d2 * @steps
- x = @cx + ( RING_R * Math.sin( d ) ).to_i
- y = @cy - ( RING_R * Math.cos( d ) ).to_i
- draw_item(x, y, i)
- end
- @steps -= 1
- if @steps < 1
- @mode = MODE_WAIT
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 描绘图片
- # i : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(x, y, i)
- rect = Rect.new(0, 0, @items[i].width, @items[i].height)
- if @index == i
- self.contents.blt( x, y, @items[i], rect )
- if @disabled[@index]
- self.contents.blt( x, y, ICON_DISABLE, rect )
- end
- else
- self.contents.blt( x, y, @items[i], rect, 128 )
- if @disabled[@index]
- self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
- end
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 项目无效化
- # index : 项目编号
- #--------------------------------------------------------------------------
- def disable_item(index)
- @disabled[index] = true
- end
-
- #--------------------------------------------------------------------------
- # ○ 初始化动画准备
- #--------------------------------------------------------------------------
- def setup_move_start
- @mode = MODE_START
- @steps = STARTUP_FRAMES
- if SE_STARTUP != nil and SE_STARTUP != ""
- Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
- end
- end
-
- #--------------------------------------------------------------------------
- # ○ 回转动画准备
- #--------------------------------------------------------------------------
- def setup_move_move(mode)
- if mode == MODE_MOVER
- @index -= 1
- @index = @items.size - 1 if @index < 0
- elsif mode == MODE_MOVEL
- @index += 1
- @index = 0 if @index >= @items.size
- else
- return
- end
- @mode = mode
- @steps = MOVING_FRAMES
- end
- #--------------------------------------------------------------------------
- # ○ 判断是否在动画中
- #--------------------------------------------------------------------------
- def animation?
- return @mode != MODE_WAIT
- end
- end
- #==============================================================================
- # ■ Window_RingMenuStatus
- #------------------------------------------------------------------------------
- # 显示环形菜单画面下同伴状态的窗口。
- # 本窗口定义与Window_MenuStatus雷同
- #==============================================================================
- class Window_RingMenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize
- super(60, 64, 232, 352)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- self.active = false
- self.index = -1
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- x = 80
- y = 80 * i
- actor = $game_party.actors[i]
- draw_actor_graphic(actor, x - 40, y + 80)
- draw_actor_name(actor, x, y + 24)
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
- end
- end
- end
- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # 处理环形菜单的类。(再定义)
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # ● 初始化对象
- # menu_index : 命令光标初始位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
-
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 获取地图信息
- # 这个是用来生成游戏画面作为背景,如果没有此行,那么打开菜单后背景就是全黑的
- @spriteset = Spriteset_Map.new
- # 获取角色坐标,并生成命令窗口
- px = $game_player.screen_x - 15
- py = $game_player.screen_y - 24
- @command_window = Window_RingMenu.new(px,py)
- @command_window.index = @menu_index
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- # 物品、特技、装备、状态无效化
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
-
- # 这个属性z的含意就是z坐标轴,这个坐标轴的0点在背景上
- # 往上(就是背景以上的层)是正方向,换言之,z越大的窗口在显示时越排在前面
- # 两个z相同的窗口,后生成的排在前面。数字差要在2以上才能产生效果
- # 也就是说两个窗口的z坐标是“100和100”与“100和101”效果是一样的
- # 总的来讲,这个属性z就是图块设置里的优先级…数字大的优先级高
- @command_window.z = 100
-
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 存档无效
- @command_window.disable_item(4)
- end
-
- # 生成环形菜单的状态窗口
- # visible : 可视性
- @status_window = Window_RingMenuStatus.new
- @status_window.x = 20
- @status_window.y = 50
- @status_window.z = 100
- @status_window.visible = false
-
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口及地图画面
- @spriteset.dispose
- @command_window.dispose
- @status_window.dispose
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @command_window.update
- @status_window.update
- # 命令窗口被激活的情况下: 调用 update_command
- if @command_window.active
- update_command
- return
- end
- # 状态窗口被激活的情况下: 调用 update_status
- if @status_window.active
- update_status
- return
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新画面 (命令窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_command
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换的地图画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 同伴人数为 0、存档、游戏结束以外的场合
- if $game_party.actors.size == 0 and @command_window.index < 4
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
-
- # 命令窗口的光标位置分支
- case @command_window.index
- when 0 # 物品
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到物品画面
- $scene = Scene_Item.new
- when 1 # 特技
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.visible = true
- @status_window.index = 0
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.visible = true
- @status_window.index = 0
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.visible = true
- @status_window.index = 0
- when 4 # 存档
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到存档画面
- $scene = Scene_Save.new
- when 5 # 游戏结束
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到游戏结束画面
- $scene = Scene_End.new
- when 6
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_End.new
- end
- return
- end
- # 动画中不能执行光标处理
- # 这句的意思就是如果正处于动画中就return,这样下面的语句就不会执行了
- # 换言之,如果正处于动画处理中,那么就无法移动菜单
- return if @command_window.animation?
- # 按下 ↑ 或 ← 键的情况下
- if Input.press?(Input::UP) or Input.press?(Input::LEFT)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 向左旋转
- @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
- return
- end
- # 按下 ↓ 或 → 键的情况下
- if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 向右旋转
- @command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
- return
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新画面 (状态窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_status
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 激活命令窗口
- @command_window.active = true
- @status_window.active = false
- @status_window.visible = false
- @status_window.index = -1
- return
- end
-
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置分支
- case @command_window.index
- when 1 # 特技
- # 本角色的行动限制在 2 以上的情况下
- if $game_party.actors[@status_window.index].restriction >= 2
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到状态画面
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # 装備
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到特技画面
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换的装备画面
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 [/fold]
[fold=全键盘脚本]- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #============================================================================
- # ■ Keyboard Script
- #----------------------------------------------------------------------------
- # By: Cybersam
- # Date: 25/05/05
- # Version 4
- #============================================================================
- # 66对此脚本使用方法的说明(可能不是很准确,反正大体能用):
- #
- # ★、Kboard.keyboard(键位) 返回是否按下这个键的判断。
- # 比如条件分歧:Kboard.keyboard($R_Key_H)
- # 则当按下键盘H键的时候条件分歧成立
- #
- # ★、Kboard.keyb(键位) == 1 当连续按住某键返回真,否则为false
- # 比如条件分歧:Kboard.keyb($R_Key_U) == 1
- # 则当持续按下键盘U的时候条件分歧成立
- #
- # ★、Kboard.key(键位,1) 似乎可以做开关用。按下一次变为true,再按变false
- #============================================================================
- module Kboard
- #==========================================================================
- # 以下是全键盘按键列表
- #--------------------------------------------------------------------------
- $Rmouse_BUTTON_L = 0x01 # left mouse button
- $Rmouse_BUTTON_R = 0x02 # right mouse button
- $Rmouse_BUTTON_M = 0x04 # middle mouse button
- $Rmouse_BUTTON_4 = 0x05 # 4th mouse button
- $Rmouse_BUTTON_5 = 0x06 # 5th mouse button
- #--------------------------------------------------------------------------
- $R_Key_BACK = 0x08 # BACKSPACE key
- $R_Key_TAB = 0x09 # TAB key
- $R_Key_RETURN = 0x0D # ENTER key
- $R_Key_SHIFT = 0x10 # SHIFT key
- $R_Key_CTLR = 0x11 # CTLR key
- $R_Key_ALT = 0x12 # ALT key
- $R_Key_PAUSE = 0x13 # PAUSE key
- $R_Key_CAPITAL = 0x14 # CAPS LOCK key
- $R_Key_ESCAPE = 0x1B # ESC key
- $R_Key_SPACE = 0x20 # SPACEBAR
- $R_Key_PRIOR = 0x21 # PAGE UP key
- $R_Key_NEXT = 0x22 # PAGE DOWN key
- $R_Key_END = 0x23 # END key
- $R_Key_HOME = 0x24 # HOME key
- $R_Key_LEFT = 0x25 # LEFT ARROW key
- $R_Key_UP = 0x26 # UP ARROW key
- $R_Key_RIGHT = 0x27 # RIGHT ARROW key
- $R_Key_DOWN = 0x28 # DOWN ARROW key
- $R_Key_SELECT = 0x29 # SELECT key
- $R_Key_PRINT = 0x2A # PRINT key
- $R_Key_SNAPSHOT = 0x2C # PRINT SCREEN key
- $R_Key_INSERT = 0x2D # INS key
- $R_Key_DELETE = 0x2E # DEL key
- #--------------------------------------------------------------------------
- $R_Key_0 = 0x30 # 0 key
- $R_Key_1 = 0x31 # 1 key
- $R_Key_2 = 0x32 # 2 key
- $R_Key_3 = 0x33 # 3 key
- $R_Key_4 = 0x34 # 4 key
- $R_Key_5 = 0x35 # 5 key
- $R_Key_6 = 0x36 # 6 key
- $R_Key_7 = 0x37 # 7 key
- $R_Key_8 = 0x38 # 8 key
- $R_Key_9 = 0x39 # 9 key
- #--------------------------------------------------------------------------
- $R_Key_A = 0x41 # A key
- $R_Key_B = 0x42 # B key
- $R_Key_C = 0x43 # C key
- $R_Key_D = 0x44 # D key
- $R_Key_E = 0x45 # E key
- $R_Key_F = 0x46 # F key
- $R_Key_G = 0x47 # G key
- $R_Key_H = 0x48 # H key
- $R_Key_I = 0x49 # I key
- $R_Key_J = 0x4A # J key
- $R_Key_K = 0x4B # K key
- $R_Key_L = 0x4C # L key
- $R_Key_M = 0x4D # M key
- $R_Key_N = 0x4E # N key
- $R_Key_O = 0x4F # O key
- $R_Key_P = 0x50 # P key
- $R_Key_Q = 0x51 # Q key
- $R_Key_R = 0x52 # R key
- $R_Key_S = 0x53 # S key
- $R_Key_T = 0x54 # T key
- $R_Key_U = 0x55 # U key
- $R_Key_V = 0x56 # V key
- $R_Key_W = 0x57 # W key
- $R_Key_X = 0x58 # X key
- $R_Key_Y = 0x59 # Y key
- $R_Key_Z = 0x5A # Z key
- #--------------------------------------------------------------------------
- $R_Key_LWIN = 0x5B # Left Windows key (Microsoft Natural keyboard)
- $R_Key_RWIN = 0x5C # Right Windows key (Natural keyboard)
- $R_Key_APPS = 0x5D # Applications key (Natural keyboard)
- #--------------------------------------------------------------------------
- $R_Key_NUMPAD0 = 0x60 # Numeric keypad 0 key
- $R_Key_NUMPAD1 = 0x61 # Numeric keypad 1 key
- $R_Key_NUMPAD2 = 0x62 # Numeric keypad 2 key
- $R_Key_NUMPAD3 = 0x63 # Numeric keypad 3 key
- $R_Key_NUMPAD4 = 0x64 # Numeric keypad 4 key
- $R_Key_NUMPAD5 = 0x65 # Numeric keypad 5 key
- $R_Key_NUMPAD6 = 0x66 # Numeric keypad 6 key
- $R_Key_NUMPAD7 = 0x67 # Numeric keypad 7 key
- $R_Key_NUMPAD8 = 0x68 # Numeric keypad 8 key
- $R_Key_NUMPAD9 = 0x69 # Numeric keypad 9 key
- $R_Key_MULTIPLY = 0x6A # Multiply key (*)
- $R_Key_ADD = 0x6B # Add key (+)
- $R_Key_SEPARATOR = 0x6C # Separator key
- $R_Key_SUBTRACT = 0x6D # Subtract key (-)
- $R_Key_DECIMAL = 0x6E # Decimal key
- $R_Key_DIVIDE = 0x6F # Divide key (/)
- #--------------------------------------------------------------------------
- $R_Key_F1 = 0x70 # F1 key
- $R_Key_F2 = 0x71 # F2 key
- $R_Key_F3 = 0x72 # F3 key
- $R_Key_F4 = 0x73 # F4 key
- $R_Key_F5 = 0x74 # F5 key
- $R_Key_F6 = 0x75 # F6 key
- $R_Key_F7 = 0x76 # F7 key
- $R_Key_F8 = 0x77 # F8 key
- $R_Key_F9 = 0x78 # F9 key
- $R_Key_F10 = 0x79 # F10 key
- $R_Key_F11 = 0x7A # F11 key
- $R_Key_F12 = 0x7B # F12 key
- #--------------------------------------------------------------------------
- $R_Key_NUMLOCK = 0x90 # NUM LOCK key
- $R_Key_SCROLL = 0x91 # SCROLL LOCK key
- #--------------------------------------------------------------------------
- $R_Key_LSHIFT = 0xA0 # Left SHIFT key
- $R_Key_RSHIFT = 0xA1 # Right SHIFT key
- $R_Key_LCONTROL = 0xA2 # Left CONTROL key
- $R_Key_RCONTROL = 0xA3 # Right CONTROL key
- $R_Key_L_ALT = 0xA4 # Left ALT key
- $R_Key_R_ALT = 0xA5 # Right ALT key
- #--------------------------------------------------------------------------
- $R_Key_SEP = 0xBC # , key
- $R_Key_DASH = 0xBD # - key
- $R_Key_DOTT = 0xBE # . Key
- #--------------------------------------------------------------------------
- GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
- GetKeyboardState = Win32API.new("user32","GetKeyState",['I'],'I')
- GetSetKeyState = Win32API.new("user32","SetKeyboardState",['I'],'I')
- #--------------------------------------------------------------------------
- module_function
- #--------------------------------------------------------------------------
- def keyb(rkey)
- if GetKeyState.call(rkey) != 0
- return 1
- end
- return 0
- end
- #--------------------------------------------------------------------------
- def keyboard(rkey)
- GetKeyState.call(rkey) & 0x01 == 1 #
- end
- #--------------------------------------------------------------------------
- def key(rkey, key = 0)
- GetKeyboardState.call(rkey) & 0x01 == key #
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
-
复制代码 [/fold]
[fold=在地图上显示变量]- #==========================================================================
- # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。
- #==========================================================================
- VAR_SWITCH = 26 # 26号开关打开此脚本才工作,关闭则停止运算,并且透明
- VAR_REFRESH_SWITCH = 27 # 27号开关控制强制刷新,使用时机:1、把窗口由透明变为不透明(包括第一次使用时),2、游戏中用脚本更改了$var
- $var = []
- $var = [[1,0,0],[2,32,32],[3,64,32]] #所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]
- #==============================================================================
- # ■ Window_XY
- #------------------------------------------------------------------------------
- # 显示坐标的窗口。
- #==============================================================================
- class Window_Var < Window_Base#注意前面那个window_var是文件名
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(-16, -16, 640+32, 480+32)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
- self.contents = Bitmap.new(width - 32, height - 32)
- self.back_opacity = 255 # 这个是背景透明
- self.opacity = 255 # 这个是边框和背景都透明
- self.contents_opacity = 255 # 这个是内容透明
- self.visible = false
- self.z=9999
- @var = $var
- @var_a = []
- for var_draw in $var
- @var_a[var_draw[0]] = $game_variables[var_draw[0]]
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if $game_switches[VAR_SWITCH]
- @var = $var # 记录现在变量数组结构
- self.contents.clear # 清除以前的东西
- for var_draw in @var
- @var_a[var_draw[0]] = $game_variables[var_draw[0]] # 记录现在的游戏变量
- self.contents.draw_text(var_draw[1],var_draw[2],640,32,@var_a[var_draw[0]].to_s)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 判断文字刷新。节约内存用
- #--------------------------------------------------------------------------
- def judge
- for var_draw in $var
- if @var_a[var_draw[0]] != $game_variables[var_draw[0]] #如果现在记录的变量和游戏变量不同,刷新
- return true
- end
- end
- if $game_switches[VAR_REFRESH_SWITCH] # 强制刷新的时候,刷新
- $game_switches[VAR_REFRESH_SWITCH] = false
- return true
- end
- return false
- end
- end
- class Scene_Map
- alias var_66rpg_main main
- def main
- @var_window = Window_Var.new
- @var_window.opacity = 0
- var_66rpg_main
- @var_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- alias var_66rpg_update update
- def update
- var_66rpg_update
- if $game_switches[VAR_SWITCH]
- @var_window.visible = true
- @var_window.refresh if @var_window.judge
- else
- @var_window.visible = false
- end
- end
- end
- #==========================================================================
- # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。
- #==========================================================================
复制代码 [/fold]
新增:
存档扩充
跳过标题
@RyanBern |
评分
-
查看全部评分
|