Project1

标题: 战斗窗口美化脚本 [打印本页]

作者: 去去去去去    时间: 2009-1-21 07:18
提示: 作者被禁止或删除 内容自动屏蔽
作者: 后知后觉    时间: 2009-1-21 09:41
你这样的发帖格式纯粹属于悬赏定制
就100积分,估计等到下个世纪末也不会有人理
虽然是很简单的东西,但别人会4你为SSD而54你……
作者: kaka0046    时间: 2009-1-21 10:51
用这个脚本!
把它全部复制!
插入即可!
分  分  分  分



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

module Momo_IconCommand
  # 图标名称设定
  ATTACK_ICON_NAME = "001-Weapon01" # 攻撃
  SKILL_ICON_NAME = "044-Skill01"   # 特技
  GUARD_ICON_NAME = "009-Shield01"  # 防御
  ITEM_ICON_NAME = "032-Item01"     # 物品
  # X坐标修正
  X_PLUS = -40
  # Y坐标修正
  Y_PLUS = -180
  # 选择时图标的动作
  # 0:静止 1:放大
  SELECT_TYPE = 0
  # 闪烁时光芒的颜色
  FLASH_COLOR = Color.new(255, 255, 255, 128)
  # 闪烁时间
  FLASH_DURATION = 10
  # 闪烁间隔
  FLASH_INTERVAL = 20
  # 是否写出文字的名称
  COM_NAME_DROW = true
  # 文字名称是否移动
  COM_NAME_MOVE = true
  # 文字内容
  ATTACK_NAME = "攻击"    # 攻击
  SKILL_NAME = "特技"   # 特技
  GUARD_NAME = "防御"     # 防御
  ITEM_NAME = "物品"  # 物品
  # 文字颜色
  COM_NAME_COLOR = Color.new(255, 255, 255, 255)
  # 文字坐标修正
  COM_NAME_X_PLUS = 0
  COM_NAME_Y_PLUS = 0
end

class Window_CommandIcon < Window_Selectable
  attr_accessor :last_index
  #------------------------------------------------------------------------
  # ● オブジェクト初期化
  #------------------------------------------------------------------------
  def initialize(x, y, commands)
    super(x, y, 32, 32)
    # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする
    self.windowskin = RPG::Cache.windowskin("")
    @item_max = commands.size
    @commands = commands
    @column_max = commands.size
    @index = 0
    @last_index = nil
    @name_sprite = nil
    @sprite = []
    refresh
  end
  def dispose
    super
    for sprite in @sprite
      sprite.dispose unless sprite.nil?
    end
    @name_sprite.dispose unless @name_sprite.nil?
  end
  #------------------------------------------------------------------------
  # ● リフレッシュ
  #------------------------------------------------------------------------
  def refresh
    @name_sprite.dispose unless @name_sprite.nil?
    for sprite in @sprite
      sprite.dispose unless sprite.nil?
    end
    @name_sprite = nil
    draw_com_name if Momo_IconCommand::COM_NAME_DROW
    @sprite = []
    for i in 0...@item_max
      draw_item(i)
    end
  end
  #------------------------------------------------------------------------
  # ● 項目の描画
  #------------------------------------------------------------------------
  def draw_item(index)
    @sprite[index] = Sprite_Icon.new(nil, @commands[index])
    @sprite[index].z = self.z + 1
  end
  def draw_com_name
    @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
   
  end
  
  # 更新
  def update
    super
    icon_update
    com_name_update if Momo_IconCommand::COM_NAME_DROW
    if move_index?
      @last_index = self.index
    end
  end
  # アイコンの更新
  def icon_update
    for i in [email protected]
      @sprite.active = (self.index == i)
      @sprite.x = self.x + i * 24
      @sprite.y = self.y + 0
      @sprite.z = (self.index == i) ? self.z + 2 : self.z + 1
      @sprite.visible = self.visible
      @sprite.update
    end
  end
  # コマンドネームの更新
  def com_name_update
    if move_index?
      @name_sprite.name = get_com_name
    end
    @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
    @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
    @name_sprite.z = self.z + 1
    @name_sprite.active = self.active
    @name_sprite.visible = self.visible
    @name_sprite.update
  end
  def get_com_name
    make_name_set if @name_set.nil?
    name = @name_set[self.index]
    name = "" if name.nil?
    return name
  end
  def make_name_set
    @name_set = []
    @name_set[0] = Momo_IconCommand::ATTACK_NAME
    @name_set[1] = Momo_IconCommand::SKILL_NAME
    @name_set[2] = Momo_IconCommand::GUARD_NAME
    @name_set[3] = Momo_IconCommand::ITEM_NAME
  end
  def move_index?
    return self.index != @last_index
  end
  def need_reset
    @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  end
end

# アイコン用スプライト
class Sprite_Icon < Sprite
  attr_accessor :active
  attr_accessor :icon_name
  #------------------------------------------------------------------------
  # ● オブジェクト初期化
  #------------------------------------------------------------------------
  def initialize(viewport, icon_name)
    super(viewport)
    @icon_name = icon_name
    @last_icon = @icon_name
    @count = 0
    self.bitmap = RPG::Cache.icon(@icon_name)
    self.ox = self.bitmap.width / 2
    self.oy = self.bitmap.height / 2
    @active = false
  end
  #------------------------------------------------------------------------
  # ● 解放
  #------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
  #------------------------------------------------------------------------
  # ● フレーム更新
  #------------------------------------------------------------------------
  def update
    super
    if @icon_name != @last_icon
      @last_icon = @icon_name
      self.bitmap = RPG::Cache.icon(@icon_name)
    end
    if @active
      @count += 1
      case Momo_IconCommand::SELECT_TYPE
      when 0
        icon_flash
      when 1
        icon_zoom
      end
      @count = 0 if @count == 20
    else
      icon_reset
    end
  end
  def icon_flash
    if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1
      self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION)
    end
  end
  def icon_zoom
    case @count
    when 1..10
      zoom = 1.0 + @count / 10.0
    when 11..20
      zoom = 2.0 - (@count - 10) / 10.0
    end
    self.zoom_x = zoom
    self.zoom_y = zoom
  end
  def icon_reset
    @count = 0
    self.zoom_x = 1.0
    self.zoom_y = 1.0
  end
end

# コマンドネーム用スプライト
class Sprite_Comm_Name < Sprite
  attr_accessor :active
  attr_accessor :name
  attr_accessor :need_reset
  #------------------------------------------------------------------------
  # ● オブジェクト初期化
  #------------------------------------------------------------------------
  def initialize(viewport, name)
    super(viewport)
    @name = name
    @last_name = nil
    @count = 0
    @x_plus = 0
    @opa_plus = 0
    @need_reset = false
    @active = false
    self.bitmap = Bitmap.new(160, 32)
  end
  #------------------------------------------------------------------------
  # ● 解放
  #------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
  #------------------------------------------------------------------------
  # ● フレーム更新
  #------------------------------------------------------------------------
  def update
    super
    if @active
      if need_reset?
        @need_reset = false
        @last_name = @name
        text_reset
      end
      move_text if Momo_IconCommand::COM_NAME_MOVE
    end
  end
  def move_text
    @count += 1
    @x_plus = [@count * 8, 80].min
    self.x = self.x - 80 + @x_plus
    self.opacity = @count * 25
  end
  def text_reset
    @count = 0
    @x_plus = 0
    self.bitmap.clear
    self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR
    self.bitmap.draw_text(0, 0, 160, 32, @name)
  end
  def need_reset?
    return (@name != @last_name or @need_reset)
  end
end

class Scene_Battle
  #------------------------------------------------------------------------
  # ● プレバトルフェーズ開始
  #------------------------------------------------------------------------
  alias scene_battle_icon_command_start_phase1 start_phase1
  def start_phase1
    com1 = Momo_IconCommand::ATTACK_ICON_NAME
    com2 = Momo_IconCommand::SKILL_ICON_NAME
    com3 = Momo_IconCommand::GUARD_ICON_NAME
    com4 = Momo_IconCommand::ITEM_ICON_NAME
    @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    @actor_command_window.update
    scene_battle_icon_command_start_phase1
  end
  #------------------------------------------------------------------------
  # ● アクターコマンドウィンドウのセットアップ
  #------------------------------------------------------------------------
  alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  def phase3_setup_command_window
    scene_battle_icon_command_phase3_setup_command_window
    # アクターコマンドウィンドウの位置を設定
    @actor_command_window.x = command_window_actor_x(@actor_index)
    @actor_command_window.y = command_window_actor_y(@actor_index)
    @actor_command_window.need_reset
  end
  def command_window_actor_x(index)
    $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  end
  def command_window_actor_y(index)
    $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  end
end

#==========================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==========================================================================
[LINE]1,#dddddd[/LINE]系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
作者: 藍色等待    时间: 2009-1-21 17:34
脚本拜托用这个。。你那样太长了。。⊙﹏⊙b~
  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. def update
  91.    super
  92.    icon_update
  93.    com_name_update if Momo_IconCommand::COM_NAME_DROW
  94.    if move_index?
  95.      @last_index = self.index
  96.    end
  97. end
  98. # アイコンの更新
  99. def icon_update
  100.    for i in [email protected]
  101.      @sprite[i].active = (self.index == i)
  102.      @sprite[i].x = self.x + i * 24
  103.      @sprite[i].y = self.y + 0
  104.      @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  105.      @sprite[i].visible = self.visible
  106.      @sprite[i].update
  107.    end
  108. end
  109. # コマンドネームの更新
  110. def com_name_update
  111.    if move_index?
  112.      @name_sprite.name = get_com_name
  113.    end
  114.    @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  115.    @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  116.    @name_sprite.z = self.z + 1
  117.    @name_sprite.active = self.active
  118.    @name_sprite.visible = self.visible
  119.    @name_sprite.update
  120. end
  121. def get_com_name
  122.    make_name_set if @name_set.nil?
  123.    name = @name_set[self.index]
  124.    name = "" if name.nil?
  125.    return name
  126. end
  127. def make_name_set
  128.    @name_set = []
  129.    @name_set[0] = Momo_IconCommand::ATTACK_NAME
  130.    @name_set[1] = Momo_IconCommand::SKILL_NAME
  131.    @name_set[2] = Momo_IconCommand::GUARD_NAME
  132.    @name_set[3] = Momo_IconCommand::ITEM_NAME
  133. end
  134. def move_index?
  135.    return self.index != @last_index
  136. end
  137. def need_reset
  138.    @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROW
  139. end
  140. end

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

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

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

  305. #==========================================================================
  306. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  307. #==========================================================================
复制代码
[LINE]1,#dddddd[/LINE]版主对此帖的认可:『thanks for your help』,积分『+350』。
作者: 去去去去去    时间: 2009-1-22 09:14
提示: 作者被禁止或删除 内容自动屏蔽
作者: 枪胜贤者    时间: 2009-1-22 17:41
你加我QQ!!我把整合给你用QQ发过去就可以了!!!QQ:474645613
作者: 200878242    时间: 2009-1-22 18:22
看一下有没有你想要的http://rpg.blue/searchResult.asp ... ername=&dtime=0下次记得先搜索没答案的情况下在提问
作者: 御风天之痕    时间: 2009-1-22 18:38
提示: 作者被禁止或删除 内容自动屏蔽




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1