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

Project1

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

[已经解决] 脚本渣求助,如何在战斗列表框内 插入战斗的图标

[复制链接]

Lv1.梦旅人

梦石
0
星屑
195
在线时间
339 小时
注册时间
2012-7-16
帖子
148
跳转到指定楼层
1
发表于 2013-5-24 12:32:56 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
就是按下战斗有 攻击 防御 物品 技能 之类的选项出现 就是如何在前面加个图标或者一个图片= =

点评

改动脚本,但是要教会LZ脚本,LZ觉得要多久?或者是谁愿意来教?  发表于 2013-5-25 03:18
【6月份回归者】

Lv3.寻梦者

梦石
0
星屑
3841
在线时间
1966 小时
注册时间
2013-1-3
帖子
9536
2
发表于 2013-5-25 06:25:22 | 只看该作者
请使用图片战斗选单,LZ可以试一下…
http://www.66rpg.com/articles/2929
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
195
在线时间
339 小时
注册时间
2012-7-16
帖子
148
3
 楼主| 发表于 2013-5-25 06:37:27 | 只看该作者
紫英晓狼1130 发表于 2013-5-25 06:25
请使用图片战斗选单,LZ可以试一下…
http://www.66rpg.com/articles/2929

= =谢谢唉,看看下他是咋写的0 0, 还是能看懂一小部分的、= =  
【6月份回归者】
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
4
发表于 2013-5-25 14:31:04 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. module Momo_IconCommand
  5.   # 图标名称设定
  6.   ATTACK_ICON_NAME = "攻击.png" # 攻撃
  7.   SKILL_ICON_NAME = "技能.png"   # 特技
  8.   GUARD_ICON_NAME = "防御.png"  # 防御
  9.   ITEM_ICON_NAME = "道具.png"     # 物品
  10.   # X坐标修正
  11.   X_PLUS = 360
  12.   # Y坐标修正
  13.   Y_PLUS = -200
  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 = 40
  23.   # 是否写出文字的名称
  24.   COM_NAME_DROW = false
  25.   # 文字名称是否移动
  26.   COM_NAME_MOVE = false
  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.     self.z = 9999
  48.    @item_max = commands.size #项目数
  49.    @commands = commands #指令数
  50.    @column_max = 1
  51.     @index = 0
  52.     @last_index = nil
  53.     @name_sprite = nil
  54.     [url=home.php?mod=space&uid=114926]@sprite[/url] = []
  55.     refresh
  56.   end
  57.   def dispose
  58.     super
  59.     for sprite in @sprite
  60.       sprite.dispose unless sprite.nil?
  61.     end
  62.     @name_sprite.dispose unless @name_sprite.nil?
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● リフレッシュ
  66.   #--------------------------------------------------------------------------
  67.   def refresh
  68.     @name_sprite.dispose unless @name_sprite.nil?
  69.     for sprite in @sprite
  70.       sprite.dispose unless sprite.nil?
  71.     end
  72.     @name_sprite = nil
  73.     draw_com_name if Momo_IconCommand::COM_NAME_DROW
  74.     @sprite = []
  75.     for i in 0...@item_max
  76.       draw_item(i)
  77.     end
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 項目の描画
  81.   #--------------------------------------------------------------------------
  82.   def draw_item(index)
  83.     @sprite[index] = Sprite_Icon.new(nil, @commands[index])
  84.     @sprite[index].z = self.z + 1
  85.   end
  86.   def draw_com_name
  87.     @name_sprite = Sprite_Comm_Name.new(nil, get_com_name)
  88.    
  89.   end
  90.   
  91.   # 更新
  92.   def update
  93.     super
  94.     icon_update
  95.     com_name_update if Momo_IconCommand::COM_NAME_DROW
  96.     if move_index?
  97.       @last_index = self.index
  98.     end
  99.   end
  100.   # アイコンの更新
  101.   def icon_update
  102.     for i in [email protected]
  103.       @sprite[i].active = (self.index == i)
  104.       @sprite[i].x = self.x
  105.       @sprite[i].y = self.y + i*26
  106.       @sprite[i].z = (self.index == i) ? self.z + 2 : self.z + 1
  107.       @sprite[i].visible = self.visible
  108.       @sprite[i].update
  109.     end
  110.   end
  111.   # コマンドネームの更新
  112.   def com_name_update
  113.     if move_index?
  114.       @name_sprite.name = get_com_name
  115.     end
  116.     @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS
  117.     @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS
  118.     @name_sprite.z = self.z + 1
  119.     @name_sprite.active = self.active
  120.     @name_sprite.visible = self.visible
  121.     @name_sprite.update
  122.   end
  123.   def get_com_name
  124.     make_name_set if @name_set.nil?
  125.     name = @name_set[self.index]
  126.     name = "" if name.nil?
  127.     return name
  128.   end
  129.   def make_name_set
  130.     @name_set = []
  131.     @name_set[0] = Momo_IconCommand::ATTACK_NAME
  132.     @name_set[1] = Momo_IconCommand::SKILL_NAME
  133.     @name_set[2] = Momo_IconCommand::GUARD_NAME
  134.     @name_set[3] = Momo_IconCommand::ITEM_NAME
  135.     @name_set[4] = Momo_IconCommand::BAOHU_NAME
  136.     @name_set[5] = Momo_IconCommand::ZHAO_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.     @actor_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
  284.     @actor_command_window.y = 160
  285.     @actor_command_window.back_opacity = 160
  286.     @actor_command_window.active = false
  287.     @actor_command_window.visible = false
  288.     @actor_command_window.update
  289.    
  290.     @actor2_command_window = Window_CommandIcon.new(0, 0, [com1, com2, com3, com4])
  291.     @actor2_command_window.y = 160
  292.     @actor2_command_window.back_opacity = 160
  293.     @actor2_command_window.active = false
  294.     @actor2_command_window.visible = false
  295.     @actor2_command_window.update
  296.    
  297.     scene_battle_icon_command_start_phase1
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● アクターコマンドウィンドウのセットアップ
  301.   #--------------------------------------------------------------------------
  302.   alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_window
  303.   def phase3_setup_command_window
  304.     scene_battle_icon_command_phase3_setup_command_window
  305.     # アクターコマンドウィンドウの位置を設定
  306.     @actor_command_window.x = command_window_actor_x(@actor_index) - 360
  307.     @actor_command_window.y = command_window_actor_y(@actor_index)
  308.     @actor_command_window.need_reset
  309.     @actor2_command_window.x = command_window_actor_x(@actor_index) - 360
  310.     @actor2_command_window.y = command_window_actor_y(@actor_index)
  311.     @actor2_command_window.need_reset
  312.   end
  313.   def command_window_actor_x(index)
  314.     $game_party.actors[index].screen_x + Momo_IconCommand::X_PLUS
  315.   end
  316.   def command_window_actor_y(index)
  317.     $game_party.actors[index].screen_y + Momo_IconCommand::Y_PLUS
  318.   end
  319. end

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

复制代码
这个效果么?

点评

已经解决,谢谢回答= =  发表于 2013-5-25 19:11

   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 15:15

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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