设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 5295|回复: 12
打印 上一主题 下一主题

[原创发布] 【不是创意的创意】关于图标选项菜单和逃跑选项的整合...

 关闭 [复制链接]

Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1697
在线时间
3038 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

跳转到指定楼层
1
发表于 2007-4-2 17:38:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 精灵使者 于 2014-12-20 20:52 编辑

首先按照取消战斗、逃跑的办法取消战斗、逃跑项
在Scene_Battle 2选项里面修改
    # 有效化同伴指令窗口
    @party_command_window.active = false
    @party_command_window.visible = false
然后再把第62行后面的
def update_phase 2
后面的东西全部注释掉,留下start_phase3一项,即改成这样:
  #--------------------------------------------------------------------------
  # ● 刷新画面 (同伴命令回合)
  #--------------------------------------------------------------------------
  def update_phase2
    # 按下 C 键的情况下
    #if Input.trigger?(Input::C)
      # 同伴指令窗口光标位置分支
      #case @party_command_window.index
     # when 0  # 战斗
        # 演奏确定 SE
        #$game_system.se_play($data_system.decision_se)
        # 开始角色的命令回合
        start_phase3
      #when 1  # 逃跑
        # 不能逃跑的情况下
        #if $game_temp.battle_can_escape == false
          # 演奏冻结 SE
          #$game_system.se_play($data_system.buzzer_se)
          #return
        #end
        # 演奏确定 SE
        #$game_system.se_play($data_system.decision_se)
        # 逃走处理
        #update_phase2_escape
      #end
      #return
    #end
  end
留下带彩色的一项。
然后在Scene_battle 1 的第30行修改为……

   @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,"逃跑"])
    @actor_command_window.y = 128

然后在Scene_battle 3里面修改这项
   #--------------------------------------------------------------------------
  # ● 刷新画面 (角色命令回合 : 基本命令)
  #--------------------------------------------------------------------------
   def update_phase3_basic_command
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 转向前一个角色的指令输入
      phase3_prior_actor
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 角色指令窗口光标位置分之
      case @actor_command_window.index
      when 0  # 攻击
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
        # 开始选择敌人
        start_enemy_select
      when 1  # 特技
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 1
        # 开始选择特技
        start_skill_select
      when 2  # 防御
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        # 转向下一位角色的指令输入
        phase3_next_actor
      when 3  # 物品
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 2
        # 开始选择物品
        start_item_select
  ###########################################################################
      when 4  # 逃跑
        if $game_temp.battle_can_escape == false
          # 演奏冻结 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 逃走处理
        update_phase2_escape

###########################################################################
       end
       return
    end
   end
到这里还不算完,真正的目的在后边。如果你选用了图标选项菜单的话,请用这个脚本替换main前面原来的脚本。
  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.   ESCAPE_ICON_NAME = "020-Accessory05"  # 逃跑
  11.   # X坐标修正
  12.   X_PLUS = -50
  13.   # Y坐标修正
  14.   Y_PLUS = -180
  15.   # 选择时图标的动作
  16.   # 0:静止 1:放大
  17.   SELECT_TYPE = 1
  18.   # 闪烁时光芒的颜色
  19.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  20.   # 闪烁时间
  21.   FLASH_DURATION = 10
  22.   # 闪烁间隔
  23.   FLASH_INTERVAL = 20
  24.   # 是否写出文字的名称
  25.   COM_NAME_DROW = true
  26.   # 文字名称是否移动
  27.   COM_NAME_MOVE = true
  28.   # 文字内容
  29.   ATTACK_NAME = "攻击"    # 攻击
  30.   SKILL_NAME = "魔法"     # 特技
  31.   GUARD_NAME = "防御"     # 防御
  32.   ITEM_NAME = "物品"      # 物品
  33.   ESCAPE_NAME = "逃跑"    # 逃跑
  34.   # 文字颜色
  35.   COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  36.   # 文字坐标修正
  37.   COM_NAME_X_PLUS = 0
  38.   COM_NAME_Y_PLUS = -15
  39. end

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

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

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

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

  310. #==============================================================================
  311. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  312. #==============================================================================
复制代码
最终截图如下:

效果很不错吧~
大家不会的话可以下载工程观摩下。
http://rpg.blue/upload_program/files/动态+逃跑.rar


Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1697
在线时间
3038 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

2
 楼主| 发表于 2007-4-2 17:38:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
首先按照取消战斗、逃跑的办法取消战斗、逃跑项
在Scene_Battle 2选项里面修改
    # 有效化同伴指令窗口
    @party_command_window.active = false
    @party_command_window.visible = false
然后再把第62行后面的
def update_phase 2
后面的东西全部注释掉,留下start_phase3一项,即改成这样:
  #--------------------------------------------------------------------------
  # ● 刷新画面 (同伴命令回合)
  #--------------------------------------------------------------------------
  def update_phase2
    # 按下 C 键的情况下
    #if Input.trigger?(Input::C)
      # 同伴指令窗口光标位置分支
      #case @party_command_window.index
     # when 0  # 战斗
        # 演奏确定 SE
        #$game_system.se_play($data_system.decision_se)
        # 开始角色的命令回合
        start_phase3
      #when 1  # 逃跑
        # 不能逃跑的情况下
        #if $game_temp.battle_can_escape == false
          # 演奏冻结 SE
          #$game_system.se_play($data_system.buzzer_se)
          #return
        #end
        # 演奏确定 SE
        #$game_system.se_play($data_system.decision_se)
        # 逃走处理
        #update_phase2_escape
      #end
      #return
    #end
  end
留下带彩色的一项。
然后在Scene_battle 1 的第30行修改为……

   @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4,"逃跑"])
    @actor_command_window.y = 128

然后在Scene_battle 3里面修改这项
   #--------------------------------------------------------------------------
  # ● 刷新画面 (角色命令回合 : 基本命令)
  #--------------------------------------------------------------------------
   def update_phase3_basic_command
    # 按下 B 键的情况下
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      $game_system.se_play($data_system.cancel_se)
      # 转向前一个角色的指令输入
      phase3_prior_actor
      return
    end
    # 按下 C 键的情况下
    if Input.trigger?(Input::C)
      # 角色指令窗口光标位置分之
      case @actor_command_window.index
      when 0  # 攻击
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 0
        # 开始选择敌人
        start_enemy_select
      when 1  # 特技
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 1
        # 开始选择特技
        start_skill_select
      when 2  # 防御
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 1
        # 转向下一位角色的指令输入
        phase3_next_actor
      when 3  # 物品
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 设置行动
        @active_battler.current_action.kind = 2
        # 开始选择物品
        start_item_select
  ###########################################################################
      when 4  # 逃跑
        if $game_temp.battle_can_escape == false
          # 演奏冻结 SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 逃走处理
        update_phase2_escape

###########################################################################
       end
       return
    end
   end
到这里还不算完,真正的目的在后边。如果你选用了图标选项菜单的话,请用这个脚本替换main前面原来的脚本。

  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.   ESCAPE_ICON_NAME = "020-Accessory05"  # 逃跑
  11.   # X坐标修正
  12.   X_PLUS = -50
  13.   # Y坐标修正
  14.   Y_PLUS = -180
  15.   # 选择时图标的动作
  16.   # 0:静止 1:放大
  17.   SELECT_TYPE = 1
  18.   # 闪烁时光芒的颜色
  19.   FLASH_COLOR = Color.new(255, 255, 255, 128)
  20.   # 闪烁时间
  21.   FLASH_DURATION = 10
  22.   # 闪烁间隔
  23.   FLASH_INTERVAL = 20
  24.   # 是否写出文字的名称
  25.   COM_NAME_DROW = true
  26.   # 文字名称是否移动
  27.   COM_NAME_MOVE = true
  28.   # 文字内容
  29.   ATTACK_NAME = "攻击"    # 攻击
  30.   SKILL_NAME = "魔法"     # 特技
  31.   GUARD_NAME = "防御"     # 防御
  32.   ITEM_NAME = "物品"      # 物品
  33.   ESCAPE_NAME = "逃跑"    # 逃跑
  34.   # 文字颜色
  35.   COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  36.   # 文字坐标修正
  37.   COM_NAME_X_PLUS = 0
  38.   COM_NAME_Y_PLUS = -15
  39. end

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

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

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

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

  310. #==============================================================================
  311. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  312. #==============================================================================
复制代码

最终截图如下:

效果很不错吧~
大家不会的话可以下载工程观摩下。
http://rpg.blue/upload_program/files/动态+逃跑.rar


头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-3-31
帖子
15
3
发表于 2007-4-3 01:21:52 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

苹果梨

梦石
0
星屑
43
在线时间
6 小时
注册时间
2007-2-14
帖子
720
4
发表于 2007-4-3 02:04:43 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1697
在线时间
3038 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

5
 楼主| 发表于 2007-4-3 05:35:27 | 只看该作者
攻击会是逃跑?我怎么没有发觉?
我的游戏里面用了这个脚本。经过测试,完全没问题。
P.S.这个脚本在使用之前要按照前面的地方修改,否则会出错,不要单一的复制粘贴
不好意思,我居然把这个关键的地方忘记了。顶楼已更新,请重新修改。
工程已经放出,你可以参照工程修改。
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-3-31
帖子
15
6
发表于 2007-4-4 00:29:03 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

秀逗の魔导士

梦石
0
星屑
50
在线时间
5 小时
注册时间
2006-10-25
帖子
2000

贵宾

7
发表于 2007-4-4 19:51:14 | 只看该作者
不错~赞一个~

能不能把攻击.技能等这些字的透明度改高点?

或者换个颜色~因为和怪物重叠的时候有点看不清楚~

还有就是菜单要能有个框框也许会好看点…
漂流的日子…
回复 支持 反对

使用道具 举报

Lv1.梦旅人

Dancer-

梦石
0
星屑
105
在线时间
78 小时
注册时间
2006-5-15
帖子
3306
8
发表于 2007-4-4 20:29:57 | 只看该作者
并不困难的效果来着……
实际上只需要扩充一下就可以了……
一个机缘巧合后,被改变了人生的第八年。
养着两只猫,可是我对猫过敏。
为了那终将到来的一天。
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

精灵族の天使

梦石
0
星屑
1697
在线时间
3038 小时
注册时间
2007-3-16
帖子
33731

开拓者贵宾

9
 楼主| 发表于 2007-4-4 20:33:43 | 只看该作者
以下引用魔剑美神于2007-4-4 11:51:14的发言:

不错~赞一个~

能不能把攻击.技能等这些字的透明度改高点?

或者换个颜色~因为和怪物重叠的时候有点看不清楚~

还有就是菜单要能有个框框也许会好看点…

这个脚本上有修改的地方。
# 文字颜色
COM_NAME_COLOR = Color.new(255, 255, 255, 255)

菜单有框的话修改这个部分
   @actor_command_window.back_opacity = 160
   @actor_command_window.active = false
   @actor_command_window.visible = false

在我的游戏上是配合了字体阴影脚本,所以重合的现象就不存在了。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

秀逗の魔导士

梦石
0
星屑
50
在线时间
5 小时
注册时间
2006-10-25
帖子
2000

贵宾

10
发表于 2007-4-4 20:36:50 | 只看该作者
以下引用小真·爱舞于2007-4-4 12:29:57的发言:

并不困难的效果来着……
实际上只需要扩充一下就可以了……


做为新人来说还是应该鼓励一下的~~
漂流的日子…
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-29 22:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表