查看: 3062|回复: 10

[已经解决] 45°战斗发生冲突

[复制链接]
梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
回帖
30
发表于 2013-7-20 16:20:20 | 显示全部楼层 |阅读模式

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

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

×
我用了一个45°战斗脚本后,发现以前的”状态叠加,图标化“和”显示敌人血条“没用了好像是被覆盖了。
这是45°脚本
[pre lang="ruby" line="1"]# ————————————————————————————————————
# 本脚本来自http://rpg.blue/web/,转载请保留此信息
# ————————————————————————————————————
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 取得战斗画面的 X 坐标
#--------------------------------------------------------------------------
def screen_x
case self.index
when 0
return 370
when 1
return 450
when 2
return 530
when 3
return 580
else
return 600
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Y 坐标
#--------------------------------------------------------------------------
def screen_y
case self.index
when 0
return 475
when 1
return 395
when 2
return 360
when 3
return 325
else
return 1000
end
end
#--------------------------------------------------------------------------
# ● 取得战斗画面的 Z 坐标
#--------------------------------------------------------------------------
def screen_z
case self.index
when 0
return 10
when 1
return 9
when 2
return 8
when 3
return 7
else
return 0
end
end
end

#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘 HP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_hp1(actor, x, y, width = 72)
# 描绘字符串 "HP"
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 24, $data_system.words.hp)
# 计算描绘 MaxHP 所需的空间
if width - 24 >= 32
hp_x = x + 32# + width - 24
end
# 描绘 HP
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 32, 24, actor.hp.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描绘 SP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_sp1(actor, x, y, width = 72)
# 描绘字符串 "SP"
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 24, $data_system.words.sp)
# 计算描绘 MaxSP 所需的空间
if width - 24 >= 32
sp_x = x + 32# + width - 24
end
# 描绘 SP
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 32, 24, actor.sp.to_s, 2)
end
end


#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
#  显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
#$data_system_level_up_me = "Audio/ME/升级音乐"
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 10, height - 32)
self.opacity = 0
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# ● 设置升级标志
# actor_index : 角色索引
#--------------------------------------------------------------------------
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
case i
when 0
x = 310
y = 390
when 1
x = 390
y = 340
when 2
x = 480
y = 300
when 3
x = 550
y = 270
end
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 80, 24, "LEVEL UP!")
Audio.me_stop
# Audio.me_play($data_system_level_up_me)
else
draw_actor_hp1(actor, x-15, y-15, 80)
draw_actor_sp1(actor, x-15, y+5, 80)
end
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 主界面的不透明度下降
if $game_temp.battle_main_phase
self.contents_opacity -= 50 if self.contents_opacity > 1
else
self.contents_opacity += 50 if self.contents_opacity < 255
end
end
end


#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
alias xrxs_bp2_refresh refresh
def refresh
xrxs_bp2_refresh
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
case i
when 0
x = 310
y = 390
when 1
x = 390
y = 340
when 2
x = 480
y = 300
when 3
x = 550
y = 270
end
draw_actor_hp_meter(actor, x, y, 50)
draw_actor_sp_meter(actor, x, y + 8, 50)
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● HP描画
#--------------------------------------------------------------------------
def draw_actor_hp_meter(actor, x, y, width = 156, type = 0)
if type == 1 and actor.hp == 0
return
end
self.contents.font.color = system_color
self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 25))
w = width * actor.hp / actor.maxhp
self.contents.fill_rect(x, y+28, w,1, Color.new(255, 96, 96, 255))
self.contents.fill_rect(x, y+29, w,1, Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y+30, w,1, Color.new(128, 0, 0, 255))
self.contents.fill_rect(x, y+31, w,1, Color.new(0, 0, 0, 255))
end
#--------------------------------------------------------------------------
# ● SP描画
#--------------------------------------------------------------------------
def draw_actor_sp_meter(actor, x, y, width = 156, type = 0)
if type == 1 and actor.hp == 0
return
end
self.contents.font.color = system_color
self.contents.fill_rect(x-1, y+27, width+2,6, Color.new(0, 0, 0, 255))
w = width * actor.sp / actor.maxsp
self.contents.fill_rect(x, y+28, w,1, Color.new(128, 255, 255, 255))
self.contents.fill_rect(x, y+29, w,1, Color.new(0, 255, 255, 255))
self.contents.fill_rect(x, y+30, w,1, Color.new(0, 192, 192, 255))
self.contents.fill_rect(x, y+31, w,1, Color.new(0, 128, 128, 255))
end
end[/pre]
梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
回帖
30
 楼主| 发表于 2013-7-20 16:23:28 | 显示全部楼层
这是血条的:

#==============================================================================
# 本脚本来自,使用和转载请保留此信息
#==============================================================================

class Window_Help < Window_Base
  def set_enemy(actor)
    self.contents.clear
    draw_actor_name(actor, 4, 0)
    draw_actor_state(actor, 140, 0)
    carol3_draw_hp_bar(actor, 284, 0)
    carol3_draw_sp_bar(actor, 460, 0)
  
    @text = nil
    self.visible = true
  end
  def carol3_draw_hp_bar(actor, x, y, width = 128) #宽度可调
    self.contents.font.color = system_color
    w = width * actor.hp / [actor.maxhp,1].max
    if actor.maxhp != 0
      rate = actor.hp.to_f / actor.maxhp
    else
      rate = 0
    end
    color1 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 150)
    self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+17, w,6,color1)
    self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.draw_text(x-53,y,128,32,$data_system.words.hp,1)
    if actor.hp>actor.maxhp/3
      self.contents.font.color = Color.new(255, 255, 255, 250)
    end
    if actor.hp>=actor.maxhp/6 and actor.maxhp/3>actor.hp
      self.contents.font.color = Color.new(200, 200, 0, 255)
    end
    if actor.maxhp/6>actor.hp
      self.contents.font.color = Color.new(200, 0, 0, 255)
    end
    self.contents.draw_text(x+47,y,128,32,actor.hp.to_s,1)
  end
  def carol3_draw_sp_bar(actor, x, y, width = 128)
    self.contents.font.color = system_color
    if actor.maxsp != 0
      rate = actor.sp.to_f / actor.maxsp
    else
      rate = 0
    end
    color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
    w = width * actor.sp / [actor.maxsp,1].max
    self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+17, w,6,color2)
    self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
    self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
    self.contents.draw_text(x-53,y,128,32,$data_system.words.sp,1)
    if actor.hp>actor.maxsp/3
      self.contents.font.color = Color.new(255, 255, 255, 250)
    end
    if actor.hp>=actor.maxsp/6 and actor.maxsp/3>actor.sp
      self.contents.font.color = Color.new(200, 200, 0, 255)
    end
    if actor.maxsp/6>actor.sp
      self.contents.font.color = Color.new(200, 0, 0, 255)
    end
    self.contents.draw_text(x+47,y,128,32,actor.sp.to_s,1)
  end
end
#==============================================================================
# 本脚本来自,使用和转载请保留此信息
#==============================================================================
回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
回帖
30
 楼主| 发表于 2013-7-20 16:24:13 | 显示全部楼层
这是状态叠加,图标化的
  1. #==============================================================================
  2. # Date 12-31-2005
  3. # 重定义类:Window_Base, Window_Help
  4. #==============================================================================
  5. # 脚本功能:
  6. # 实现战斗中和菜单中用图标显示状态,代替原来的文字显示。
  7. # 默认最多同时显示5个状态
  8. #------------------------------------------------------------------------------
  9. # 设置方法:
  10. # 一个状态对应的图标文件名为“状态的动画ID.png”
  11. # 例如某状态的动画ID为50,那么它的图标就是“Icons\50.png”
  12. # 如果找不到对应的文件,会报错
  13. #==============================================================================

  14. # 注意,在ICON_STATE_IDS中写上需要带图标的状态ID
  15. # ICON_STATE_IDS是一个数组,数组的方法请参考帮助文件
  16. # 例如:
  17. # 只要1,5,8号状态带图标,就这样:ICON_STATE_IDS = [1,5,8]
  18. # 要20到50号状态带图标:ICON_STATE_IDS = 20..50

  19. ICON_STATE_IDS = [2..10]

  20. #==============================================================================
  21. # ■ Window_Base
  22. #------------------------------------------------------------------------------
  23. #  游戏中全部窗口的超级类。
  24. #==============================================================================

  25. class Window_Base < Window
  26. #--------------------------------------------------------------------------
  27. # ● 描绘状态
  28. #     actor : 角色
  29. #     x     : 描画目标 X 坐标
  30. #     y     : 描画目标 Y 坐标
  31. #     width : 描画目标的宽
  32. #--------------------------------------------------------------------------
  33. def draw_actor_state(actor, x, y, width = 120)
  34.   state_size = 0
  35.   for state in actor.states
  36.     # 图标数量超出宽度就中断循环
  37.     if state_size >= width / 1
  38.       break
  39.     end
  40.     # 此状态不带图标就跳过
  41.     if !ICON_STATE_IDS.include?(state)
  42.       next
  43.     end
  44.     bitmap = RPG::Cache.icon($data_states[state].name + "_sta.png")
  45.     if actor.states_turn[state] >= $data_states[state].hold_turn/2
  46.       opacity = 255
  47.     else
  48.       opacity = 100
  49.     end
  50.     # 这里的图标大小默认是24x24,要改就改下面那个Rect.new(0, 0, 24, 24)
  51.     self.contents.blt(x + 24 * state_size ,y ,bitmap, Rect.new(0, 0, 24, 24), opacity)
  52.     state_size += 1
  53.   end
  54. end
  55. end


  56. #==============================================================================
  57. # ■ Window_Help
  58. #------------------------------------------------------------------------------
  59. #  特技及物品的说明、角色的状态显示的窗口。
  60. #==============================================================================

  61. class Window_Help < Window_Base
  62. #--------------------------------------------------------------------------
  63. # ● 设置敌人
  64. #     enemy : 要显示名字和状态的敌人
  65. #--------------------------------------------------------------------------
  66. def set_enemy(enemy)
  67.   # 描绘状态图标
  68.   state_size = 0
  69.   for state in enemy.states
  70.     # 图标数量超出宽度就中断循环
  71.     if state_size >= width / 16
  72.       break
  73.     end
  74.     # 此状态不带图标就跳过
  75.     if !ICON_STATE_IDS.include?(state)
  76.       next
  77.     end
  78.     bitmap = RPG::Cache.icon($data_states[state].name + "_sta.png")
  79.     if enemy.states_turn[state] >= $data_states[state].hold_turn/2
  80.       opacity = 255
  81.     else
  82.       opacity = 100
  83.     end
  84.     self.contents.blt(70 + 16 * state_size, 0, bitmap, Rect.new(0, 0, 24, 24), opacity)
  85.     state_size += 1
  86.   end
  87.   # 描绘敌人名字
  88.   set_text(enemy.name, 1)
  89. end
  90. end

  91. class Game_Battler
  92. attr_reader :states_turn       # 声明状态剩余回合
  93. end
复制代码
回复

使用道具 举报

梦石
0
星屑
34467
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2013-7-20 16:34:21 | 显示全部楼层
不是被覆盖了,而是没用以前的战斗状态窗口了,用的是那个 45 度 战斗自带的窗口。
感觉LZ用的脚本好杂,如果要达到LZ的要求,就需要整合。
但不知LZ的要求是怎么样的,没有一个模版:比如 敌人血条放哪儿?状态图标显示在哪个位置?
冒然整合也不符合LZ的要求。
xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
回帖
30
 楼主| 发表于 2013-7-21 09:57:12 | 显示全部楼层
在攻击敌人的时候,把敌人的血条显示在最上面那个框上,状态都在人物的左边
回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
回帖
30
 楼主| 发表于 2013-7-21 17:58:31 | 显示全部楼层
急!!!!快来回复呀
回复

使用道具 举报

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
回帖
10960

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

发表于 2013-7-21 18:13:45 | 显示全部楼层
脚本好乱啊
看不下去了
能提供一下工程范例的话,可以会比较好解决······
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
回帖
30
 楼主| 发表于 2013-7-22 13:02:36 | 显示全部楼层
就这个

Project1.zip

205.13 KB, 下载次数: 19

回复

使用道具 举报

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
回帖
10960

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

发表于 2013-7-22 13:15:05 | 显示全部楼层
Project1.zip (204.19 KB, 下载次数: 24)
修改好了

点评

发现露露现在水平超高的说  发表于 2013-7-22 13:41
我不懂脚本······  发表于 2013-7-22 13:22
目前 指的是现在这个时刻..  发表于 2013-7-22 13:16
帮我看一下我的问题吧= = 发现目前论坛里懂脚本木有几个..  发表于 2013-7-22 13:16

评分

参与人数 1星屑 +105 收起 理由
弗雷德 + 105 认可答案

查看全部评分

大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复

使用道具 举报

梦石
0
星屑
50
在线时间
47 小时
注册时间
2013-7-14
回帖
30
 楼主| 发表于 2013-7-22 13:20:18 | 显示全部楼层
哇!你修改的哪里呀?
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部