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

Project1

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

[已经解决] 请问如何显示状态回合数?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
46
在线时间
1502 小时
注册时间
2010-8-27
帖子
392
跳转到指定楼层
1
发表于 2013-9-18 08:39:10 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
2星屑
请问如何将默认的状态显示(即“[正常]”这样的文字)改成显示该状态的剩余回合数?

最佳答案

查看完整内容

初制品。由于要显示的状态文字较多,缩小了字体大小。

点评

我想你的关键问题是剩余回合数怎么获取吧?其实我也是找了很久。  发表于 2013-9-18 10:43
建议新建窗口显示状态,也可根据思路修改或调整。  发表于 2013-9-18 10:37

Lv5.捕梦者

梦石
0
星屑
31958
在线时间
5081 小时
注册时间
2012-11-19
帖子
4877

开拓者

2
发表于 2013-9-18 08:39:11 | 只看该作者
初制品。由于要显示的状态文字较多,缩小了字体大小。
  1. #==============================================================================
  2. class Game_Battler
  3.   attr_accessor :states_turn
  4. end
  5. #==============================================================================
  6. class Window_Base < Window
  7.   #--------------------------------------------------------------------------
  8.   def make_battler_state_text(battler, width, need_normal)
  9.     brackets_width = self.contents.text_size("[]").width
  10.     if battler.is_a?(Game_Actor)
  11.       text = []
  12.       txt = ""
  13.       if battler.states != []
  14.         txt_1 = "回合后,"
  15.         txt_2 = "% 几率解除。"
  16.         for i in battler.states_turn.keys.clone
  17.           if $data_states[i].rating >= 1
  18.             txt = $data_states[i].name
  19.             txt = "[" + txt + "]  " + battler.states_turn[i].to_s + txt_1
  20.             txt = txt + $data_states[i].auto_release_prob.to_s + txt_2
  21.             text.push(txt)
  22.           end
  23.         end
  24.       end
  25.       if text == []
  26.         if need_normal
  27.           text.push("[正常]")
  28.         end
  29.       end
  30.     else
  31.       text = ""
  32.       for i in battler.states
  33.         if $data_states[i].rating >= 1
  34.           if text == ""
  35.             text = $data_states[i].name
  36.           else
  37.             new_text = text + "/" + $data_states[i].name
  38.             text_width = self.contents.text_size(new_text).width
  39.             if text_width > width - brackets_width
  40.               break
  41.             end
  42.             text = new_text
  43.           end
  44.         end
  45.       end
  46.       # 状态名空的字符串是 "[正常]" 的情况下
  47.       if text == ""
  48.         if need_normal
  49.           text = "[正常]"
  50.         end
  51.       else
  52.         # 加上括号
  53.         text = "[" + text + "]"
  54.       end
  55.     end
  56.     return text
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   def draw_actor_state(actor, x, y, width = 120)
  60.     text = make_battler_state_text(actor, width, true)
  61.     self.contents.font.size = 16
  62.     self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
  63.     for i in 0...text.size
  64.       txt = text[i]
  65.       y = i * 24 + y
  66.       self.contents.draw_text(x, y, width, 32, txt)
  67.     end
  68.     self.contents.font.size = 22
  69.   end
  70. end
复制代码

点评

新的问题已经自己解决,不麻烦了  发表于 2013-9-18 16:25
不好意思,能不能再问一个问题:这个状态显示能否竖着显示——就是上图的显示方法变成: 状态 -【换行】- 回合- -【换行】- 几率 行-这样子显示   发表于 2013-9-18 14:39
这个是用来配合图标状态用的,所以只需要数字,太多就不好看了  发表于 2013-9-18 10:54
很不错的脚本,虽然我只需要回合数就可以了。  发表于 2013-9-18 10:41
意见要看LZ的。不过本人建议新建窗口显示状态  发表于 2013-9-18 10:35

评分

参与人数 1星屑 +135 收起 理由
myownroc + 135 认可答案

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 17:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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