查看: 4104|回复: 9

[已经过期] 轮到谁就显示对应的立绘的脚本,求大神完善一下

[复制链接]
梦石
0
星屑
433
在线时间
50 小时
注册时间
2017-1-10
回帖
16
发表于 2019-9-12 11:31:42 | 显示全部楼层 |阅读模式

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

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

×
偶然发现一个脚本,可以实现轮到谁就显示对应的大号立绘,而且还会根据生命变

我想改成根据状态变

另外我还有个脚本可以根据状态自动改变战斗图,不知道这两个脚本怎么联动


这是自动根据状态找战斗图的

[pre lang="ruby"]#==============================================================================
# ■ 我方显示战斗图                                                 by:celica
#------------------------------------------------------------------------------
#==============================================================================

#==============================================================================
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 取得画面 X 坐标
  #--------------------------------------------------------------------------
  def screen_x
    (3-index) * Graphics.width / 4 + Graphics.width / 8
  end
  #--------------------------------------------------------------------------
  # ● 取得画面 Y 坐标
  #--------------------------------------------------------------------------
  def screen_y
    Graphics.height
  end
  #--------------------------------------------------------------------------
  # ● 取得画面 Z 坐标
  #--------------------------------------------------------------------------
  def screen_z
    screen_y
  end
  #--------------------------------------------------------------------------
  # ● 自动获得战斗图
  #--------------------------------------------------------------------------
  def battler_name
    name = @name
    states.each {|s| name = name + "_" + s.name if s.show_lihui? }
   #name = @name unless FileTest.exists?("Graphics/Battlers/" + name + ".png")
    return name
  end
  #--------------------------------------------------------------------------
  # ● 是否使用活动块
  #--------------------------------------------------------------------------
  def use_sprite?
    true
  end
end
#==============================================================================

#==============================================================================
class Spriteset_Battle
  #--------------------------------------------------------------------------
  # ● 生成角色活动块
  #--------------------------------------------------------------------------
  def create_actors
    @actor_sprites = $game_party.members.reverse.collect do |actor|
      Sprite_Battler.new(@viewport1, actor)
    end
  end
end

[/pre]

这是显示大号立绘的,我想改的应该就在11行,但是不会写。。。

[pre lang="ruby"]class Window_BattlePicture < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    super(15, 10, 640, 480)
  end
  #--------------------------------------------------------------------------
  # ● 立ち絵のセット
  #--------------------------------------------------------------------------
  def set(face_name, actor = nil)
    self.contents.clear
    if actor != nil
      case ((actor.hp * 100) / actor.mhp)
      when 31...60
        bitmap1 = Cache.picture(face_name + "-2")
      when 0...30
        bitmap1 = Cache.picture(face_name + "-3")
      else
        bitmap1 = Cache.picture(face_name)
      end
    end
    rect1 = Rect.new(0, 0, bitmap1.width, bitmap1.height)
    x = 570-bitmap1.width/2 + 0
    y = 480-bitmap1.height + 0
    self.contents.blt(x, y, bitmap1, rect1)
  end
end

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 情報表示ビューポートの作成
  #--------------------------------------------------------------------------
  alias wd_orig_create_info_viewport_009 create_info_viewport
  def create_info_viewport
    @battle_picture_window = Window_BattlePicture.new
    @battle_picture_window.hide
    @battle_picture_window.opacity = 0
    wd_orig_create_info_viewport_009
  end
  #--------------------------------------------------------------------------
  # ● 次のコマンド入力へ
  #--------------------------------------------------------------------------
  alias wd_orig_next_command_009 next_command
  def next_command
    @battle_picture_window.hide
    wd_orig_next_command_009
  end
  #--------------------------------------------------------------------------
  # ● 前のコマンド入力へ
  #--------------------------------------------------------------------------
  alias wd_orig_prior_command_009 prior_command
  def prior_command
    @battle_picture_window.hide
    wd_orig_prior_command_009
  end
  #--------------------------------------------------------------------------
  # ● アクターコマンド選択の開始
  #--------------------------------------------------------------------------
  alias wd_orig_start_actor_command_selection_009 start_actor_command_selection
  def start_actor_command_selection
    wd_orig_start_actor_command_selection_009
    actor = BattleManager.actor
    @battle_picture_window.show
    @battle_picture_window.set(actor.face_name, actor)
  end
end[/pre]
梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2019-9-12 13:02:49 | 显示全部楼层
本帖最后由 soulsaga 于 2019-9-13 22:08 编辑

[pre lang="ruby"]#--------------------------------------------------------------------------
  # ● 立ち絵のセット
  #--------------------------------------------------------------------------
  def set(face_name, actor = nil)
    self.contents.clear
    name = ""
    actor.states.each {|s| name = name + "_" + STATE_P::SP[s.id] if s.show_lihui? } if actor.states.size == 1
    name = name + "_" + STATE_P::SP["N"] if actor.states.size > 1
    bitmap1 = Cache.picture(face_name + name)
    rect1 = Rect.new(0, 0, bitmap1.width, bitmap1.height)
    x = 570-bitmap1.width/2 + 0
    y = 480-bitmap1.height + 0
    self.contents.blt(x, y, bitmap1, rect1)
  end
end[/pre]

下面脚本插入到MAIN的上面
[pre lang="ruby"]module STATE_P
  SP = {
#写法 状态ID=>["表情名"],
1=>"死亡",
4=>"中毒",
"N"=>"嘤嘤嘤",
}
end
[/pre]
回复

使用道具 举报

梦石
0
星屑
433
在线时间
50 小时
注册时间
2017-1-10
回帖
16
 楼主| 发表于 2019-9-12 23:00:09 | 显示全部楼层
太谢谢了,
两个问题
1,位置怎么调呢,我用了800 600 分辨率脚本,结果显示的大图会被消掉一点
2,不考虑跟自动立绘联动,单纯给某几个特定状态附加不一样的图,其他都用一样的,有几个状态都有的话最好能设置显示哪一个
回复

使用道具 举报

梦石
0
星屑
433
在线时间
50 小时
注册时间
2017-1-10
回帖
16
 楼主| 发表于 2019-9-13 13:40:02 | 显示全部楼层
soulsaga 发表于 2019-9-12 13:02
#--------------------------------------------------------------------------
  # ● 立ち絵のセット
   ...

太谢谢了,不点回复大佬看不到吧,帮我帮到底吗,谢谢谢谢谢谢谢谢谢谢谢谢谢谢

两个问题
1,位置怎么调呢,我用了800 600 分辨率脚本,结果显示的大图会被消掉一点
2,不考虑跟自动立绘联动,单纯给某几个特定状态附加不一样的图,其他都用一样的,有几个状态都有的话最好能设置显示哪一个
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2019-9-13 13:42:07 | 显示全部楼层
sezhiyang 发表于 2019-9-13 13:40
太谢谢了,不点回复大佬看不到吧,帮我帮到底吗,谢谢谢谢谢谢谢谢谢谢谢谢谢谢

两个问题

1我不知道..
2..什么是联动..还有图指什么图?
还有..不是大佬..是平凡的萌新
回复

使用道具 举报

梦石
0
星屑
433
在线时间
50 小时
注册时间
2017-1-10
回帖
16
 楼主| 发表于 2019-9-13 18:04:59 | 显示全部楼层
soulsaga 发表于 2019-9-13 13:42
1我不知道..
2..什么是联动..还有图指什么图?
还有..不是大佬..是平凡的萌新 ...

就是按某几个特定状态id 显示不同的图片,应该是把原来的脚本的判断hp 改成判断某个指定的状态就行了
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2019-9-13 18:45:40 | 显示全部楼层
sezhiyang 发表于 2019-9-13 18:04
就是按某几个特定状态id 显示不同的图片,应该是把原来的脚本的判断hp 改成判断某个指定的状态就行了 ...

所以你是要把第2个脚本改成显示图片..不是显示立绘?
回复

使用道具 举报

梦石
0
星屑
433
在线时间
50 小时
注册时间
2017-1-10
回帖
16
 楼主| 发表于 2019-9-13 21:11:05 | 显示全部楼层
soulsaga 发表于 2019-9-13 18:45
所以你是要把第2个脚本改成显示图片..不是显示立绘?

第二个脚本第14行不是有个判断hp显示不同的图片么,改成根据状态id 显示不同图片


  1. class Window_BattlePicture < Window_Base
  2.   #--------------------------------------------------------------------------
  3.   # ● オブジェクト初期化
  4.   #--------------------------------------------------------------------------
  5.   def initialize
  6.     super(15, 10, 640, 480)
  7.   end
  8.   #--------------------------------------------------------------------------
  9.   # ● 立ち絵のセット
  10.   #--------------------------------------------------------------------------
  11.   def set(face_name, actor = nil)
  12.     self.contents.clear
  13.     if actor != nil
  14.       case ((actor.hp * 100) / actor.mhp)
  15.       when 31...60
  16.         bitmap1 = Cache.picture(face_name + "-2")
  17.       when 0...30
  18.         bitmap1 = Cache.picture(face_name + "-3")
  19.       else
  20.         bitmap1 = Cache.picture(face_name)
  21.       end
  22.     end
  23.     rect1 = Rect.new(0, 0, bitmap1.width, bitmap1.height)
  24.     x = 570-bitmap1.width/2 + 0
  25.     y = 480-bitmap1.height + 0
  26.     self.contents.blt(x, y, bitmap1, rect1)
  27.   end
  28. end

  29. class Scene_Battle < Scene_Base
  30.   #--------------------------------------------------------------------------
  31.   # ● 情報表示ビューポートの作成
  32.   #--------------------------------------------------------------------------
  33.   alias wd_orig_create_info_viewport_009 create_info_viewport
  34.   def create_info_viewport
  35.     @battle_picture_window = Window_BattlePicture.new
  36.     @battle_picture_window.hide
  37.     @battle_picture_window.opacity = 0
  38.     wd_orig_create_info_viewport_009
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 次のコマンド入力へ
  42.   #--------------------------------------------------------------------------
  43.   alias wd_orig_next_command_009 next_command
  44.   def next_command
  45.     @battle_picture_window.hide
  46.     wd_orig_next_command_009
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 前のコマンド入力へ
  50.   #--------------------------------------------------------------------------
  51.   alias wd_orig_prior_command_009 prior_command
  52.   def prior_command
  53.     @battle_picture_window.hide
  54.     wd_orig_prior_command_009
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● アクターコマンド選択の開始
  58.   #--------------------------------------------------------------------------
  59.   alias wd_orig_start_actor_command_selection_009 start_actor_command_selection
  60.   def start_actor_command_selection
  61.     wd_orig_start_actor_command_selection_009
  62.     actor = BattleManager.actor
  63.     @battle_picture_window.show
  64.     @battle_picture_window.set(actor.face_name, actor)
  65.   end
  66. end
复制代码
回复

使用道具 举报

梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2019-9-13 22:08:33 | 显示全部楼层
sezhiyang 发表于 2019-9-13 21:11
第二个脚本第14行不是有个判断hp显示不同的图片么,改成根据状态id 显示不同图片

更新脚本了...
回复

使用道具 举报

梦石
0
星屑
433
在线时间
50 小时
注册时间
2017-1-10
回帖
16
 楼主| 发表于 2019-9-14 21:37:42 | 显示全部楼层
soulsaga 发表于 2019-9-12 13:02
#--------------------------------------------------------------------------
  # ● 立ち絵のセット
   ...

收下我的膝盖。。。但我可以说我没看懂怎么用么。。。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部