楼主: RyanBern

[版务] RMXP 图书馆【常年更新】

[复制链接]
梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-5-17 19:25:39 | 显示全部楼层
RM天干宝典+RM百变宝典   下载地址
https://rpg.blue/thread-304473-1-1.html

点评

建议重新保存一下,毕竟这是别人的网盘,不知道什么时候链接就失效了。怪可惜的  发表于 2015-5-17 19:28

评分

参与人数 1星屑 +50 收起 理由
RyanBern + 50 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-5-17 19:53:24 | 显示全部楼层
地图绘制

F派地图绘制教学7-1
https://rpg.blue/thread-62948-1-1.html
好像资源没有了。。。

地图绘制教学y1.rar

2.34 MB, 下载次数: 2343

回复

使用道具 举报

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
回帖
295
发表于 2015-5-17 20:01:50 | 显示全部楼层
純搬運請無視我感謝

如何在进入游戏标题前增加是否全屏的提示?
https://rpg.blue/thread-276600-1-1.html

如何边测试边修改事件?
https://rpg.blue/thread-163786-1-1.html

如何做持续回血的技能?
https://rpg.blue/thread-307140-1-1.html

如何在标题菜单选项加入设定选项?
https://rpg.blue/thread-279175-1-1.html





评分

参与人数 1星屑 +150 收起 理由
RyanBern + 150 1 3 4收录

查看全部评分

我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复

使用道具 举报

梦石
0
星屑
462
在线时间
871 小时
注册时间
2014-5-5
回帖
914
发表于 2015-5-17 22:36:05 | 显示全部楼层
本帖最后由 邪月长啸 于 2015-7-19 13:48 编辑

因为网盘较乱,本人决定分类整理分享
网盘会不定时更新~



[fold=软件工具]XP,VX,VA及行走图和头像拼接器

软件工具
[/fold]


[fold=教学视频]柳柳和癫狂侠客的教学视频
适合新手学习~

教学视频
[/fold]


[fold=整合脚本]天干百变宝典及个别大量脚本整合范例
整合范例
[/fold]

[fold=范例脚本]单独的脚本范例
脚本范例
[/fold]


[fold=开源不加密游戏范例]黑暗圣剑等开源或不加密的游戏
如提取素材或脚本请注明出处和作者,谢谢
http://pan.baidu.com/s/1mgJ2wdE
[/fold]

点评

汗,不知道为什么,发了好几次都死链,我先发天干宝典吧,有时间再把其他补上  发表于 2015-5-18 12:48
网盘链接失效了……能否再重发一份呢?  发表于 2015-5-18 12:38

评分

参与人数 2星屑 +100 梦石 +2 赞 +1 收起 理由
企鹅大虾 + 1 塞糖
RyanBern + 100 + 2 认可答案

查看全部评分

回复

使用道具 举报

梦石
3
星屑
77
在线时间
1266 小时
注册时间
2012-10-9
回帖
1045
发表于 2015-5-18 20:28:26 | 显示全部楼层
本帖最后由 游戏我的爱 于 2015-5-18 20:29 编辑

[fold=普通攻击的被动(我方)]if attacker.is_a?(Game_Actor)
      if  attacker.skill_learn?(232)
      chuan_ci = (self.maxhp * 0.07 ).to_i
      self.hp -= chuan_ci
       #self.animation_id = 200 #攻击时对方显示的动画
if $game_switches[104] == false
$game_temp.message_text = "穿刺额外伤害:"+chuan_ci.to_s
end
      end
end
[/fold]

[fold=普通攻击的被动(敌方)]if attacker.is_a?(Game_Enemy) && self.is_a?(Game_Actor)#攻击方为敌人的场合

     if self.skill_learn?(225)
     xu_kong = (self.damage * 0.23).to_i
     self.damage -= xu_kong
     if  $game_switches[104] == false
     $game_temp.message_text = "受到的伤害降低:"+xu_kong.to_s
     end
    end

end[/fold]

[fold=技能被动(我方)]if user.is_a?(Game_Actor)
      if user.skill_learn?(222)
      xiaoguo = (self.damage * 0.3).to_i
      user.hp += xiaoguo
      self.damage += xiaoguo
if  $game_switches[104] == false
$game_temp.message_text = "剑灵能力提升:"+xiaoguo.to_s
end
      end[/fold]

[fold=技能被动(敌方)]if user.is_a?(Game_Enemy)
      if self.damage >= 0
    if self.skill_learn?(225)
    xu_kong_ji = (self.damage * 0.13).to_i
    self.damage -= xu_kong_ji
if  $game_switches[104] == false
$game_temp.message_text = "受到的伤害降低:"+xu_kong_ji.to_s
end
      end
     end
end[/fold]


PS:以上脚本都是本人自己写下来的情况然后进行复制黏贴,如果需要使用但是不会的话问问我吧~
另外如果掌握了这些脚本的意思就可以举一反三~具体修改的位置是在(Game_Battler 3)处修改!

评分

参与人数 1星屑 +100 收起 理由
RyanBern + 100 认可答案

查看全部评分


我大家教永不弃坑
联络方式:QQ1747800952
回复 1 0

使用道具 举报

梦石
0
星屑
34457
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2015-5-20 19:04:58 | 显示全部楼层
xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
回帖
295
发表于 2015-5-21 10:16:39 | 显示全部楼层
本帖最后由 RyanBern 于 2015-12-5 09:39 编辑

無意看見這帖子就把這個彩虹腳本發出來。
https://rpg.blue/thread-379320-1-1.html
不知道是否純淨但感覺還是能用的。
[fold=彩虹神剑 v1.0b][pre lang="Ruby"]=begin
==============================================================================

彩虹神剑(伤害分段显示)显示总伤害版 v1.0b

==============================================================================

彩虹神剑 by 柳柳
显示总伤害修改 by 叶子

==============================================================================

6-20-2006 v1.0
在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的

v1.0a
修正了显示伤害和实际伤害有差别的问题
修正了miss的情况下显示miss混乱的问题
修正了对己方技能重复显示伤害的问题
未修正播放目标动画第一帧时目标有时无端跳动的BUG

v1.0b
修改了总伤害数字的位置和z坐标
未修正播放目标动画第一帧时目标有时无端跳动的BUG

==============================================================================
=end
# 核心的说明:
# damage_pop 不再附带damage()的功能,这个放到animation里面去了

module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = true
# 角色受攻击时是否跳一下
BATTLER_JUMP = false

class Sprite < ::Sprite
   #==========================================
   # 修改说明:
   # @flash_shake用来制作挨打时候跳跃
   # @_damage    用来记录每次打击之后弹出数字
   # @_total_damage 记录总伤害
   # @_total_damage_duration 总伤害持续帧
   #==========================================
   #alias 66RPG_rainbow_initialize : initialize
   def initialize(viewport = nil)
     #66RPG_rainbow_initialize(viewport)
     super(viewport)
     @_whiten_duration = 0
     @_appear_duration = 0
     @_escape_duration = 0
     @_collapse_duration = 0
     @_damage_duration = 0
     @_animation_duration = 0
     @_blink = false
     # 挨打时候跳跃
     @flash_shake = 0
     # 伤害记录数组
     @_damage = []
     # 总伤害数字
     @_total_damage = 0
     # 总伤害持续帧
     @_total_damage_duration = 0
   end
   def damage(value, critical)
     if value.is_a?(Numeric)
       damage_string = value.abs.to_s
     else
       damage_string = value.to_s
     end
     bitmap = Bitmap.new(160, 48)
     bitmap.font.name = "黑体"
     bitmap.font.size = 24
     bitmap.font.bold = true
     bitmap.font.color.set(0, 0, 0)
     bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
     bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
     bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
     bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
     #=======================================
     # 修改:颜色
     #=======================================
     if value.is_a?(Numeric) and value < 0
       bitmap.font.color.set(176, 255, 144)
     else
       bitmap.font.color.set(255, 55, 55)
     end
     bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
     if critical
       bitmap.font.size = 20
       bitmap.font.color.set(0, 0, 0)
       bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
       bitmap.font.color.set(255, 255, 255)
       bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
     end
     @_damage_sprite = ::Sprite.new(self.viewport)
     @_damage_sprite.bitmap = bitmap
     @_damage_sprite.ox = 80
     @_damage_sprite.oy = 20
     @_damage_sprite.x = self.x
     @_damage_sprite.y = self.y - self.oy / 2
     @_damage_sprite.z = 3000
     @_damage_duration = 40
     #=======================================
     # 修改:推入新的伤害
     #=======================================
     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
     # 总伤害处理
     make_total_damage(value)
   end
   #--------------------------------------------------------------------------
   # ● 总伤害处理
   #--------------------------------------------------------------------------
   def make_total_damage(value)
     if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
       @_total_damage += value
     else
       return
     end
     bitmap = Bitmap.new(300, 150)
     bitmap.font.name = "黑体"
     bitmap.font.size = 28
     bitmap.font.bold = true
     bitmap.font.color.set(0, 0, 0)
     bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
     if @_total_damage < 0
       bitmap.font.color.set(80, 255, 00)
     else
       bitmap.font.color.set(255, 140, 0)
     end
     bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
     if @_total_damage_sprite.nil?
       @_total_damage_sprite = ::Sprite.new(self.viewport)
       @_total_damage_sprite.ox = 80
       @_total_damage_sprite.oy = 20
       @_total_damage_sprite.z = 3000
     end
     @_total_damage_sprite.bitmap = bitmap
     @_total_damage_sprite.zoom_x = 1.5
     @_total_damage_sprite.zoom_y = 1.5
     @_total_damage_sprite.x = self.x
     @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
     @_total_damage_sprite.z = 3001
     @_total_damage_duration = 80
   end
   def animation(animation, hit, battler_damage="", battler_critical=false)
     dispose_animation      
     #=======================================
     # 修改:记录伤害和critical
     #=======================================
     @battler_damage = battler_damage
     @battler_critical = battler_critical
     @_animation = animation
     return if @_animation == nil
     @_animation_hit = hit
     @_animation_duration = @_animation.frame_max
     animation_name = @_animation.animation_name
     animation_hue = @_animation.animation_hue
     bitmap = RPG::Cache.animation(animation_name, animation_hue)
     #=======================================
     # 修改:计算总闪光权限值
     #=======================================
     for timing in @_animation.timings
       quanzhong = animation_process_timing(timing, @_animation_hit,true)
       @all_quanzhong += quanzhong
       # 记录最后一次闪光
       @_last_frame = timing.frame if quanzhong != 0
     end      
     if @@_reference_count.include?(bitmap)
       @@_reference_count[bitmap] += 1
     else
       @@_reference_count[bitmap] = 1
     end
     #=======================================
     # 修改:行动方动画不显示伤害
     #=======================================
     if $scene.is_a?(Scene_Battle)
       if $scene.animation1_id == @battler.animation_id
         @battler_damage = ""
       end
     end
     @_animation_sprites = []
     if @_animation.position != 3 or not @@_animations.include?(animation)
       for i in 0..15
         sprite = ::Sprite.new(self.viewport)
         sprite.bitmap = bitmap
         sprite.visible = false
         @_animation_sprites.push(sprite)
       end
       unless @@_animations.include?(animation)
         @@_animations.push(animation)
       end
     end
     update_animation
   end
   #=======================================
   # 修改:更换清除伤害的算法,以防万一
   #       本内容在脚本中没有使用过
   #=======================================
   def dispose_damage
     for damage in @_damage.reverse
       damage[0].bitmap.dispose
       damage[0].dispose
       @_damage.delete(damage)
     end
     @_total_damage = 0
     @_last_frame = -1
     if @_total_damage_sprite != nil
       @_total_damage_duration = 0
       @_total_damage_sprite.bitmap.dispose
       @_total_damage_sprite.dispose
       @_total_damage_sprite = nil
     end
   end
   def dispose_animation
     #=======================================
     # 修改:清除记录的伤害,清除权重记录
     #=======================================
     @battler_damage = nil
     @battler_critical = nil
     @all_quanzhong = 1
     @_total_damage = 0
     @_last_frame = -1
     if @_animation_sprites != nil
       sprite = @_animation_sprites[0]
       if sprite != nil
         @@_reference_count[sprite.bitmap] -= 1
         if @@_reference_count[sprite.bitmap] == 0
           sprite.bitmap.dispose
         end
       end
       for sprite in @_animation_sprites
         sprite.dispose
       end
       @_animation_sprites = nil
       @_animation = nil
     end
   end
   def update
     super
     if @_whiten_duration > 0
       @_whiten_duration -= 1
       self.color.alpha = 128 - (16 - @_whiten_duration) * 10
     end
     if @_appear_duration > 0
       @_appear_duration -= 1
       self.opacity = (16 - @_appear_duration) * 16
     end
     if @_escape_duration > 0
       @_escape_duration -= 1
       self.opacity = 256 - (32 - @_escape_duration) * 10
     end
     if @_collapse_duration > 0
       @_collapse_duration -= 1
       self.opacity = 256 - (48 - @_collapse_duration) * 6
     end
     #=======================================
     # 修改:更新算法,更新弹出
     #=======================================
     if @_damage_duration > 0
       @_damage_duration -= 1
       for damage in @_damage
         damage[0].x = self.x + self.viewport.rect.x -
                       self.ox + self.src_rect.width / 2 +
                       (40 - damage[1]) * damage[3] / 10
         damage[0].y -= damage[4]+damage[1]/10
         damage[0].opacity = damage[1]*20
         damage[1] -= 1
         if damage[1]==0
           damage[0].bitmap.dispose
           damage[0].dispose
           @_damage.delete(damage)
           next
         end
       end
     end
     #=======================================
     # 添加:弹出总伤害
     #=======================================
     if @_total_damage_duration > 0
       @_total_damage_duration -= 1
       @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
       if @_total_damage_sprite.zoom_x > 1.0
         @_total_damage_sprite.zoom_x -= 0.05
       end
       if @_total_damage_sprite.zoom_y > 1.0
         @_total_damage_sprite.zoom_y -= 0.05
       end
       @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
       if @_total_damage_duration <= 0
         @_total_damage = 0
         @_total_damage_duration = 0
         @_total_damage_sprite.bitmap.dispose
         @_total_damage_sprite.dispose
         @_total_damage_sprite = nil
       end
     end
     #=======================================
     if @_animation != nil and (Graphics.frame_count % 2 == 0)
       @_animation_duration -= 1
       update_animation
     end
     if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
       update_loop_animation
       @_loop_animation_index += 1
       @_loop_animation_index %= @_loop_animation.frame_max
     end
     if @_blink
       @_blink_count = (@_blink_count + 1) % 32
       if @_blink_count < 16
         alpha = (16 - @_blink_count) * 6
       else
         alpha = (@_blink_count - 16) * 6
       end
       self.color.set(255, 255, 255, alpha)
     end
     @@_animations.clear
   end
   def update_animation
     if @_animation_duration > 0
       frame_index = @_animation.frame_max - @_animation_duration
       cell_data = @_animation.frames[frame_index].cell_data
       position = @_animation.position
       animation_set_sprites(@_animation_sprites, cell_data, position)
       #=======================================
       # 修改:弹出伤害,权重计算
       #=======================================
       for timing in @_animation.timings
         if timing.frame == frame_index
           t = 1.0 * animation_process_timing(timing, @_animation_hit)            
           #p t,"当前权重", @all_quanzhong,"总权重"
           if @battler_damage.is_a?(Numeric) and t != 0
             t *= @battler_damage
             t /= @all_quanzhong
             #p t,"当前伤害",@battler_damage,"总伤害"
             t = t.to_i
             # 最后一次闪光的话,伤害修正
             if frame_index == @_last_frame
               @_total_damage = @battler_damage - t
             end
             #p t,@battler_damage,@all_quanzhong
             damage(t,@battler_critical)
           # 防止重复播放miss
           elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
             damage(@battler_damage,@battler_critical)
           end
         end
       end
     else
       dispose_animation
     end
   end
   #=======================================
   # 修改:敌人跳跃的功能 + 添加返回数值
   #=======================================
    def animation_process_timing(timing, hit,dontflash=false)
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        unless dontflash
          if timing.se.name != ""
            se = timing.se
            Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
          end
        end
        case timing.flash_scope
        when 1
          unless dontflash
            self.flash(timing.flash_color, timing.flash_duration * 2)
            if @_total_damage >0
              @flash_shake_switch = true
              @flash_shake = 10
            end
          end
          return timing.flash_color.alpha * timing.flash_duration
        when 2
          unless dontflash
            if self.viewport != nil
              self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
              return timing.flash_color.alpha * timing.flash_duration
            end
          end
        when 3
          unless dontflash
            self.flash(nil, timing.flash_duration * 2)
          end
          return timing.flash_color.alpha * timing.flash_duration
        end
      end      
      return 0
    end   
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 初始化对像
#    添加跳跃记录
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
  super(viewport)
  @battler = battler
  @battler_visible = false
  @flash_shake_switch = true
end
#--------------------------------------------------------------------------
# ● 刷新画面
#    增添跳跃功能
#--------------------------------------------------------------------------
def update
  super
  # 战斗者为 nil 的情况下
  if @battler == nil
    self.bitmap = nil
    loop_animation(nil)
    return
  end
  # 文件名和色相与当前情况有差异的情况下
  if @battler.battler_name != @battler_name or
     @battler.battler_hue != @battler_hue
    # 获取、设置位图
    @battler_name = @battler.battler_name
    @battler_hue = @battler.battler_hue
    self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
    @width = bitmap.width
    @height = bitmap.height
    self.ox = @width / 2
    self.oy = @height
    # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
    if @battler.dead? or @battler.hidden
      self.opacity = 0
    end
  end
  # 动画 ID 与当前的情况有差异的情况下
  if @battler.damage == nil and
     @battler.state_animation_id != @state_animation_id
    @state_animation_id = @battler.state_animation_id
    loop_animation($data_animations[@state_animation_id])
  end
  # 应该被显示的角色的情况下
  if @battler.is_a?(Game_Actor) and @battler_visible
    # 不是主状态的时候稍稍降低点透明度
    if $game_temp.battle_main_phase
      self.opacity += 3 if self.opacity < 255
    else
      self.opacity -= 3 if self.opacity > 207
    end
  end
  # 明灭
  if @battler.blink
    blink_on
  else
    blink_off
  end
  # 不可见的情况下
  unless @battler_visible
    # 出现
    if not @battler.hidden and not @battler.dead? and
       (@battler.damage == nil or @battler.damage_pop)
      appear
      @battler_visible = true
    end
  end
  # 可见的情况下
  if @battler_visible
    # 逃跑
    if @battler.hidden
      $game_system.se_play($data_system.escape_se)
      escape
      @battler_visible = false
    end
    # 白色闪烁
    if @battler.white_flash
      whiten
      @battler.white_flash = false
    end
    # 动画
    if @battler.animation_id != 0
      animation = $data_animations[@battler.animation_id]
      animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
      @battler.animation_id = 0
    end
    # 伤害
    if @battler.damage_pop
      @battler.damage = nil
      @battler.critical = false
      @battler.damage_pop = false
    end
    # korapusu
    if @battler.damage == nil and @battler.dead?
      if @battler.is_a?(Game_Enemy)
        $game_system.se_play($data_system.enemy_collapse_se)
      else
        $game_system.se_play($data_system.actor_collapse_se)
      end
      collapse
      @battler_visible = false
    end
  end
  # 设置活动块的坐标
  if @flash_shake_switch == true
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
    @flash_shake_switch = false
  end
  if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
    case @flash_shake
    when 9..10
      self.x = @battler.screen_x
      self.y -=4
      self.z = @battler.screen_z
    when 6..8
      self.x = @battler.screen_x
      self.y -=2
      self.z = @battler.screen_z
    when 3..5
      self.x = @battler.screen_x
      self.y +=2
      self.z = @battler.screen_z
    when 2
      self.x = @battler.screen_x
      self.y += 4
      self.z = @battler.screen_z
    when 1
      self.x = @battler.screen_x
      self.y = @battler.screen_y
      self.z = @battler.screen_z
    end
    @flash_shake -= 1
  end
end
end

#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  处理战斗画面的类。
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader   :animation1_id                    # 行动方动画ID
end


[/pre][/fold]
RyanBern注:
下面这个较新版的彩虹神剑v1.0e修复了一些问题,推荐下载这个版本。范例中使用的脚本仍为较旧版本。
[fold=彩虹神剑v1.0e][pre lang="Ruby"]
=begin
==============================================================================

彩虹神剑(伤害分段显示)显示总伤害版 v1.0e

==============================================================================

彩虹神剑 -柳柳

6-20-2006 v1.0 -叶子
在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的

v1.0a -叶子
修正了显示伤害和实际伤害有差别的问题
修正了miss的情况下显示miss混乱的问题
修正了对己方技能重复显示伤害的问题
未修正播放目标动画第一帧时目标有时无端跳动的BUG

v1.0b -叶子
修改了总伤害数字的位置和z坐标
未修正播放目标动画第一帧时目标有时无端跳动的BUG

v1.0c -柳柳
? ? ?

v1.0d -柳柳
1.0d最终解决了那个闪光问题,还有最末帧伤害多次的算法

7-24-2006 v1.0e -叶子
修正全屏幕闪烁弹出伤害错误的问题
修正连续伤害不会弹出伤害的问题
仍然未修正播放目标动画第一帧时目标有时无端跳动的BUG

==============================================================================
=end
# 核心的说明:
# damage_pop 不再附带damage()的功能,这个放到animation里面去了

module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = true
# 角色受攻击时是否跳一下
BATTLER_JUMP = true
# 连续伤害的动画ID
SLIP_DAMAGE_ANIMATION_ID = 53

class Sprite < ::Sprite
   #==========================================
   # 修改说明:
   # @flash_shake用来制作挨打时候跳跃
   # @_damage    用来记录每次打击之后弹出数字
   # @_total_damage 记录总伤害
   # @_total_damage_duration 总伤害持续帧
   #==========================================
   #alias 66RPG_rainbow_initialize : initialize
   def initialize(viewport = nil)
     #66RPG_rainbow_initialize(viewport)
     super(viewport)
     @_whiten_duration = 0
     @_appear_duration = 0
     @_escape_duration = 0
     @_collapse_duration = 0
     @_damage_duration = 0
     @_animation_duration = 0
     @_blink = false
     # 挨打时候跳跃
     @flash_shake = 0
     # 伤害记录数组
     @_damage = []
     # 总伤害数字
     @_total_damage = 0
     # 总伤害持续帧
     @_total_damage_duration = 0
   end
   def damage(value, critical)
     if value.is_a?(Numeric)
       damage_string = value.abs.to_s
     else
       damage_string = value.to_s
     end
     bitmap = Bitmap.new(160, 48)
     bitmap.font.name = "Arial Black"
     bitmap.font.size = 32
     bitmap.font.color.set(0, 0, 0)
     bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
     bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
     bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
     bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
     #=======================================
     # 修改:颜色
     #=======================================
     if value.is_a?(Numeric) and value < 0
       bitmap.font.color.set(176, 255, 144)
     else
       bitmap.font.color.set(255, 55, 55)
     end
     bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
     if critical
       bitmap.font.size = 20
       bitmap.font.color.set(0, 0, 0)
       bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
       bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
       bitmap.font.color.set(255, 255, 255)
       bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
     end
     @_damage_sprite = ::Sprite.new(self.viewport)
     @_damage_sprite.bitmap = bitmap
     @_damage_sprite.ox = 80
     @_damage_sprite.oy = 20
     @_damage_sprite.x = self.x
     @_damage_sprite.y = self.y - self.oy / 2
     @_damage_sprite.z = 3000
     @_damage_duration = 40
     #=======================================
     # 修改:推入新的伤害
     #=======================================
     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
     # 总伤害处理
     make_total_damage(value)
   end
   #--------------------------------------------------------------------------
   # ● 总伤害处理
   #--------------------------------------------------------------------------
   def make_total_damage(value)
     if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
       @_total_damage += value
     else
       return
     end
     bitmap = Bitmap.new(300, 150)
     bitmap.font.name = "Arial Black"
     bitmap.font.size = 48
     bitmap.font.color.set(0, 0, 0)
     bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
     if @_total_damage < 0
       bitmap.font.color.set(80, 255, 00)
     else
       bitmap.font.color.set(255, 140, 0)
     end
     bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
     if @_total_damage_sprite.nil?
       @_total_damage_sprite = ::Sprite.new(self.viewport)
       @_total_damage_sprite.ox = 80
       @_total_damage_sprite.oy = 20
       @_total_damage_sprite.z = 3000
     end
     @_total_damage_sprite.bitmap = bitmap
     @_total_damage_sprite.zoom_x = 1.5
     @_total_damage_sprite.zoom_y = 1.5
     @_total_damage_sprite.x = self.x
     @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
     @_total_damage_sprite.z = 3001
     @_total_damage_duration = 80
   end
   def animation(animation, hit, battler_damage="", battler_critical=false)
     dispose_animation      
     #=======================================
     # 修改:记录伤害和critical
     #=======================================
     @battler_damage = battler_damage
     @battler_critical = battler_critical
     @_animation = animation
     return if @_animation == nil
     @_animation_hit = hit
     @_animation_duration = @_animation.frame_max
     animation_name = @_animation.animation_name
     animation_hue = @_animation.animation_hue
     bitmap = RPG::Cache.animation(animation_name, animation_hue)
     #=======================================
     # 修改:计算总闪光权限值
     #=======================================
     for timing in @_animation.timings
       quanzhong = animation_process_timing(timing, @_animation_hit,true)
       @all_quanzhong += quanzhong
       # 记录最后一次闪光
       @_last_frame = timing.frame if quanzhong != 0
     end      
     if @@_reference_count.include?(bitmap)
       @@_reference_count[bitmap] += 1
     else
       @@_reference_count[bitmap] = 1
     end
     #=======================================
     # 修改:行动方动画不显示伤害
     #=======================================
     if $scene.is_a?(Scene_Battle)
       if $scene.animation1_id == @battler.animation_id
         @battler_damage = ""
       end
     end
     @_animation_sprites = []
     if @_animation.position != 3 or not @@_animations.include?(animation)
       for i in 0..15
         sprite = ::Sprite.new(self.viewport)
         sprite.bitmap = bitmap
         sprite.visible = false
         @_animation_sprites.push(sprite)
       end
       unless @@_animations.include?(animation)
         @@_animations.push(animation)
       end
     end
     update_animation
   end
   #=======================================
   # 修改:更换清除伤害的算法,以防万一
   #       本内容在脚本中没有使用过
   #=======================================
   def dispose_damage
     for damage in @_damage.reverse
       damage[0].bitmap.dispose
       damage[0].dispose
       @_damage.delete(damage)
     end
     @_total_damage = 0
     @_last_frame = -1
     if @_total_damage_sprite != nil
       @_total_damage_duration = 0
       @_total_damage_sprite.bitmap.dispose
       @_total_damage_sprite.dispose
       @_total_damage_sprite = nil
     end
   end
   def dispose_animation
     #=======================================
     # 修改:清除记录的伤害,清除权重记录
     #=======================================
     @battler_damage = nil
     @battler_critical = nil
     @all_quanzhong = 1
     @_total_damage = 0
     @_last_frame = -1
     if @_animation_sprites != nil
       sprite = @_animation_sprites[0]
       if sprite != nil
         @@_reference_count[sprite.bitmap] -= 1
         if @@_reference_count[sprite.bitmap] == 0
           sprite.bitmap.dispose
         end
       end
       for sprite in @_animation_sprites
         sprite.dispose
       end
       @_animation_sprites = nil
       @_animation = nil
     end
   end
   def update
     super
     if @_whiten_duration > 0
       @_whiten_duration -= 1
       self.color.alpha = 128 - (16 - @_whiten_duration) * 10
     end
     if @_appear_duration > 0
       @_appear_duration -= 1
       self.opacity = (16 - @_appear_duration) * 16
     end
     if @_escape_duration > 0
       @_escape_duration -= 1
       self.opacity = 256 - (32 - @_escape_duration) * 10
     end
     if @_collapse_duration > 0
       @_collapse_duration -= 1
       self.opacity = 256 - (48 - @_collapse_duration) * 6
     end
     #=======================================
     # 修改:更新算法,更新弹出
     #=======================================
     if @_damage_duration > 0
       @_damage_duration -= 1
       for damage in @_damage
         damage[0].x = self.x + self.viewport.rect.x -
                       self.ox + self.src_rect.width / 2 +
                       (40 - damage[1]) * damage[3] / 10
         damage[0].y -= damage[4]+damage[1]/10
         damage[0].opacity = damage[1]*20
         damage[1] -= 1
         if damage[1]==0
           damage[0].bitmap.dispose
           damage[0].dispose
           @_damage.delete(damage)
           next
         end
       end
     end
     #=======================================
     # 添加:弹出总伤害
     #=======================================
     if @_total_damage_duration > 0
       @_total_damage_duration -= 1
       @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
       if @_total_damage_sprite.zoom_x > 1.0
         @_total_damage_sprite.zoom_x -= 0.05
       end
       if @_total_damage_sprite.zoom_y > 1.0
         @_total_damage_sprite.zoom_y -= 0.05
       end
       @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
       if @_total_damage_duration <= 0
         @_total_damage = 0
         @_total_damage_duration = 0
         @_total_damage_sprite.bitmap.dispose
         @_total_damage_sprite.dispose
         @_total_damage_sprite = nil
       end
     end
     #=======================================
     if @_animation != nil and (Graphics.frame_count % 2 == 0)
       @_animation_duration -= 1
       update_animation
     end
     if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
       update_loop_animation
       @_loop_animation_index += 1
       @_loop_animation_index %= @_loop_animation.frame_max
     end
     if @_blink
       @_blink_count = (@_blink_count + 1) % 32
       if @_blink_count < 16
         alpha = (16 - @_blink_count) * 6
       else
         alpha = (@_blink_count - 16) * 6
       end
       self.color.set(255, 255, 255, alpha)
     end
     @@_animations.clear
   end
   def update_animation
     if @_animation_duration > 0
       frame_index = @_animation.frame_max - @_animation_duration
       cell_data = @_animation.frames[frame_index].cell_data
       position = @_animation.position
       animation_set_sprites(@_animation_sprites, cell_data, position)
       #=======================================
       # 修改:弹出伤害,权重计算
       #=======================================
       for timing in @_animation.timings
         if timing.frame == frame_index
           t = 1.0 * animation_process_timing(timing, @_animation_hit)            
           #p t,"当前权重", @all_quanzhong,"总权重"
           if @battler_damage.is_a?(Numeric) and t != 0
             t *= @battler_damage
             t /= @all_quanzhong
             #p t,"当前伤害",@battler_damage,"总伤害"
             t = t.to_i
             # 最后一次闪光的话,伤害修正
             if frame_index == @_last_frame
               @_total_damage = @battler_damage - t
             end
             #p t,@battler_damage,@all_quanzhong
             damage(t,@battler_critical)
           # 防止重复播放miss
           elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
             damage(@battler_damage,@battler_critical)
           end
         end
       end
     else
       dispose_animation
     end
   end
   #=======================================
   # 修改:敌人跳跃的功能 + 添加返回数值
   #=======================================
    def animation_process_timing(timing, hit,dontflash=false)
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        if timing.se.name != ""
          se = timing.se
          Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
        end
        case timing.flash_scope
        when 1
          unless dontflash
            self.flash(timing.flash_color, timing.flash_duration * 2)
            if @_total_damage >0
              @flash_shake_switch = true
              @flash_shake = 10
            end
          end
          return timing.flash_color.alpha * timing.flash_duration
        when 2
          unless dontflash
            if self.viewport != nil
              self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
            end
          end
          return timing.flash_color.alpha * timing.flash_duration
        when 3
          unless dontflash
            self.flash(nil, timing.flash_duration * 2)
          end
          return timing.flash_color.alpha * timing.flash_duration
        end
      end      
      return 0
    end   
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 初始化对像
#    添加跳跃记录
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
  super(viewport)
  @battler = battler
  @battler_visible = false
  @flash_shake_switch = true
end
#--------------------------------------------------------------------------
# ● 刷新画面
#    增添跳跃功能
#--------------------------------------------------------------------------
def update
  super
  # 战斗者为 nil 的情况下
  if @battler == nil
    self.bitmap = nil
    loop_animation(nil)
    return
  end
  # 文件名和色相与当前情况有差异的情况下
  if @battler.battler_name != @battler_name or
     @battler.battler_hue != @battler_hue
    # 获取、设置位图
    @battler_name = @battler.battler_name
    @battler_hue = @battler.battler_hue
    self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
    @width = bitmap.width
    @height = bitmap.height
    self.ox = @width / 2
    self.oy = @height
    # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
    if @battler.dead? or @battler.hidden
      self.opacity = 0
    end
  end
  # 动画 ID 与当前的情况有差异的情况下
  if @battler.damage == nil and
     @battler.state_animation_id != @state_animation_id
    @state_animation_id = @battler.state_animation_id
    loop_animation($data_animations[@state_animation_id])
  end
  # 应该被显示的角色的情况下
  if @battler.is_a?(Game_Actor) and @battler_visible
    # 不是主状态的时候稍稍降低点透明度
    if $game_temp.battle_main_phase
      self.opacity += 3 if self.opacity < 255
    else
      self.opacity -= 3 if self.opacity > 207
    end
  end
  # 明灭
  if @battler.blink
    blink_on
  else
    blink_off
  end
  # 不可见的情况下
  unless @battler_visible
    # 出现
    if not @battler.hidden and not @battler.dead? and
       (@battler.damage == nil or @battler.damage_pop)
      appear
      @battler_visible = true
    end
  end
  # 可见的情况下
  if @battler_visible
    # 逃跑
    if @battler.hidden
      $game_system.se_play($data_system.escape_se)
      escape
      @battler_visible = false
    end
    # 白色闪烁
    if @battler.white_flash
      whiten
      @battler.white_flash = false
    end
    # 动画
    if @battler.animation_id != 0
      animation = $data_animations[@battler.animation_id]
      animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
      @battler.animation_id = 0
    end
    # 伤害
    if @battler.damage_pop
      @battler.damage = nil
      @battler.critical = false
      @battler.damage_pop = false
    end
    # korapusu
    if @battler.damage == nil and @battler.dead?
      if @battler.is_a?(Game_Enemy)
        $game_system.se_play($data_system.enemy_collapse_se)
      else
        $game_system.se_play($data_system.actor_collapse_se)
      end
      collapse
      @battler_visible = false
    end
  end
  # 设置活动块的坐标
  if @flash_shake_switch == true
    self.x = @battler.screen_x
    self.y = @battler.screen_y
    self.z = @battler.screen_z
    @flash_shake_switch = false
  end
  if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
    case @flash_shake
    when 9..10
      self.x = @battler.screen_x
      self.y -=4
      self.z = @battler.screen_z
    when 6..8
      self.x = @battler.screen_x
      self.y -=2
      self.z = @battler.screen_z
    when 3..5
      self.x = @battler.screen_x
      self.y +=2
      self.z = @battler.screen_z
    when 2
      self.x = @battler.screen_x
      self.y += 4
      self.z = @battler.screen_z
    when 1
      self.x = @battler.screen_x
      self.y = @battler.screen_y
      self.z = @battler.screen_z
    end
    @flash_shake -= 1
  end
end
end

#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  处理战斗画面的类。
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader   :animation1_id                    # 行动方动画ID
end

#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
#  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
# 超级类来使用。
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● 应用连续伤害效果
  #--------------------------------------------------------------------------
  alias rainbow_sword_slip_damage_effect slip_damage_effect
  def slip_damage_effect
    self.animation_id = RPG::SLIP_DAMAGE_ANIMATION_ID
    self.animation_hit = true
    rainbow_sword_slip_damage_effect
  end
end
[/pre][/fold]

彩虹神剑.zip (205 KB, 下载次数: 447)

自己收藏準備使用的腳本範例:
66加强对话框与Fuki对话框整合 附送功能.zip (274.28 KB, 下载次数: 697)

無聊自修改範例:
角色倉庫.zip (204.37 KB, 下载次数: 507)
      

评分

参与人数 2梦石 +1 赞 +1 收起 理由
baecaxxx + 1 关于 角色仓库 如果出现人物过多,有无方法.
RyanBern + 1 认可答案

查看全部评分

我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复

使用道具 举报

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
回帖
295
发表于 2015-5-21 14:20:21 | 显示全部楼层
實在找不到了,想自己整合也沒有思路就這樣吧。
最後倆個貌似費勁時間才弄到的,但好像不實用的樣子。

RTAB系統:
RTAB初版.zip (226.81 KB, 下载次数: 794)

菜鳥橫版系統:
菜鸟横版v1.1.zip (217.85 KB, 下载次数: 353)

菜鳥橫版系統整合:
整合彩虹神剑的菜鸟横版.rar (547.25 KB, 下载次数: 848)

评分

参与人数 2梦石 +1 赞 +1 收起 理由
baecaxxx + 1 关于 角色仓库 如果出现人物过多,有无方法.
RyanBern + 1 认可答案

查看全部评分

我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复 1 0

使用道具 举报

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
回帖
295
发表于 2015-5-21 18:16:25 | 显示全部楼层
本帖最后由 妖精蕾贝卡 于 2015-5-21 18:29 编辑

補充一下:
剛剛自行收集和整合的範例。
不知道需不需要?
多種特殊狀態:
絕防、反射、恢復狀態範例.zip (212.53 KB, 下载次数: 365)

多人戰鬥修改:
六人戰鬥.zip (202.86 KB, 下载次数: 431)

行走腳步聲:
腳步聲.zip (200.79 KB, 下载次数: 297)

评分

参与人数 1星屑 +100 收起 理由
RyanBern + 100 收录前两个,脚步声已有

查看全部评分

我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复

使用道具 举报

梦石
0
星屑
2310
在线时间
5539 小时
注册时间
2011-1-10
回帖
6353

青铜编剧史诗剧作家剧作品鉴家

发表于 2015-5-21 18:43:42 | 显示全部楼层
本帖最后由 H·H·Y 于 2015-5-21 18:54 编辑

以下是收集的脚本,先不管三七二十一全放上来了。

菜单类
[fold=跳过标题]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. class Scene_Title
  5.   #==============================================================================
  6.   # 脚本作者:朱仔メ龍 QQ:251724722
  7.   # 脚本转载请保留以上信息
  8.   #==============================================================================
  9.   def main
  10.     $data_actors        = load_data("Data/Actors.rxdata")
  11.     $data_classes       = load_data("Data/Classes.rxdata")
  12.     $data_skills        = load_data("Data/Skills.rxdata")
  13.     $data_items         = load_data("Data/Items.rxdata")
  14.     $data_weapons       = load_data("Data/Weapons.rxdata")
  15.     $data_armors        = load_data("Data/Armors.rxdata")
  16.     $data_enemies       = load_data("Data/Enemies.rxdata")
  17.     $data_troops        = load_data("Data/Troops.rxdata")
  18.     $data_states        = load_data("Data/States.rxdata")
  19.     $data_animations    = load_data("Data/Animations.rxdata")
  20.     $data_tilesets      = load_data("Data/Tilesets.rxdata")
  21.     $data_common_events = load_data("Data/CommonEvents.rxdata")
  22.     $data_system        = load_data("Data/System.rxdata")
  23.     $game_system = Game_System.new
  24.     Graphics.frame_count = 0
  25.     $game_temp          = Game_Temp.new
  26.     $game_system        = Game_System.new
  27.     $game_switches      = Game_Switches.new
  28.     $game_variables     = Game_Variables.new
  29.     $game_self_switches = Game_SelfSwitches.new
  30.     $game_screen        = Game_Screen.new
  31.     $game_actors        = Game_Actors.new
  32.     $game_party         = Game_Party.new
  33.     $game_troop         = Game_Troop.new
  34.     $game_map           = Game_Map.new
  35.     $game_player        = Game_Player.new
  36.     $game_party.setup_starting_members
  37.     $game_map.setup($data_system.start_map_id)
  38.     $game_player.moveto($data_system.start_x, $data_system.start_y)
  39.     $game_player.refresh
  40.     $game_map.autoplay
  41.     $game_map.update
  42.     $scene = Scene_Map.new
  43.   end
  44. end


  45. #==============================================================================
  46. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  47. #==============================================================================

复制代码
[/fold]
[fold=菜单血条]
  1. #===============================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #===============================================================  
  4. # ——————————————————————————————
  5. # HP/SP/EXPゲージ表示スクリプト Ver 1.00
  6. # 配布元?サポートURL
  7. # http://members.jcom.home.ne.jp/cogwheel/
  8. #===============================================================
  9. # ■ Game_Actor
  10. #--------------------------------------------------------
  11. #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
  12. # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
  13. #==============================================================
  14. class Game_Actor < Game_Battler
  15.   def now_exp
  16.     return @exp - @exp_list[@level]
  17.   end
  18.   def next_exp
  19.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  20.   end
  21. end
  22. #==========================================================
  23. # ■ Window_Base
  24. #------------------------------------------------------------
  25. #  ゲーム中のすべてのウィンドウのスーパークラスです。
  26. #============================================================
  27. class Window_Base < Window
  28.   #--------------------------------------------------------
  29.   # ● HP ゲージの描画
  30.   #--------------------------------------------------
  31.   # オリジナルのHP描画を draw_actor_hp_original と名前変更
  32.   alias :draw_actor_hp_original :draw_actor_hp
  33.   def draw_actor_hp(actor, x, y, width = 144)
  34.     # 変数rateに 現在のHP/MHPを代入
  35.     if actor.maxhp != 0
  36.       rate = actor.hp.to_f / actor.maxhp
  37.     else
  38.       rate = 0
  39.     end
  40.     # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  41.     # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  42.     # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  43.     # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  44.     # align3:ゲージタイプ 0:左詰め 1:右詰め
  45.     plus_x = 0
  46.     rate_x = 0
  47.     plus_y = 25
  48.     plus_width = 0
  49.     rate_width = 100
  50.     height = 10
  51.     align1 = 1
  52.     align2 = 2
  53.     align3 = 0
  54.     # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  55.     # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
  56.     grade1 = 1
  57.     grade2 = 0
  58.     # 色設定。color1:外枠,color2:中枠
  59.     # color3:空ゲージダークカラー,color4:空ゲージライトカラー
  60.     # color5:実ゲージダークカラー,color6:実ゲージライトカラー
  61.     color1 = Color.new(0, 0, 0, 192)
  62.     color2 = Color.new(255, 255, 192, 192)
  63.     color3 = Color.new(0, 0, 0, 192)
  64.     color4 = Color.new(64, 0, 0, 192)
  65.     color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
  66.     color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
  67.     # 変数spに描画するゲージの幅を代入
  68.     if actor.maxhp != 0
  69.       hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
  70.     else
  71.       hp = 0
  72.     end
  73.     # ゲージの描画
  74.     gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  75.                 width, plus_width + width * rate_width / 100,
  76.                 height, hp, align1, align2, align3,
  77.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  78.     # オリジナルのHP描画処理を呼び出し
  79.     draw_actor_hp_original(actor, x, y, width)
  80.   end
  81.   #--------------------------------------------------------------
  82.   # ● SP ゲージの描画
  83.   #------------------------------------------------------------
  84.   # オリジナルのSP描画を draw_actor_sp_original と名前変更
  85.   alias :draw_actor_sp_original :draw_actor_sp
  86.   def draw_actor_sp(actor, x, y, width = 144)
  87.     # 変数rateに 現在のSP/MSPを代入
  88.     if actor.maxsp != 0
  89.       rate = actor.sp.to_f / actor.maxsp
  90.     else
  91.       rate = 1
  92.     end
  93.     # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  94.     # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  95.     # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  96.     # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  97.     # align3:ゲージタイプ 0:左詰め 1:右詰め
  98.     plus_x = 0
  99.     rate_x = 0
  100.     plus_y = 25
  101.     plus_width = 0
  102.     rate_width = 100
  103.     height = 10
  104.     align1 = 1
  105.     align2 = 2
  106.     align3 = 0
  107.     # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  108.     # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
  109.     grade1 = 1
  110.     grade2 = 0
  111.     # 色設定。color1:外枠,color2:中枠
  112.     # color3:空ゲージダークカラー,color4:空ゲージライトカラー
  113.     # color5:実ゲージダークカラー,color6:実ゲージライトカラー
  114.     color1 = Color.new(0, 0, 0, 192)
  115.     color2 = Color.new(255, 255, 192, 192)
  116.     color3 = Color.new(0, 0, 0, 192)
  117.     color4 = Color.new(0, 64, 0, 192)
  118.     color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
  119.     color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
  120.     # 変数spに描画するゲージの幅を代入
  121.     if actor.maxsp != 0
  122.       sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
  123.     else
  124.       sp = (width + plus_width) * rate_width / 100
  125.     end
  126.     # ゲージの描画
  127.     gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  128.                 width, plus_width + width * rate_width / 100,
  129.                 height, sp, align1, align2, align3,
  130.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  131.     # オリジナルのSP描画処理を呼び出し
  132.     draw_actor_sp_original(actor, x, y, width)
  133.   end
  134.   #--------------------------------------------------------
  135.   # ● EXP ゲージの描画
  136.   #----------------------------------------------------------
  137.   # オリジナルのEXP描画を draw_actor_sp_original と名前変更
  138.   alias :draw_actor_exp_original :draw_actor_exp
  139.   def draw_actor_exp(actor, x, y, width = 204)
  140.     # 変数rateに 現在のexp/nextexpを代入
  141.     if actor.next_exp != 0
  142.       rate = actor.now_exp.to_f / actor.next_exp
  143.     else
  144.       rate = 1
  145.     end
  146.     # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
  147.     # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
  148.     # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
  149.     # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
  150.     # align3:ゲージタイプ 0:左詰め 1:右詰め
  151.     plus_x = 0
  152.     rate_x = 0
  153.     plus_y = 25
  154.     plus_width = 0
  155.     rate_width = 100
  156.     height = 10
  157.     align1 = 1
  158.     align2 = 2
  159.     align3 = 0
  160.     # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
  161.     # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
  162.     grade1 = 1
  163.     grade2 = 0
  164.     # 色設定。color1:外枠,color2:中枠
  165.     # color3:空ゲージダークカラー,color4:空ゲージライトカラー
  166.     # color5:実ゲージダークカラー,color6:実ゲージライトカラー
  167.     color1 = Color.new(0, 0, 0, 192)
  168.     color2 = Color.new(255, 255, 192, 192)
  169.     color3 = Color.new(0, 0, 0, 192)
  170.     color4 = Color.new(64, 0, 0, 192)
  171.     color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  172.     color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  173.     # 変数expに描画するゲージの幅を代入
  174.     if actor.next_exp != 0
  175.       exp = (width + plus_width) * actor.now_exp * rate_width /
  176.                                                           100 / actor.next_exp
  177.     else
  178.       exp = (width + plus_width) * rate_width / 100
  179.     end
  180.     # ゲージの描画
  181.     gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  182.                 width, plus_width + width * rate_width / 100,
  183.                 height, exp, align1, align2, align3,
  184.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  185.     # オリジナルのEXP描画処理を呼び出し
  186.     draw_actor_exp_original(actor, x, y)
  187.   end
  188.   #---------------------------------------------------------
  189.   # ● ゲージの描画
  190.   #-----------------------------------------------------
  191.   def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
  192.                 color1, color2, color3, color4, color5, color6, grade1, grade2)
  193.     case align1
  194.     when 1
  195.       x += (rect_width - width) / 2
  196.     when 2
  197.       x += rect_width - width
  198.     end
  199.     case align2
  200.     when 1
  201.       y -= height / 2
  202.     when 2
  203.       y -= height
  204.     end
  205.     # 枠描画
  206.     self.contents.fill_rect(x, y, width, height, color1)
  207.     self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
  208.     if align3 == 0
  209.       if grade1 == 2
  210.         grade1 = 3
  211.       end
  212.       if grade2 == 2
  213.         grade2 = 3
  214.       end
  215.     end
  216.     if (align3 == 1 and grade1 == 0) or grade1 > 0
  217.       color = color3
  218.       color3 = color4
  219.       color4 = color
  220.     end
  221.     if (align3 == 1 and grade2 == 0) or grade2 > 0
  222.       color = color5
  223.       color5 = color6
  224.       color6 = color
  225.     end
  226.     # 空ゲージの描画
  227.     self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
  228.                                   color3, color4, grade1)
  229.     if align3 == 1
  230.       x += width - gauge
  231.     end
  232.     # 実ゲージの描画
  233.     self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
  234.                                   color5, color6, grade2)
  235.   end
  236. end
  237. #--------------------------------------------------------------
  238. #  Bitmapクラスに新たな機能を追加します。
  239. #===================================================================
  240. class Bitmap
  241.   #------------------------------------------------------------
  242.   # ● 矩形をグラデーション表示
  243.   #     color1 : スタートカラー
  244.   #     color2 : エンドカラー
  245.   #     align  :  0:横にグラデーション
  246.   #               1:縦にグラデーション
  247.   #               2:斜めにグラデーション(激重につき注意)
  248.   #--------------------------------------------------------
  249.   def gradation_rect(x, y, width, height, color1, color2, align = 0)
  250.     if align == 0
  251.       for i in x...x + width
  252.         red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  253.         green = color1.green +
  254.                 (color2.green - color1.green) * (i - x) / (width - 1)
  255.         blue  = color1.blue +
  256.                 (color2.blue - color1.blue) * (i - x) / (width - 1)
  257.         alpha = color1.alpha +
  258.                 (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  259.         color = Color.new(red, green, blue, alpha)
  260.         fill_rect(i, y, 1, height, color)
  261.       end
  262.     elsif align == 1
  263.       for i in y...y + height
  264.         red   = color1.red +
  265.                 (color2.red - color1.red) * (i - y) / (height - 1)
  266.         green = color1.green +
  267.                 (color2.green - color1.green) * (i - y) / (height - 1)
  268.         blue  = color1.blue +
  269.                 (color2.blue - color1.blue) * (i - y) / (height - 1)
  270.         alpha = color1.alpha +
  271.                 (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  272.         color = Color.new(red, green, blue, alpha)
  273.         fill_rect(x, i, width, 1, color)
  274.       end
  275.     elsif align == 2
  276.       for i in x...x + width
  277.         for j in y...y + height
  278.           red   = color1.red + (color2.red - color1.red) *
  279.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  280.           green = color1.green + (color2.green - color1.green) *
  281.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  282.           blue  = color1.blue + (color2.blue - color1.blue) *
  283.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  284.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  285.                   ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  286.           color = Color.new(red, green, blue, alpha)
  287.           set_pixel(i, j, color)
  288.         end
  289.       end
  290.     elsif align == 3
  291.       for i in x...x + width
  292.         for j in y...y + height
  293.           red   = color1.red + (color2.red - color1.red) *
  294.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  295.           green = color1.green + (color2.green - color1.green) *
  296.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  297.           blue  = color1.blue + (color2.blue - color1.blue) *
  298.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  299.           alpha = color1.alpha + (color2.alpha - color1.alpha) *
  300.                 ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  301.           color = Color.new(red, green, blue, alpha)
  302.           set_pixel(i, j, color)
  303.         end
  304.       end
  305.     end
  306.   end
  307. end
  308. #==================================================================
  309. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  310. #==================================================================
复制代码
[/fold]
[fold=读书系统]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. class Interpreter
  5.    
  6.   BOOK_READING = 50 # 默认打开50开关后进入读书系统
  7.    
  8.   #--------------------------------------------------------------------------
  9.   # ● 显示文章
  10.   #--------------------------------------------------------------------------
  11.   def command_101
  12.     # 另外的文章已经设置过 message_text 的情况下
  13.     if $game_temp.message_text != nil
  14.       # 结束
  15.       return false
  16.     end
  17.     # 设置信息结束后待机和返回调用标志
  18.     @message_waiting = true
  19.     $game_temp.message_proc = Proc.new { @message_waiting = false }
  20.     # message_text 设置为 1 行
  21.     $game_temp.message_text = @list[@index].parameters[0] + "\n"
  22.     line_count = 1
  23.     # 循环
  24.     loop do
  25.       # 下一个事件指令为文章两行以上的情况
  26.       if $game_switches[BOOK_READING] and @list[@index+1].code == 101#阅读书刊报纸
  27.         unless $game_temp.in_battle
  28.           $scene.message_window.height = 320
  29.           $scene.message_window.contents = Bitmap.new($scene.message_window.width - 32, $scene.message_window.height - 32)
  30.           $scene.message_window.contents.font.size = 20
  31.           $game_temp.message_text += @list[@index+1].parameters[0] +"\n"
  32.           line_count+=1
  33.           @index+=1
  34.         end
  35.       end
  36.       if $game_switches[BOOK_READING]==false
  37.         unless $game_temp.in_battle
  38.           if $scene.message_window.height == 320
  39.             $scene.message_window.height = 160
  40.             $scene.message_window.contents = Bitmap.new($scene.message_window.width - 32, $scene.message_window.height - 32)
  41.             $scene.message_window.contents.font.size = 22
  42.           end
  43.         end
  44.       end
  45.       if @list[@index+1].code == 401
  46.         # message_text 添加到第 2 行以下
  47.         $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
  48.         line_count += 1
  49.       # 事件指令不在文章两行以下的情况
  50.       else
  51.         # 下一个事件指令为显示选择项的情况下
  52.         if @list[@index+1].code == 102
  53.           # 如果选择项能收纳在画面里
  54.           if @list[@index+1].parameters[0].size <= 4 - line_count
  55.             # 推进索引
  56.             @index += 1
  57.             # 设置选择项
  58.             $game_temp.choice_start = line_count
  59.             setup_choices(@list[@index].parameters)
  60.           end
  61.         # 下一个事件指令为处理输入数值的情况下
  62.         elsif @list[@index+1].code == 103
  63.           # 如果数值输入窗口能收纳在画面里
  64.           if line_count < 4
  65.             # 推进索引
  66.             @index += 1
  67.             # 设置输入数值
  68.             $game_temp.num_input_start = line_count
  69.             $game_temp.num_input_variable_id = @list[@index].parameters[0]
  70.             $game_temp.num_input_digits_max = @list[@index].parameters[1]
  71.           end
  72.         end
  73.         # 继续
  74.         return true
  75.       end
  76.       # 推进索引
  77.       @index += 1
  78.     end
  79.   end
  80. end
  81. class Scene_Map
  82.   attr_accessor :message_window
  83. end
  84. #==============================================================================
  85. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  86. #==============================================================================
复制代码
[/fold]
[fold=存档扩充]
  1. # --------------------------------------------------------------------
  2. class Scene_File
  3.   #——最大存档数量,一般我认为最多50足够了,20比较合适
  4.   SAVEFILE_MAX = 10
  5.   # -------------------
  6.   def initialize(help_text)
  7.     @help_text = help_text
  8.   end
  9.   # -------------------
  10.   def main
  11.     @spriteset = Spriteset_Map.new
  12.     @help_window = Window_Help.new
  13.     @help_window.opacity = 160
  14.     @help_window.z = 500
  15.     @help_window.set_text(@help_text)
  16.     @savefile_windows = []
  17.     @cursor_displace = 0
  18.     for i in 0..3
  19.       @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
  20.       @savefile_windows[i].opacity = 160
  21.       @savefile_windows[i].z = 500
  22.     end
  23.     @file_index = 0
  24.     @savefile_windows[@file_index].selected = true
  25.     Graphics.transition
  26.     loop do
  27.       Graphics.update
  28.       Input.update
  29.       update
  30.       if $scene != self
  31.         break
  32.       end
  33.     end
  34.     Graphics.freeze
  35.     @help_window.dispose
  36.     @spriteset.dispose
  37.     for i in @savefile_windows
  38.       i.dispose
  39.     end
  40.   end
  41.   # -------------------
  42.   def update
  43.     @help_window.update
  44.     for i in @savefile_windows
  45.       i.update
  46.     end
  47.     if Input.trigger?(Input::C)
  48.       on_decision(make_filename(@file_index))
  49.       $game_temp.last_file_index = @file_index
  50.       return
  51.     end
  52.     if Input.trigger?(Input::B)
  53.       on_cancel
  54.       return
  55.     end
  56.     if Input.repeat?(Input::DOWN)
  57.       if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
  58.         if @file_index == SAVEFILE_MAX - 1
  59.           $game_system.se_play($data_system.buzzer_se)
  60.           return
  61.         end
  62.         @cursor_displace += 1
  63.         if @cursor_displace == 4
  64.           @cursor_displace = 3
  65.           for i in @savefile_windows
  66.             i.dispose
  67.           end
  68.           @savefile_windows = []
  69.           for i in 0..3
  70.             f = i - 2 + @file_index
  71.             name = make_filename(f)
  72.             @savefile_windows.push(Window_SaveFile.new(f, name, i))
  73.             @savefile_windows[i].opacity = 160
  74.             @savefile_windows[i].z = 500
  75.             @savefile_windows[i].selected = false
  76.           end
  77.         end
  78.         $game_system.se_play($data_system.cursor_se)
  79.         @file_index = (@file_index + 1)
  80.         if @file_index == SAVEFILE_MAX
  81.           @file_index = SAVEFILE_MAX - 1
  82.         end
  83.         for i in 0..3
  84.           @savefile_windows[i].selected = false
  85.         end
  86.         @savefile_windows[@cursor_displace].selected = true
  87.         return
  88.       end
  89.     end
  90.     if Input.repeat?(Input::UP)
  91.       if Input.trigger?(Input::UP) or @file_index > 0
  92.         if @file_index == 0
  93.           $game_system.se_play($data_system.buzzer_se)
  94.           return
  95.         end
  96.         @cursor_displace -= 1
  97.         if @cursor_displace == -1
  98.           @cursor_displace = 0
  99.           for i in @savefile_windows
  100.             i.dispose
  101.           end
  102.           @savefile_windows = []
  103.           for i in 0..3
  104.             f = i - 1 + @file_index
  105.             name = make_filename(f)
  106.             @savefile_windows.push(Window_SaveFile.new(f, name, i))
  107.             @savefile_windows[i].opacity = 160
  108.             @savefile_windows[i].z = 500
  109.             @savefile_windows[i].selected = false
  110.           end
  111.         end
  112.         $game_system.se_play($data_system.cursor_se)
  113.         @file_index = (@file_index - 1)
  114.         if @file_index == -1
  115.           @file_index = 0
  116.         end
  117.         for i in 0..3
  118.           @savefile_windows[i].selected = false
  119.         end
  120.         @savefile_windows[@cursor_displace].selected = true
  121.         return
  122.       end
  123.     end
  124.   end
  125.   # -------------------
  126.   def make_filename(file_index)
  127.     return "Save#{file_index + 1}.rxdata"
  128.   end
  129.   # -------------------
  130. end




  131. class Window_SaveFile < Window_Base
  132.   # -------------------
  133.   def initialize(file_index, filename, position)
  134.     y = 64 + position * 104
  135.     super(0, y, 640, 104)
  136.     self.contents = Bitmap.new(width - 32, height - 32)
  137.     @file_index = file_index
  138.     @filename = "Save#{@file_index + 1}.rxdata"
  139.     @time_stamp = Time.at(0)
  140.     @file_exist = FileTest.exist?(@filename)
  141.     if @file_exist
  142.       file = File.open(@filename, "r")
  143.       @time_stamp = file.mtime
  144.       @characters = Marshal.load(file)
  145.       @frame_count = Marshal.load(file)
  146.       @game_system = Marshal.load(file)
  147.       @game_switches = Marshal.load(file)
  148.       @game_variables = Marshal.load(file)
  149.       @total_sec = @frame_count / Graphics.frame_rate
  150.       file.close
  151.     end
  152.     refresh
  153.     @selected = false
  154.   end
  155. end


  156. #==============================================================================
复制代码
[/fold]
[fold=存档覆盖提示]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #在覆盖存档的时候弹出对话框提示
  5. class Scene_Save < Scene_File
  6. # -----------------------------
  7.   def initialize
  8.     super("储存到哪一个进度")
  9.     @confirm_window = Window_Base.new(120, 188, 400, 64)
  10.     @confirm_window.contents = Bitmap.new(368, 32)
  11.     string = "确定要覆盖这个进度吗?"
  12.     @confirm_window.contents.font.name = "黑体"
  13.     @confirm_window.contents.font.size = 24
  14.     @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  15.     @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  16.     @confirm_window.visible = false
  17.     @confirm_window.z = 1500
  18.     @yes_no_window.visible = false
  19.     @yes_no_window.active = false
  20.     @yes_no_window.index = 1
  21.     @yes_no_window.x = 270
  22.     @yes_no_window.y = 252
  23.     @yes_no_window.z = 1500
  24.     @mode = 0
  25.   end
  26. # -----------------------------
  27.   def on_decision(filename)
  28.     if FileTest.exist?(filename)
  29.       @confirm_window.visible = true
  30.       @yes_no_window.visible = true
  31.       @yes_no_window.active = true
  32.       @mode = 1
  33.     else
  34.       $game_system.se_play($data_system.save_se)
  35.       file = File.open(filename, "wb")
  36.       write_save_data(file)
  37.       file.close
  38.       if $game_temp.save_calling
  39.         $game_temp.save_calling = false
  40.         $scene = Scene_Map.new
  41.       return
  42.     end
  43.     $scene = Scene_Menu.new(4)
  44.     end
  45.   end
  46. # -----------------------------
  47.   def update
  48.     if @mode == 0
  49.       super
  50.     else
  51.       @help_window.update
  52.       @yes_no_window.update
  53.       if Input.trigger?(Input::C)
  54.         $game_system.se_play($data_system.decision_se)
  55.         if @yes_no_window.index == 0
  56.           @yes_no_window.visible = false
  57.           @yes_no_window.active = false
  58.           @confirm_window.visible = false
  59.           filename = make_filename(@file_index)
  60.           $game_system.se_play($data_system.save_se)
  61.           file = File.open(filename, "wb")
  62.           write_save_data(file)
  63.           file.close
  64.           if $game_temp.save_calling
  65.             $game_temp.save_calling = false
  66.             $scene = Scene_Map.new
  67.           else
  68.             $scene = Scene_Menu.new(4)
  69.           end
  70.         else
  71.           @confirm_window.visible = false
  72.           @yes_no_window.visible = false
  73.           @yes_no_window.active = false
  74.           @yes_no_window.index = 1
  75.           @mode = 0
  76.         end
  77.       end
  78.       if Input.trigger?(Input::B)
  79.         @confirm_window.visible = false
  80.         @yes_no_window.visible = false
  81.         @yes_no_window.active = false
  82.         @yes_no_window.index = 1
  83.         @mode = 0
  84.       return
  85.     end
  86.   end
  87. end
  88. # -----------------------------
  89.   def on_cancel
  90.     $game_system.se_play($data_system.cancel_se)
  91.     if $game_temp.save_calling
  92.       $game_temp.save_calling = false
  93.       $scene = Scene_Map.new
  94.       return
  95.     end
  96.     $scene = Scene_Menu.new(4)
  97.   end
  98. # -----------------------------
  99.   def write_save_data(file)
  100.     characters = []
  101.     for i in 0...$game_party.actors.size
  102.       actor = $game_party.actors[i]
  103.       characters.push([actor.character_name, actor.character_hue])
  104.     end
  105.     Marshal.dump(characters, file)
  106.     Marshal.dump(Graphics.frame_count, file)
  107.     $game_system.save_count += 1
  108.     $game_system.magic_number = $data_system.magic_number
  109.     Marshal.dump($game_system, file)
  110.     Marshal.dump($game_switches, file)
  111.     Marshal.dump($game_variables, file)
  112.     Marshal.dump($game_self_switches, file)
  113.     Marshal.dump($game_screen, file)
  114.     Marshal.dump($game_actors, file)
  115.     Marshal.dump($game_party, file)
  116.     Marshal.dump($game_troop, file)
  117.     Marshal.dump($game_map, file)
  118.     Marshal.dump($game_player, file)
  119.   end
  120. end
  121. class Scene_File
  122.   alias carol3_main main
  123.   def main
  124.     carol3_main
  125.     if self.is_a?(Scene_Save)
  126.       @confirm_window.dispose
  127.       @yes_no_window.dispose
  128.     end
  129.   end
  130. end
  131. #==============================================================================
  132. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  133. #==============================================================================
复制代码
[/fold]
[fold=人物简介]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. # 人物介绍     Ver. 1.1          作者: Claimh     翻译与修正:柳柳
  5. #------------------------------------------------------------------------------
  6. # http://www.k3.dion.ne.jp/~claimh/
  7. #==============================================================================
  8.    
  9. #——功能简介:在状态页面按下回车键会进入人物介绍页面。
  10. #——如果想自行建立功能,使用$scene = Scene_Charactor.new(角色编号)即可  
  11. #——如果自行建立了功能不想使用默认的切换,去掉217行以后的内容
  12.    
  13. #——以下数组,如果人物超过8人,请自行继续添加(一般游戏没那么多主人公吧)
  14. #——如果想更改内容,比如把“体重”改为“智商”,请修改102-107行的文字内容
  15.    
  16. # 从状态页面切换至人物介绍页面的按键
  17. CHENGE_KEY = Input::C
  18. #--------------------------------------------------------------------------
  19. # 人物年龄 (自定义)  
  20. #--------------------------------------------------------------------------
  21. CHARA_AGE = ["17","16","??","??","??","??","15","15"]
  22. #--------------------------------------------------------------------------
  23. # 人物出生地
  24. #--------------------------------------------------------------------------
  25. CHARA_FROM = ["希腊","罗马","??","??","??","??","雷都","日本东京"]
  26. #--------------------------------------------------------------------------
  27. # 人物身高
  28. #--------------------------------------------------------------------------
  29. CHARA_H = ["170","160","??","??","??","??","162","165"]
  30. #--------------------------------------------------------------------------
  31. # 人物体重
  32. #--------------------------------------------------------------------------
  33. CHARA_W = ["60","50","??","??","??","??","46","53"]
  34. #--------------------------------------------------------------------------
  35. # 人物介绍,可以写多行
  36. #--------------------------------------------------------------------------
  37. # 人物1号介绍
  38. L1 = "RPG制作大师XP的标准主人公+形象代言人"
  39. L2 = "是一个外表不经世事、内心坚强无比的小伙子"
  40. L3 = ""               
  41. L_SET1 = [L1, L2, L3]  # 人物1号的数组
  42. # 人物2号介绍
  43. L1 = "RPG制作大师XP的1号女主角"
  44. L2 = "一个充满人性温情的女战士"
  45. L3 = ""
  46. L_SET2 = [L1, L2, L3]  # 人物2号的数组
  47. # 人物3号介绍
  48. L1 = ""  
  49. L2 = ""  
  50. L3 = ""  
  51. L_SET3 = [L1, L2, L3]  
  52. # 人物4号介绍
  53. L1 = ""  
  54. L2 = ""  
  55. L3 = ""  
  56. L_SET4 = [L1, L2, L3]  
  57. # 人物5号介绍
  58. L1 = ""  
  59. L2 = ""  
  60. L3 = ""  
  61. L_SET5 = [L1, L2, L3]
  62. # 人物6号介绍
  63. L1 = ""  
  64. L2 = ""  
  65. L3 = ""  
  66. L_SET6 = [L1, L2, L3]  
  67. # 人物7号介绍
  68. L1 = "充满冷酷的红魔法师"
  69. L2 = "11岁,父母阵亡后加入了杀手组织"
  70. L3 = "13岁,在一次行动失利中被抓到地牢严刑拷打长达半年"
  71. L4 = "14岁,一个人杀光所有蹂躏她的狱卒,独自踏上旅途"
  72. L_SET7 = [L1, L2, L3, L4]
  73. # 人物8号介绍
  74. L1 = "娇生惯养的贵族魔法师,从不懂人世艰难"
  75. L2 = "自以为实力天下第一"
  76. L3 = ""
  77. L_SET8 = [L1, L2, L3]
  78. # 人物介绍数组,如果不够继续添加。
  79. CHARA_INFO = [L_SET1,L_SET2,L_SET3,L_SET4,L_SET5,L_SET6,L_SET7,L_SET8]

  80. #==============================================================================
  81. # Window_Charactor
  82. #==============================================================================
  83. class Window_Charactor < Window_Base
  84.   #--------------------------------------------------------------------------
  85.   # actor : 初始化的角色
  86.   #--------------------------------------------------------------------------
  87.   def initialize(actor)
  88.     super(0, 0, 640, 480)
  89.     self.contents = Bitmap.new(width - 32, height - 32)
  90.     @actor = actor
  91.     refresh
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   #--------------------------------------------------------------------------
  95.   def refresh
  96.     self.contents.clear
  97.     draw_battler_graphics(@actor, 100, 200)
  98.     self.contents.font.color.set(255, 255,50)
  99.     self.contents.draw_text(250, 10, 80, 32, "姓名")
  100.     self.contents.draw_text(250, 50, 80, 32, "年龄")
  101.     self.contents.draw_text(250, 90, 80, 32, "出生地")
  102.     self.contents.draw_text(250, 130, 80, 32, "身高")
  103.     self.contents.draw_text(250, 170, 80, 32, "体重")
  104.     self.contents.font.color = normal_color
  105.     draw_actor_name(@actor, 350, 10)
  106.     draw_actor_age(@actor, 350, 50)
  107.     draw_actor_from(@actor, 350, 90)
  108.     draw_actor_height(@actor, 350, 130)     
  109.     draw_actor_weight(@actor, 350, 170)
  110.     draw_actor_other(@actor, 50, 250)
  111.   end
  112. end
  113. class Window_Base < Window
  114.   #--------------------------------------------------------------------------
  115.   #--------------------------------------------------------------------------
  116.   def draw_battler_graphics(actor, x, y)
  117.     battler=RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  118.     w = battler.width
  119.     h = battler.height
  120.     self.contents.blt(x-w/2, y-h, battler, Rect.new(0, 0, w,h))
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   #--------------------------------------------------------------------------
  124.   def draw_actor_age(actor, x, y)
  125.     self.contents.draw_text(x, y, 80, 32, CHARA_AGE[actor.id-1])
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   #--------------------------------------------------------------------------
  129.   def draw_actor_from(actor, x, y)
  130.     self.contents.draw_text(x, y, 180, 32, CHARA_FROM[actor.id-1])
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   #--------------------------------------------------------------------------
  134.   def draw_actor_height(actor, x, y)
  135.     self.contents.draw_text(x, y , 200, 32, CHARA_H[actor.id-1])
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   #--------------------------------------------------------------------------
  139.   def draw_actor_weight(actor, x, y)
  140.     self.contents.draw_text(x, y, 250, 32, CHARA_W[actor.id-1])
  141.   end
  142.   #--------------------------------------------------------------------------
  143.   #--------------------------------------------------------------------------
  144.   def draw_actor_other(actor, x, y)
  145.     info = CHARA_INFO[actor.id-1]
  146.     for i in 0...info.size
  147.       self.contents.draw_text(x, y+32*i, 600, 32, info[i])
  148.     end
  149.   end
  150. end

  151. #==============================================================================
  152. # Scene_Charactor
  153. #==============================================================================
  154. class Scene_Charactor
  155.   #--------------------------------------------------------------------------
  156.   #   actor_index :角色编号
  157.   #--------------------------------------------------------------------------
  158.   def initialize(actor_index = 0, equip_index = 0)
  159.     @actor_index = actor_index
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   #--------------------------------------------------------------------------
  163.   def main
  164.     @actor = $game_party.actors[@actor_index]
  165.     @status_window = Window_Charactor.new(@actor)
  166.     Graphics.transition
  167.     loop do
  168.       Graphics.update
  169.       Input.update
  170.       update
  171.       if $scene != self
  172.         break
  173.       end
  174.     end
  175.     Graphics.freeze
  176.     @status_window.dispose
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   #--------------------------------------------------------------------------
  180.   def update
  181.     if Input.trigger?(Input::B)
  182.       $game_system.se_play($data_system.cancel_se)
  183.       $scene = Scene_Menu.new(3)
  184.       return
  185.     end
  186.     if Input.trigger?(Input::R)
  187.       $game_system.se_play($data_system.cursor_se)
  188.       @actor_index += 1
  189.       @actor_index %= $game_party.actors.size
  190.       $scene = Scene_Charactor.new(@actor_index)
  191.       return
  192.     end
  193.     if Input.trigger?(Input::L)
  194.       $game_system.se_play($data_system.cursor_se)
  195.       @actor_index += $game_party.actors.size - 1
  196.       @actor_index %= $game_party.actors.size
  197.       $scene = Scene_Charactor.new(@actor_index)
  198.       return
  199.     end
  200.   end
  201. end

  202. #==============================================================================
  203. # Scene_Status
  204. #==============================================================================
  205. class Scene_Status
  206.   alias update_chara update
  207.   def update
  208.     if Input.trigger?(CHENGE_KEY)
  209.       $game_system.se_play($data_system.decision_se)
  210.       $scene = Scene_Charactor.new(@actor_index)
  211.       return
  212.     end
  213.     update_chara
  214.   end
  215. end
  216.   
  217. #==============================================================================
  218. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  219. #==============================================================================
复制代码
[/fold]
[fold=任务系统]
  1. 脚本内容

  2. #==============================================================================
  3. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  4. #==============================================================================

  5. #简略使用说明:
  6. #事件脚本输入  $任务 = "文字"  或  $支线 = "文字"  即可设定任务。
  7. #至于怎么完成任务……本喵忘记了……(~ ̄△ ̄)~

  8. #==============================================================================
  9. # Game_System
  10. #------------------------------------------------------------------------------
  11. # 添加内容
  12. #==============================================================================
  13. class Game_System
  14.   attr_accessor :mission #现在执行的任务
  15.   attr_accessor :partmission
  16.   alias carol3_ini initialize
  17.   def initialize
  18.     carol3_ini
  19.     @mission = ""
  20.     @partmission = []
  21.   end
  22. end
  23. #==============================================================================
  24. # ■ Scene_Title
  25. #------------------------------------------------------------------------------
  26. #  处理标题画面的类。
  27. #==============================================================================
  28. class Scene_Title
  29.   alias carol3_title1 main
  30.   def main
  31.     $map_infos = load_data("Data/MapInfos.rxdata")
  32.     for key in $map_infos.keys
  33.       $map_infos[key] = $map_infos[key].name
  34.     end
  35.     $任务 = ""
  36.     $支线 = nil
  37.     $支线完成 = nil
  38.     carol3_title1
  39.   end
  40. end
  41. class Scene_Map
  42.   alias carol3_update update
  43.   def update
  44.     carol3_update
  45.     if $支线 != nil
  46.       for i in 0...$game_system.partmission.size
  47.         if $game_system.partmission[i] == $支线
  48.           $支线 = nil
  49.           break
  50.         end
  51.       end
  52.       if $支线 != nil
  53.         $game_system.partmission.push($支线)
  54.         $支线 = nil
  55.       end
  56.     end
  57.     if $支线完成 != nil
  58.       for i in 0...$game_system.partmission.size
  59.         if $game_system.partmission[i] == $支线完成
  60.           $game_system.partmission.delete($game_system.partmission[i])
  61.           break
  62.         end
  63.       end
  64.       $支线完成 = nil
  65.     end
  66.   end
  67. end
  68. #==============================================================================
  69. # Window_MenuStatus
  70. #------------------------------------------------------------------------------
  71. # 显示菜单画面和同伴状态的窗口。
  72. #==============================================================================
  73. class Window_MenuStatus < Window_Selectable
  74.   #--------------------------------------------------------------------------
  75.   # ● 初始化目标
  76.   #--------------------------------------------------------------------------
  77.   def initialize
  78.     super(0, 0, 480, 384)
  79.     self.contents = Bitmap.new(width - 32, height - 32)
  80.     self.active = false
  81.     self.index = -1
  82.     @position = 0
  83.     @count = 0
  84.     @oldposition = 0
  85.     refresh
  86.   end
  87.   #--------------------------------------------------------------------------
  88.   # ● 刷新
  89.   #--------------------------------------------------------------------------
  90.   def refresh
  91.     self.contents.clear
  92.     @item_max = $game_party.actors.size
  93.     for i in 0...$game_party.actors.size
  94.       x = 64
  95.       y = i * 90
  96.       actor = $game_party.actors[i]
  97.       self.contents.font.size = 18
  98.       draw_actor_active_graphic(actor, x - 40, y + 50)
  99.       draw_actor_name(actor, x, y)
  100.       draw_actor_class(actor, x + 144, y)
  101.       draw_actor_level(actor, x, y + 25)
  102.       draw_actor_state(actor, x + 90, y + 25)
  103.       draw_actor_exp(actor, x, y + 50)
  104.       draw_actor_hp(actor, x + 236, y + 25)
  105.       draw_actor_sp(actor, x + 236, y + 50)
  106.     end
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ● 绘制行走图
  110.   #--------------------------------------------------------------------------
  111.   def draw_actor_active_graphic(actor, x, y)
  112.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  113.     cw = bitmap.width / 4
  114.     ch = bitmap.height / 4
  115.     p = @position * cw
  116.     src_rect = Rect.new(p, 0, cw, ch)
  117.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ● 刷新光标矩形
  121.   #--------------------------------------------------------------------------
  122.   def update_cursor_rect
  123.     if @index < 0
  124.       self.cursor_rect.empty
  125.     else
  126.       self.cursor_rect.set(0, @index *90-5, self.width - 32, 90)
  127.     end
  128.   end  
  129.   def update
  130.     super
  131.     @count += 1
  132.     @count %= 15
  133.     if @count == 0
  134.       @position = (@position + 1) % 4
  135.     end
  136.     if @position != @oldposition
  137.       @oldposition = @position
  138.       refresh
  139.     end
  140.   end
  141. end
  142. #==============================================================================
  143. # ■ Game_Map
  144. #------------------------------------------------------------------------------
  145. #  处理地图的类。包含卷动以及可以通行的判断功能。
  146. # 本类的实例请参考 $game_map 。
  147. #==============================================================================
  148. class Game_Map
  149.   def name
  150.     return $map_infos[@map_id]
  151.   end
  152. end
  153. #==============================================================================
  154. # Window_RecordBook
  155. #------------------------------------------------------------------------------
  156. # 菜单界面表示信息的窗口
  157. #==============================================================================
  158. class Window_RecordBook < Window_Base
  159.   #--------------------------------------------------------------------------
  160.   # ● 初始化对象
  161.   #--------------------------------------------------------------------------
  162.   def initialize
  163.     super(160, 384, 480, 480)
  164.     self.contents = Bitmap.new(width - 32, height - 32)
  165.     if $任务 == ""
  166.       $任务 = $game_system.mission
  167.     else
  168.       $game_system.mission = $任务
  169.     end
  170.     refresh
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 刷新画面
  174.   #--------------------------------------------------------------------------
  175.   def refresh
  176.     self.contents.clear
  177.     self.contents.font.color = system_color
  178.     self.contents.font.size = 20
  179.     cx = self.contents.text_size("现在地点").width + 24
  180.     self.contents.draw_text(4, 0, cx, 24, "现在地点")
  181.     self.contents.font.color = normal_color
  182.     self.contents.draw_text(4 + cx, 0, 444 - cx, 24, $game_map.name.to_s)  
  183.     self.contents.font.color = system_color
  184.     cx = self.contents.text_size("主线任务").width + 24
  185.     self.contents.draw_text(4, 32, cx, 24, "主线任务")
  186.     self.contents.font.color = Color.new(240,250,75,255)
  187.     self.contents.draw_text(4 + cx, 32, 444 - cx, 24, $game_system.mission.to_s)  
  188.     self.contents.font.color = system_color
  189.     cx = self.contents.text_size("支线任务").width + 24
  190.     self.contents.draw_text(4, 96, cx, 24, "支线任务")
  191.     self.contents.font.color = normal_color
  192.     for i in 0...$game_system.partmission.size
  193.       self.contents.draw_text(4 + cx, 96 + i * 32, 444 - cx, 24, $game_system.partmission[i].to_s)
  194.     end
  195.   end
  196. end
  197. #==============================================================================
  198. # ■ Scene_Menu
  199. #------------------------------------------------------------------------------
  200. #  处理菜单画面的类。
  201. #==============================================================================
  202. class Scene_Menu
  203.   #--------------------------------------------------------------------------
  204.   # ● 初始化对像
  205.   # menu_index : 命令光标的初期位置
  206.   #--------------------------------------------------------------------------
  207.   def initialize(menu_index = 0)
  208.     @menu_index = menu_index
  209.     @切换状态暂停 = ""
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 主处理
  213.   #--------------------------------------------------------------------------
  214.   def main
  215.     # 生成命令窗口
  216.     s1 = " 使用物品"#$data_system.words.item
  217.     s2 = " 使用技能"#$data_system.words.skill
  218.     s3 = " 更改装备"#$data_system.words.equip
  219.     s4 = " 查看状态"
  220.     s5 = " 储存游戏"
  221.     s6 = " 结束游戏"
  222.     s7 = " 查看任务"
  223.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  224.     @command_window.index = @menu_index
  225.     # 同伴人数为 0 的情况下
  226.     if $game_party.actors.size == 0
  227.       # 物品、特技、装备、状态无效化
  228.       @command_window.disable_item(0)
  229.       @command_window.disable_item(1)
  230.       @command_window.disable_item(2)
  231.       @command_window.disable_item(3)
  232.     end
  233.     # 禁止存档的情况下
  234.     if $game_system.save_disabled
  235.       # 存档无效
  236.       @command_window.disable_item(4)
  237.     end
  238.     # 生成游戏时间窗口
  239.     @playtime_window = Window_PlayTime.new
  240.     @playtime_window.x = 0
  241.     @playtime_window.y = 256
  242.     # 生成金钱窗口
  243.     @gold_window = Window_Gold.new
  244.     @gold_window.x = 0
  245.     @gold_window.y = 416
  246.     # 生成状态窗口
  247.     @status_window = Window_MenuStatus.new
  248.     @status_window.x = 160
  249.     @status_window.y = 0
  250.     #—— 生成天书窗口
  251.     @recordbook_window = Window_RecordBook.new
  252.     @recordbook_window.z = 1000
  253.     #—— 生成外边框窗口
  254.     @outside_window = Window_Outside.new
  255.     @outside_window.visible = true
  256.     @outside_window.z = 1001
  257.     # 执行过渡
  258.     Graphics.transition
  259.     # 主循环
  260.     loop do
  261.       # 刷新游戏画面
  262.       Graphics.update
  263.       # 刷新输入信息
  264.       Input.update
  265.       # 刷新画面
  266.       update
  267.       # 如果切换画面就中断循环
  268.       if $scene != self
  269.         break
  270.       end
  271.     end
  272.     # 准备过渡
  273.     Graphics.freeze
  274.     # 释放窗口
  275.     @command_window.dispose
  276.     @playtime_window.dispose
  277.     @gold_window.dispose
  278.     @status_window.dispose
  279.     @outside_window.dispose
  280.     @recordbook_window.dispose
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # ● 刷新画面
  284.   #--------------------------------------------------------------------------
  285.   def update
  286.     # 刷新窗口
  287.     @command_window.update
  288.     @playtime_window.update
  289.     @gold_window.update
  290.     @status_window.update
  291.     # 命令窗口被激活的情况下: 调用 update_command
  292.     if @command_window.active
  293.       update_command
  294.       return
  295.     end
  296.     # 状态窗口被激活的情况下: 调用 update_status
  297.     if @status_window.active
  298.       update_status
  299.       return
  300.     end
  301.     if @outside_window.visible == false
  302.       update_recordbook
  303.       return
  304.     end
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # ● 刷新画面 (命令窗口被激活的情况下)
  308.   #--------------------------------------------------------------------------
  309.   def update_command
  310.     # 按下 B 键的情况下
  311.     if Input.trigger?(Input::B)
  312.       # 演奏取消 SE
  313.       $game_system.se_play($data_system.cancel_se)
  314.       # 切换的地图画面
  315.       $scene = Scene_Map.new
  316.       return
  317.     end
  318.     # 按下 C 键的情况下
  319.     if Input.trigger?(Input::C)
  320.       # 同伴人数为 0、存档、游戏结束以外的场合
  321.       if $game_party.actors.size == 0 and @command_window.index < 4
  322.         # 演奏冻结 SE
  323.         $game_system.se_play($data_system.buzzer_se)
  324.         return
  325.       end
  326.       # 命令窗口的光标位置分支
  327.       case @command_window.index
  328.       when 0 # 物品
  329.         # 演奏确定 SE
  330.         $game_system.se_play($data_system.decision_se)
  331.         # 切换到物品画面
  332.         $scene = Scene_Item.new
  333.       when 1 # 特技
  334.         # 演奏确定 SE
  335.         $game_system.se_play($data_system.decision_se)
  336.         # 激活状态窗口
  337.         @command_window.active = false
  338.         @status_window.active = true
  339.         @status_window.index = 0
  340.       when 2 # 装备
  341.         # 演奏确定 SE
  342.         $game_system.se_play($data_system.decision_se)
  343.         # 激活状态窗口
  344.         @command_window.active = false
  345.         @status_window.active = true
  346.         @status_window.index = 0
  347.       when 3 # 状态
  348.         # 演奏确定 SE
  349.         $game_system.se_play($data_system.decision_se)
  350.         # 激活状态窗口
  351.         @command_window.active = false
  352.         @status_window.active = true
  353.         @status_window.index = 0
  354.       when 4 # 存档
  355.         # 禁止存档的情况下
  356.         if $game_system.save_disabled
  357.           # 演奏冻结 SE
  358.           $game_system.se_play($data_system.buzzer_se)
  359.           return
  360.         end
  361.         # 演奏确定 SE
  362.         $game_system.se_play($data_system.decision_se)
  363.         # 切换到存档画面
  364.         $scene = Scene_Save.new
  365.       when 5 # 游戏结束
  366.         # 演奏确定 SE
  367.         $game_system.se_play($data_system.decision_se)
  368.         # 切换到游戏结束画面
  369.         $scene = Scene_End.new
  370.       when 6 # 查看任务
  371.         # 演奏确定 SE
  372.         $game_system.se_play($data_system.decision_se)
  373.         @command_window.active = false
  374.         @outside_window.visible = false
  375.       end
  376.       return
  377.     end
  378.   end
  379.   #--------------------------------------------------------------------------
  380.   # ● 刷新画面 (查看天书的情况下)
  381.   #--------------------------------------------------------------------------
  382.   def update_recordbook
  383.     if @切换状态暂停 == "天书消失"
  384.       if @recordbook_window.y < 384
  385.         @recordbook_window.y +=64
  386.         @status_window.y -= 16
  387.         return
  388.       else
  389.         @切换状态暂停 = ""
  390.         @outside_window.visible = true
  391.         @command_window.active = true
  392.       end
  393.     else
  394.       if @recordbook_window.y >0
  395.         @recordbook_window.y -= 32
  396.         @status_window.y += 8
  397.         return
  398.       else
  399.         @status_window.visible = false
  400.         if Input.trigger?(Input::B)
  401.           @切换状态暂停 = "天书消失"
  402.           $game_system.se_play($data_system.cancel_se)
  403.           @status_window.visible = true
  404.           return
  405.         end
  406.       end
  407.     end
  408.   end  
  409.   #--------------------------------------------------------------------------
  410.   # ● 刷新画面 (状态窗口被激活的情况下)
  411.   #--------------------------------------------------------------------------
  412.   def update_status
  413.     # 按下 B 键的情况下
  414.     if Input.trigger?(Input::B)
  415.       # 演奏取消 SE
  416.       $game_system.se_play($data_system.cancel_se)
  417.       # 激活命令窗口
  418.       @command_window.active = true
  419.       @status_window.active = false
  420.       @status_window.index = -1
  421.       return
  422.     end
  423.     # 按下 C 键的情况下
  424.     if Input.trigger?(Input::C)
  425.       # 命令窗口的光标位置分支
  426.       case @command_window.index
  427.       when 1 # 特技
  428.         # 本角色的行动限制在 2 以上的情况下
  429.         if $game_party.actors[@status_window.index].restriction >= 2
  430.           # 演奏冻结 SE
  431.           $game_system.se_play($data_system.buzzer_se)
  432.           return
  433.         end
  434.         # 演奏确定 SE
  435.         $game_system.se_play($data_system.decision_se)
  436.         # 切换到特技画面
  437.         $scene = Scene_Skill.new(@status_window.index)
  438.       when 2 # 装备
  439.         # 演奏确定 SE
  440.         $game_system.se_play($data_system.decision_se)
  441.         # 切换的装备画面
  442.         $scene = Scene_Equip.new(@status_window.index)
  443.       when 3 # 状态
  444.         # 演奏确定 SE
  445.         $game_system.se_play($data_system.decision_se)
  446.         # 切换到状态画面
  447.         $scene = Scene_Status.new(@status_window.index)
  448.       end
  449.       return
  450.     end
  451.   end
  452. end

  453. #==============================================================================
  454. # Window_Outside
  455. #------------------------------------------------------------------------------
  456. # 外边框窗口
  457. #==============================================================================
  458. class Window_Outside < Window_Base
  459.   #--------------------------------------------------------------------------
  460.   # ● 初始化对象
  461.   #--------------------------------------------------------------------------
  462.   def initialize
  463.     super(160, 384, 480, 96)
  464.     self.back_opacity = 0
  465.   end
  466. end
  467. #==============================================================================
  468. # ■ Window_PlayTime
  469. #------------------------------------------------------------------------------
  470. # 菜单画面的系统时间表示
  471. #==============================================================================
  472. class Window_PlayTime < Window_Base
  473.   #--------------------------------------------------------------------------
  474.   # ● 初始化对像
  475.   #--------------------------------------------------------------------------
  476.   def initialize
  477.     super(0, 0, 160, 128)
  478.     self.contents = Bitmap.new(width - 32, height - 32)
  479.     self.contents.font.size = 18
  480.     refresh
  481.   end
  482.   #--------------------------------------------------------------------------
  483.   # ● 刷新
  484.   #--------------------------------------------------------------------------
  485.   def refresh
  486.     self.contents.clear
  487.     self.contents.font.color = system_color
  488.     self.contents.font.color = text_color(6)
  489.     time = Time.now
  490.     text = time.strftime("%x %X")
  491.     self.contents.draw_text(-2, 32, 130, 32, text, 2)
  492.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  493.     hour = @total_sec / 60 / 60
  494.     min = @total_sec / 60 % 60
  495.     sec = @total_sec % 60
  496.     text = sprintf("%02d:%02d:%02d", hour, min, sec)
  497.     self.contents.font.color = normal_color
  498.     self.contents.draw_text(4, 0, 160, 32, "日期与游戏时间")
  499.     self.contents.draw_text(-2, 64, 130, 32, text, 2)
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 更新
  503.   #--------------------------------------------------------------------------
  504.   def update
  505.     super
  506.     if Graphics.frame_count / Graphics.frame_rate != @total_sec
  507.       refresh
  508.     end
  509.   end
  510. end



  511. #==============================================================================
  512. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  513. #==============================================================================
复制代码
[/fold]
[fold=图片菜单]
  1. 使用方法
  2. 全选后插入到main前面,只有在Pictures\下面放入6张图片:start-1.png,start-2.png,continue-1png,continue-2.png,exit-1.png,exit-2.png  
  3. 脚本冲突可能:各种涉及了Title的脚本都有可能冲突。
  4. 编者注:建立一个新工程,然后将下载的范例提供的内容全部粘贴过去,替换原文件

  5. 脚本内容

  6. #==============================================================================
  7. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  8. #==============================================================================
  9. #==============================================================================
  10. # ■ 图片标题菜单1.0
  11. # Scene_Title
  12. #------------------------------------------------------------------------------
  13. # 作者:chaochao
  14. # http://zhuchao.go1.icpcn.com
  15. #==============================================================================
  16. class Scene_Title
  17.   def main
  18.     if $BTEST
  19.       battle_test
  20.       return
  21.     end
  22.     $data_actors = load_data("Data/Actors.rxdata")
  23.     $data_classes = load_data("Data/Classes.rxdata")
  24.     $data_skills = load_data("Data/Skills.rxdata")
  25.     $data_items = load_data("Data/Items.rxdata")
  26.     $data_weapons = load_data("Data/Weapons.rxdata")
  27.     $data_armors = load_data("Data/Armors.rxdata")
  28.     $data_enemies = load_data("Data/Enemies.rxdata")
  29.     $data_troops = load_data("Data/Troops.rxdata")
  30.     $data_states = load_data("Data/States.rxdata")
  31.     $data_animations = load_data("Data/Animations.rxdata")
  32.     $data_tilesets = load_data("Data/Tilesets.rxdata")
  33.     $data_common_events = load_data("Data/CommonEvents.rxdata")
  34.     $data_system = load_data("Data/System.rxdata")
  35.     $game_system = Game_System.new
  36.     # 生成标题图形
  37.     @sprite = [Sprite.new]
  38.     for i in 0..6
  39.       @sprite[i] = Sprite.new
  40.       @sprite[i].opacity = 0
  41.     end
  42.     @sprite[0].bitmap = RPG::Cache.title($data_system.title_name)
  43.     @sprite[0].opacity = 0
  44.     #开始游戏的图片
  45.     @sprite[1].bitmap = Bitmap.new("Graphics/Pictures/start-1.png")
  46.     @sprite[2].bitmap = Bitmap.new("Graphics/Pictures/start-2.png")
  47.     #继续游戏的图片
  48.     @sprite[3].bitmap = Bitmap.new("Graphics/Pictures/continue-1.png")
  49.     @sprite[4].bitmap = Bitmap.new("Graphics/Pictures/continue-2.png")
  50.     #结束游戏的图片
  51.     @sprite[5].bitmap = Bitmap.new("Graphics/Pictures/exit-1.png")
  52.     @sprite[6].bitmap = Bitmap.new("Graphics/Pictures/exit-2.png")
  53.     #图片位置
  54.     for i in 1..6
  55.       x=110
  56.       y=(i+1)/2*35+240
  57.       @sprite[i].x =x
  58.       @sprite[i].y =y
  59.     end
  60.     @continue_enabled = false
  61.     for i in 0..3
  62.       if FileTest.exist?("Save#{i+1}.rxdata")
  63.         @continue_enabled = true
  64.       end
  65.     end
  66.     if @continue_enabled
  67.       @command_index = 1
  68.     else
  69.       @command_index = 0
  70.       @sprite[3].tone = Tone.new(0, 0, 0, 255)
  71.       @sprite[4].tone = Tone.new(0, 0, 0, 255)
  72.     end
  73.     $game_system.bgm_play($data_system.title_bgm)
  74.     Audio.me_stop
  75.     Audio.bgs_stop
  76.     Graphics.transition
  77.     loop do
  78.       Graphics.update
  79.       #淡出背景圖形
  80.       if @sprite[0].opacity <= 255
  81.         @sprite[0].opacity += 15
  82.       end
  83.       Input.update
  84.       update
  85.       if $scene != self
  86.         break
  87.       end
  88.     end
  89.     Graphics.freeze
  90.     # 釋放圖形
  91.     for i in 0..6
  92.       @sprite[i].bitmap.dispose
  93.       @sprite[i].dispose
  94.     end
  95.   end
  96.   def update
  97.   chaochaocommandchaochao
  98.   if Input.trigger?(Input::C)
  99.     case @command_index
  100.       when 0
  101.         command_new_game
  102.       when 1
  103.         command_continue
  104.       when 2
  105.         command_shutdown
  106.       end
  107.     end
  108.   end
  109.   def chaochaocommandchaochao
  110.     if Input.trigger?(Input::UP)
  111.       @command_index -= 1
  112.       if @command_index < 0
  113.         @command_index = 2
  114.       end
  115.       $game_system.se_play($data_system.cursor_se)
  116.     end
  117.     if Input.trigger?(Input::DOWN)
  118.       @command_index += 1
  119.       if @command_index > 2
  120.         @command_index = 0
  121.       end
  122.       $game_system.se_play($data_system.cursor_se)
  123.     end
  124.     case @command_index
  125.     when 0
  126.       if @sprite[1].opacity >= 0
  127.         @sprite[1].opacity -= 30
  128.       end
  129.       if @sprite[2].opacity <= 240
  130.         @sprite[2].opacity += 30
  131.       end
  132.       if @sprite[3].opacity <= 210
  133.         @sprite[3].opacity += 30
  134.       end
  135.       if @sprite[4].opacity >= 0
  136.         @sprite[4].opacity -= 30
  137.       end
  138.       if @sprite[5].opacity <= 210
  139.         @sprite[5].opacity += 30
  140.       end
  141.       if @sprite[6].opacity >= 0
  142.         @sprite[6].opacity -= 30
  143.       end
  144.     when 1
  145.       if @sprite[1].opacity <= 210
  146.         @sprite[1].opacity += 30
  147.       end
  148.       if @sprite[2].opacity >= 0
  149.         @sprite[2].opacity -= 30
  150.       end
  151.       if @sprite[3].opacity >= 0
  152.         @sprite[3].opacity -= 30
  153.       end
  154.       if @sprite[4].opacity <= 240
  155.         @sprite[4].opacity += 30
  156.       end
  157.       if @sprite[5].opacity <= 210
  158.         @sprite[5].opacity += 30
  159.       end
  160.       if @sprite[6].opacity >= 0
  161.         @sprite[6].opacity -= 30
  162.       end
  163.     when 2
  164.       if @sprite[1].opacity <= 210
  165.         @sprite[1].opacity += 30
  166.       end
  167.       if @sprite[2].opacity >= 0
  168.         @sprite[2].opacity -= 30
  169.       end
  170.       if @sprite[3].opacity <= 210
  171.         @sprite[3].opacity += 30
  172.       end
  173.       if @sprite[4].opacity >= 0
  174.         @sprite[4].opacity -= 30
  175.       end
  176.       if @sprite[5].opacity >= 0
  177.         @sprite[5].opacity -= 30
  178.       end
  179.       if @sprite[6].opacity <= 240
  180.         @sprite[6].opacity += 30
  181.       end
  182.     end
  183.   end
  184. end
  185. #==============================================================================
  186. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  187. #==============================================================================
复制代码
[/fold]
[fold=物品分类]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # ■ Harts_Window_ItemTitle
  6. #------------------------------------------------------------------------------
  7. #  アイテム画面で、タイトルを表示するウィンドウ。
  8. #==============================================================================
  9. class Harts_Window_ItemTitle < Window_Base
  10.   #--------------------------------------------------------------------------
  11.   # ● オブジェクト初期化
  12.   #--------------------------------------------------------------------------
  13.   def initialize
  14.     super(0, 0, 160, 64)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.contents.clear
  17.     self.contents.font.color = normal_color
  18.     self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
  19.   end
  20. end
  21. #==============================================================================
  22. # ■ Harts_Window_ItemCommand
  23. #------------------------------------------------------------------------------
  24. #  アイテムの種別選択を行うウィンドウです。
  25. #==============================================================================
  26. class Harts_Window_ItemCommand < Window_Selectable
  27.   #--------------------------------------------------------------------------
  28.   # ● オブジェクト初期化
  29.   #--------------------------------------------------------------------------
  30.   def initialize
  31.     super(0, 64, 160, 288)
  32.     self.contents = Bitmap.new(width - 32, height - 32)
  33.     @item_max = 8
  34.     @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, $data_system.words.armor4, "特殊道具"]
  35.     refresh
  36.     self.index = 0
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● リフレッシュ
  40.   #--------------------------------------------------------------------------
  41.   def refresh
  42.     self.contents.clear
  43.     for i in 0...@item_max
  44.     draw_item(i, normal_color)
  45.     end
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # ● 項目の描画
  49.   # index : 項目番号
  50.   # color : 文字色
  51.   #--------------------------------------------------------------------------
  52.   def draw_item(index, color)
  53.     self.contents.font.color = color
  54.     y = index * 32
  55.     self.contents.draw_text(4, y, 128, 32, @commands[index])
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # ● ヘルプテキスト更新
  59.   #--------------------------------------------------------------------------
  60.   def update_help
  61.     case self.index
  62.     when 0
  63.       @text = @commands[0]
  64.     when 1
  65.       @text = @commands[1]
  66.     when 2
  67.       @text = @commands[2]
  68.     when 3
  69.       @text = @commands[3]
  70.     when 4
  71.       @text = @commands[4]
  72.     when 5
  73.       @text = @commands[5]
  74.     when 6
  75.       @text = @commands[6]
  76.     when 7
  77.       @text = @commands[7]
  78.     end
  79.     @help_window.set_text(@text)
  80.   end
  81. end
  82. #==============================================================================
  83. # ■ Window_Item
  84. #------------------------------------------------------------------------------
  85. #  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
  86. #==============================================================================
  87. class Harts_Window_ItemList < Window_Selectable
  88.   #--------------------------------------------------------------------------
  89.   # ● オブジェクト初期化
  90.   #--------------------------------------------------------------------------
  91.   def initialize
  92.     super(160, 0, 480, 416)
  93.     refresh
  94.     self.index = 0
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● アイテムの取得
  98.   #--------------------------------------------------------------------------
  99.   def item
  100.     return @data[self.index]
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● リフレッシュ
  104.   #--------------------------------------------------------------------------
  105.   def refresh
  106.     if self.contents != nil
  107.       self.contents.dispose
  108.       self.contents = nil
  109.     end
  110.     @data = []
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● アイテム一覧設定
  114.   # command : 選択中のコマンド
  115.   #--------------------------------------------------------------------------
  116.   def set_item(command)
  117.     refresh
  118.     case command
  119.     when 0
  120.       for i in 1...$data_items.size
  121.         if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
  122.           @data.push($data_items[i])
  123.         end
  124.       end
  125.     when 1
  126.       for i in 1...$data_items.size
  127.         if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
  128.           @data.push($data_items[i])
  129.         end
  130.       end
  131.     when 2
  132.       for i in 1...$data_weapons.size
  133.         if $game_party.weapon_number(i) > 0
  134.           @data.push($data_weapons[i])
  135.         end
  136.       end
  137.     when 3
  138.       for i in 1...$data_armors.size
  139.         if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
  140.           @data.push($data_armors[i])
  141.         end
  142.       end
  143.     when 4
  144.       for i in 1...$data_armors.size
  145.         if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
  146.           @data.push($data_armors[i])
  147.         end
  148.       end
  149.     when 5
  150.       for i in 1...$data_armors.size
  151.         if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
  152.           @data.push($data_armors[i])
  153.         end
  154.       end
  155.     when 6
  156.       for i in 1...$data_armors.size
  157.         if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
  158.           @data.push($data_armors[i])
  159.         end
  160.       end
  161.     when 7
  162.       for i in 1...$data_items.size
  163.         if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
  164.           @data.push($data_items[i])
  165.         end
  166.       end
  167.     end
  168.     # 項目数が 0 でなければビットマップを作成し、全項目を描画
  169.     @item_max = @data.size
  170.     if @item_max > 0
  171.       self.contents = Bitmap.new(width - 32, row_max * 32)
  172.       self.contents.clear
  173.       for i in 0...@item_max
  174.         draw_item(i)
  175.       end
  176.     end
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 種類別アイテム数の取得
  180.   #--------------------------------------------------------------------------
  181.   def item_number
  182.     return @item_max
  183.   end
  184.   #--------------------------------------------------------------------------
  185.   # ● 項目の描画
  186.   # index : 項目番号
  187.   #--------------------------------------------------------------------------
  188.   def draw_item(index)
  189.     item = @data[index]
  190.     case item
  191.     when RPG::Item
  192.       number = $game_party.item_number(item.id)
  193.     when RPG::Weapon
  194.       number = $game_party.weapon_number(item.id)
  195.     when RPG::Armor
  196.       number = $game_party.armor_number(item.id)
  197.     end
  198.     if item.is_a?(RPG::Item) and
  199.       $game_party.item_can_use?(item.id)
  200.       self.contents.font.color = normal_color
  201.     else
  202.       self.contents.font.color = disabled_color
  203.     end
  204.     x = 4
  205.     y = index * 32
  206.     bitmap = RPG::Cache.icon(item.icon_name)
  207.     opacity = self.contents.font.color == normal_color ? 255 : 128
  208.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  209.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  210.     self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
  211.     self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ● ヘルプテキスト更新
  215.   #--------------------------------------------------------------------------
  216.   def update_help
  217.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  218.   end
  219. end
  220. #==============================================================================
  221. # ■ Harts_Scene_Item
  222. #------------------------------------------------------------------------------
  223. #  アイテム画面の処理を行うクラスです。再定義
  224. #==============================================================================
  225. class Scene_Item
  226.   #--------------------------------------------------------------------------
  227.   # ● メイン処理
  228.   #--------------------------------------------------------------------------
  229.   def main
  230.     # タイトルウィンドウを作成
  231.     @itemtitle_window = Harts_Window_ItemTitle.new
  232.     #コマンドウィンドウを作成
  233.     @itemcommand_window = Harts_Window_ItemCommand.new
  234.     @command_index = @itemcommand_window.index
  235.     #アイテムウィンドウを作成
  236.     @itemlist_window = Harts_Window_ItemList.new
  237.     @itemlist_window.active = false
  238.     #ヘルプウィンドウを作成
  239.     @help_window = Window_Help.new
  240.     @help_window.x = 0
  241.     @help_window.y = 416
  242.     # ヘルプウィンドウを関連付け
  243.     @itemcommand_window.help_window = @help_window
  244.     @itemlist_window.help_window = @help_window
  245.     # ターゲットウィンドウを作成 (不可視?非アクティブに設定)
  246.     @target_window = Window_Target.new
  247.     @target_window.visible = false
  248.     @target_window.active = false
  249.     # アイテムウィンドウ内容表示
  250.     @itemlist_window.set_item(@command_index)
  251.     # トランジション実行
  252.     Graphics.transition
  253.     # メインループ
  254.     loop do
  255.       # ゲーム画面を更新
  256.       Graphics.update
  257.       # 入力情報を更新
  258.       Input.update
  259.       # フレーム更新
  260.       update
  261.       # 画面が切り替わったらループを中断
  262.       if $scene != self
  263.         break
  264.       end
  265.     end
  266.     # トランジション準備
  267.     Graphics.freeze
  268.     # ウィンドウを解放
  269.     @itemtitle_window.dispose
  270.     @itemcommand_window.dispose
  271.     @itemlist_window.dispose
  272.     @help_window.dispose
  273.     @target_window.dispose
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● フレーム更新
  277.   #--------------------------------------------------------------------------
  278.   def update
  279.     # ウィンドウを更新
  280.     @itemtitle_window.update
  281.     @itemcommand_window.update
  282.     @itemlist_window.update
  283.     @help_window.update
  284.     @target_window.update
  285.     if @command_index != @itemcommand_window.index
  286.       @command_index = @itemcommand_window.index
  287.       @itemlist_window.set_item(@command_index)
  288.     end
  289.     # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
  290.     if @itemcommand_window.active
  291.       update_itemcommand
  292.       return
  293.     end
  294.     # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
  295.     if @itemlist_window.active
  296.       update_itemlist
  297.       return
  298.     end
  299.     # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
  300.     if @target_window.active
  301.       update_target
  302.       return
  303.     end
  304.   end
  305.   #--------------------------------------------------------------------------
  306.   # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
  307.   #--------------------------------------------------------------------------
  308.   def update_itemcommand
  309.   # B ボタンが押された場合
  310.   if Input.trigger?(Input::B)
  311.   # キャンセル SE を演奏
  312.   $game_system.se_play($data_system.cancel_se)
  313.   # メニュー画面に切り替え
  314.   $scene = Scene_Menu.new(0)
  315.   return
  316.   end
  317.   # C ボタンが押された場合
  318.   if Input.trigger?(Input::C)
  319.   # 選択中のコマンドのアイテムがない場合
  320.   if @itemlist_window.item_number == 0
  321.   # ブザー SE を演奏
  322.   $game_system.se_play($data_system.buzzer_se)
  323.   return
  324.   end
  325.   # 決定 SE を演奏
  326.   $game_system.se_play($data_system.decision_se)
  327.   # アイテムウィンドウをアクティブにする
  328.   @itemcommand_window.active = false
  329.   @itemlist_window.active = true
  330.   @itemlist_window.index = 0
  331.   return
  332.   end
  333.   end
  334.   #--------------------------------------------------------------------------
  335.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  336.   #--------------------------------------------------------------------------
  337.   def update_itemlist
  338.     # B ボタンが押された場合
  339.     if Input.trigger?(Input::B)
  340.       # キャンセル SE を演奏
  341.       $game_system.se_play($data_system.cancel_se)
  342.       # アイテムウィンドウをアクティブにする
  343.       @itemcommand_window.active = true
  344.       @itemlist_window.active = false
  345.       @itemlist_window.index = 0
  346.       @itemcommand_window.index = @command_index
  347.       return
  348.     end
  349.     # C ボタンが押された場合
  350.     if Input.trigger?(Input::C)
  351.       # アイテムウィンドウで現在選択されているデータを取得
  352.       @item = @itemlist_window.item
  353.       # 使用アイテムではない場合
  354.       unless @item.is_a?(RPG::Item)
  355.         # ブザー SE を演奏
  356.         $game_system.se_play($data_system.buzzer_se)
  357.         return
  358.       end
  359.       # 使用できない場合
  360.       unless $game_party.item_can_use?(@item.id)
  361.         # ブザー SE を演奏
  362.         $game_system.se_play($data_system.buzzer_se)
  363.         return
  364.       end
  365.       # 決定 SE を演奏
  366.       $game_system.se_play($data_system.decision_se)
  367.       # 効果範囲が味方の場合
  368.       if @item.scope >= 3
  369.         # ターゲットウィンドウをアクティブ化
  370.         @itemlist_window.active = false
  371.         @target_window.x = 304
  372.         @target_window.visible = true
  373.         @target_window.active = true
  374.         # 効果範囲 (単体/全体) に応じてカーソル位置を設定
  375.         if @item.scope == 4 || @item.scope == 6
  376.           @target_window.index = -1
  377.         else
  378.           @target_window.index = 0
  379.         end
  380.         # 効果範囲が味方以外の場合
  381.       else
  382.         # コモンイベント ID が有効の場合
  383.         if @item.common_event_id > 0
  384.           # コモンイベント呼び出し予約
  385.           $game_temp.common_event_id = @item.common_event_id
  386.           # アイテムの使用時 SE を演奏
  387.           $game_system.se_play(@item.menu_se)
  388.           # 消耗品の場合
  389.             if @item.consumable
  390.               # 使用したアイテムを 1 減らす
  391.               $game_party.lose_item(@item.id, 1)
  392.               # アイテムウィンドウの項目を再描画
  393.               @itemlist_window.draw_item(@itemlist_window.index)
  394.             end
  395.           # マップ画面に切り替え
  396.           $scene = Scene_Map.new
  397.           return
  398.         end
  399.       end
  400.       return
  401.     end
  402.   end
  403.   #--------------------------------------------------------------------------
  404.   # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
  405.   #--------------------------------------------------------------------------
  406.   def update_target
  407.     # B ボタンが押された場合
  408.     if Input.trigger?(Input::B)
  409.       # キャンセル SE を演奏
  410.       $game_system.se_play($data_system.cancel_se)
  411.       # アイテム切れなどで使用できなくなった場合
  412.       unless $game_party.item_can_use?(@item.id)
  413.         # アイテムウィンドウの内容を再作成
  414.         @itemlist_window.refresh
  415.       end
  416.       # ターゲットウィンドウを消去
  417.       @itemlist_window.active = true
  418.       @target_window.visible = false
  419.       @target_window.active = false
  420.       @itemlist_window.set_item(@command_index)
  421.       return
  422.     end
  423.     # C ボタンが押された場合
  424.     if Input.trigger?(Input::C)
  425.       # アイテムを使い切った場合
  426.       if $game_party.item_number(@item.id) == 0
  427.         # ブザー SE を演奏
  428.         $game_system.se_play($data_system.buzzer_se)
  429.         return
  430.       end
  431.       # ターゲットが全体の場合
  432.       if @target_window.index == -1
  433.         # パーティ全体にアイテムの使用効果を適用
  434.         used = false
  435.         for i in $game_party.actors
  436.           used |= i.item_effect(@item)
  437.         end
  438.       end
  439.       # ターゲットが単体の場合
  440.       if @target_window.index >= 0
  441.         # ターゲットのアクターにアイテムの使用効果を適用
  442.         target = $game_party.actors[@target_window.index]
  443.         used = target.item_effect(@item)
  444.       end
  445.       # アイテムを使った場合
  446.       if used
  447.         # アイテムの使用時 SE を演奏
  448.         $game_system.se_play(@item.menu_se)
  449.         # 消耗品の場合
  450.         if @item.consumable
  451.           # 使用したアイテムを 1 減らす
  452.           $game_party.lose_item(@item.id, 1)
  453.           # アイテムウィンドウの項目を再描画
  454.           @itemlist_window.draw_item(@itemlist_window.index)
  455.           @itemlist_window.set_item(@command_index)
  456.         end
  457.         # ターゲットウィンドウの内容を再作成
  458.         @target_window.refresh
  459.         # 全滅の場合
  460.         if $game_party.all_dead?
  461.           # ゲームオーバー画面に切り替え
  462.           $scene = Scene_Gameover.new
  463.           return
  464.         end
  465.         # コモンイベント ID が有効の場合
  466.         if @item.common_event_id > 0
  467.           # コモンイベント呼び出し予約
  468.           $game_temp.common_event_id = @item.common_event_id
  469.           # マップ画面に切り替え
  470.           $scene = Scene_Map.new
  471.           return
  472.         end
  473.       end
  474.       # アイテムを使わなかった場合
  475.       unless used
  476.         # ブザー SE を演奏
  477.         $game_system.se_play($data_system.buzzer_se)
  478.       end
  479.     return
  480.     end
  481.   end
  482. end
  483. #==============================================================================
  484. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  485. #==============================================================================
复制代码
[/fold]
[fold=物品颜色修改]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #
  5. # 脚本功能:给不同物品显示不同颜色,类似暗黑破坏神,比如套装为绿色,超级为金色
  6. #           可以更改的种类包括物品、防具、特技、武器。
  7. #
  8. # 使用方法:对于不想为白色表示的物品,在描述中最后添加@6,@4一类的即可。
  9. #           数字为颜色编号,和对话框中的一样。
  10. # ——————————————————————————————————————
  11. module RPG
  12.   class Skill
  13.     def description
  14.       description = @description.split(/@/)[0]
  15.       return description != nil ? description : ''
  16.     end
  17.     def name_color_66RPG
  18.       name_color = @description.split(/@/)[1]
  19.       return name_color != nil ? name_color.to_i : 0
  20.     end
  21.   end
  22.   class Weapon
  23.     def description
  24.       description = @description.split(/@/)[0]
  25.       return description != nil ? description : ''
  26.     end
  27.     def name_color_66RPG
  28.       name_color = @description.split(/@/)[1]
  29.       return name_color != nil ? name_color.to_i : 0
  30.     end
  31.   end
  32.   class Item
  33.     def description
  34.       description = @description.split(/@/)[0]
  35.       return description != nil ? description : ''
  36.     end
  37.     def name_color_66RPG
  38.       name_color = @description.split(/@/)[1]
  39.       return name_color != nil ? name_color.to_i : 0
  40.     end
  41.   end
  42.   class Armor
  43.     def description
  44.       description = @description.split(/@/)[0]
  45.       return description != nil ? description : ''
  46.     end
  47.     def name_color_66RPG
  48.       name_color = @description.split(/@/)[1]
  49.       return name != nil ? name_color.to_i : 0
  50.     end
  51.   end
  52. end

  53. # ——————————————————————————————————————
  54. # 本脚本原创自www.66rpg.com,转载请保留此信息
  55. # ——————————————————————————————————————
  56. class Window_Base < Window
  57.   #--------------------------------------------------------------------------
  58.   # ● 描绘物品名
  59.   #     item : 物品
  60.   #     x    : 描画目标 X 坐标
  61.   #     y    : 描画目标 Y 坐标
  62.   #--------------------------------------------------------------------------
  63.   def draw_item_name(item, x, y)
  64.     if item == nil
  65.       return
  66.     end
  67.     bitmap = RPG::Cache.icon(item.icon_name)
  68.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  69.     self.contents.font.color = text_color(item.name_color_66RPG)
  70.     self.contents.draw_text(x + 28, y, 212, 32, item.name.to_s)
  71.   end
  72. end

  73. # ——————————————————————————————————————
  74. # 本脚本原创自www.66rpg.com,转载请保留此信息
  75. # ——————————————————————————————————————
  76. class Window_Item
  77.   #--------------------------------------------------------------------------
  78.   # ● 描绘项目
  79.   #     index : 项目编号
  80.   #--------------------------------------------------------------------------
  81.   def draw_item(index)
  82.     item = @data[index]
  83.     case item
  84.     when RPG::Item
  85.       number = $game_party.item_number(item.id)
  86.     when RPG::Weapon
  87.       number = $game_party.weapon_number(item.id)
  88.     when RPG::Armor
  89.       number = $game_party.armor_number(item.id)
  90.     end
  91.     if item.is_a?(RPG::Item) and
  92.        $game_party.item_can_use?(item.id)
  93.       self.contents.font.color = text_color(item.name_color_66RPG)
  94.     else
  95.       self.contents.font.color = disabled_color
  96.     end
  97.     x = 4 + index % 2 * (288 + 32)
  98.     y = index / 2 * 32
  99.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  100.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  101.     bitmap = RPG::Cache.icon(item.icon_name)
  102.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  103.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  104.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  105.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  106.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  107.   end
  108. end

  109. # ——————————————————————————————————————
  110. # 本脚本原创自www.66rpg.com,转载请保留此信息
  111. # ——————————————————————————————————————
  112. class Window_EquipItem < Window_Selectable
  113.   #--------------------------------------------------------------------------
  114.   # ● 项目的描绘
  115.   #     index : 项目符号
  116.   #--------------------------------------------------------------------------
  117.   def draw_item(index)
  118.     item = @data[index]
  119.     x = 4 + index % 2 * (288 + 32)
  120.     y = index / 2 * 32
  121.     case item
  122.     when RPG::Weapon
  123.       number = $game_party.weapon_number(item.id)
  124.     when RPG::Armor
  125.       number = $game_party.armor_number(item.id)
  126.     end
  127.     bitmap = RPG::Cache.icon(item.icon_name)
  128.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  129.     self.contents.font.color = text_color(item.name_color_66RPG)
  130.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  131.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  132.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  133.   end
  134. end

  135. # ——————————————————————————————————————
  136. # 本脚本原创自www.66rpg.com,转载请保留此信息
  137. # ——————————————————————————————————————
  138. class Window_ShopBuy < Window_Selectable
  139.   #--------------------------------------------------------------------------
  140.   # ● 描绘羡慕
  141.   #     index : 项目编号
  142.   #--------------------------------------------------------------------------
  143.   def draw_item(index)
  144.     item = @data[index]
  145.     # 获取物品所持数
  146.     case item
  147.     when RPG::Item
  148.       number = $game_party.item_number(item.id)
  149.     when RPG::Weapon
  150.       number = $game_party.weapon_number(item.id)
  151.     when RPG::Armor
  152.       number = $game_party.armor_number(item.id)
  153.     end
  154.     # 价格在所持金以下、并且所持数不是 99 的情况下为普通颜色
  155.     # 除此之外的情况设置为无效文字色
  156.     if item.price <= $game_party.gold and number < 99
  157.       self.contents.font.color = text_color(item.name_color_66RPG)
  158.     else
  159.       self.contents.font.color = disabled_color
  160.     end
  161.     x = 4
  162.     y = index * 32
  163.     rect = Rect.new(x, y, self.width - 32, 32)
  164.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  165.     bitmap = RPG::Cache.icon(item.icon_name)
  166.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  167.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  168.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  169.     self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
  170.   end
  171. end

  172. # ——————————————————————————————————————
  173. # 本脚本原创自www.66rpg.com,转载请保留此信息
  174. # ——————————————————————————————————————
  175. class Window_ShopSell < Window_Selectable
  176.   #--------------------------------------------------------------------------
  177.   # ● 描绘项目
  178.   #     index : 项目标号
  179.   #--------------------------------------------------------------------------
  180.   def draw_item(index)
  181.     item = @data[index]
  182.     case item
  183.     when RPG::Item
  184.       number = $game_party.item_number(item.id)
  185.     when RPG::Weapon
  186.       number = $game_party.weapon_number(item.id)
  187.     when RPG::Armor
  188.       number = $game_party.armor_number(item.id)
  189.     end
  190.     # 可以卖掉的显示为普通颜色、除此之外设置成无效文字颜色
  191.     if item.price > 0
  192.       self.contents.font.color = text_color(item.name_color_66RPG)
  193.     else
  194.       self.contents.font.color = disabled_color
  195.     end
  196.     x = 4 + index % 2 * (288 + 32)
  197.     y = index / 2 * 32
  198.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  199.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  200.     bitmap = RPG::Cache.icon(item.icon_name)
  201.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  202.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  203.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  204.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  205.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  206.   end
  207. end
  208.   
  209. # ——————————————————————————————————————
  210. # 本脚本原创自www.66rpg.com,转载请保留此信息
  211. # ——————————————————————————————————————
  212. class Window_Skill
  213.   #--------------------------------------------------------------------------
  214.   # ● 描绘项目
  215.   #     index : 项目编号
  216.   #--------------------------------------------------------------------------
  217.   def draw_item(index)
  218.     skill = @data[index]
  219.     if @actor.skill_can_use?(skill.id)
  220.       self.contents.font.color = text_color(skill.name_color_66RPG)
  221.     else
  222.       self.contents.font.color = disabled_color
  223.     end
  224.     x = 4 + index % 2 * (288 + 32)
  225.     y = index / 2 * 32
  226.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  227.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  228.     bitmap = RPG::Cache.icon(skill.icon_name)
  229.     opacity = self.contents.font.color == disabled_color ? 128 : 255
  230.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  231.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  232.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  233.   end
  234. end

  235. #==============================================================================
  236. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  237. #==============================================================================

复制代码
[/fold]

战斗类
[fold=把逃跑加入到正常选项中]
  1. #=======================================================================
  2. # ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息
  3. #-----------------------------------------------------------------------
  4. #   脚本功能:去掉战斗开始时候的 战斗/逃跑 的选择过程.
  5. #   脚本作者:后知后觉  2010-8-11 13:46:59
  6. #   使用方法:直接在 Main 前插入即可
  7. #=======================================================================
  8. class Window_PartyCommand < Window_Selectable
  9.   def visible=(value)
  10.     super(false)
  11.   end
  12.   def active=(value)
  13.     super(false)
  14.   end
  15. end
  16. class Scene_Battle
  17.   alias hzhj_old_start_phase2 start_phase2
  18.   def start_phase2
  19.     hzhj_old_start_phase2
  20.     if @phase == 2
  21.       start_phase3
  22.     end
  23.   end
  24. end
  25. #=======================================================================
  26. # ■ 本脚本来自 www.66rpg.com 转载和使用时请保留此信息
  27. #=======================================================================
复制代码
[/fold]
[fold=公共事件战斗特效]
  1. 距“公共事件的战斗特效”上个版本放出有一年了,直到现在我仍然认为这个是最灵活,可扩展性最强的战斗特效系统。无他,利用公共事件可以避免和很多脚本的冲突。
  2. 然而,每次调用战斗特效都要还原HP很麻烦,而且还原HP有时不是能完全恢复原样的。要真的让公共事件达到想怎么用就怎么用的程度,只能从改变RGSS的执行顺序上作文章。
  3. 这次修改,我最后达到的状况是:
  4. ·对所有RGSS的修改,仅限于Scene_Battle类,且改动很少,对诸如Game_Battler类等绝无一丝改动。
  5. ·在保证Phase4完整顺序的前提下,更改其内部执行顺序,100%完美化视觉效果,并简化公共事件中的脚本书写复杂度。
  6. ·纯插件制作,可以插入默认的战斗系统或CP制战斗系统。但是RTAB不适用。

  7. 理论:
  8. 考查Scene_Battle中Phase4的执行顺序:
  9. Step1:开始
  10. Step2:应用行动效果
  11. Step3:行动方动画
  12. Step4:对象方动画
  13. Step5:伤害处理
  14. Step6:刷新
  15. 以前的公共事件战斗特效要还原HP,是因为HP已经在Step2发生了改动(技能被实际应用了),自然想到
  16. 如果不让技能在那么早就被应用,不是可以省去一堆麻烦事了?
  17. 那么就来想想技能应用最晚可以放在哪里——
  18. Step3是行动方动画,技能成功与否,对行动方的动画是没有影响的。
  19. Step4是对象方动画,这里需要调用到技能行动的结果——是否命中,所以无论如何,对象方动画肯定只能在技能应用的后面
  20. 也就是说技能最晚可以是在Step3和Step4之间才应用。
  21. 那么只要将make_skill_action_result中的相关项移到该位置,并外包条件判断以免影响不相干的动作,即可。
  22. 即然技能应用放在这里了,而之前技能的公共事件ID已经被调用,我们当然可以用公共事件ID来做判断:
  23. 有公共事件——直接调用公共事件
  24. 无公共事件——通常应用技能效果
  25. 这就意味着有些利用了通常技能效果(改其他东西)的特效,其应用步骤要放在公共事件里。这样对公共事件中的执行顺序提出了要求。好在这并不是太大的问题。
  26. 强烈推荐将所有技能调用的公共事件放在同一个事件里的方法,用条件分歧框住每一个特殊效果。
  27. 另外,这个插件把状态窗口每执行一条事件指令就刷新的功能禁止了,默认情况下是每执行完一个事件才刷新,为了避免刷新不畅的问题,定义了$scene.status_refresh方法,可以在公共事件中手工刷新。

  28. 实践:
  29. 将以下脚本插入到Main的前面。然后看公共事件的脚本书写方法。
  30. class Scene_Battle
  31. attr_reader   :active_battler
  32. attr_reader   :skill
  33. attr_accessor :target_battlers
  34. attr_accessor :animation2_id
  35. #--------------------------------------------------------------------------
  36. # ● 刷新画面
  37. #--------------------------------------------------------------------------
  38. def update
  39.    # 执行战斗事件中的情况下
  40.    if $game_system.battle_interpreter.running?
  41.      # 刷新解释器
  42.      $game_system.battle_interpreter.update
  43.      # 强制行动的战斗者不存在的情况下
  44.      if $game_temp.forcing_battler == nil
  45.        # 执行战斗事件结束的情况下
  46.        unless $game_system.battle_interpreter.running?
  47.          # 继续战斗的情况下、再执行战斗事件的设置
  48.          if @common_event_id == 0
  49.            unless judge
  50.              setup_battle_event
  51.            end
  52.          end
  53.        end
  54.        # 如果不是结束战斗回合的情况下
  55.        if @phase != 5 and @common_event_id == 0
  56.          # 刷新状态窗口
  57.          @status_window.refresh
  58.        end
  59.      end
  60.    end
  61.    # 系统 (计时器)、刷新画面
  62.    $game_system.update
  63.    $game_screen.update
  64.    # 计时器为 0 的情况下
  65.    if $game_system.timer_working and $game_system.timer == 0
  66.      # 中断战斗
  67.      $game_temp.battle_abort = true
  68.    end
  69.    # 刷新窗口
  70.    @help_window.update
  71.    @party_command_window.update
  72.    @actor_command_window.update
  73.    @status_window.update
  74.    @message_window.update
  75.    # 刷新活动块
  76.    @spriteset.update
  77.    # 处理过渡中的情况下
  78.    if $game_temp.transition_processing
  79.      # 清除处理过渡中标志
  80.      $game_temp.transition_processing = false
  81.      # 执行过渡
  82.      if $game_temp.transition_name == ""
  83.        Graphics.transition(20)
  84.      else
  85.        Graphics.transition(40, "Graphics/Transitions/" +
  86.          $game_temp.transition_name)
  87.      end
  88.    end
  89.    # 显示信息窗口中的情况下
  90.    if $game_temp.message_window_showing
  91.      return
  92.    end
  93.    # 显示效果中的情况下
  94.    if @spriteset.effect?
  95.      return
  96.    end
  97.    # 游戏结束的情况下
  98.    if $game_temp.gameover
  99.      # 切换到游戏结束画面
  100.      $scene = Scene_Gameover.new
  101.      return
  102.    end
  103.    # 返回标题画面的情况下
  104.    if $game_temp.to_title
  105.      # 切换到标题画面
  106.      $scene = Scene_Title.new
  107.      return
  108.    end
  109.    # 中断战斗的情况下
  110.    if $game_temp.battle_abort
  111.      # 还原为战斗前的 BGM
  112.      $game_system.bgm_play($game_temp.map_bgm)
  113.      # 战斗结束
  114.      battle_end(1)
  115.      return
  116.    end
  117.    # 等待中的情况下
  118.    if @wait_count > 0
  119.      # 减少等待计数
  120.      @wait_count -= 1
  121.      return
  122.    end
  123.    # 强制行动的角色存在、
  124.    # 并且战斗事件正在执行的情况下
  125.    if $game_temp.forcing_battler == nil and
  126.       $game_system.battle_interpreter.running?
  127.      return
  128.    end
  129.    # 回合分支
  130.    case @phase
  131.    when 1  # 自由战斗回合
  132.      update_phase1
  133.    when 2  # 同伴命令回合
  134.      update_phase2
  135.    when 3  # 角色命令回合
  136.      update_phase3
  137.    when 4  # 主回合
  138.      update_phase4
  139.    when 5  # 战斗结束回合
  140.      update_phase5
  141.    end
  142. end
  143. #--------------------------------------------------------------------------
  144. # ● 生成特技行动结果
  145. #--------------------------------------------------------------------------
  146. def make_skill_action_result
  147.    # 获取特技
  148.    @skill = $data_skills[@active_battler.current_action.skill_id]
  149.    # 如果不是强制行动
  150.    unless @active_battler.current_action.forcing
  151.      # 因为 SP 耗尽而无法使用的情况下
  152.      unless @active_battler.skill_can_use?(@skill.id)
  153.        # 清除强制行动对像的战斗者
  154.        $game_temp.forcing_battler = nil
  155.        # 移至步骤 1
  156.        @phase4_step = 1
  157.        return
  158.      end
  159.    end
  160.    # 在帮助窗口显示特技名
  161.    @help_window.set_text(@skill.name, 1)
  162.    # 设置动画 ID
  163.    @animation1_id = @skill.animation1_id
  164.    @animation2_id = @skill.animation2_id
  165.    # 设置公共事件 ID
  166.    @common_event_id = @skill.common_event_id
  167.    # 设置对像侧战斗者
  168.    set_target_battlers(@skill.scope)
  169. end
  170. #--------------------------------------------------------------------------
  171. # ● 一般特技效果应用(公共事件用)
  172. #--------------------------------------------------------------------------
  173. def normal_skill_effect
  174.    # 应用特技效果
  175.    for target in @target_battlers
  176.      target.skill_effect(@active_battler, @skill)
  177.    end
  178. end
  179. #--------------------------------------------------------------------------
  180. # ● 特技的状态变化应用(公共事件用)
  181. #--------------------------------------------------------------------------
  182. def state_apply
  183.    # 应用状态变化
  184.    for target in @target_battlers
  185.      target.states_plus(@skill.plus_state_set)
  186.      target.states_minus(@skill.minus_state_set)
  187.    end
  188. end
  189. #--------------------------------------------------------------------------
  190. # ● 状态窗口刷新(公共事件用)
  191. #--------------------------------------------------------------------------
  192. def status_refresh
  193.    # 刷新状态窗口
  194.    @status_window.refresh
  195. end
  196. #--------------------------------------------------------------------------
  197. # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  198. #--------------------------------------------------------------------------
  199. def update_phase4_step4
  200.    # 公共事件 ID 有效的情况下
  201.    if @common_event_id > 0
  202.      # 设置事件
  203.      common_event = $data_common_events[@common_event_id]
  204.      $game_system.battle_interpreter.setup(common_event.list, 0)
  205.      @common_event_id = -1
  206.      return
  207.    # 公共事件 ID 无效的情况下
  208.    elsif @common_event_id == 0
  209.      # 一般特技效果应用
  210.      if @active_battler.current_action.kind == 1
  211.        @active_battler.sp -= @skill.sp_cost
  212.        normal_skill_effect
  213.      end
  214.    end
  215.    # 对像方动画
  216.    for target in @target_battlers
  217.      target.animation_id = @animation2_id
  218.      target.animation_hit = (target.damage != "Miss")
  219.    end
  220.    # 限制动画长度、最低 8 帧
  221.    @wait_count = 8
  222.    # 移至步骤 5
  223.    @phase4_step = 5
  224. end
  225. #--------------------------------------------------------------------------
  226. # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  227. #--------------------------------------------------------------------------
  228. def update_phase4_step5
  229.    # 隐藏帮助窗口
  230.    @help_window.visible = false
  231.    # 刷新状态窗口
  232.    @status_window.refresh
  233.    # 显示伤害
  234.    for target in @target_battlers
  235.      if target.damage != nil
  236.        target.damage_pop = true
  237.      end
  238.    end
  239.    if @active_battler.damage != nil
  240.      @active_battler.damage_pop = true
  241.    end
  242.    # 移至步骤 6
  243.    @phase4_step = 6
  244. end
  245. #--------------------------------------------------------------------------
  246. # ● 刷新画面 (主回合步骤 6 : 刷新)
  247. #--------------------------------------------------------------------------
  248. def update_phase4_step6
  249.    # 清除强制行动对像的战斗者
  250.    $game_temp.forcing_battler = nil
  251.    # 移至步骤 1
  252.    @phase4_step = 1
  253. end
  254. end

  255. 公共事件脚本书写需知:

  256. 关于“前趋”“SP覆写”“覆写”和“后继”的说明:

  257. 前趋处理:这些脚本(含外包的条件分歧)总是放在公共事件靠前的位置,它们在技能没有实际起作用时就被改写,通常是改变攻击对象的效果。

  258. 后继处理:这些脚本(含外包的条件分歧)总是放在公共事件靠后的位置,它们在技能生效后追加一些效果,通常是一些特殊的效果,比如追加伤害,强制会心一击,HP吸收等。

  259. 由于战斗特效操作对象的不同,以及一些相关共性,我们在公共事件中插入三条通用脚本:

  260. 脚本1:$scene.active_battler.sp-=\
  261.       $scene.skill.sp_cost
  262. 脚本2:$scene.status_refresh
  263. 脚本3:$scene.normal_skill_effect

  264. 细心的读者会发现,这三条脚本执行的就是在RGSS中,当技能不附带公共事件时所执行的东西,只不过这里换了个写法而已。

  265. 这三个脚本不能放在任何条件分歧里,作为默认应用技能的步骤,脚本2的前后各跟一个标签事件
  266. 实际写法如下:

  267. (所有的前趋脚本)
  268. 脚本:$scene.active_battler.sp-=\
  269.      $scene.skill.sp_cost
  270. 标签:SP消耗结束
  271. 脚本:$scene.status_refresh
  272. 脚本:$scene.normal_skill_effect
  273. 标签:伤害计算结束
  274. (所有的后继脚本)

  275. 凡是不按照常规方法消耗SP,但是伤害计算通式的技能效果脚本(比如消耗HP代替SP,或特定状态下半减SP消耗),计为“覆写SP”,应当插入在脚本1的前面(在前趋脚本之后),其后跟标签跳转事件,跳转到“SP消耗结束”处

  276. 凡是不按照常规公式计算伤害值的技能效果脚本(比如比例伤害),应当插入在脚本2与脚本3之间,其后跟标签跳转事件,跳转到“伤害计算结束”处。

  277. 若有既不常规消耗SP,也不常规计算伤害的效果脚本,则插入到脚本1之前,但是标签跳转到脚本2以后,但请注意手工刷新状态窗口。也可以拆成两个脚本按上面的方法处理。

  278. 举例如下:
  279. [前趋脚本]
  280. 条件分歧:........
  281. 脚本:....(特殊方法SP消耗的脚本)
  282. 标签跳转:SP消耗结束
  283. 分歧结束
  284. 脚本:$scene.active_battler.sp-=\
  285.      $scene.skill.sp_cost
  286. 标签:SP消耗结束
  287. 条件分歧:........
  288. 脚本:....(特殊计算伤害值的脚本)
  289. 标签跳转:伤害计算结束
  290. 分歧结束
  291. 脚本:$scene.normal_skill_effect
  292. 标签:伤害计算结束
  293. [后继脚本]

  294. 公共事件特效范例:

  295. 一、全体化/全域化
  296. 效果:当技能范围为敌单体时,攻击敌全体;
  297. 当技能范围为我方单体或自身时,攻击我方全体;
  298. 当技能范围为我方单体HP0时,攻击我方全体HP0;
  299. 当技能范围为无时,攻击战场上所有对象。
  300. 处理:前趋
  301. 脚本:
  302. s=$scene.skill.scope
  303. $scene.target_battlers=[]
  304. $scene.set_target_battlers(2) if s==1
  305. $scene.set_target_battlers(4) if s%4==3
  306. $scene.set_target_battlers(6) if s==5
  307. (t=$game_troop.enemies+$game_party.actors
  308. for battler in t.clone
  309. t.delete(battler) if not battler.exist?
  310. end
  311. $scene.target_battlers=t) if s==0

  312. 二、敌/己/全方随机对象
  313. 效果:当技能范围为敌单或敌全时,随机选定敌方单体;
  314. 当技能范围为我单或我全时,随机选定我方单体;
  315. 当技能范围为我单或我全HP0时,随机选定我方单体HP0;
  316. 当技能范围为无时,随机选定战场上一个对象;
  317. 当技能范围为自身时,不作处理。
  318. 处理:前趋
  319. 条件分歧:$scene.active_battler.is_a?(Game_Enemy)
  320. 脚本:
  321. s=($scene.skill.scope+1)/2
  322. t=$game_party.random_target_actor if s==1
  323. t=$game_troop.random_target_enemy if s==2
  324. t=$game_troop.random_target_enemy(true) if s==3
  325. (x=$game_party.actors+$game_troop.enemies
  326. t=x[rand(x.size)]) if s==0
  327. $scene.target_battlers=[t]
  328. 除此以外的情况下
  329. 脚本:
  330. s=($scene.skill.scope+1)/2
  331. t=$game_troop.random_target_enemy if s==1
  332. t=$game_party.random_target_actor if s==2
  333. t=$game_party.random_target_actor(true) if s==3
  334. (x=$game_troop.enemies+$game_party.actors
  335. t=x[rand(x.size)]) if s==0
  336. $scene.target_battlers=[t]
  337. 分歧结束

  338. 三、HP吸收
  339. 效果:攻击者增加等同于伤害值的HP
  340. 处理:后继
  341. 脚本:
  342. a=$scene.active_battler
  343. a.damage=0
  344. for t in $scene.target_battlers
  345. if t.damage.is_a?(Numeric)
  346.    a.damage -= t.damage
  347.    a.hp += t.damage
  348. end
  349. end

  350. 四、SP伤害
  351. 效果:本来伤害对方HP,改成伤害对方SP
  352. 处理:覆写
  353. 脚本:
  354. a=$scene.active_battler
  355. s=$scene.skill
  356. for t in $scene.target_battlers
  357. t1=t.clone.skill_effect(a,s)
  358. if t1.damage.is_a?(Numeric)
  359.    t.damage=t1.damage
  360.    t.sp-=t.damage
  361. end
  362. end
  363. $scene.state_apply

  364. 五、SP吸收
  365. 效果:攻击者增加等同于伤害值的SP。
  366. 处理:后继
  367. 脚本:
  368. a=$scene.active_battler
  369. a.damage=0
  370. for t in $scene.target_battlers
  371. if t.damage.is_a?(Numeric)
  372.    a.damage -= t.damage
  373.    a.sp += t.damage
  374. end
  375. end

  376. 六、SP同等伤害
  377. 效果:攻击对象损失等同于HP损失的SP。
  378. 处理:后继
  379. 脚本:
  380. for t in $scene.target_battlers
  381. t.sp-=t.damage if t.damage.is_a?(Numeric)
  382. end

  383. 七、反馈
  384. 效果:攻击对象损失所有的SP,并损失相当于其SP损失量的HP(参考Starcraft的Feedback)。
  385. 处理:覆写
  386. 脚本:
  387. s=$scene.skill
  388. for t in $scene.target_battlers
  389. t.damage=t.sp
  390. t.sp=0
  391. t.hp-=t.damage
  392. end
  393. $scene.state_apply

  394. 八、消耗HP发动
  395. 效果:本来是消耗SP发动的技能变成消耗HP发动,如果HP不足则发动后死亡。
  396. 处理:SP覆写
  397. 脚本:
  398. s=$scene.skill
  399. $scene.active_battler.hp-=s.sp_cost


  400. 九、SP节约
  401. 效果:中了特定状态(例为22)发动技能只消耗常规一半的SP,中了另一状态(23)则无差别消耗1点SP。
  402. 处理:SP覆写
  403. 脚本:
  404. s=$scene.skill
  405. a=$scene.active_battler
  406. if a.state?(22)
  407. a.sp-=s.sp_cost/2
  408. elsif a.state?(23)
  409. a.sp-=[s.sp_cost,1].min
  410. end

  411. 十、现有HP比例伤害
  412. 效果:按照技能的威力设置,和攻击对象的HP,计算损害百分比的HP,属性和防御修正有效。
  413. 处理:覆写
  414. 脚本:
  415. s=$scene.skill
  416. for t in $scene.target_battlers
  417. e=t.element_correct(s.element_set)
  418. t.damage=t.hp*s.power*e/10000
  419. t.damage/=2 if t.guarding?
  420. t.hp-=t.damage
  421. end
  422. $scene.state_apply

  423. 十一、现有HP差分比例伤害
  424. 效果:按照技能的威力设置,和攻击对象的HP与其最大HP的差值,计算损害百分比的HP,属性和防御修正无效。
  425. 处理:覆写
  426. 脚本:
  427. s=$scene.skill
  428. for t in $scene.target_battlers
  429. t.damage=(t.maxhp-t.hp)*s.power/100
  430. t.hp-=t.damage
  431. end
  432. $scene.state_apply

  433. 十二、最大HP比例伤害
  434. 效果:按照技能的威力设置,和攻击对象的最大HP,计算损害百分比的HP,属性有效,无视防御修正。
  435. 处理:覆写
  436. 脚本:
  437. s=$scene.skill
  438. for t in $scene.target_battlers
  439. e=t.element_correct(s.element_set)
  440. t.damage=t.maxhp*s.power*e/10000
  441. t.hp-=t.damage
  442. end
  443. $scene.state_apply

  444. 十三、自身HP比例伤害
  445. 效果:按照技能的威力设置,和攻击者的HP,计算损害百分比的HP,属性和防御修正有效。
  446. 处理:覆写
  447. 脚本:
  448. s=$scene.skill
  449. a=$scene.active_battler
  450. for t in $scene.target_battlers
  451. e=t.element_correct(s.element_set)
  452. t.damage=a.hp*s.power*e/10000
  453. t.damage/=2 if t.guarding?
  454. t.hp-=t.damage
  455. end
  456. $scene.state_apply

  457. 十四、自身HP差分比例伤害
  458. 效果:按照技能的威力设置,和攻击者的HP与其最大HP的差值,计算损害百分比的HP,属性有效,无视防御修正。
  459. 处理:覆写
  460. 脚本:
  461. s=$scene.skill
  462. a=$scene.active_battler
  463. for t in $scene.target_battlers
  464. e=t.element_correct(s.element_set)
  465. t.damage=(a.maxhp-a.hp)*s.power*e/10000
  466. t.hp-=t.damage
  467. end
  468. $scene.state_apply

  469. 十五、自身最大HP比例伤害
  470. 效果:按照技能的威力设置,和攻击者的最大HP,计算损害百分比的HP,属性和防御修正无效。
  471. 处理:覆写
  472. 脚本:
  473. s=$scene.skill
  474. a=$scene.active_battler
  475. for t in $scene.target_battlers
  476. t.damage=a.maxhp*s.power/100
  477. t.hp-=t.damage
  478. end
  479. $scene.state_apply

  480. 十六、舍命一击
  481. 效果:攻击者攻击后死亡。
  482. 处理:后继
  483. 脚本:
  484. $scene.active_battler.hp=0
  485. $scene.active_battler.damage=""

  486. 十七、强制会心一击
  487. 效果:强制造成会心一击(伤害值2倍)。
  488. 处理:后继
  489. 脚本:
  490. for t in $scene.target_battlers
  491. if t.damage.is_a?(Numeric)
  492.    t.hp-=t.damage
  493.    t.damage*=2
  494. end
  495. end

  496. 十八、技能反射
  497. 效果:攻击对象有特定状态(24)时,技能被反射到另外一方的随机对象。
  498. 处理:前趋+后继
  499. 脚本(前趋):
  500. x=$scene.target_battlers
  501. x1=x.clone
  502. for t in x1
  503. if t.state?(24)
  504.    x.delete(t)
  505.    c=(t.is_a?(Game_Actor) ?
  506.      $game_troop.random_target_enemy :
  507.      $game_party.random_target_actor)
  508.    x.push(c)
  509. end
  510. end
  511. @d=x.clone
  512. 脚本(后继):
  513. for i in 0...@d.size
  514. t=$scene.target_battlers[i]
  515. t1=@d[i]
  516. t.damage=t1.hp-t.hp
  517. end

  518. 十九、复活对不死系反效果(即死)
  519. 效果:用复活类技能攻击对象为不死系(属性9)时,造成敌人无条件即死。
  520. 处理:覆写
  521. 脚本:
  522. a=$scene.active_battler
  523. s=$scene.skill
  524. for t in $scene.target_battlers
  525. if t.element_rate(9)>=150
  526.    t.add_state(1)
  527. else
  528.    t.skill_effect(a,s)
  529. end
  530. end

  531. 二十、即死对不死系反效果(完全回复)
  532. 效果:用即死类技能攻击对象为不死系时,造成敌人完全回复。
  533. 处理:覆写
  534. 脚本:
  535. a=$scene.active_battler
  536. s=$scene.skill
  537. for t in $scene.target_battlers
  538. if t.element_rate(9)>=150
  539.    t.recover_all
  540. else
  541.    t.skill_effect(a,s)
  542. end
  543. end
复制代码
[/fold]
[fold=技能熟练度]
  1. #=====================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #====================================================================


  4. #====================================================================
  5. # ■ スキルアップデート   Ver. 4.4.0                     by Claimh
  6. #---------------------------------------------------------------
  7. #     スキルごとにレベル制を導入する
  8. #     戦闘中にスキルを使用するほど、威力上昇、消費SP減少、命中率上昇
  9. #==============================================================

  10. module Skill_updata
  11. S_MIGHT = []
  12. S_COST = []
  13. S_HIT = []
  14. S_LEVEL = []
  15. S_INTER = []
  16. S_SLOPE = []
  17. S_ANIME = []
  18. S_ELEMENT = []
  19. S_STATE_P = []
  20. S_STATE_N = []
  21. #=============================================================
  22. # □ 自定义内容
  23. #==============================================================
  24. # 威力上升使用true/false
  25. SKILL_MIGHT_UP = true

  26. # SP消耗减少使用true/false
  27. SP_COST_DOWN = true      

  28. # 命中率上升使用true/false
  29. SKILL_HIT_UP = true      

  30. # 属性变化的使用true/false
  31. ELEMENT_CHANGE = true   

  32. # 状态变化的使用true/false
  33. STATE_CHANGE = true

  34. # 显示特技等级上升true/false
  35. SHOW_SKILL_LV_UP = true

  36. # 等级上升的声效,不用的时候就=nil
  37. SKILLUP_SE = "056-Right02"

  38. # 菜单使用计数true/false
  39. MENU_COUNT = false

  40. # 升级所需次数
  41. UPDATA_INTERVAL = 1

  42. # 等级上限
  43. LEVEL_LIMIT = 20

  44. # 威力上升率(%%)
  45. MIGHT_RATE = 0.5

  46. # SP消耗减少率(%)
  47. COST_RATE = 3

  48. # 命中上升率(%)
  49. HIT_RATE = 1

  50. #-------------------------------------------------------------
  51. # 特别技能的详细设定,57和61号特技分别是十字斩和扫荡,大家最熟悉的两个招数
  52. #----------------------------------------------------------------

  53. # 界限水平
  54. # S_LEVEL[技艺ID]=[角色ID=>界限,…]
  55. S_LEVEL[57] = {1=>18, 2=>12, 3=>5, 4=>12, 5=>12, 6=>12, 7=>12, 8=>12}
  56. S_LEVEL[61] = {1=>12, 2=>18, 3=>15, 4=>12, 5=>12, 6=>12, 7=>12, 8=>12}
  57.    
  58. # 技艺&actor威力上升率
  59. # S_MIGHT[技艺ID]=[角色ID=>威力上升率,…]
  60. S_MIGHT[57] = {1=>8, 2=>2, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
  61. S_MIGHT[61] = {1=>2, 2=>8, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}

  62. # 技艺&actorSP消费减少率
  63. # S_COST[技艺ID]=[角色ID=>SP消费减少率,…]
  64. S_COST[57] = {1=>8, 2=>2, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}
  65. S_COST[61] = {1=>2, 2=>8, 3=>5, 4=>2, 5=>2, 6=>2, 7=>2, 8=>2}

  66. # 技艺&actor命中率
  67. # S_HIT[技艺ID]=[角色ID=>命中上升率,…]
  68. S_HIT[57] = {1=>2, 2=>1, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1}
  69. S_HIT[61] = {1=>1, 2=>2, 3=>1, 4=>1, 5=>1, 6=>1, 7=>1, 8=>1}

  70. #-----------------------------------------------------------------
  71. # 技能成长的具体调节
  72. #-----------------------------------------------------------------
  73. # 技艺的增长图形
  74. # 0:使用技艺一定回数的话提高水平
  75. # 1:技艺一定回数+每水平の使用提高水平
  76. SKILL_PATTERN = 0

  77. # 技艺水平上升间隔每(使用几回Lv提高)
  78. #   ※没有设定的情况→基本设定被适应
  79. # S_INTER[技艺ID]=[actorID=>上升间隔,…]
  80. S_INTER[57] = {1=>5, 2=>8, 3=>8, 4=>8, 5=>8, 6=>8, 7=>8, 8=>8}

  81. # スキルレベル上昇の傾き(パターン1を使用する場合のみ必要)
  82. #   ※設定がない場合は1となります。
  83. # S_SLOPE[スキルID] = [アクターID=>上昇の傾き, …]
  84. S_SLOPE[57] = {1=>5, 2=>8, 3=>8, 4=>8, 5=>8, 6=>8, 7=>8, 8=>8}

  85. #-------------------------------------------------------------
  86. # 技艺增长的话使之动画变化
  87. #  记录格式: S_ANIME[技艺ID] = [角色ID=>[[等级, 动画ID]], ・・・]
  88. #------------------------------------------------------------
  89. # 实施技艺增长的动画变化?
  90. USE_S_ANIME = true

  91. # 設定例
  92. # 1号角色,57号特技,lv5,lv10动画变化
  93. # 2号角色,Lv.11动画变化
  94. S_ANIME[57] = {1=>[[5, 69], [10, 70]], 2=>[[11, 70]]}

  95. #-------------------------------------------------------------------
  96. # 属性変化/状态変化
  97. #------------------------------------------------------------------
  98. # 属性変化
  99. # S_ELEMENT[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
  100. S_ELEMENT[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}

  101. # 状态変化+
  102. # S_STATE_P[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
  103. S_STATE_P[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}

  104. # 状态変化-
  105. # S_STATE_N[技艺ID] = {角色ID=>{水平=>[属性ID,属性ID…]}, ・・・・}
  106. S_STATE_N[57] = {1=>{1=>[1], 2=>[2], 3=>[3]}, 2=>{1=>[2], 2=>[5]}}

  107. #==================================================================
  108. # □ 自定义内容终了
  109. #==================================================================
  110. end


  111. class Game_Actor
  112. include Skill_updata
  113. attr_accessor   :skill_use      # スキル使用回数
  114. attr_accessor   :skill_level    # スキルレベル
  115. attr_accessor   :skill_power    # スキル威力更新値
  116. attr_accessor   :skill_sp_cost  # スキルSP消費更新値
  117. attr_accessor   :skill_hit      # スキル命中率
  118. attr_accessor   :skill_up       # レベルアップフラグ
  119. attr_accessor   :skill_list     # スキルEXPリスト
  120. alias skill_updata_init setup
  121. def setup(actor_id)
  122.    skill_updata_init(actor_id)
  123.    @skill_use = []
  124.    @skill_level = []
  125.    @skill_power = []
  126.    @skill_sp_cost = []
  127.    @skill_hit = []
  128.    @skill_up = false
  129.    @skill_list = []
  130.    for id in 1...$data_skills.size
  131.      @skill_use[id] = 0
  132.      @skill_level[id] = 0
  133.      @skill_power[id] = $data_skills[id].power
  134.      @skill_sp_cost[id] = $data_skills[id].sp_cost
  135.      @skill_hit[id] = $data_skills[id].hit
  136.      @skill_list[id] = make_skill_list(id)
  137.    end
  138. end

  139. #-------------------------------------------------------------
  140. # ● スキルEXP 計算
  141. #------------------------------------------------------------
  142. def make_skill_list(skill_id)
  143.    interval = S_INTER[skill_id]
  144.    up_interval = ( (interval != nil and interval[@actor_id] != nil) ? interval[@actor_id] : UPDATA_INTERVAL )
  145.    slope = S_SLOPE[skill_id]
  146.    up_slope = ( (slope != nil and slope[@actor_id] != nil) ? slope[@actor_id] : 1 )
  147.    limit = S_LEVEL[skill_id]
  148.    limit_lv = ( (limit != nil and limit[@actor_id] != nil) ? limit[@actor_id] : LEVEL_LIMIT )
  149.    list = []
  150.    list[0] = 0
  151.    for lv in 1...limit_lv+1
  152.      exp = 0
  153.      case SKILL_PATTERN
  154.      when 0
  155.        exp = up_interval * lv
  156.      when 1
  157.        exp = list[lv-1] + up_slope * lv + up_interval
  158.      end
  159.      list[lv] = exp.truncate
  160.    end
  161.    return list
  162. end
  163. end


  164. class Game_Battler
  165. include Skill_updata
  166. #-----------------------------------------------------------------
  167. # ● スキルの効果適用
  168. #     user  : スキルの使用者 (バトラー)
  169. #     skill : スキル
  170. #-------------------------------------------------------------
  171. alias skill_effect_update skill_effect
  172. def skill_effect(user, skill)
  173.    up_flag = false
  174.    if user.is_a?(Game_Actor) and ($scene.is_a?(Scene_Battle) or MENU_COUNT)
  175.      skill_update_main(user, skill)
  176.      skill_base = skill.dup
  177.      # 威力上昇
  178.      if SKILL_MIGHT_UP
  179.        skill.power = user.skill_power[skill.id]
  180.      end
  181.      # 命中率上昇
  182.      if SKILL_HIT_UP
  183.        skill.hit = user.skill_hit[skill.id]
  184.      end
  185.      # 属性変化
  186.      if ELEMENT_CHANGE and S_ELEMENT != []
  187.        ele1 = S_ELEMENT[skill.id]
  188.        if ele1 != nil and ele1[user.id] != nil
  189.          ele2 = ele1[user.id]
  190.          if ele2 != [] and ele2[user.skill_level[skill.id]] != nil
  191.            skill.element_set = ele2[user.skill_level[skill.id]]
  192.          end
  193.        end
  194.      end
  195.      # ステート変化
  196.      if STATE_CHANGE
  197.        if S_STATE_P != []
  198.          pst1 = S_STATE_P[skill.id]
  199.          if pst1 != nil and pst1[user.id] != nil
  200.            pst2 = pst1[user.id]
  201.            if pst2 != nil and pst2[user.skill_level[skill.id]] != nil
  202.              skill.plus_state_set = pst2[user.skill_level[skill.id]]
  203. #              p skill.plus_state_set
  204.            end
  205.          end
  206.        end
  207.        if S_STATE_N != []
  208.          nst1 = S_STATE_N[skill.id]
  209.          if nst1 != nil and nst1[user.id] != nil
  210.            nst2 = nst1[user.id]
  211.            if nst1 != nil and nst2[user.skill_level[skill.id]] != nil
  212.              skill.minus_state_set = nst2[user.skill_level[skill.id]]
  213.            end
  214.          end
  215.        end
  216.      end
  217.      up_flag = true
  218.    end
  219.    ret = skill_effect_update(user, skill)    # 原物
  220.    if up_flag
  221.      skill = skill_base
  222.      # Miss時には後戻し
  223.      if self.damage == "Miss"
  224.        skill_use_recount(user, skill)
  225.      end
  226.    end
  227.    return ret
  228. end

  229. #------------------------------------------------------------
  230. # ● スキルアップデータメイン
  231. #-------------------------------------------------------------
  232. def skill_update_main(actor, skill)
  233.    # スキル使用回数のカウント
  234.    actor.skill_use[skill.id] += 1
  235.    # リミット取得
  236.    limit = S_LEVEL[skill.id]
  237.    s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
  238.    # 書き換え限界到達
  239.    if s_limit == false or actor.skill_level[skill.id] < s_limit
  240.      # レベルアップ間隔取得
  241.      interval = actor.skill_list[skill.id]
  242.      # 書き換え回数到達
  243.      if actor.skill_use[skill.id] == interval[actor.skill_level[skill.id]+1]
  244.        # スキルレベル上昇
  245.        actor.skill_level[skill.id] += 1
  246.        actor.skill_up = true
  247.        # 威力上昇 = 有効
  248.        if SKILL_MIGHT_UP
  249.          might = S_MIGHT[skill.id]
  250.          might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
  251.          # 補正値更新
  252.          actor.skill_power[skill.id] += skill.power * might_rate / 100
  253.          actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
  254.        end
  255.        # SP消費減少 = 有効
  256.        if SP_COST_DOWN
  257.          cost = S_COST[skill.id]
  258.          cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
  259.          actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
  260.          actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
  261.          # SP消費が0以下はありえない
  262.          if actor.skill_sp_cost[skill.id] < 0
  263.            actor.skill_sp_cost[skill.id] = 0
  264.          end
  265.        end
  266.        # 命中率上昇 = 有効
  267.        if SKILL_HIT_UP
  268.          hit = S_HIT[skill.id]
  269.          hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
  270.          actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
  271.          actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
  272.          # 100以上はありえない
  273.          if actor.skill_hit[skill.id] > 100
  274.            actor.skill_hit[skill.id] = 100
  275.          end
  276.        end
  277.      end
  278.    end
  279. end

  280. #---------------------------------------------------------
  281. # ● 再カウント
  282. #------------------------------------------------------
  283. def skill_use_recount(actor, skill)
  284.    if actor.skill_up
  285.      actor.skill_level[skill.id] -= 1
  286.      # 威力を再計算
  287.      if SKILL_MIGHT_UP
  288.        actor.skill_power[skill.id] = skill.power
  289.        might = S_MIGHT[skill.id]
  290.        might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
  291.        for i in 1...actor.skill_level[skill.id]
  292.          actor.skill_power[skill.id] += skill.power * might_rate / 100
  293.          actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
  294.        end
  295.      end
  296.      # SP消費再計算
  297.      if SP_COST_DOWN
  298.        actor.skill_sp_cost[skill.id] = skill.sp_cost
  299.        cost = S_COST[skill.id]
  300.        cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
  301.        for i in 1...actor.skill_level[skill.id]
  302.          actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
  303.          actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
  304.        end
  305.        # SP消費が0以下はありえない
  306.        if actor.skill_sp_cost[skill.id] < 0
  307.          actor.skill_sp_cost[skill.id] = 0
  308.        end
  309.      end
  310.      # 命中率再計算
  311.      if SKILL_HIT_UP
  312.        actor.skill_hit[skill.id] = skill.hit
  313.        hit = S_HIT[skill.id]
  314.        hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
  315.        for i in 1...actor.skill_level[skill.id]
  316.          actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
  317.          actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
  318.        end
  319.        # 100以上はありえない
  320.        if actor.skill_hit[skill.id] > 100
  321.          actor.skill_hit[skill.id] = 100
  322.        end
  323.      end
  324.      actor.skill_up = false
  325.    end
  326.    actor.skill_use[skill.id] -= 1
  327. end
  328. end

  329. #=================================================================
  330. # スキル成長によるアニメーション変化
  331. #=================================================================
  332. class Scene_Battle
  333. include Skill_updata
  334. #--------------------------------------------------------------
  335. # ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
  336. #-----------------------------------------------------------
  337. alias update_phase4_step4_skillup update_phase4_step4
  338. def update_phase4_step4
  339.    update_phase4_step4_skillup
  340.    if @active_battler.is_a?(Game_Actor) and USE_S_ANIME
  341.      s_anime = S_ANIME[@skill.id]
  342.      # 設定がないなら無視
  343.      if s_anime != nil and s_anime[@active_battler.id] != nil
  344.        s_anime_set = s_anime[@active_battler.id]
  345.        for i in 0...s_anime_set.size
  346.          s_anime_def = s_anime_set[i]
  347.          # 規定レベル以上
  348.          if @active_battler.skill_level[@skill.id] >= s_anime_def[0]
  349.            # 対象側アニメーション
  350.            for target in @target_battlers
  351.              target.animation_id = s_anime_def[1]
  352.            end
  353.          end
  354.        end
  355.      end
  356.    end
  357. end
  358. end

  359. #=================================================================
  360. # 以下、レベルアップ表示部分(レベルアップ表示がいらないなら消してもOK)
  361. #=================================================================
  362. class Scene_Battle
  363. include Skill_updata
  364. if SHOW_SKILL_LV_UP
  365. #----------------------------------------------------------
  366. # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  367. #----------------------------------------------------------
  368. alias update_phase4_step2_skillup update_phase4_step2
  369. def update_phase4_step2
  370.    if @active_battler.is_a?(Game_Actor)
  371.      @active_battler.skill_up = false
  372.    end
  373.    @skillup = false
  374.    update_phase4_step2_skillup   # 原物
  375. end

  376. #-------------------------------------------------------------
  377. # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  378. #-----------------------------------------------------------
  379. alias update_phase4_step3_skillup update_phase4_step3
  380. def update_phase4_step3
  381.    if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up != false
  382.      @skillup = true
  383.      @skill_up_window = Window_Skillup.new(@active_battler)
  384.      if SKILLUP_SE != nil
  385.        Audio.se_play("Audio/SE/" + SKILLUP_SE)
  386.        sleep(0.1)
  387.      end
  388.    end
  389.    update_phase4_step3_skillup
  390. end

  391. #--------------------------------------------------------------
  392. # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  393. #--------------------------------------------------------------
  394. alias update_phase4_step5_skillup update_phase4_step5
  395. def update_phase4_step5
  396.    if @active_battler.is_a?(Game_Actor) and @skillup
  397.      @skill_up_window.dispose
  398.      @active_battler.skill_up = false
  399.      @skillup = false
  400.    end
  401.    update_phase4_step5_skillup     # 原物
  402. end

  403. #---------------------------------------------------------------
  404. # ● フレーム更新
  405. #----------------------------------------------------------------
  406. alias update_skillup update
  407. def update
  408.    if @active_battler.is_a?(Game_Actor) and @active_battler.skill_up and @skillup
  409.      @skill_up_window.contents_opacity -= 4
  410.    end
  411.    update_skillup              # 原物
  412. end
  413. end # if SHOW_SKILL_LV_UP
  414. end

  415. class Window_Skillup < Window_Base
  416. #--------------------------------------------------------------
  417. # ● オブジェクト初期化
  418. #     actor : アクター
  419. #-------------------------------------------------------------
  420. def initialize(actor)
  421.    super(actor.screen_x-140, 260, 250, 64)
  422.    self.contents = Bitmap.new(width - 32, height - 32)
  423.    self.opacity = 0
  424.    self.contents.font.color = Color.new(255, 64, 0)
  425.    self.contents.draw_text(80, 0, 150, 32, "LEVEL UP!")
  426. end
  427. end



  428. #====================================================================
  429. # 以下、再定義部分を含む(SP消費減少の機能がいらないなら消してもOK)
  430. #====================================================================
  431. class Window_Skill < Window_Selectable
  432. #----------------------------------------------------------------
  433. # ● 項目の描画
  434. #     index : 項目番号
  435. #-----------------------------------------------------------------
  436. def draw_item(index)
  437.    skill = @data[index]
  438.    if @actor.skill_can_use?(skill.id)
  439.      self.contents.font.color = normal_color
  440.    else
  441.      self.contents.font.color = disabled_color
  442.    end
  443.    x = 4 + index % 2 * (288 + 32)
  444.    y = index / 2 * 32
  445.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  446.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  447.    bitmap = RPG::Cache.icon(skill.icon_name)
  448.    opacity = self.contents.font.color == normal_color ? 255 : 128
  449.    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  450. #-修正-----
  451.    @actor.skill_level[skill.id] = 0 if @actor.skill_level[skill.id] == nil
  452.    name_level = skill.name + "(Lv" + @actor.skill_level[skill.id].to_s + ")"
  453.    self.contents.draw_text(x + 28, y, 204, 32, name_level, 0)
  454.    @actor.skill_sp_cost[skill.id] = skill.sp_cost if @actor.skill_sp_cost[skill.id] == nil
  455.    self.contents.draw_text(x + 232, y, 48, 32, @actor.skill_sp_cost[skill.id].to_s, 2)
  456. #----------
  457. end
  458. end

  459. class Scene_Skill
  460. #----------------------------------------------------------
  461. # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
  462. #-------------------------------------------------------------
  463. def update_target
  464.    # B ボタンが押された場合
  465.    if Input.trigger?(Input::B)
  466.      # キャンセル SE を演奏
  467.      $game_system.se_play($data_system.cancel_se)
  468.      # ターゲットウィンドウを消去
  469.      @skill_window.active = true
  470.      @target_window.visible = false
  471.      @target_window.active = false
  472.      return
  473.    end
  474.    # C ボタンが押された場合
  475.    if Input.trigger?(Input::C)
  476.      # SP 切れなどで使用できなくなった場合
  477.      unless @actor.skill_can_use?(@skill.id)
  478.        # ブザー SE を演奏
  479.        $game_system.se_play($data_system.buzzer_se)
  480.        return
  481.      end
  482.      # ターゲットが全体の場合
  483.      if @target_window.index == -1
  484.        # パーティ全体にスキルの使用効果を適用
  485.        used = false
  486.        for i in $game_party.actors
  487.          used |= i.skill_effect(@actor, @skill)
  488.        end
  489.      end
  490.      # ターゲットが使用者の場合
  491.      if @target_window.index <= -2
  492.        # ターゲットのアクターにスキルの使用効果を適用
  493.        target = $game_party.actors[@target_window.index + 10]
  494.        used = target.skill_effect(@actor, @skill)
  495.      end
  496.      # ターゲットが単体の場合
  497.      if @target_window.index >= 0
  498.        # ターゲットのアクターにスキルの使用効果を適用
  499.        target = $game_party.actors[@target_window.index]
  500.        used = target.skill_effect(@actor, @skill)
  501.      end
  502.      # スキルを使った場合
  503.      if used
  504.        # スキルの使用時 SE を演奏
  505.        $game_system.se_play(@skill.menu_se)
  506. #-----修正---------------------------------------------
  507.        @actor.skill_sp_cost[@skill.id] = @skill.sp_cost if @actor.skill_sp_cost[@skill.id] == nil
  508.        # SP 消費
  509.        @actor.sp -= @actor.skill_sp_cost[@skill.id]
  510. #------------------------------------------------
  511.        # 各ウィンドウの内容を再作成
  512.        @status_window.refresh
  513.        @skill_window.refresh
  514.        @target_window.refresh
  515.        # 全滅の場合
  516.        if $game_party.all_dead?
  517.          # ゲームオーバー画面に切り替え
  518.          $scene = Scene_Gameover.new
  519.          return
  520.        end
  521.        # コモンイベント ID が有効の場合
  522.        if @skill.common_event_id > 0
  523.          # コモンイベント呼び出し予約
  524.          $game_temp.common_event_id = @skill.common_event_id
  525.          # マップ画面に切り替え
  526.          $scene = Scene_Map.new
  527.          return
  528.        end
  529.      end
  530.      # スキルを使わなかった場合
  531.      unless used
  532.        # ブザー SE を演奏
  533.        $game_system.se_play($data_system.buzzer_se)
  534.      end
  535.      return
  536.    end
  537. end
  538. end

  539. class Scene_Battle
  540. include Skill_updata
  541. #------------------------------------------------------
  542. # ● スキルアクション 結果作成
  543. #-------------------------------------------------------
  544. alias make_skill_action_result_skill_update make_skill_action_result
  545. def make_skill_action_result
  546.    make_skill_action_result_skill_update
  547.    # SP 消費
  548.    if SP_COST_DOWN and @active_battler.is_a?(Game_Actor)
  549.      @active_battler.sp += @skill.sp_cost
  550.      @active_battler.sp -= @active_battler.skill_sp_cost[@skill.id]
  551.    end
  552. end
  553. end

  554. class Game_Battler
  555. #--------------------------------------------------------
  556. # ● スキルの使用可能判定
  557. #     skill_id : スキル ID
  558. #------------------------------------------------------
  559. alias skill_update_can_use? skill_can_use?
  560. def skill_can_use?(skill_id)
  561.    ret = skill_update_can_use?(skill_id)
  562.    if !ret and SP_COST_DOWN
  563.      # SP が足りない場合は使用不可となった?
  564.      if $data_skills[skill_id].sp_cost > self.sp
  565.        if self.is_a?(Game_Actor)
  566.          skill_sp_cost = self.skill_sp_cost[skill_id]
  567.          if skill_sp_cost < self.sp
  568.            ret = true
  569.          end
  570.        end
  571.      end
  572.    end
  573.    return ret
  574. end
  575. end

  576. #===============================================================
  577. # イベントスクリプト操作
  578. #===============================================================
  579. class Interpreter
  580. include Skill_updata
  581. #-----------------------------------------------------------
  582. # ● スキルレベル設定(レベルセット)
  583. #     actor_id  :   アクターID
  584. #     skill_id  :   スキルID
  585. #     level     :   設定レベル
  586. #-----------------------------------------------------------
  587. def set_skill_level(actor_id, skill_id, level)
  588.    actor = $game_actors[actor_id]
  589.    skill = $data_skills[skill_id]
  590.    # リミット取得
  591.    limit = S_LEVEL[skill_id]
  592.    s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
  593.    if level > s_limit or level < 0
  594.      return
  595.    end
  596.    # レベル
  597.    actor.skill_level[skill.id] = level
  598.    # 使用回数
  599.    use_list = actor.skill_list[skill.id]
  600.    actor.skill_use[skill.id] = use_list[level]
  601.    # 威力を再計算
  602.    if SKILL_MIGHT_UP
  603.      actor.skill_power[skill.id] = skill.power
  604.      might = S_MIGHT[skill.id]
  605.      might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
  606.      for i in 0...level
  607.        actor.skill_power[skill.id] += skill.power * might_rate / 100
  608.        actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
  609.      end
  610.    end
  611.    # SP消費再計算
  612.    if SP_COST_DOWN
  613.      actor.skill_sp_cost[skill.id] = skill.sp_cost
  614.      cost = S_COST[skill.id]
  615.      cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
  616.      for i in 0...level
  617.        actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
  618.        actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
  619.      end
  620.      # SP消費が0以下はありえない
  621.      if actor.skill_sp_cost[skill.id] < 0
  622.        actor.skill_sp_cost[skill.id] = 0
  623.      end
  624.    end
  625.    # 命中率再計算
  626.    if SKILL_HIT_UP
  627.      actor.skill_hit[skill.id] = skill.hit
  628.      hit = S_HIT[skill.id]
  629.      hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
  630.      for i in 0...level
  631.        actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
  632.        actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
  633.      end
  634.      # 100以上はありえない
  635.      if actor.skill_hit[skill.id] > 100
  636.        actor.skill_hit[skill.id] = 100
  637.      end
  638.    end
  639. end

  640. #---------------------------------------------------------
  641. # ● スキルレベル設定(レベルアップ)
  642. #     actor_id  :   アクターID
  643. #     skill_id  :   スキルID
  644. #--------------------------------------------------------
  645. def skill_level_up(actor_id, skill_id)
  646.    actor = $game_actors[actor_id]
  647.    set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]+1)
  648. end

  649. #-------------------------------------------------------
  650. # ● スキルレベル設定(レベルダウン)
  651. #     actor_id  :   アクターID
  652. #     skill_id  :   スキルID
  653. #--------------------------------------------------------
  654. def skill_level_down(actor_id, skill_id)
  655.    actor = $game_actors[actor_id]
  656.    set_skill_level(actor_id, skill_id, actor.skill_level[skill_id]-1)
  657. end
  658. end

  659. #==================================================================
  660. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  661. #==================================================================
复制代码
[/fold]
[fold=空手攻防]
  1. #=========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #=========================================================================
  4. # 空手的攻击防御力           by Claimh
  5. #------------------------------------------------------------------
  6. # http://www.k3.dion.ne.jp/~claimh/
  7. #========================================================================
  8. module Arm_Element
  9.   ARM_ATK = []
  10.   ARM_PDEF = []
  11.   ARM_MDEF = []
  12.   ARM_ELEMENT = []
  13.   ARM_ELE_PLUS = []
  14.   ARM_ELE_MINUS = []
  15.   ARM_ANIMATION1 = []
  16.   ARM_ANIMATION2 = []
  17.   #===================================================================
  18.   # 自定义开始
  19.   #====================================================================
  20.   # 空手时1号角色攻击力与力量值的百分比关系(60%)
  21.   ARM_ATK[1] = 0.6
  22.   # 空手时2号角色攻击力与力量值的百分比关系(70%),以下类推,不一一举例。
  23.   ARM_ATK[1] = 0.7
  24.    
  25.   # 空手时1号角色防御力与灵巧值的百分比关系(60%)
  26.   ARM_PDEF[1] = 0.6
  27.    
  28.   # 空手时1号角色魔法防御力与速度值的百分比关系(60%)
  29.   ARM_MDEF[1] = 0.6
  30.    
  31.   # 空手时攻击方动画编号
  32.   ARM_ANIMATION1[1] = 1
  33.    
  34.   # 空手时挨打方动画编号
  35.   ARM_ANIMATION2[1] = 4
  36.    
  37.   #————以下几个慎用,是空手时的属性增减,不推荐修改
  38.    
  39.   ARM_ELEMENT[1] = [1]
  40.   ARM_ELE_PLUS[1] = []
  41.   ARM_ELE_MINUS[1] = []
  42. end
  43. class Game_Actor < Game_Battler
  44.   include Arm_Element
  45.   #--------------------------------------------------------------------
  46.   #------------------------------------------------------------------
  47.   alias base_atk_arm base_atk
  48.   def base_atk
  49.     if @weapon_id == 0 and ARM_ATK[@actor_id] != nil
  50.       return $data_actors[@actor_id].parameters[2, @level] * ARM_ATK[@actor_id]
  51.     end
  52.     return base_atk_arm
  53.   end
  54.   #--------------------------------------------------------------------
  55.   #-------------------------------------------------------------------
  56.   alias base_pdef_arm base_pdef
  57.   def base_pdef
  58.     if @weapon_id == 0 and ARM_PDEF[@actor_id] != nil
  59.       return base_pdef_arm + $data_actors[@actor_id].parameters[3, @level] * ARM_PDEF[@actor_id]
  60.     end
  61.     return base_pdef_arm
  62.   end
  63.    
  64.   #--------------------------------------------------------------------
  65.   #--------------------------------------------------------------------
  66.   alias base_mdef_arm base_mdef
  67.   def base_mdef
  68.     if @weapon_id == 0 and ARM_MDEF[@actor_id] != nil
  69.       return base_mdef_arm + $data_actors[@actor_id].parameters[4, @level] * ARM_MDEF[@actor_id]
  70.     end
  71.     return base_mdef_arm
  72.   end
  73.   #------------------------------------------------------------------
  74.   #--------------------------------------------------------------
  75.   alias element_set_arm element_set
  76.   def element_set
  77.     if @weapon_id == 0 and ARM_ELEMENT[@actor_id] != []
  78.       return ARM_ELEMENT[@actor_id]
  79.     end
  80.     return element_set_arm
  81.   end
  82.   #-----------------------------------------------------------------
  83.   #-------------------------------------------------------------------
  84.   alias plus_state_set_arm plus_state_set
  85.   def plus_state_set
  86.     if @weapon_id == 0 and ARM_ELE_PLUS[@actor_id] != []
  87.       return ARM_ELE_PLUS[@actor_id]
  88.     end
  89.     return plus_state_set_arm
  90.   end
  91.    
  92.   #-------------------------------------------------------------------
  93.   #------------------------------------------------------------------
  94.   alias minus_state_set_arm minus_state_set
  95.   def minus_state_set
  96.     if @weapon_id == 0 and ARM_ELE_MINUS[@actor_id] != []
  97.       return ARM_ELE_MINUS[@actor_id]
  98.     end
  99.     return minus_state_set_arm
  100.   end
  101.   #------------------------------------------------------------------
  102.   #-----------------------------------------------------------------
  103.   alias animation1_id_arm animation1_id
  104.   def animation1_id
  105.     if @weapon_id == 0 and ARM_ANIMATION1[@actor_id] != nil
  106.       return ARM_ANIMATION1[@actor_id]
  107.     end
  108.     return animation1_id_arm
  109.   end
  110.    
  111.   #---------------------------------------------------------------------
  112.   #------------------------------------------------------------------
  113.   alias animation2_id_arm animation2_id
  114.   def animation2_id
  115.     if @weapon_id == 0 and ARM_ANIMATION2[@actor_id] != nil
  116.       return ARM_ANIMATION2[@actor_id]
  117.     end
  118.     return animation2_id_arm
  119.   end
  120. end
  121.   
  122. #=====================================================================
  123. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  124. #=====================================================================
复制代码
[/fold]
[fold=图标战斗菜单]
  1. #==========================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==========================================================================

  4. module Momo_IconCommand
  5.   # 图标名称设定
  6.   ATTACK_ICON_NAME = "001-Weapon01" # 攻撃
  7.   SKILL_ICON_NAME = "044-Skill01"   # 特技
  8.   GUARD_ICON_NAME = "009-Shield01"  # 防御
  9.   ITEM_ICON_NAME = "032-Item01"     # 物品
  10.   # X坐标修正
  11.   X_PLUS = -40
  12.   # Y坐标修正
  13.   Y_PLUS = -180
  14.   # 选择时图标的动作
  15.   # 0:静止 1:放大
  16.   SELECT_TYPE = 0
  17.   # 闪烁时光芒的颜色
  18.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  19.   # 闪烁时间
  20.   FLASH_DURATION = 10
  21.   # 闪烁间隔
  22.   FLASH_INTERVAL = 20
  23.   # 是否写出文字的名称
  24.   COM_NAME_DROW = true
  25.   # 文字名称是否移动
  26.   COM_NAME_MOVE = true
  27.   # 文字内容
  28.   ATTACK_NAME = "攻击"    # 攻击
  29.   SKILL_NAME = "特技"   # 特技
  30.   GUARD_NAME = "防御"     # 防御
  31.   ITEM_NAME = "物品"  # 物品
  32.   # 文字颜色
  33.   COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  34.   # 文字坐标修正
  35.   COM_NAME_X_PLUS = 0
  36.   COM_NAME_Y_PLUS = 0
  37. end

  38. class Window_CommandIcon < Window_Selectable
  39.   attr_accessor :last_index
  40.   #------------------------------------------------------------------------
  41.   # ● オブジェクト初期化
  42.   #------------------------------------------------------------------------
  43.   def initialize(x, y, commands)
  44.     super(x, y, 32, 32)
  45.     # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
  46.     self.windowskin = RPG::Cache.windowskin("")
  47.     @item_max = commands.size
  48.     @commands = commands
  49.     @column_max = commands.size
  50.     @index = 0
  51.     @last_index = nil
  52.     @name_sprite = nil
  53.     @sprite = []
  54.     refresh
  55.   end
  56.   def dispose
  57.     super
  58.     for sprite in @sprite
  59.       sprite.dispose unless sprite.nil?
  60.     end
  61.     @name_sprite.dispose unless @name_sprite.nil?
  62.   end
  63.   #------------------------------------------------------------------------
  64.   # ● リフレッシュ
  65.   #------------------------------------------------------------------------
  66.   def refresh
  67.     @name_sprite.dispose unless @name_sprite.nil?
  68.     for sprite in @sprite
  69.       sprite.dispose unless sprite.nil?
  70.     end
  71.     @name_sprite = nil
  72.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  73.     @sprite = []
  74.     for i in 0...@item_max
  75.       draw_item(i)
  76.     end
  77.   end
  78.   #------------------------------------------------------------------------
  79.   # ● 項目の描画
  80.   #------------------------------------------------------------------------
  81.   def draw_item(index)
  82.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  83.     @sprite[index].z = self.z + 1
  84.   end
  85.   def draw_com_name
  86.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  87.    
  88.   end
  89.   
  90.   # 更新
  91.   def update
  92.     super
  93.     icon_update
  94.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  95.     if move_index?
  96.       @last_index = self.index
  97.     end
  98.   end
  99.   # アイコンの更新
  100.   def icon_update
  101.     for i in 0...@sprite.size
  102.       @sprite[i].active = (self.index == i)
  103.       @sprite[i].x = self.x + i * 24
  104.       @sprite[i].y = self.y + 0
  105.       @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  106.       @sprite[i].visible = self.visible
  107.       @sprite[i].update
  108.     end
  109.   end
  110.   # コマンドネームの更新
  111.   def com_name_update
  112.     if move_index?
  113.       @name_sprite.name = get_com_name
  114.     end
  115.     @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  116.     @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  117.     @name_sprite.z = self.z + 1
  118.     @name_sprite.active = self.active
  119.     @name_sprite.visible = self.visible
  120.     @name_sprite.update
  121.   end
  122.   def get_com_name
  123.     make_name_set if @name_set.nil?
  124.     name = @name_set[self.index]
  125.     name = "" if name.nil?
  126.     return name
  127.   end
  128.   def make_name_set
  129.     @name_set = []
  130.     @name_set[0] = Momo_IconCommand::ATTACK_NAME
  131.     @name_set[1] = Momo_IconCommand::SKILL_NAME
  132.     @name_set[2] = Momo_IconCommand::GUARD_NAME
  133.     @name_set[3] = Momo_IconCommand::ITEM_NAME
  134.   end
  135.   def move_index?
  136.     return self.index != @last_index
  137.   end
  138.   def need_reset
  139.     @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  140.   end
  141. end

  142. # アイコン用スプライト
  143. class Sprite_Icon < Sprite
  144.   attr_accessor :active
  145.   attr_accessor :icon_name
  146.   #------------------------------------------------------------------------
  147.   # ● オブジェクト初期化
  148.   #------------------------------------------------------------------------
  149.   def initialize(viewport, icon_name)
  150.     super(viewport)
  151.     @icon_name = icon_name
  152.     @last_icon = @icon_name
  153.     @count = 0
  154.     self.bitmap = RPG::Cache.icon(@icon_name)
  155.     self.ox = self.bitmap.width / 2
  156.     self.oy = self.bitmap.height / 2
  157.     @active = false
  158.   end
  159.   #------------------------------------------------------------------------
  160.   # ● 解放
  161.   #------------------------------------------------------------------------
  162.   def dispose
  163.     if self.bitmap != nil
  164.       self.bitmap.dispose
  165.     end
  166.     super
  167.   end
  168.   #------------------------------------------------------------------------
  169.   # ● フレーム更新
  170.   #------------------------------------------------------------------------
  171.   def update
  172.     super
  173.     if @icon_name != @last_icon
  174.       @last_icon = @icon_name
  175.       self.bitmap = RPG::Cache.icon(@icon_name)
  176.     end
  177.     if @active
  178.       @count += 1
  179.       case Momo_IconCommand::SELECT_TYPE
  180.       when 0
  181.         icon_flash
  182.       when 1
  183.         icon_zoom
  184.       end
  185.       @count = 0 if @count == 20
  186.     else
  187.       icon_reset
  188.     end
  189.   end
  190.   def icon_flash
  191.     if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
  192.       self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
  193.     end
  194.   end
  195.   def icon_zoom
  196.     case @count
  197.     when 1..10
  198.       zoom = 1.0 + @count / 10.0
  199.     when 11..20
  200.       zoom = 2.0 - (@count - 10) / 10.0
  201.     end
  202.     self.zoom_x = zoom
  203.     self.zoom_y = zoom
  204.   end
  205.   def icon_reset
  206.     @count = 0
  207.     self.zoom_x = 1.0
  208.     self.zoom_y = 1.0
  209.   end
  210. end

  211. # コマンドネーム用スプライト
  212. class Sprite_Comm_Name < Sprite
  213.   attr_accessor :active
  214.   attr_accessor :name
  215.   attr_accessor :need_reset
  216.   #------------------------------------------------------------------------
  217.   # ● オブジェクト初期化
  218.   #------------------------------------------------------------------------
  219.   def initialize(viewport, name)
  220.     super(viewport)
  221.     @name = name
  222.     @last_name = nil
  223.     @count = 0
  224.     @x_plus = 0
  225.     @opa_plus = 0
  226.     @need_reset = false
  227.     @active = false
  228.     self.bitmap = Bitmap.new(160, 32)
  229.   end
  230.   #------------------------------------------------------------------------
  231.   # ● 解放
  232.   #------------------------------------------------------------------------
  233.   def dispose
  234.     if self.bitmap != nil
  235.       self.bitmap.dispose
  236.     end
  237.     super
  238.   end
  239.   #------------------------------------------------------------------------
  240.   # ● フレーム更新
  241.   #------------------------------------------------------------------------
  242.   def update
  243.     super
  244.     if @active
  245.       if need_reset?
  246.         @need_reset = false
  247.         @last_name = @name
  248.         text_reset
  249.       end
  250.       move_text if Momo_IconCommand::COM_NAME_MOVE
  251.     end
  252.   end
  253.   def move_text
  254.     @count += 1
  255.     @x_plus = [@count * 8, 80].min
  256.     self.x = self.x - 80 + @x_plus
  257.     self.opacity = @count * 25
  258.   end
  259.   def text_reset
  260.     @count = 0
  261.     @x_plus = 0
  262.     self.bitmap.clear
  263.     self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
  264.     self.bitmap.draw_text(0, 0, 160, 32, @name)
  265.   end
  266.   def need_reset?
  267.     return (@name != @last_name or @need_reset)
  268.   end
  269. end

  270. class Scene_Battle
  271.   #------------------------------------------------------------------------
  272.   # ● プレバトルフェーズ開始
  273.   #------------------------------------------------------------------------
  274.   alias scene_battle_icon_command_start_phase1 start_phase1
  275.   def start_phase1
  276.     com1 = Momo_IconCommand::ATTACK_ICON_NAME
  277.     com2 = Momo_IconCommand::SKILL_ICON_NAME
  278.     com3 = Momo_IconCommand::GUARD_ICON_NAME
  279.     com4 = Momo_IconCommand::ITEM_ICON_NAME
  280.     @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
  281.     @actor_command_window.y = 160
  282.     @actor_command_window.back_opacity = 160
  283.     @actor_command_window.active = false
  284.     @actor_command_window.visible = false
  285.     @actor_command_window.update
  286.     scene_battle_icon_command_start_phase1
  287.   end
  288.   #------------------------------------------------------------------------
  289.   # ● アクターコマンドウィンドウのセットアップ
  290.   #------------------------------------------------------------------------
  291.   alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  292.   def phase3_setup_command_window
  293.     scene_battle_icon_command_phase3_setup_command_window
  294.     # アクターコマンドウィンドウの位置を設定
  295.     @actor_command_window.x = command_window_actor_x(@actor_index)
  296.     @actor_command_window.y = command_window_actor_y(@actor_index)
  297.     @actor_command_window.need_reset
  298.   end
  299.   def command_window_actor_x(index)
  300.     $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  301.   end
  302.   def command_window_actor_y(index)
  303.     $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  304.   end
  305. end

  306. #==========================================================================
  307. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  308. #==========================================================================

复制代码
[/fold]
[fold=相应武器才能施展的技能]
  1. class Game_Actor
  2.   WEAPONSKILL = []
  3.   WEAPONSKILL[1] = 80#1号武器自带80号特技,根据需要自己添加修改
  4.   WEAPONSKILL[2] = 70#2号武器自带70号特技
  5.   alias oldsetup setup
  6.   def setup(actor_id)
  7.     oldsetup(actor_id)
  8.     change_weapon_skill($data_actors[actor_id].weapon_id)
  9.   end
  10.   def forget_skill(skill_id)
  11.     unless skill_id == @weapon_skill
  12.       @skills.delete(skill_id)
  13.     end
  14.   end
  15.   def learn_skill(skill_id)
  16.     if skill_id == @weapon_skill
  17.       @weapon_skill = nil
  18.       return
  19.     end
  20.     if skill_id > 0 and not skill_learn?(skill_id)
  21.       @skills.push(skill_id)
  22.       @skills.sort!
  23.     end
  24.   end
  25.   def change_weapon_skill(weapon_id)
  26.     if @weapon_skill != nil
  27.       @skills.delete(@weapon_skill)
  28.       @weapon_skill = nil
  29.     end
  30.     unless skill_learn?(WEAPONSKILL[weapon_id]) or WEAPONSKILL[weapon_id] == nil
  31.       learn_skill(WEAPONSKILL[weapon_id])
  32.       @weapon_skill = WEAPONSKILL[weapon_id]
  33.     end
  34.   end
  35.   def equip(equip_type, id)
  36.     case equip_type
  37.     when 0  # 武器
  38.       if id == 0 or $game_party.weapon_number(id) > 0
  39.         $game_party.gain_weapon(@weapon_id, 1)
  40.         change_weapon_skill(id)
  41.         @weapon_id = id
  42.         $game_party.lose_weapon(id, 1)
  43.       end
  44.     when 1  # 盾
  45.       if id == 0 or $game_party.armor_number(id) > 0
  46.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  47.         $game_party.gain_armor(@armor1_id, 1)
  48.         @armor1_id = id
  49.         $game_party.lose_armor(id, 1)
  50.       end
  51.     when 2  # 头
  52.       if id == 0 or $game_party.armor_number(id) > 0
  53.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  54.         $game_party.gain_armor(@armor2_id, 1)
  55.         @armor2_id = id
  56.         $game_party.lose_armor(id, 1)
  57.       end
  58.     when 3  # 身体
  59.       if id == 0 or $game_party.armor_number(id) > 0
  60.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  61.         $game_party.gain_armor(@armor3_id, 1)
  62.         @armor3_id = id
  63.         $game_party.lose_armor(id, 1)
  64.       end
  65.     when 4  # 装饰品
  66.       if id == 0 or $game_party.armor_number(id) > 0
  67.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  68.         $game_party.gain_armor(@armor4_id, 1)
  69.         @armor4_id = id
  70.         $game_party.lose_armor(id, 1)
  71.       end
  72.     end
  73.   end
  74. end
复制代码
[/fold]

其他
[fold=魔法商店]
  1. #==============================================================================
  2. # ■ 本脚本源自www.66rpg.com,转载与使用请保留此信息
  3. #==============================================================================

  4. #——以下是一些自定义的内容

  5. $mShop_use_1 = "金钱"    #——这项是购买魔法特技的货币的名称,如“灵魄”、“金钱”

  6. $mShop_use_2 = "金"  #——这项是购买魔法特技的货币单位,如“点”、“¥”

  7. $mShop_use_variable = 1  #——这项是购买魔法特技时消耗的变量编号,如果=0 则是消耗金钱

  8. $mShop_Window_Opacity = 200  #——这项是窗口透明度

  9. #==============================================================================
  10. # ■ Window_MGold
  11. #------------------------------------------------------------------------------
  12. #  显示金钱的窗口。
  13. #==============================================================================
  14. class Window_MGold < Window_Base
  15.   #--------------------------------------------------------------------------
  16.   # ● 初始化窗口
  17.   #--------------------------------------------------------------------------
  18.   def initialize
  19.     super(0, 0, 272, 64)
  20.     self.contents = Bitmap.new(width - 32, height - 32)
  21.     refresh
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # ● 刷新
  25.   #--------------------------------------------------------------------------
  26.   def refresh
  27.     self.contents.clear
  28.     self.contents.font.color = system_color
  29.     self.contents.draw_text(0, 0 , 240,32 ,$mShop_use_1)
  30.     self.contents.font.color = normal_color
  31.     self.contents.draw_text(0, 0, 240-contents.text_size($mShop_use_2).width-6, 32, $mShop_gold.to_s, 2)
  32.     self.contents.font.color = system_color
  33.     self.contents.draw_text(0, 0, 240, 32, $mShop_use_2, 2)
  34.   end
  35. end
  36. #==============================================================================
  37. # ■ Scene_MShop
  38. #------------------------------------------------------------------------------
  39. #  处理特技商店画面的类。
  40. #==============================================================================
  41. class Scene_MShop
  42.   #--------------------------------------------------------------------------
  43.   # ● 初始化
  44.   #--------------------------------------------------------------------------
  45.   def initialize(id)
  46.     @id = id
  47.   end  
  48.   #--------------------------------------------------------------------------
  49.   # ● 主处理
  50.   #--------------------------------------------------------------------------
  51.   def main
  52.     screen = Spriteset_Map.new
  53.     if $mShop_use_variable == 0
  54.       $mShop_gold = $game_party.gold
  55.     else
  56.       $mShop_gold = $game_variables[$mShop_use_variable]
  57.     end
  58.     # 生成帮助窗口
  59.     @help_window = Window_Help.new
  60.     @help_window.opacity = $mShop_Window_Opacity

  61.     # 生成金钱窗口
  62.     @gold_window = Window_MGold.new
  63.     @gold_window.x = 368
  64.     @gold_window.y = 416
  65.     @gold_window.opacity = $mShop_Window_Opacity
  66.     # 生成购买窗口
  67.     @buy_window = Window_MShopBuy.new(@id)
  68.     @buy_window.active = true
  69.     @buy_window.visible = true
  70.     @buy_window.help_window = @help_window
  71.     @buy_window.opacity = $mShop_Window_Opacity
  72.     # 生成状态窗口
  73.     @status_window = Window_MShopStatus.new
  74.     @status_window.visible = true
  75.     @status_window.active = false
  76.     @status_window.opacity = $mShop_Window_Opacity
  77.         
  78.     #生成指令窗口
  79.     @command_window = Window_Command.new(160,["学习","遗忘"])
  80.     @command_window.x = 320
  81.     @command_window.y = 240
  82.     @command_window.z = 500
  83.     @command_window.visible = false
  84.     @command_window.active = false
  85.     @command_window.opacity = $mShop_Window_Opacity
  86.    
  87.     # 执行过渡
  88.     Graphics.transition
  89.     # 主循环
  90.     loop do
  91.       # 刷新游戏画面
  92.       Graphics.update
  93.       # 刷新输入信息
  94.       Input.update
  95.       # 刷新画面
  96.       update
  97.       # 如果画面切换的话就中断循环
  98.       if $scene != self
  99.         break
  100.       end
  101.     end
  102.     # 准备过渡
  103.     Graphics.freeze
  104.     # 释放窗口
  105.     @help_window.dispose
  106.     #@mhelp_window.dispose
  107.     @gold_window.dispose
  108.     @buy_window.dispose
  109.     @status_window.dispose
  110.     @command_window.dispose
  111.     screen.dispose
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # ● 刷新画面
  115.   #--------------------------------------------------------------------------
  116.   def update
  117.     # 刷新窗口
  118.     @help_window.update
  119.     #@mhelp_window.update
  120.     @gold_window.update
  121.     @buy_window.update
  122.     @status_window.update
  123.     @command_window.update
  124.     # 购买窗口激活的情况下: 调用 update_buy
  125.     if @buy_window.active
  126.       update_buy
  127.       return
  128.     end
  129.     if @status_window.active
  130.       update_status
  131.       return
  132.     end
  133.     if @command_window.active
  134.       update_command
  135.       return
  136.     end
  137.    
  138.   end
  139.   
  140.   #--------------------------------------------------------------------------
  141.   # ● 刷新画面 (指令窗口激活的情况下)
  142.   #--------------------------------------------------------------------------
  143.   def update_command
  144.     if Input.trigger?(Input::B)
  145.       $game_system.se_play($data_system.cancel_se)
  146.       @status_window.index = -1
  147.       @command_window.active = false
  148.       @command_window.visible = false
  149.       @buy_window.active = true
  150.       return
  151.     end
  152.     if Input.trigger?(Input::C)
  153.       if @command_window.index == 0      
  154.         if $game_party.actors[@status_window.index].skill_learn?(@skill.id) or @skill.price >$mShop_gold
  155.           $game_system.se_play($data_system.cancel_se)
  156.           return
  157.         else
  158.           $game_system.se_play($data_system.decision_se)
  159.           if $mShop_use_variable == 0
  160.             $game_party.gain_gold(-@skill.price)
  161.             $mShop_gold -= @skill.price
  162.           else
  163.             $game_variables[$mShop_use_variable] -= @skill.price
  164.             $mShop_gold -= @skill.price
  165.           end
  166.           $game_party.actors[@status_window.index].learn_skill(@skill.id)
  167.           @gold_window.refresh
  168.           @buy_window.refresh
  169.           @status_window.refresh
  170.           @status_window.index = -1
  171.           @buy_window.active = true
  172.           @command_window.active = false
  173.           @command_window.visible = false   
  174.         end
  175.       elsif  @command_window.index == 1
  176.         if $game_party.actors[@status_window.index].skill_learn?(@skill.id) == false
  177.           $game_system.se_play($data_system.cancel_se)
  178.           return
  179.         else
  180.           $game_system.se_play($data_system.decision_se)
  181.           if $mShop_use_variable == 0
  182.             $game_party.gain_gold(@skill.price/2)  #<-遗忘价格为学习的一半,/2的地方相同
  183.             $mShop_gold += @skill.price/2
  184.           else
  185.             $game_variables[$mShop_use_variable] += @skill.price/2
  186.             $mShop_gold += @skill.price/2
  187.           end
  188.           $game_party.actors[@status_window.index].forget_skill(@skill.id)
  189.           @gold_window.refresh
  190.           @buy_window.refresh
  191.           @status_window.refresh
  192.           @status_window.index = -1
  193.           @buy_window.active = true
  194.           @command_window.active = false
  195.           @command_window.visible = false
  196.         end
  197.       end
  198.       return
  199.     end
  200.   end
  201.   
  202.   #--------------------------------------------------------------------------
  203.   # ● 刷新画面 (购买窗口激活的情况下)
  204.   #--------------------------------------------------------------------------
  205.   def update_buy
  206.     @status_window.skill = @buy_window.skill
  207.     if Input.trigger?(Input::B)
  208.       $game_system.se_play($data_system.cancel_se)
  209.       $scene = Scene_Map.new
  210.       return
  211.     end
  212.     if Input.trigger?(Input::C)
  213.       @skill = @buy_window.skill
  214.       if @skill == nil #or @skill.price > $mShop_gold  
  215.         $game_system.se_play($data_system.buzzer_se)
  216.         return
  217.       end
  218.       $game_system.se_play($data_system.decision_se)
  219.       @buy_window.active = false
  220.       @status_window.index = 0
  221.       @status_window.active = true
  222.     end
  223.   end
  224.   #--------------------------------------------------------------------------
  225.   # ● 刷新画面 (状态窗口激活的情况下)
  226.   #--------------------------------------------------------------------------
  227.   def update_status
  228.     if Input.trigger?(Input::B)
  229.       $game_system.se_play($data_system.cancel_se)
  230.       @status_window.active = false
  231.       @status_window.index = -1
  232.       @buy_window.active = true
  233.     end
  234.     if Input.trigger?(Input::C)
  235.        @status_window.active = false
  236.        @command_window.visible = true
  237.        @command_window.active = true
  238.     end   
  239.   end
  240. end
  241. #==============================================================================
  242. # ■ Window_MShopStatus
  243. #------------------------------------------------------------------------------
  244. #  特技商店画面、显示物品所持数与角色装备的窗口。
  245. #==============================================================================
  246. class Window_MShopStatus < Window_Selectable
  247.   #--------------------------------------------------------------------------
  248.   # ● 初始化对像
  249.   #--------------------------------------------------------------------------
  250.   def initialize
  251.     super(368, 64, 272, 352)
  252.     self.contents = Bitmap.new(width - 32, height - 32)
  253.     self.contents.font.size = 18
  254.     @skill = nil
  255.     refresh
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ● 刷新
  259.   #--------------------------------------------------------------------------
  260.   def refresh
  261.     self.contents.clear
  262.     for i in 0...$game_party.actors.size
  263.       actor = $game_party.actors[i]
  264.       draw_actor_graphic(actor,12,80*i+64)
  265.       self.contents.font.color = system_color
  266.       self.contents.draw_text(44, 80*i, 240, 32, actor.name)
  267.       self.contents.draw_text(0, 80*i , 240-20,32,"等级",2)
  268.       self.contents.font.color = normal_color
  269.       self.contents.draw_text(0, 80*i, 240, 32, actor.level.to_s , 2)
  270.       self.contents.font.color = system_color
  271.       self.contents.draw_text(44, 80*i+22, 45, 32, $data_system.words.hp)
  272.       self.contents.font.color = normal_color
  273.       self.contents.draw_text(44, 80*i+22, 90, 32, actor.maxhp.to_s,2)
  274.       self.contents.font.color = system_color
  275.       self.contents.draw_text(150, 80*i+22, 45, 32, $data_system.words.sp)
  276.       self.contents.font.color = normal_color
  277.       self.contents.draw_text(150, 80*i+22, 90, 32, actor.maxsp.to_s,2)      
  278.       if actor.skill_learn?(@skill.id)
  279.         self.contents.font.color = Color.new(255,255,255,128)
  280.         self.contents.draw_text(44, 80*i+44, 196, 32, "⊙此项特技已经学习⊙",2)        
  281.       else
  282.         self.contents.font.color = Color.new(255,255,0,255)
  283.         self.contents.draw_text(44, 80*i+44, 240, 32, "★此项特技尚未学习★")
  284.       end
  285.     end
  286.     @item_max = $game_party.actors.size
  287.   end
  288.   #--------------------------------------------------------------------------
  289.   # ● 设置物品
  290.   #     item : 新的物品
  291.   #--------------------------------------------------------------------------
  292.   def skill=(skill)
  293.     if @skill != skill
  294.       @skill = skill
  295.       refresh
  296.     end
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ● 刷新光标矩形
  300.   #--------------------------------------------------------------------------
  301.   def update_cursor_rect
  302.     if @index < 0
  303.       self.cursor_rect.empty
  304.     else
  305.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  306.     end
  307.   end
  308. end
  309. #==============================================================================
  310. # ■ Window_MShopBuy
  311. #------------------------------------------------------------------------------
  312. #  特技商店画面、浏览显示可以购买的商品的窗口。
  313. #==============================================================================
  314. class Window_MShopBuy < Window_Selectable
  315.   #--------------------------------------------------------------------------
  316.   # ● 初始化对像
  317.   #     shop_goods : 商品
  318.   #--------------------------------------------------------------------------
  319.   def initialize(id)
  320.     super(0, 64, 368, 416)
  321.     @id = id
  322.     refresh
  323.     self.index = 0
  324.   end
  325.   #--------------------------------------------------------------------------
  326.   # ● 获取物品
  327.   #--------------------------------------------------------------------------
  328.   def skill
  329.     return @data[self.index]
  330.   end
  331.   #--------------------------------------------------------------------------
  332.   # ● 刷新
  333.   #--------------------------------------------------------------------------
  334.   def refresh
  335.     if self.contents != nil
  336.       self.contents.dispose
  337.       self.contents = nil
  338.     end
  339.     @data = []
  340.     for skill_id in @id
  341.       skill = $data_skills[skill_id]
  342.       if skill != nil
  343.         @data.push(skill)
  344.       end
  345.     end
  346.     @item_max = @data.size
  347.     if @item_max > 0
  348.       self.contents = Bitmap.new(width - 32, row_max * 32)
  349.       for i in 0...@item_max
  350.         draw_item(i)
  351.       end
  352.     end
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● 描绘羡慕
  356.   #     index : 项目编号
  357.   #--------------------------------------------------------------------------
  358.   def draw_item(index)
  359.     skill = @data[index]
  360.     # 除此之外的情况设置为无效文字色
  361.     if skill.price <= $mShop_gold
  362.       self.contents.font.color = normal_color
  363.     else
  364.       self.contents.font.color = disabled_color
  365.     end
  366.     x = 4
  367.     y = index * 32
  368.     rect = Rect.new(x, y, self.width - 32, 32)
  369.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  370.     bitmap = RPG::Cache.icon(skill.icon_name)
  371.     opacity = self.contents.font.color == normal_color ? 255 : 128
  372.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  373.     self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
  374.     self.contents.draw_text(x + 240, y, 88, 32, skill.price.to_s, 2)
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 刷新帮助文本
  378.   #--------------------------------------------------------------------------
  379.   def update_help
  380.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  381.   end
  382. end
  383. #==============================================================================
  384. # ■ RPG原装定义
  385. #==============================================================================
  386. module RPG
  387.   class Skill
  388.     def description
  389.       description = @description.split(/@/)[0]
  390.       return description != nil ? description : ''
  391.     end
  392.     def price
  393.       price = @description.split(/@/)[1]
  394.       return price != nil ? price.to_i : 0
  395.     end
  396.   end
  397. end
复制代码
[/fold]
[fold=地图上显示伤害数值]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #
  5. # 使用方法:
  6. #  
  7. # ★、对角色显示伤害,如下3步:
  8. #
  9. # 1、设置伤害内容:$game_player.damage = 数值
  10. #                  $game_player.damage = $game_variables[变量编号]  
  11. #    注意:如果数值是负数,就变成补血的颜色了。
  12. #
  13. # 2、设置是否会心一击:$game_player.critical = true/false
  14. #    如果不是会心一击,就不用这一步了
  15. #
  16. # 3、释放伤害:$game_player.damage_pop = true
  17. #
  18. #
  19. # ★、对普通NPC和事件进行伤害,类似的3步:
  20. #
  21. # 1、设置伤害内容:$game_map.events[事件编号].damage = 数值
  22. #                  $game_map.events[事件编号].damage = $game_variables[变量编号]
  23. #  
  24. # 2、设置是否会心一击:$game_map.events[事件编号].critical = true/false
  25. #
  26. # 3、释放伤害:$game_map.events[事件编号].damage_pop = true
  27. #
  28. # 注意,事件编号是事件的ID号,如果目标是“本事件”,那么在事件编号输入@event_id
  29. #
  30. #------------------------------------------------------------------------------
  31. # 预祝有人能早日做出华丽的ARPG来,别忘了到网站发布哦~
  32. #------------------------------------------------------------------------------
  33. class Sprite_Character < RPG::Sprite
  34.   alias carol3_66RPG_damage_pop_update update
  35.   def update
  36.     carol3_66RPG_damage_pop_update
  37.     if @character.damage_pop
  38.       damage(@character.damage, @character.critical)
  39.       @character.damage = nil
  40.       @character.critical = false
  41.       @character.damage_pop = false
  42.     end
  43.   end   
  44. end
  45. class Game_Character
  46.   attr_accessor :damage_pop
  47.   attr_accessor :damage
  48.   attr_accessor :critical
  49.   alias carol3_66RPG_damage_pop_initialize initialize
  50.   def initialize
  51.     @damage_pop = false
  52.     @damage = 0
  53.     @critical = false
  54.     carol3_66RPG_damage_pop_initialize
  55.   end
  56. end
  57. #==============================================================================
  58. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  59. #==============================================================================
复制代码
[/fold]
[fold=环状菜单]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. # ————————————————————————————————————
  5. # ▼▲▼ XRXS_MP 6. 环形菜单 ▼▲▼
  6. # by 和希
  7. ###############################################################################
  8. # 环形菜单脚本(中文注释版)
  9. # writen by 和希
  10. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11. # ▽导入
  12. # 1.在脚本编辑器的Main的前一个位置进行插入操作,然后将本脚本复制到新的页里
  13. # 2.Window_RingMenu最开始的7个RPG::Cache.icon("") 的 "" 的中的图标作用在右边
  14. #     的说明里标注了分别是什么项目的,可以根据需要进行修改
  15. #     (最下方禁止使用项目的图标建议使用类似“φ”的图标)
  16. #     (译者按:就是原图标上多一个横杠或是斜杠的图片)
  17. # 3.类常量定义最下方的 SE_STARTUP = "" 的 "" 的中是打开菜单时的音效的名字
  18. #
  19. ###############################################################################

  20. #==============================================================================
  21. # ■ Window_RingMenu
  22. #------------------------------------------------------------------------------
  23. #  显示环形菜单画面
  24. #==============================================================================
  25. class Window_RingMenu < Window_Base
  26.   #--------------------------------------------------------------------------
  27.   # ○ 类常量定义
  28.   # 这里定义的变量是整个Window_RingMenu类都可以用的常量
  29.   # 所有变量名都是用大写,以区别其他变量
  30.   #--------------------------------------------------------------------------
  31.   # 打开菜单使用的帧数,数字越小打开菜单时速度越快
  32.   STARTUP_FRAMES =  20
  33.   # 切换选项时使用的帧数,数字越小切换选项速度越快
  34.   MOVING_FRAMES = 5
  35.   # 环的半径(单位:象素),数字越大环越大←本句为废话
  36.   RING_R = 64
  37.   # 定义各种图标,以便之后使用
  38.   ICON_ITEM = RPG::Cache.icon("034-Item03")       # 「道具」项目的图标
  39.   ICON_SKILL = RPG::Cache.icon("044-Skill01")     # 「特技」项目的图标
  40.   ICON_EQUIP = RPG::Cache.icon("001-Weapon01")    # 「装备」项目的图标
  41.   ICON_STATUS = RPG::Cache.icon("050-Skill07")    # 「状态」项目的图标
  42.   ICON_SAVE = RPG::Cache.icon("038-Item07")       # 「存储」项目的图标
  43.   ICON_EXIT = RPG::Cache.icon("046-Skill03")      # 「结束」项目的图标
  44.   ICON_DISABLE= RPG::Cache.icon("")               # 禁止使用项目的图标
  45.   # 打开菜单时的音效
  46.   SE_STARTUP = "056-Right02"
  47.   # 定义各种状态时的赋值。
  48.   # 译注:对于程序而言,个人感觉多此一举…不过的确方便了阅读
  49.   MODE_START = 1  # 动画开始时
  50.   MODE_WAIT  = 2  # 待机中
  51.   MODE_MOVER = 3  # 顺时针旋转(往右)
  52.   MODE_MOVEL = 4  # 逆时针旋转(往左)
  53.   #--------------------------------------------------------------------------
  54.   # ○ 定义实例变量
  55.   #--------------------------------------------------------------------------
  56.   attr_accessor :index # ?
  57.   #--------------------------------------------------------------------------
  58.   # ● 初始化对象
  59.   #--------------------------------------------------------------------------
  60.   def initialize( center_x, center_y )
  61.     super(0, 0, 640, 480)
  62.     self.contents = Bitmap.new(width-32, height-32)
  63.     self.opacity = 0
  64.     self.back_opacity = 0
  65.     s1 = $data_system.words.item
  66.     s2 = $data_system.words.skill
  67.     s3 = $data_system.words.equip
  68.     s4 = "状态"
  69.     s5 = "储存"
  70.     s6 = "结束"
  71.     @commands = [ s1, s2, s3, s4, s5, s6 ]
  72.     @item_max = 6
  73.     @index = 0
  74.     @items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_SAVE, ICON_EXIT ]
  75.     @disabled = [ false, false, false, false, false, false ]
  76.     @cx = center_x - 16
  77.     @cy = center_y - 16
  78.     # 初始化动画
  79.     setup_move_start
  80.     # 刷新
  81.     refresh
  82.   end
  83.    
  84.   #--------------------------------------------------------------------------
  85.   # ● 刷新画面
  86.   #--------------------------------------------------------------------------
  87.   def update
  88.     super
  89.     refresh
  90.   end
  91.    
  92.   #--------------------------------------------------------------------------
  93.   # ● 画面描绘(刷新)
  94.   #--------------------------------------------------------------------------
  95.   def refresh
  96.     self.contents.clear
  97.      
  98.     # 选择描绘方式
  99.     case @mode
  100.     when MODE_START
  101.       refresh_start
  102.     when MODE_WAIT
  103.       refresh_wait
  104.     when MODE_MOVER
  105.       refresh_move(1)
  106.     when MODE_MOVEL
  107.       refresh_move(0)
  108.     end
  109.     # 指令名描绘
  110.     rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
  111.     self.contents.draw_text(rect, @commands[@index],1)
  112.   end
  113.    
  114.   #--------------------------------------------------------------------------
  115.   # ○ 画面生成
  116.   #--------------------------------------------------------------------------
  117.   def refresh_start
  118.     d1 = 2.0 * Math::PI / @item_max
  119.     d2 = 1.0 * Math::PI / STARTUP_FRAMES
  120.     r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
  121.     for i in 0...@item_max
  122.       j = i - @index
  123.       d = d1 * j + d2 * @steps
  124.       x = @cx + ( r * Math.sin( d ) ).to_i
  125.       y = @cy - ( r * Math.cos( d ) ).to_i
  126.       draw_item(x, y, i)
  127.     end
  128.     @steps -= 1
  129.     if @steps < 1
  130.       @mode = MODE_WAIT
  131.     end
  132.   end
  133.    
  134.   #--------------------------------------------------------------------------
  135.   # ○ 画面再描绘(待机时)
  136.   #--------------------------------------------------------------------------
  137.   def refresh_wait
  138.     d = 2.0 * Math::PI / @item_max
  139.     for i in 0...@item_max
  140.       j = i - @index
  141.       x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
  142.       y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
  143.       draw_item(x, y, i)
  144.     end
  145.   end
  146.    
  147.   #--------------------------------------------------------------------------
  148.   # ○ 画面再描绘(旋转时)
  149.   #   mode : 旋转方向(0 : 逆时针旋转时,1 : 顺时针旋转时)
  150.   #--------------------------------------------------------------------------
  151.   def refresh_move( mode )
  152.     d1 = 2.0 * Math::PI / @item_max
  153.     d2 = d1 / MOVING_FRAMES
  154.     d2 *= -1 if mode != 0
  155.     for i in 0...@item_max
  156.       # 以下便是那华丽的曲线公式
  157.       j = i - @index
  158.       d = d1 * j + d2 * @steps
  159.       x = @cx + ( RING_R * Math.sin( d ) ).to_i
  160.       y = @cy - ( RING_R * Math.cos( d ) ).to_i
  161.       draw_item(x, y, i)
  162.     end
  163.     @steps -= 1
  164.     if @steps < 1
  165.       @mode = MODE_WAIT
  166.     end
  167.   end
  168.    
  169.   #--------------------------------------------------------------------------
  170.   # ● 描绘图片
  171.   # i : 项目编号
  172.   #--------------------------------------------------------------------------
  173.   def draw_item(x, y, i)
  174.     rect = Rect.new(0, 0, @items[i].width, @items[i].height)
  175.     if @index == i
  176.       self.contents.blt( x, y, @items[i], rect )
  177.       if @disabled[@index]
  178.         self.contents.blt( x, y, ICON_DISABLE, rect )
  179.       end
  180.     else
  181.       self.contents.blt( x, y, @items[i], rect, 128 )
  182.       if @disabled[@index]
  183.         self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
  184.       end
  185.     end
  186.   end
  187.    
  188.   #--------------------------------------------------------------------------
  189.   # ● 项目无效化
  190.   # index : 项目编号
  191.   #--------------------------------------------------------------------------
  192.   def disable_item(index)
  193.     @disabled[index] = true
  194.   end
  195.    
  196.   #--------------------------------------------------------------------------
  197.   # ○ 初始化动画准备
  198.   #--------------------------------------------------------------------------
  199.   def setup_move_start
  200.     @mode = MODE_START
  201.     @steps = STARTUP_FRAMES
  202.     if SE_STARTUP != nil and SE_STARTUP != ""
  203.       Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
  204.     end
  205.   end
  206.    
  207.   #--------------------------------------------------------------------------
  208.   # ○ 回转动画准备
  209.   #--------------------------------------------------------------------------
  210.   def setup_move_move(mode)
  211.     if mode == MODE_MOVER
  212.       @index -= 1
  213.       @index = @items.size - 1 if @index < 0
  214.     elsif mode == MODE_MOVEL
  215.       @index += 1
  216.       @index = 0 if @index >= @items.size
  217.     else
  218.       return
  219.     end
  220.     @mode = mode
  221.     @steps = MOVING_FRAMES
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ○ 判断是否在动画中
  225.   #--------------------------------------------------------------------------
  226.   def animation?
  227.     return @mode != MODE_WAIT
  228.   end
  229. end

  230. #==============================================================================
  231. # ■ Window_RingMenuStatus
  232. #------------------------------------------------------------------------------
  233. #  显示环形菜单画面下同伴状态的窗口。
  234. #   本窗口定义与Window_MenuStatus雷同
  235. #==============================================================================
  236. class Window_RingMenuStatus < Window_Selectable
  237.   #--------------------------------------------------------------------------
  238.   # ● 初始化对象
  239.   #--------------------------------------------------------------------------
  240.   def initialize
  241.     super(60, 64, 232, 352)
  242.     self.contents = Bitmap.new(width - 32, height - 32)
  243.     refresh
  244.     self.active = false
  245.     self.index = -1
  246.   end
  247.    
  248.   #--------------------------------------------------------------------------
  249.   # ● 刷新
  250.   #--------------------------------------------------------------------------
  251.   def refresh
  252.     self.contents.clear
  253.     @item_max = $game_party.actors.size
  254.     for i in 0...$game_party.actors.size
  255.       x = 80
  256.       y = 80 * i
  257.       actor = $game_party.actors[i]
  258.       draw_actor_graphic(actor, x - 40, y + 80)
  259.       draw_actor_name(actor, x, y + 24)
  260.     end
  261.   end
  262.    
  263.   #--------------------------------------------------------------------------
  264.   # ● 刷新光标矩形
  265.   #--------------------------------------------------------------------------
  266.   def update_cursor_rect
  267.     if @index < 0
  268.       self.cursor_rect.empty
  269.     else
  270.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  271.     end
  272.   end
  273. end
  274. #==============================================================================
  275. # ■ Scene_Menu
  276. #------------------------------------------------------------------------------
  277. #   处理环形菜单的类。(再定义)
  278. #==============================================================================
  279. class Scene_Menu
  280.   #--------------------------------------------------------------------------
  281.   # ● 初始化对象
  282.   # menu_index : 命令光标初始位置
  283.   #--------------------------------------------------------------------------
  284.   def initialize(menu_index = 0)
  285.     @menu_index = menu_index
  286.   end
  287.    
  288.   #--------------------------------------------------------------------------
  289.   # ● 主处理
  290.   #--------------------------------------------------------------------------
  291.   def main
  292.     # 获取地图信息
  293.     # 这个是用来生成游戏画面作为背景,如果没有此行,那么打开菜单后背景就是全黑的
  294.     @spriteset = Spriteset_Map.new
  295.     # 获取角色坐标,并生成命令窗口
  296.     px = $game_player.screen_x - 15
  297.     py = $game_player.screen_y - 24
  298.     @command_window = Window_RingMenu.new(px,py)
  299.     @command_window.index = @menu_index
  300.     # 同伴人数为 0 的情况下
  301.     if $game_party.actors.size == 0
  302.       # 物品、特技、装备、状态无效化
  303.       @command_window.disable_item(0)
  304.       @command_window.disable_item(1)
  305.       @command_window.disable_item(2)
  306.       @command_window.disable_item(3)
  307.     end
  308.    
  309.     # 这个属性z的含意就是z坐标轴,这个坐标轴的0点在背景上
  310.     # 往上(就是背景以上的层)是正方向,换言之,z越大的窗口在显示时越排在前面
  311.     # 两个z相同的窗口,后生成的排在前面。数字差要在2以上才能产生效果
  312.     # 也就是说两个窗口的z坐标是“100和100”与“100和101”效果是一样的
  313.     # 总的来讲,这个属性z就是图块设置里的优先级…数字大的优先级高
  314.     @command_window.z = 100
  315.    
  316.     # 禁止存档的情况下
  317.     if $game_system.save_disabled
  318.       # 存档无效
  319.       @command_window.disable_item(4)
  320.     end
  321.      
  322.     # 生成环形菜单的状态窗口
  323.     # visible : 可视性
  324.     @status_window = Window_RingMenuStatus.new
  325.     @status_window.x = 20
  326.     @status_window.y = 50
  327.     @status_window.z = 100
  328.     @status_window.visible = false
  329.    
  330.     # 执行过渡
  331.     Graphics.transition
  332.     # 主循环
  333.     loop do
  334.       # 刷新游戏画面
  335.       Graphics.update
  336.       # 刷新输入信息
  337.       Input.update
  338.       # 刷新画面
  339.       update
  340.       # 如果切换画面就中断循环
  341.       if $scene != self
  342.         break
  343.       end
  344.     end
  345.     # 准备过渡
  346.     Graphics.freeze
  347.     # 释放窗口及地图画面
  348.     @spriteset.dispose
  349.     @command_window.dispose
  350.     @status_window.dispose
  351.   end
  352.    
  353.   #--------------------------------------------------------------------------
  354.   # ● 刷新画面
  355.   #--------------------------------------------------------------------------
  356.   def update
  357.     # 刷新窗口
  358.     @command_window.update
  359.     @status_window.update
  360.     # 命令窗口被激活的情况下: 调用 update_command
  361.     if @command_window.active
  362.       update_command
  363.       return
  364.     end
  365.     # 状态窗口被激活的情况下: 调用 update_status
  366.     if @status_window.active
  367.       update_status
  368.     return
  369.     end
  370.   end
  371.    
  372.   #--------------------------------------------------------------------------
  373.   # ● 刷新画面 (命令窗口被激活的情况下)
  374.   #--------------------------------------------------------------------------
  375.   def update_command
  376.     # 按下 B 键的情况下
  377.     if Input.trigger?(Input::B)
  378.       # 演奏取消 SE
  379.       $game_system.se_play($data_system.cancel_se)
  380.       # 切换的地图画面
  381.       $scene = Scene_Map.new
  382.       return
  383.     end
  384.     # 按下 C 键的情况下
  385.     if Input.trigger?(Input::C)
  386.       # 同伴人数为 0、存档、游戏结束以外的场合
  387.       if $game_party.actors.size == 0 and @command_window.index < 4
  388.         # 演奏冻结 SE
  389.         $game_system.se_play($data_system.buzzer_se)
  390.         return
  391.       end
  392.       
  393.       # 命令窗口的光标位置分支
  394.       case @command_window.index
  395.       when 0 # 物品
  396.         # 演奏确定 SE
  397.         $game_system.se_play($data_system.decision_se)
  398.         # 切换到物品画面
  399.         $scene = Scene_Item.new
  400.       when 1 # 特技
  401.         # 演奏确定 SE
  402.         $game_system.se_play($data_system.decision_se)
  403.         # 激活状态窗口
  404.         @command_window.active = false
  405.         @status_window.active = true
  406.         @status_window.visible = true
  407.         @status_window.index = 0
  408.       when 2 # 装备
  409.         # 演奏确定 SE
  410.         $game_system.se_play($data_system.decision_se)
  411.         # 激活状态窗口
  412.         @command_window.active = false
  413.         @status_window.active = true
  414.         @status_window.visible = true
  415.         @status_window.index = 0
  416.       when 3 # 状态
  417.         # 演奏确定 SE
  418.         $game_system.se_play($data_system.decision_se)
  419.         # 激活状态窗口
  420.         @command_window.active = false
  421.         @status_window.active = true
  422.         @status_window.visible = true
  423.         @status_window.index = 0
  424.       when 4 # 存档
  425.         # 禁止存档的情况下
  426.         if $game_system.save_disabled
  427.           # 演奏冻结 SE
  428.           $game_system.se_play($data_system.buzzer_se)
  429.           return
  430.         end
  431.         # 演奏确定 SE
  432.         $game_system.se_play($data_system.decision_se)
  433.         # 切换到存档画面
  434.         $scene = Scene_Save.new
  435.       when 5 # 游戏结束
  436.         # 演奏确定 SE
  437.         $game_system.se_play($data_system.decision_se)
  438.         # 切换到游戏结束画面
  439.         $scene = Scene_End.new
  440.       when 6
  441.         $game_system.se_play($data_system.decision_se)   
  442.         $scene = Scene_End.new
  443.       end
  444.       return
  445.     end
  446.     # 动画中不能执行光标处理
  447.     # 这句的意思就是如果正处于动画中就return,这样下面的语句就不会执行了
  448.     # 换言之,如果正处于动画处理中,那么就无法移动菜单
  449.     return if @command_window.animation?
  450.     # 按下 ↑ 或 ← 键的情况下
  451.     if Input.press?(Input::UP) or Input.press?(Input::LEFT)
  452.       # 演奏光标 SE
  453.       $game_system.se_play($data_system.cursor_se)
  454.       # 向左旋转
  455.       @command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
  456.       return
  457.     end
  458.     # 按下 ↓ 或 → 键的情况下
  459.     if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
  460.       # 演奏光标 SE
  461.       $game_system.se_play($data_system.cursor_se)
  462.       # 向右旋转
  463.       @command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
  464.       return
  465.     end
  466.   end
  467.    
  468.   #--------------------------------------------------------------------------
  469.   # ● 刷新画面 (状态窗口被激活的情况下)
  470.   #--------------------------------------------------------------------------
  471.   def update_status
  472.     # 按下 B 键的情况下
  473.     if Input.trigger?(Input::B)
  474.       # 演奏取消 SE
  475.       $game_system.se_play($data_system.cancel_se)
  476.       # 激活命令窗口
  477.       @command_window.active = true
  478.       @status_window.active = false
  479.       @status_window.visible = false
  480.       @status_window.index = -1
  481.       return
  482.     end
  483.      
  484.     # 按下 C 键的情况下
  485.     if Input.trigger?(Input::C)
  486.       # 命令窗口的光标位置分支
  487.       case @command_window.index
  488.       when 1 # 特技
  489.         # 本角色的行动限制在 2 以上的情况下
  490.         if $game_party.actors[@status_window.index].restriction >= 2
  491.           # 演奏冻结 SE
  492.           $game_system.se_play($data_system.buzzer_se)
  493.           return
  494.         end
  495.         # 演奏确定 SE
  496.         $game_system.se_play($data_system.decision_se)
  497.         # 切换到状态画面
  498.         $scene = Scene_Skill.new(@status_window.index)
  499.       when 2 # 装備
  500.         # 演奏确定 SE
  501.         $game_system.se_play($data_system.decision_se)
  502.         # 切换到特技画面
  503.         $scene = Scene_Equip.new(@status_window.index)
  504.       when 3 # 装备
  505.         # 演奏确定 SE
  506.         $game_system.se_play($data_system.decision_se)
  507.         # 切换的装备画面
  508.         $scene = Scene_Status.new(@status_window.index)
  509.       end
  510.       return
  511.     end
  512.   end
  513. end
  514. #==============================================================================
  515. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  516. #==============================================================================
复制代码
[/fold]
[fold=全键盘脚本]
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #============================================================================
  5. # ■ Keyboard Script
  6. #----------------------------------------------------------------------------
  7. #  By: Cybersam
  8. #   Date: 25/05/05
  9. #   Version 4
  10. #============================================================================
  11. # 66对此脚本使用方法的说明(可能不是很准确,反正大体能用):
  12. #
  13. # ★、Kboard.keyboard(键位)  返回是否按下这个键的判断。
  14. #     比如条件分歧:Kboard.keyboard($R_Key_H)
  15. #                   则当按下键盘H键的时候条件分歧成立
  16. #
  17. # ★、Kboard.keyb(键位) == 1 当连续按住某键返回真,否则为false
  18. #     比如条件分歧:Kboard.keyb($R_Key_U) == 1
  19. #                   则当持续按下键盘U的时候条件分歧成立
  20. #
  21. # ★、Kboard.key(键位,1) 似乎可以做开关用。按下一次变为true,再按变false
  22. #============================================================================

  23. module Kboard
  24.   #==========================================================================
  25.   # 以下是全键盘按键列表
  26.   #--------------------------------------------------------------------------
  27.   $Rmouse_BUTTON_L = 0x01        # left mouse button
  28.   $Rmouse_BUTTON_R = 0x02        # right mouse button
  29.   $Rmouse_BUTTON_M = 0x04        # middle mouse button
  30.   $Rmouse_BUTTON_4 = 0x05        # 4th mouse button
  31.   $Rmouse_BUTTON_5 = 0x06        # 5th mouse button
  32.   #--------------------------------------------------------------------------
  33.   $R_Key_BACK      = 0x08        # BACKSPACE key
  34.   $R_Key_TAB       = 0x09        # TAB key
  35.   $R_Key_RETURN    = 0x0D        # ENTER key
  36.   $R_Key_SHIFT     = 0x10        # SHIFT key
  37.   $R_Key_CTLR      = 0x11        # CTLR key
  38.   $R_Key_ALT       = 0x12        # ALT key
  39.   $R_Key_PAUSE     = 0x13        # PAUSE key
  40.   $R_Key_CAPITAL   = 0x14        # CAPS LOCK key
  41.   $R_Key_ESCAPE    = 0x1B        # ESC key
  42.   $R_Key_SPACE     = 0x20        # SPACEBAR
  43.   $R_Key_PRIOR     = 0x21        # PAGE UP key
  44.   $R_Key_NEXT      = 0x22        # PAGE DOWN key
  45.   $R_Key_END       = 0x23        # END key
  46.   $R_Key_HOME      = 0x24        # HOME key
  47.   $R_Key_LEFT      = 0x25        # LEFT ARROW key
  48.   $R_Key_UP        = 0x26        # UP ARROW key
  49.   $R_Key_RIGHT     = 0x27        # RIGHT ARROW key
  50.   $R_Key_DOWN      = 0x28        # DOWN ARROW key
  51.   $R_Key_SELECT    = 0x29        # SELECT key
  52.   $R_Key_PRINT     = 0x2A        # PRINT key
  53.   $R_Key_SNAPSHOT  = 0x2C        # PRINT SCREEN key
  54.   $R_Key_INSERT    = 0x2D        # INS key
  55.   $R_Key_DELETE    = 0x2E        # DEL key
  56.   #--------------------------------------------------------------------------
  57.   $R_Key_0         = 0x30        # 0 key
  58.   $R_Key_1         = 0x31        # 1 key
  59.   $R_Key_2         = 0x32        # 2 key
  60.   $R_Key_3         = 0x33        # 3 key
  61.   $R_Key_4         = 0x34        # 4 key
  62.   $R_Key_5         = 0x35        # 5 key
  63.   $R_Key_6         = 0x36        # 6 key
  64.   $R_Key_7         = 0x37        # 7 key
  65.   $R_Key_8         = 0x38        # 8 key
  66.   $R_Key_9         = 0x39        # 9 key
  67.   #--------------------------------------------------------------------------
  68.   $R_Key_A         = 0x41        # A key
  69.   $R_Key_B         = 0x42        # B key
  70.   $R_Key_C         = 0x43        # C key
  71.   $R_Key_D         = 0x44        # D key
  72.   $R_Key_E         = 0x45        # E key
  73.   $R_Key_F         = 0x46        # F key
  74.   $R_Key_G         = 0x47        # G key
  75.   $R_Key_H         = 0x48        # H key
  76.   $R_Key_I         = 0x49        # I key
  77.   $R_Key_J         = 0x4A        # J key
  78.   $R_Key_K         = 0x4B        # K key
  79.   $R_Key_L         = 0x4C        # L key
  80.   $R_Key_M         = 0x4D        # M key
  81.   $R_Key_N         = 0x4E        # N key
  82.   $R_Key_O         = 0x4F        # O key
  83.   $R_Key_P         = 0x50        # P key
  84.   $R_Key_Q         = 0x51        # Q key
  85.   $R_Key_R         = 0x52        # R key
  86.   $R_Key_S         = 0x53        # S key
  87.   $R_Key_T         = 0x54        # T key
  88.   $R_Key_U         = 0x55        # U key
  89.   $R_Key_V         = 0x56        # V key
  90.   $R_Key_W         = 0x57        # W key
  91.   $R_Key_X         = 0x58        # X key
  92.   $R_Key_Y         = 0x59        # Y key
  93.   $R_Key_Z         = 0x5A        # Z key
  94.   #--------------------------------------------------------------------------
  95.   $R_Key_LWIN      = 0x5B        # Left Windows key (Microsoft Natural keyboard)
  96.   $R_Key_RWIN      = 0x5C        # Right Windows key (Natural keyboard)
  97.   $R_Key_APPS      = 0x5D        # Applications key (Natural keyboard)
  98.   #--------------------------------------------------------------------------
  99.   $R_Key_NUMPAD0   = 0x60        # Numeric keypad 0 key
  100.   $R_Key_NUMPAD1   = 0x61        # Numeric keypad 1 key
  101.   $R_Key_NUMPAD2   = 0x62        # Numeric keypad 2 key
  102.   $R_Key_NUMPAD3   = 0x63        # Numeric keypad 3 key
  103.   $R_Key_NUMPAD4   = 0x64        # Numeric keypad 4 key
  104.   $R_Key_NUMPAD5   = 0x65        # Numeric keypad 5 key
  105.   $R_Key_NUMPAD6   = 0x66        # Numeric keypad 6 key
  106.   $R_Key_NUMPAD7   = 0x67        # Numeric keypad 7 key
  107.   $R_Key_NUMPAD8   = 0x68        # Numeric keypad 8 key
  108.   $R_Key_NUMPAD9  = 0x69        # Numeric keypad 9 key
  109.   $R_Key_MULTIPLY  = 0x6A        # Multiply key (*)
  110.   $R_Key_ADD       = 0x6B        # Add key (+)
  111.   $R_Key_SEPARATOR = 0x6C        # Separator key
  112.   $R_Key_SUBTRACT  = 0x6D        # Subtract key (-)
  113.   $R_Key_DECIMAL   = 0x6E        # Decimal key
  114.   $R_Key_DIVIDE    = 0x6F        # Divide key (/)
  115.   #--------------------------------------------------------------------------
  116.   $R_Key_F1        = 0x70        # F1 key
  117.   $R_Key_F2        = 0x71        # F2 key
  118.   $R_Key_F3        = 0x72        # F3 key
  119.   $R_Key_F4        = 0x73        # F4 key
  120.   $R_Key_F5        = 0x74        # F5 key
  121.   $R_Key_F6        = 0x75        # F6 key
  122.   $R_Key_F7        = 0x76        # F7 key
  123.   $R_Key_F8        = 0x77        # F8 key
  124.   $R_Key_F9        = 0x78        # F9 key
  125.   $R_Key_F10       = 0x79        # F10 key
  126.   $R_Key_F11       = 0x7A        # F11 key
  127.   $R_Key_F12       = 0x7B        # F12 key
  128.   #--------------------------------------------------------------------------
  129.   $R_Key_NUMLOCK   = 0x90        # NUM LOCK key
  130.   $R_Key_SCROLL    = 0x91        # SCROLL LOCK key
  131.   #--------------------------------------------------------------------------
  132.   $R_Key_LSHIFT    = 0xA0        # Left SHIFT key
  133.   $R_Key_RSHIFT    = 0xA1        # Right SHIFT key
  134.   $R_Key_LCONTROL  = 0xA2        # Left CONTROL key
  135.   $R_Key_RCONTROL  = 0xA3        # Right CONTROL key
  136.   $R_Key_L_ALT    = 0xA4        # Left ALT key
  137.   $R_Key_R_ALT    = 0xA5        # Right ALT key
  138.   #--------------------------------------------------------------------------
  139.   $R_Key_SEP      = 0xBC        # , key
  140.   $R_Key_DASH      = 0xBD        # - key
  141.   $R_Key_DOTT      = 0xBE        # . Key
  142.   #--------------------------------------------------------------------------
  143.   GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
  144.   GetKeyboardState = Win32API.new("user32","GetKeyState",['I'],'I')
  145.   GetSetKeyState = Win32API.new("user32","SetKeyboardState",['I'],'I')
  146.   #--------------------------------------------------------------------------
  147.   module_function
  148.   #--------------------------------------------------------------------------
  149.   def keyb(rkey)
  150.      if GetKeyState.call(rkey) != 0
  151.        return 1
  152.      end
  153.      return 0
  154.   end
  155.    #--------------------------------------------------------------------------
  156.   def keyboard(rkey)
  157.     GetKeyState.call(rkey) & 0x01 == 1  #
  158.   end
  159.   #--------------------------------------------------------------------------
  160.   def key(rkey, key = 0)
  161.     GetKeyboardState.call(rkey) & 0x01 == key #
  162.   end
  163. end

  164. #==============================================================================
  165. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  166. #==============================================================================

复制代码
[/fold]
[fold=在地图上显示变量]
  1. #==========================================================================
  2. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。
  3. #==========================================================================

  4. VAR_SWITCH = 26          # 26号开关打开此脚本才工作,关闭则停止运算,并且透明
  5. VAR_REFRESH_SWITCH = 27  # 27号开关控制强制刷新,使用时机:1、把窗口由透明变为不透明(包括第一次使用时),2、游戏中用脚本更改了$var

  6. $var = []
  7. $var = [[1,0,0],[2,32,32],[3,64,32]] #所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]

  8. #==============================================================================
  9. # ■ Window_XY
  10. #------------------------------------------------------------------------------
  11. #  显示坐标的窗口。
  12. #==============================================================================
  13. class Window_Var < Window_Base#注意前面那个window_var是文件名
  14. #--------------------------------------------------------------------------
  15. # ● 初始化窗口
  16. #--------------------------------------------------------------------------
  17. def initialize
  18.   super(-16, -16, 640+32, 480+32)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
  19.   self.contents = Bitmap.new(width - 32, height - 32)
  20.   self.back_opacity = 255  # 这个是背景透明
  21.   self.opacity = 255       # 这个是边框和背景都透明
  22.   self.contents_opacity = 255       # 这个是内容透明
  23.   self.visible = false
  24.   self.z=9999
  25.   @var = $var
  26.   @var_a = []
  27.   for var_draw in $var
  28.     @var_a[var_draw[0]] = $game_variables[var_draw[0]]
  29.   end   
  30.   refresh
  31. end

  32. #--------------------------------------------------------------------------
  33. # ● 刷新
  34. #--------------------------------------------------------------------------
  35. def refresh
  36.   if $game_switches[VAR_SWITCH]
  37.     @var = $var         # 记录现在变量数组结构
  38.     self.contents.clear # 清除以前的东西
  39.     for var_draw in @var
  40.       @var_a[var_draw[0]] = $game_variables[var_draw[0]] # 记录现在的游戏变量
  41.       self.contents.draw_text(var_draw[1],var_draw[2],640,32,@var_a[var_draw[0]].to_s)
  42.     end
  43.   end
  44. end
  45. #--------------------------------------------------------------------------
  46. # ● 判断文字刷新。节约内存用
  47. #--------------------------------------------------------------------------
  48. def judge
  49.   for var_draw in $var
  50.     if @var_a[var_draw[0]] != $game_variables[var_draw[0]] #如果现在记录的变量和游戏变量不同,刷新
  51.       return true
  52.     end
  53.   end
  54.   if $game_switches[VAR_REFRESH_SWITCH]  # 强制刷新的时候,刷新
  55.     $game_switches[VAR_REFRESH_SWITCH] = false
  56.     return true
  57.   end
  58.   return false
  59. end
  60. end

  61. class Scene_Map
  62. alias var_66rpg_main main
  63. def main
  64.   @var_window = Window_Var.new
  65.   @var_window.opacity = 0
  66.   var_66rpg_main
  67.   @var_window.dispose
  68. end
  69. #--------------------------------------------------------------------------
  70. # ● 刷新画面
  71. #--------------------------------------------------------------------------
  72. alias var_66rpg_update update
  73. def update
  74.   var_66rpg_update
  75.   if $game_switches[VAR_SWITCH]
  76.     @var_window.visible = true      
  77.     @var_window.refresh if @var_window.judge
  78.   else
  79.     @var_window.visible = false
  80.   end
  81. end
  82. end
  83. #==========================================================================
  84. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。
  85. #==========================================================================
复制代码
[/fold]

新增:
存档扩充
跳过标题

@RyanBern

评分

参与人数 1梦石 +2 收起 理由
RyanBern + 2 好多脚本,我先从中挑一挑

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部