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

Project1

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

[原创发布] 【XAS】xas多技能脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
128
在线时间
12 小时
注册时间
2019-2-10
帖子
4
跳转到指定楼层
1
发表于 2020-1-31 02:48:14 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  如题,即时战斗系统xas的脚本插件,这是我第一次发布脚本,话会多些,我与xas也算挺有渊源的吧。
  很早之前就一直想做一个ARPG,做之前也看了很多即时战斗的方法和脚本,但最终还是选择了XAS,入坑时就有很多和我一样同样在找xas的多技能脚本的人
我看这么久了依然没有看到有人发布xas的额外技能脚本,自己边学边写也写了挺久的,本来想整合一下再发出来,以前半生不熟还多bug,现在一看便重写了
一遍。
  同时很感谢在这期间教我大佬,感谢你们!


        用了这脚本可能快捷菜单就没用了
  我想防御和冲刺可以放在一起做出一个专属技能的效果,并空出一个按钮,可用于存放三技能或二道具,我这里没有写,需要你自行去定义了。
  以下是核心脚本:
RUBY 代码复制
  1. =begin
  2. #===============================================================================
  3. # ■ XAS 多技能脚本
  4. #本脚本将原快捷菜单中的快捷菜单按钮用于新增2技能
  5. #放置技能到 菜单》技能》选择技能
  6. #作者:唯莫                                                   v:1.0.1;2020.1.31,02:48
  7. #===============================================================================
  8. =end
  9. module XAS_BUTTON
  10. #使2技能的按钮
  11.   BSKILL_BUTTON = Input::L
  12. #是否启用3技能 :请自行定义
  13.   CSKILL_ENABLE = true
  14. #使用3技能的按钮 :请自行定义
  15.   CSKILL_BUTTON = Input::L
  16. #是否允许相同的技能
  17.   ALLOW_SAME_SKILL = false
  18. end
  19. module XAS_TOOL_HUD
  20.    #是否启用2技能槽HUD
  21.    SECOND_SKILL_HUD = true
  22.    #2技能HUD位置[x,y]
  23.    SECOND_HUD_POSITION = [205,365]
  24.    #是否启用3技能槽HUD
  25.    THIRD_SKILL_HUD = true
  26.    #3技能HUD位置[x,y]
  27.    THIRD_HUD_POSITION = [237,365]
  28.   end
  29. #===============================================================================
  30. # ■ XAS 部分
  31. #===============================================================================
  32. class Game_Actor < Game_Battler
  33.   attr_accessor :skill_id
  34.   attr_accessor :skill_id2
  35.   attr_accessor :skill_id3
  36.   alias dj_setup setup
  37. def setup(actor_id)
  38.       @skill_id = 0
  39.       @skill_id2 = 0
  40.       @skill_id3 = 0
  41.    dj_setup(actor_id)
  42.    end
  43.   end
  44. class Window_SkillList < Window_Selectable
  45.   include XAS_BUTTON
  46.   def can_equip_skill_action?
  47.       return false if $game_party.in_battle
  48.       skill = @data[index]   
  49.       if skill != nil and ( skill.note =~ /<Duration = (\d+)>/ or skill.note =~ /<存在时间 = (\d+)>/)
  50.         if $djnxx==3
  51.           @技能检测 = skill.id
  52.           if can_skill_identical?
  53.             msgbox("不能装备相同的技能")
  54.             return true
  55.           else
  56.             @i = $game_party.battle_members[0].id
  57.             @actor.skill_id3 = skill.id
  58.             Sound.play_equip
  59.             return true
  60.            end
  61.          end
  62.         if $djnxx==2
  63.           @技能检测 = skill.id
  64.           if can_skill_identical?
  65.             msgbox("不能装备相同的技能")
  66.             return true   
  67.           else
  68.             i = $game_party.battle_members[0].id
  69.              @actor.skill_id2 = skill.id
  70.              Sound.play_equip
  71.             return true  
  72.            end
  73.         end
  74.         if $djnxx==1
  75.           @技能检测 = skill.id
  76.           if can_skill_identical?
  77.             msgbox("不能装备相同的技能")
  78.             return true   
  79.           else
  80.             @actor.skill_id = skill.id
  81.             Sound.play_equip
  82.          return true
  83.            end
  84.          end
  85.           return false
  86.        end
  87.      end   
  88.     def can_skill_identical?
  89.       return false if ALLOW_SAME_SKILL
  90.       if $djnxx==3
  91.         return true if @技能检测 == @actor.skill_id or @技能检测 == @actor.skill_id2
  92.     end
  93.        if $djnxx==2
  94.         return true if @技能检测 == @actor.skill_id or @技能检测 ==@actor.skill_id3
  95.       end
  96.        if $djnxx==1
  97.         return true if @技能检测 ==@actor.skill_id2 or @技能检测 ==@actor.skill_id3
  98.       end
  99.       end
  100. end
  101. class Window_much_skill < Window_Command
  102.      include XAS_BUTTON
  103.   def initialize
  104.     super(150, 100)
  105.   end
  106.   def window_width
  107.     return 240
  108.   end
  109.   def window_height
  110.     if CSKILL_ENABLE
  111.       return 100
  112.     else
  113.       return 80
  114.       end
  115.   end
  116. def make_command_list
  117.   add_command("放入一技能",   :qwe,   true)
  118.   add_command("放入二技能",   :qwer,   true)
  119.   add_command("放入三技能",   :qwert,   true) if CSKILL_ENABLE
  120. end
  121. end
  122. class Scene_Sqtory < Scene_MenuBase
  123.    include XAS_BUTTON
  124.   def start
  125.     super
  126.     @teleport_window = Window_much_skill.new
  127.     @teleport_window.set_handler(:qwe, method(:scck))
  128.     @teleport_window.set_handler(:qwer, method(:secondskill))
  129.     @teleport_window.set_handler(:qwert, method(:thirdskill))if CSKILL_ENABLE
  130.     @teleport_window.set_handler(:cancel, method(:return_scene))
  131.     end
  132.  
  133. def scck #第一技能
  134. $djnxx=1
  135. SceneManager.call(Scene_Skill)
  136. end
  137. def secondskill
  138.   $djnxx=2
  139. SceneManager.call(Scene_Skill)
  140. end
  141. def thirdskill
  142.   $djnxx=3
  143. SceneManager.call(Scene_Skill)
  144. end
  145. end
  146. class Scene_Menu < Scene_MenuBase
  147.   def on_personal_ok
  148.     case @command_window.current_symbol
  149.     when :skill
  150.       SceneManager.call(Scene_Sqtory)
  151.     when :equip
  152.       SceneManager.call(Scene_Equip)
  153.     when :status
  154.       SceneManager.call(Scene_Status)
  155.     end
  156.   end
  157. end
  158. class Game_Player < Game_Character
  159. alias new_update_action_command update_action_command
  160.   def update_action_command
  161.   new_update_action_command
  162.    update_2skill_button
  163.   end
  164. def  update_2skill_button
  165.     if Input.trigger?(BSKILL_BUTTON)
  166.          type = 2
  167.          return unless can_use_skill_command?
  168.          return if execute_combo?(type)
  169.          check_equipped_action(type)
  170.          action_id = self.battler.skill_id2
  171.          return if action_id == 0
  172.          return if state_seal_command?(type)         
  173.          self.shoot(action_id)
  174.       end   
  175.        if Input.trigger?(CSKILL_BUTTON)
  176.          type = 2
  177.          return unless can_use_skill_command?
  178.          return if execute_combo?(type)
  179.          check_equipped_action(type)
  180.          action_id = self.battler.skill_id3
  181.          return if action_id == 0
  182.          return if state_seal_command?(type)         
  183.          self.shoot(action_id)
  184.       end   
  185.    end
  186. end




以下是HUD部分,这东西直接粘贴在原脚本HUD插件页上
   -> Tool HUD

,把原脚本给覆盖掉,试了好多方法,就是没法像上面那样定义







RUBY 代码复制
  1. #==============================================================================
  2. # ■ +++ MOG - XAS TOOL HUD (v1.0) +++
  3. #==============================================================================
  4. # By Moghunter
  5. # http://www.atelier-rgss.com
  6. #==============================================================================
  7. # 以下是在XAS系统中使用的插件显示器脚本的设置。
  8. #
  9. #===============================================================================
  10. module XAS_TOOL_HUD
  11.    #是否启用2技能槽HUD
  12.    SECOND_SKILL_HUD = true
  13.    #2技能HUD位置[x,y]
  14.    SECOND_HUD_POSITION = [205,365]
  15.    #是否启用3技能槽HUD
  16.    THIRD_SKILL_HUD = true
  17.    #3技能HUD位置[x,y]
  18.    THIRD_HUD_POSITION = [237,365]
  19.    #是否启用技能HUD
  20.    ENABLE_SKILL_HUD = true
  21.    #是否启用道具HUD.
  22.    ENABLE_ITEM_HUD = true
  23.    #是否启用武器HUD.
  24.    ENABLE_WEAPON_HUD = true
  25.    #是否启用防具HUD.
  26.    ENABLE_SHIELD_HUD = true
  27.    #是否启用金钱HUD.
  28.    ENABLE_GOLD_HUD = false
  29.    #道具的位置
  30.    ITEM_HUD = [427,365]
  31.    #技能的位置
  32.    SKILL_HUD = [218,365]
  33.    #武器的位置
  34.    WEAPON_HUD = [324,365]
  35.    #防具的位置
  36.    SHIELD_HUD = [352,365]
  37.    #金钱窗口的位置
  38.    GOLD_HUD = [430,395]
  39.    #金钱数字的位置
  40.    GOLD_NUMBER = [40,1]
  41.    #位置布局
  42.    LAYOUT = [50,0]
  43.    #道具图标
  44.    ICON = [55, 12]
  45.    #数字的位置.
  46.    NUMBER = [68, 35]
  47.    #数字间距.
  48.    NUMBER_SPACE = 0
  49. end
  50.  
  51. #==============================================================================
  52. # ■ Tool Hud
  53. #==============================================================================
  54. class Tool_Hud
  55.   include XAS_TOOL_HUD
  56.  
  57. #--------------------------------------------------------------------------
  58. # ● Initialize
  59. #--------------------------------------------------------------------------  
  60.   def initialize
  61.       @actor = $game_party.members[0]
  62.       return if @actor == nil
  63.       @icon_image = Cache.system("Iconset")
  64.       @number_image = Cache.system("XAS_Tool_Number")
  65.       @number_cw = @number_image.width / 10
  66.       @number_ch = @number_image.height / 3      
  67.       @number_sc = @number_cw + NUMBER_SPACE
  68.       create_skill if ENABLE_SKILL_HUD
  69.       create_item if ENABLE_ITEM_HUD
  70.       create_weapon if ENABLE_WEAPON_HUD
  71.       create_shield if ENABLE_SHIELD_HUD
  72.       create_gold if ENABLE_GOLD_HUD
  73.       create_second_skill if SECOND_SKILL_HUD
  74.       create_third_skill if THIRD_SKILL_HUD
  75.  
  76.   end  
  77.  
  78. #--------------------------------------------------------------------------
  79. # ● Refresh
  80. #--------------------------------------------------------------------------   
  81. def refresh
  82.      dispose  
  83.      initialize
  84. end  
  85.  
  86. #--------------------------------------------------------------------------
  87. # ● Create Gold
  88. #--------------------------------------------------------------------------     
  89. def create_gold
  90.      @gold = $game_party.gold
  91.      @gold_old = @gold
  92.      @gold_ref = @gold_old
  93.      @gold_refresh = false         
  94.      # Layout -------------------------------------------------------------------
  95.      @gold_layout_sprite = Sprite.new
  96.      @gold_layout_sprite.bitmap = Cache.system("XAS_Tool_Gold")
  97.      @gold_layout_sprite.z = 151
  98.      @gold_layout_sprite.x = GOLD_HUD[0]
  99.      @gold_layout_sprite.y = GOLD_HUD[1]
  100.      # Gold ---------------------------------------------------------------------
  101.      @gold_number_sprite = Sprite.new
  102.      @gold_number_sprite.bitmap = Bitmap.new(@number_image.width, @number_image.height / 3)
  103.      @gold_number_sprite.z = 152
  104.      @gold_number_sprite.x = GOLD_HUD[0] + GOLD_NUMBER[0]
  105.      @gold_number_sprite.y = GOLD_HUD[1] + GOLD_NUMBER[1]
  106.      gold_number_update     
  107. end
  108.  
  109. #--------------------------------------------------------------------------
  110. # ● Create Shield
  111. #--------------------------------------------------------------------------   
  112. def create_shield
  113.       #LAYOUT ------------------------------------------------------------
  114.       @shield_layout_sprite = Sprite.new
  115.       @shield_layout_sprite.bitmap = Cache.system("XAS_Tool_Shield")
  116.       @shield_layout_sprite.z = 150
  117.       @shield_layout_sprite.x = SHIELD_HUD[0] + LAYOUT[0]
  118.       @shield_layout_sprite.y = SHIELD_HUD[1] + LAYOUT[1]
  119.       @shield = @actor.equips[1]
  120.       @old_shield = @shield
  121.       if @shield != nil
  122.          icon_index = @shield.icon_index
  123.       else
  124.          icon_index = 0
  125.       end   
  126.       @shield_icon_sprite = Sprite.new
  127.       @shield_icon_sprite.bitmap = Bitmap.new(24,24)
  128.       bitmap_shield_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  129.       @shield_icon_sprite.bitmap.blt(0, 0, @icon_image, bitmap_shield_rect)
  130.       @shield_icon_sprite.z = 151
  131.       @shield_icon_sprite.x = SHIELD_HUD[0] + ICON[0]
  132.       @shield_icon_sprite.y = SHIELD_HUD[1] + ICON[1]           
  133.       #NUMBER ------------------------------------------------------------
  134.       @shield_number_sprite = Sprite.new
  135.       @shield_number_sprite.bitmap = Bitmap.new(@number_image.width, @number_image.height / 3)
  136.       @shield_number_sprite.z = 152
  137.       refresh_shield_number
  138. end
  139.  
  140. #--------------------------------------------------------------------------
  141. # ● Refresh Shield Number
  142. #--------------------------------------------------------------------------     
  143. def refresh_shield_number
  144.      @shield_number = 0
  145.      @s_item = 0
  146.      @shield_number_sprite.bitmap.clear
  147.      return if @shield == nil
  148.      if @shield.note =~ /<Action ID = (\d+)>/
  149.          action_id =  $1.to_i   
  150.          skill = $data_skills[action_id]
  151.          if skill != nil
  152.             if skill.note =~ /<Item Cost = (\d+)>/
  153.                item_id = $1.to_i
  154.                if item_id != nil
  155.                   @s_item = $data_items[item_id]
  156.                   @shield_number = $game_party.item_number(@s_item)              
  157.                end
  158.              end
  159.          end   
  160.      end  
  161.      return if @s_item == 0
  162.      cost_split = @shield_number.to_s.split(//)
  163.      for r in 0..cost_split.size - 1
  164.          number_abs = cost_split[r].to_i
  165.          src_rect = Rect.new(@number_cw * number_abs, 0, @number_cw, @number_ch)
  166.          @shield_number_sprite.bitmap.blt(@number_sc  *  r, 0, @number_image, src_rect)        
  167.      end         
  168.      xf = ((cost_split.size * @number_sc) / 2)
  169.      @shield_number_sprite.x = SHIELD_HUD[0] + NUMBER[0] - xf
  170.      @shield_number_sprite.y = SHIELD_HUD[1] + NUMBER[1]  
  171. end   
  172.  
  173. #--------------------------------------------------------------------------
  174. # ● Create Weapon
  175. #--------------------------------------------------------------------------   
  176. def create_weapon
  177.       #LAYOUT ------------------------------------------------------------
  178.       @weapon_layout_sprite = Sprite.new
  179.       @weapon_layout_sprite.bitmap = Cache.system("XAS_Tool_Weapon")
  180.       @weapon_layout_sprite.z = 150
  181.       @weapon_layout_sprite.x = WEAPON_HUD[0] + LAYOUT[0]
  182.       @weapon_layout_sprite.y = WEAPON_HUD[1] + LAYOUT[1]
  183.       #ICON
  184.       @weapon = @actor.equips[0]
  185.       @old_weapon = @weapon
  186.       if @weapon != nil
  187.          icon_index = @weapon.icon_index
  188.       else
  189.          icon_index = 0
  190.       end   
  191.       @weapon_icon_sprite = Sprite.new
  192.       @weapon_icon_sprite.bitmap = Bitmap.new(24,24)
  193.       bitmap_weapon_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  194.       @weapon_icon_sprite.bitmap.blt(0, 0, @icon_image, bitmap_weapon_rect)
  195.       @weapon_icon_sprite.z = 151
  196.       @weapon_icon_sprite.x = WEAPON_HUD[0] + ICON[0]
  197.       @weapon_icon_sprite.y = WEAPON_HUD[1] + ICON[1]           
  198.       #NUMBER ------------------------------------------------------------
  199.       @weapon_number_sprite = Sprite.new
  200.       @weapon_number_sprite.bitmap = Bitmap.new(@number_image.width, @number_image.height / 3)
  201.       @weapon_number_sprite.z = 152
  202.       refresh_weapon_number
  203. end
  204.  
  205. #--------------------------------------------------------------------------
  206. # ● Refresh Weapon Number
  207. #--------------------------------------------------------------------------     
  208. def refresh_weapon_number
  209.      @weapon_number = 0
  210.      @w_item = 0
  211.      @weapon_number_sprite.bitmap.clear
  212.      return if @weapon == nil
  213.      if @weapon.note =~ /<Action ID = (\d+)>/
  214.          action_id =  $1.to_i   
  215.          skill = $data_skills[action_id]
  216.          if skill != nil
  217.             if skill.note =~ /<Item Cost = (\d+)>/
  218.                item_id = $1.to_i
  219.                if item_id != nil
  220.                   @w_item = $data_items[item_id]
  221.                   @weapon_number = $game_party.item_number(@w_item)              
  222.                end
  223.              end
  224.          end   
  225.      end  
  226.      return if @w_item == 0
  227.      cost_split = @weapon_number.to_s.split(//)
  228.      for r in 0..cost_split.size - 1
  229.          number_abs = cost_split[r].to_i
  230.          src_rect = Rect.new(@number_cw * number_abs, 0, @number_cw, @number_ch)
  231.          @weapon_number_sprite.bitmap.blt(@number_sc  *  r, 0, @number_image, src_rect)        
  232.      end         
  233.      xf = ((cost_split.size * @number_sc) / 2)
  234.      @weapon_number_sprite.x = WEAPON_HUD[0] + NUMBER[0] - xf
  235.      @weapon_number_sprite.y = WEAPON_HUD[1] + NUMBER[1]  
  236. end  
  237.  
  238. #--------------------------------------------------------------------------
  239. # ● Create Skill
  240. #--------------------------------------------------------------------------   
  241.   def create_skill
  242.       #LAYOUT ------------------------------------------------------------
  243.       @skill_layout_sprite = Sprite.new
  244.       @skill_layout_sprite.bitmap = Cache.system("XAS_Tool_Skill")
  245.       @skill_layout_sprite.z = 150
  246.       @skill_layout_sprite.x = SKILL_HUD[0] + LAYOUT[0]
  247.       @skill_layout_sprite.y = SKILL_HUD[1] + LAYOUT[1]
  248.       #ICON ------------------------------------------------------------
  249.       @old_skill = @actor.skill_id
  250.       @skill = $data_skills[@actor.skill_id]
  251.       if @skill != nil
  252.          icon_index = @skill.icon_index
  253.          @skill_mp_cost = @skill.mp_cost
  254.       else  
  255.          icon_index = 0
  256.          @skill_mp_cost = 0
  257.       end  
  258.       @skill_icon_sprite = Sprite.new
  259.       @skill_icon_sprite.bitmap = Bitmap.new(24,24)
  260.       bitmap_skill_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  261.       @skill_icon_sprite.bitmap.blt(0, 0, @icon_image, bitmap_skill_rect)
  262.       @skill_icon_sprite.z = 151
  263.       @skill_icon_sprite.x = SKILL_HUD[0] + ICON[0]
  264.       @skill_icon_sprite.y = SKILL_HUD[1] + ICON[1]   
  265.       #NUMBER ------------------------------------------------------------
  266.       skill_number_bitmap = Bitmap.new(@number_image.width, @number_image.height / 3)
  267.       @skill_number_sprite = Sprite.new
  268.       @skill_number_sprite.bitmap = skill_number_bitmap
  269.       cost_split = @skill_mp_cost.to_s.split(//)
  270.       for r in 0..cost_split.size - 1
  271.           number_abs = cost_split[r].to_i
  272.           src_rect = Rect.new(@number_cw * number_abs, @number_ch, @number_cw, @number_ch)
  273.           skill_number_bitmap.blt(@number_sc  *  r, 0, @number_image, src_rect)        
  274.       end         
  275.       @skill_number_sprite.z = 152
  276.       xf = ((cost_split.size * @number_sc) / 2)
  277.       @skill_number_sprite.x = SKILL_HUD[0] + NUMBER[0] - xf
  278.       @skill_number_sprite.y = SKILL_HUD[1] + NUMBER[1]         
  279.   end
  280.  
  281. #--------------------------------------------------------------------------
  282. # ● Create Item
  283. #--------------------------------------------------------------------------     
  284.   def create_item
  285.       #LAYOUT ------------------------------------------------------------
  286.       @item_layout_sprite = Sprite.new
  287.       @item_layout_sprite.bitmap = Cache.system("XAS_Tool_Item")
  288.       @item_layout_sprite.z = 150
  289.       @item_layout_sprite.x = ITEM_HUD[0] + LAYOUT[0]
  290.       @item_layout_sprite.y = ITEM_HUD[1] + LAYOUT[1]
  291.       #ICON ------------------------------------------------------------
  292.       @old_item = @actor.item_id
  293.       @item = $data_items[@actor.item_id]
  294.       if @item != nil
  295.          icon_index = @item.icon_index
  296.          @item_number = $game_party.item_number(@item)
  297.       else  
  298.          icon_index = 0
  299.          @item_number = 0
  300.       end  
  301.       @item_icon_sprite = Sprite.new
  302.       @item_icon_sprite.bitmap = Bitmap.new(24,24)
  303.       bitmap_item_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  304.       @item_icon_sprite.bitmap.blt(0, 0, @icon_image, bitmap_item_rect)
  305.       @item_icon_sprite.z = 160
  306.       @item_icon_sprite.x = ITEM_HUD[0] + ICON[0]
  307.       @item_icon_sprite.y = ITEM_HUD[1] + ICON[1]      
  308.       #NUMBER ------------------------------------------------------------
  309.       item_number_bitmap = Bitmap.new(@number_image.width, @number_image.height / 3)
  310.       @item_number_sprite = Sprite.new
  311.       @item_number_sprite.bitmap = item_number_bitmap
  312.       cost_split = @item_number.to_s.split(//)
  313.       for r in 0..cost_split.size - 1
  314.           number_abs = cost_split[r].to_i
  315.           src_rect = Rect.new(@number_cw * number_abs, 0, @number_cw, @number_ch)
  316.           @item_number_sprite.bitmap.blt(@number_sc  *  r, 0, @number_image, src_rect)        
  317.       end         
  318.       @item_number_sprite.z = 152
  319.       xf = ((cost_split.size * @number_sc) / 2)
  320.       @item_number_sprite.x = ITEM_HUD[0] + NUMBER[0] - xf
  321.       @item_number_sprite.y = ITEM_HUD[1] + NUMBER[1]   
  322.   end
  323.    def create_second_skill
  324.     #创建技能槽-----------------------------------------------------------------
  325.     @second_skill = Sprite.new
  326.     @second_skill.bitmap = Cache.system("XAS_Tool_Skill")
  327.     @second_skill.x= SECOND_HUD_POSITION[0]
  328.     @second_skill.y= SECOND_HUD_POSITION[1]
  329.     #槽中图标-------------------------------------------------------------------
  330.     @old_second_skill = @actor.skill_id2
  331.     @bskill = $data_skills[@actor.skill_id2]
  332.     if @bskill != nil
  333.       icon_index = @bskill.icon_index
  334.       @second_skill_number = @bskill.mp_cost
  335.   else
  336.       icon_index = 0
  337.        @second_skill_number = 0
  338.     end
  339.     @second_skill_icon = Sprite.new
  340.     @second_skill_icon.bitmap = Bitmap.new(24,24)
  341.     bitmap_bskill_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  342.     @second_skill_icon.bitmap.blt(0, 0, @icon_image, bitmap_bskill_rect)
  343.     @second_skill_icon.x = SECOND_HUD_POSITION[0]+5
  344.     @second_skill_icon.y = SECOND_HUD_POSITION[1]+12
  345.     #槽下数字-------------------------------------------------------------------
  346.      skill_number_bitmap = Bitmap.new(@number_image.width, @number_image.height / 3)
  347.       @second_skill_number_sprite = Sprite.new
  348.       @second_skill_number_sprite.bitmap = skill_number_bitmap
  349.       cost_split = @second_skill_number.to_s.split(//)
  350.       for r in 0..cost_split.size - 1
  351.           number_abs = cost_split[r].to_i
  352.           src_rect = Rect.new(@number_cw * number_abs, @number_ch, @number_cw, @number_ch)
  353.            skill_number_bitmap.blt(@number_sc  *  r, 0, @number_image, src_rect)        
  354.       end         
  355.       xf = ((cost_split.size * @number_sc) / 2)
  356.       @second_skill_number_sprite.x = SECOND_HUD_POSITION[0] +12
  357.       @second_skill_number_sprite.y = SECOND_HUD_POSITION[1] +35
  358. end
  359.    def create_third_skill
  360.     #创建技能槽-----------------------------------------------------------------
  361.     @third_skill = Sprite.new
  362.     @third_skill.bitmap = Cache.system("XAS_Tool_Skill")
  363.     @third_skill.x= THIRD_HUD_POSITION[0]
  364.     @third_skill.y= THIRD_HUD_POSITION[1]
  365.     #槽中图标-------------------------------------------------------------------
  366.     @old_third_skill = @actor.skill_id3
  367.     @cskill = $data_skills[@actor.skill_id3]
  368.     if @cskill != nil
  369.       icon_index =  @cskill.icon_index
  370.       @third_skill_number = @cskill.mp_cost
  371.   else
  372.       icon_index = 0
  373.        @third_skill_number = 0
  374.     end
  375.     @third_skill_icon = Sprite.new
  376.     @third_skill_icon.bitmap = Bitmap.new(24,24)
  377.     bitmap_bskill_rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  378.     @third_skill_icon.bitmap.blt(0, 0, @icon_image, bitmap_bskill_rect)
  379.     @third_skill_icon.x = THIRD_HUD_POSITION[0]+5
  380.     @third_skill_icon.y = THIRD_HUD_POSITION[1]+12
  381.     #槽下数字-------------------------------------------------------------------
  382.      skill_number_bitmap = Bitmap.new(@number_image.width, @number_image.height / 3)
  383.       @third_skill_number_sprite = Sprite.new
  384.       @third_skill_number_sprite.bitmap = skill_number_bitmap
  385.       cost_split = @second_skill_number.to_s.split(//)
  386.       for r in 0..cost_split.size - 1
  387.           number_abs = cost_split[r].to_i
  388.           src_rect = Rect.new(@number_cw * number_abs, @number_ch, @number_cw, @number_ch)
  389.            skill_number_bitmap.blt(@number_sc  *  r, 0, @number_image, src_rect)        
  390.       end         
  391.       xf = ((cost_split.size * @number_sc) / 2)
  392.       @third_skill_number_sprite.x = THIRD_HUD_POSITION[0] +12
  393.       @third_skill_number_sprite.y = THIRD_HUD_POSITION[1] +35
  394. end
  395.  
  396. #--------------------------------------------------------------------------
  397. # ● Dispose
  398. #--------------------------------------------------------------------------   
  399.   def dispose
  400.       return if @actor == nil
  401.       dispose_skill if ENABLE_SKILL_HUD
  402.       dispose_item if ENABLE_ITEM_HUD
  403.       dispose_weapon if ENABLE_WEAPON_HUD
  404.       dispose_shield if ENABLE_SHIELD_HUD
  405.       dispose_gold if ENABLE_GOLD_HUD
  406.       @icon_image.dispose
  407.       @number_image.dispose   
  408.       dispose_second_skill if SECOND_SKILL_HUD
  409.       dispose_third_skill if THIRD_SKILL_HUD
  410.     end
  411. #--------------------------------------------------------------------------
  412. # ● 处置二技能
  413. #--------------------------------------------------------------------------      
  414.   def dispose_second_skill
  415.     @second_skill.bitmap.dispose
  416.     @second_skill.dispose
  417.     @second_skill_icon.bitmap.dispose
  418.     @second_skill_icon.dispose
  419.     @second_skill_number_sprite.bitmap.dispose
  420.     @second_skill_number_sprite.dispose
  421.   end
  422. #--------------------------------------------------------------------------
  423. # ● 处置3技能
  424. #--------------------------------------------------------------------------      
  425.   def dispose_third_skill
  426.     @third_skill.bitmap.dispose
  427.     @third_skill.dispose
  428.     @third_skill_icon.bitmap.dispose
  429.     @third_skill_icon.dispose
  430.     @third_skill_number_sprite.bitmap.dispose
  431.     @third_skill_number_sprite.dispose
  432.   end
  433.  
  434. #--------------------------------------------------------------------------
  435. # ● Dispose Skill
  436. #--------------------------------------------------------------------------      
  437.   def dispose_skill
  438.       @skill_layout_sprite.bitmap.dispose
  439.       @skill_layout_sprite.dispose
  440.       @skill_icon_sprite.bitmap.dispose
  441.       @skill_icon_sprite.dispose
  442.       @skill_number_sprite.bitmap.dispose
  443.       @skill_number_sprite.dispose
  444.   end
  445.  
  446. #--------------------------------------------------------------------------
  447. # ● Dispose Gold
  448. #--------------------------------------------------------------------------        
  449.   def dispose_gold
  450.       @gold_layout_sprite.bitmap.dispose
  451.       @gold_layout_sprite.dispose
  452.       @gold_number_sprite.bitmap.dispose
  453.       @gold_number_sprite.dispose
  454.   end
  455.  
  456. #--------------------------------------------------------------------------
  457. # ● Dispose Item
  458. #--------------------------------------------------------------------------        
  459.   def dispose_item
  460.       @item_layout_sprite.bitmap.dispose
  461.       @item_layout_sprite.dispose      
  462.       @item_icon_sprite.bitmap.dispose
  463.       @item_icon_sprite.dispose      
  464.       @item_number_sprite.bitmap.dispose
  465.       @item_number_sprite.dispose   
  466.   end  
  467.  
  468. #--------------------------------------------------------------------------
  469. # ● Dispose Weapon
  470. #--------------------------------------------------------------------------         
  471.   def dispose_weapon
  472.       @weapon_layout_sprite.bitmap.dispose
  473.       @weapon_layout_sprite.dispose
  474.       @weapon_icon_sprite.bitmap.dispose
  475.       @weapon_icon_sprite.dispose
  476.       @weapon_number_sprite.bitmap.dispose
  477.       @weapon_number_sprite.dispose     
  478.   end  
  479.  
  480. #--------------------------------------------------------------------------
  481. # ● Dispose shield
  482. #--------------------------------------------------------------------------            
  483.   def dispose_shield
  484.       @shield_layout_sprite.bitmap.dispose
  485.       @shield_layout_sprite.dispose
  486.       @shield_icon_sprite.bitmap.dispose
  487.       @shield_icon_sprite.dispose
  488.       @shield_number_sprite.bitmap.dispose
  489.       @shield_number_sprite.dispose   
  490.   end  
  491.  
  492. #--------------------------------------------------------------------------
  493. # ● Update
  494. #--------------------------------------------------------------------------   
  495.   def update
  496.       return if @actor == nil
  497.       update_visible
  498.       refresh if can_refresh_hud?
  499.       refresh_item if ENABLE_ITEM_HUD and can_refresh_item_number?
  500.       refresh_weapon_number if ENABLE_WEAPON_HUD and can_refreh_weapon_number?
  501.       refresh_shield_number if ENABLE_SHIELD_HUD and can_refreh_shield_number?
  502.       update_gold if ENABLE_GOLD_HUD
  503.       refresh if wm_Refresh_method?
  504.   end
  505.  
  506. #--------------------------------------------------------------------------
  507. # ● Update Gold
  508. #--------------------------------------------------------------------------         
  509.   def update_gold
  510.       gold_number_down if @gold > $game_party.gold
  511.       gold_number_up if @gold < $game_party.gold     
  512.       gold_number_update if @gold_refresh   
  513.   end  
  514.  
  515. #--------------------------------------------------------------------------
  516. # ● Can Refresh Weapon Number
  517. #--------------------------------------------------------------------------        
  518.   def can_refreh_weapon_number?
  519.       return true if @weapon_number != $game_party.item_number(@w_item)  
  520.       return false
  521.   end  
  522.  
  523. #--------------------------------------------------------------------------
  524. # ● Can Refresh Shield Number
  525. #--------------------------------------------------------------------------        
  526.   def can_refreh_shield_number?
  527.       return true if @shield_number != $game_party.item_number(@s_item)  
  528.       return false
  529.   end   
  530.  
  531. #--------------------------------------------------------------------------
  532. # ● Update Visible
  533. #--------------------------------------------------------------------------      
  534.   def update_visible
  535.       vis = $game_system.enable_hud
  536.       if ENABLE_SKILL_HUD
  537.          @skill_layout_sprite.visible = vis
  538.          @skill_icon_sprite.visible = vis
  539.          @skill_number_sprite.visible = vis
  540.       end
  541.       if ENABLE_ITEM_HUD
  542.          @item_layout_sprite.visible = vis
  543.          @item_icon_sprite.visible = vis
  544.          @item_number_sprite.visible = vis
  545.       end
  546.       if ENABLE_WEAPON_HUD         
  547.          @weapon_layout_sprite.visible = vis
  548.          @weapon_icon_sprite.visible = vis
  549.          @weapon_number_sprite.visible = vis
  550.       end
  551.       if ENABLE_SHIELD_HUD  
  552. #~     vis = false unless $game_party.battle_members[0].class_id == 11
  553.          @shield_layout_sprite.visible = vis
  554.          @shield_icon_sprite.visible = vis
  555.          @shield_number_sprite.visible = vis      
  556.       end
  557.       if ENABLE_GOLD_HUD   
  558.          @gold_layout_sprite.visible = vis
  559.          @gold_number_sprite.visible = vis         
  560.        end  
  561.        if SECOND_SKILL_HUD
  562.        @second_skill.visible = vis
  563.        @second_skill_icon.visible = vis
  564.        @second_skill_number_sprite.visible = vis
  565.      end
  566.       if THIRD_SKILL_HUD
  567.        @third_skill.visible = vis
  568.        @third_skill_icon.visible = vis
  569.        @third_skill_number_sprite.visible = vis
  570.          end
  571.   end
  572.  
  573. #--------------------------------------------------------------------------
  574. # ● Can Refresh Hud
  575. #--------------------------------------------------------------------------      
  576.   def can_refresh_hud?      
  577.       if @actor != nil
  578.          if ENABLE_SKILL_HUD
  579.             return true if @old_skill != @actor.skill_id
  580.           end
  581.          if ENABLE_ITEM_HUD
  582.             return true if @old_item != @actor.item_id
  583.          end
  584.          if ENABLE_WEAPON_HUD
  585.             return true if @old_weapon != @actor.equips[0]
  586.          end
  587.          if ENABLE_SHIELD_HUD
  588.             return true if @old_shield != @actor.equips[1]
  589.          end      
  590.        end
  591.  
  592.  
  593.       return false
  594.   end  
  595.  
  596. #--------------------------------------------------------------------------
  597. # ● Can Refresh Item Number
  598. #--------------------------------------------------------------------------        
  599.   def can_refresh_item_number?
  600.       return true if @item_number != $game_party.item_number(@item)      
  601.       return false
  602.   end  
  603.  
  604. #--------------------------------------------------------------------------
  605. # ● Create Item
  606. #--------------------------------------------------------------------------     
  607.   def refresh_item
  608.       @item_number = $game_party.item_number(@item)   
  609.       #Item Number ------------------------------------------------------------
  610.       @item_number_sprite.bitmap.clear
  611.       cost_split = @item_number.to_s.split(//)
  612.       for r in 0..cost_split.size - 1
  613.           number_abs = cost_split[r].to_i
  614.           src_rect = Rect.new(@number_cw * number_abs, 0, @number_cw, @number_ch)
  615.           @item_number_sprite.bitmap.blt(@number_sc  *  r, 0, @number_image, src_rect)        
  616.       end         
  617.       xf = ((cost_split.size * @number_sc) / 2)
  618.       @item_number_sprite.x = ITEM_HUD[0] + NUMBER[0] - xf
  619.   end  
  620.  
  621.   #--------------------------------------------------------------------------
  622.   # ● gold_number_up
  623.   #--------------------------------------------------------------------------
  624.   def gold_number_up
  625.       @gold_refresh = true
  626.       @gold_ref = 20 * (@gold - @gold_old) / 100
  627.       @gold_ref = 1 if @gold_ref < 1
  628.       @gold += @gold_ref   
  629.       if @gold >= $game_party.gold
  630.          @gold_old = $game_party.gold
  631.          @gold = $game_party.gold
  632.          @gold_ref = 0
  633.       end  
  634.   end   
  635.  
  636.   #--------------------------------------------------------------------------
  637.   # ● gold_number_down
  638.   #--------------------------------------------------------------------------
  639.   def gold_number_down
  640.       @gold_refresh = true
  641.       @gold_ref = 10 * (@gold_old - @gold) / 100
  642.       @gold_ref = 1 if @gold_ref < 1
  643.       @gold -= @gold_ref     
  644.       if @gold <= $game_party.gold
  645.          @gold_old = $game_party.gold
  646.          @gold = $game_party.gold
  647.          @gold_ref = 0
  648.       end   
  649.   end
  650.  
  651.   #--------------------------------------------------------------------------
  652.   # ● gold_number_update
  653.   #--------------------------------------------------------------------------
  654.   def gold_number_update  
  655.       @gold_number_sprite.bitmap.clear
  656.       @gold_number_text = @gold.abs.to_s.split(//)
  657.       for r in 0..@gold_number_text.size - 1
  658.           @gold_number_abs = @gold_number_text[r].to_i
  659.           gold_src_rect = Rect.new(@number_cw * @gold_number_abs, @number_ch * 2, @number_cw, @number_ch)
  660.           @gold_number_sprite.bitmap.blt(@number_cw  *  r, 0, @number_image, gold_src_rect)        
  661.       end   
  662.       @gold_refresh = false if @gold == $game_party.gold   
  663.     end  
  664.   #--------------------------------------------------------------------------
  665.   # ● 自定义的刷新方法
  666.   #--------------------------------------------------------------------------
  667.  
  668.   def wm_Refresh_method?
  669.     if @bskill != nil
  670.       if SECOND_SKILL_HUD
  671.         return true if @old_second_skill != @actor.skill_id2
  672.         end
  673.       end
  674.       if @cskill !=nil and THIRD_SKILL_HUD
  675.         return true if @old_third_skill !=  @actor.skill_id3
  676.         end
  677.     end
  678.  
  679. end
  680.  
  681. #==============================================================================
  682. # ■ Spriteset_Map
  683. #==============================================================================
  684. class Spriteset_Map
  685.  
  686.   #--------------------------------------------------------------------------
  687.   # ● initialize  
  688.   #--------------------------------------------------------------------------
  689.   alias mog_tool_hud_initialize initialize
  690.   def initialize  
  691.       @toolhud = Tool_Hud.new
  692.       mog_tool_hud_initialize
  693.   end
  694.  
  695.   #--------------------------------------------------------------------------
  696.   # ● Dispose
  697.   #--------------------------------------------------------------------------
  698.   alias mog_tool_hud_dispose dispose
  699.   def dispose   
  700.       @toolhud.dispose
  701.       mog_tool_hud_dispose
  702.   end
  703.  
  704.   #--------------------------------------------------------------------------
  705.   # ● update   
  706.   #--------------------------------------------------------------------------
  707.   alias mog_tool_hud_update update
  708.   def update   
  709.       @toolhud.update
  710.       mog_tool_hud_update
  711.   end
  712.  
  713.   #--------------------------------------------------------------------------
  714.   # ● Refresh Hud
  715.   #--------------------------------------------------------------------------  
  716.   alias mog_tool_hud_refresh_hud refresh_hud
  717.   def refresh_hud
  718.       mog_tool_hud_refresh_hud
  719.       @toolhud.refresh
  720.   end   
  721.  
  722. end   
  723.  
  724. $mog_rgss3_xas_tool_hud = true




Data.zip

318.69 KB, 下载次数: 58

评分

参与人数 2+2 收起 理由
kunikai + 1 精品文章
百里_飞柳 + 1 精品文章

查看全部评分

Lv3.寻梦者

梦石
0
星屑
2560
在线时间
447 小时
注册时间
2019-6-22
帖子
74
2
发表于 2020-1-31 17:15:16 | 只看该作者
本帖最后由 kunikai 于 2020-1-31 17:18 编辑


这可真是……
非常值得赞赏啊。

一介凡人。对大多数事情都有心无力的凡人。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-23 23:05

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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