查看: 3219|回复: 10

[已经解决] 【已解决】如何让多等级名称在文章中显示成中文

[复制链接]
梦石
0
星屑
6412
在线时间
1700 小时
注册时间
2018-1-16
回帖
364
发表于 2020-11-13 15:10:43 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 l734273398 于 2020-11-13 17:14 编辑

如题:劳烦大佬们帮帮忙

怎么在对话框中,显示文章,怎么把等级的名称显示出来,而不是代入等级的数字

[pre lang="ruby"]LEVEL_LIST = {
  1=>"菜鸡",
  2=>"小菜鸡",

}
LEVEL_LIST2 = {
  1=>"勇士",
  2=>"小勇士",

}
class Window_Base < Window
  def draw_actor_level(actor, x, y)
    if LEVEL_LIST.has_key?(actor.level) or LEVEL_LIST2.has_key?(actor.level)
      self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level]) if $game_switches[1]
      self.contents.draw_text(x, y, 128, 32, LEVEL_LIST2[actor.level]) if $game_switches[2]
    else
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 32, 32, "Lv")
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
    end
  end
end
[/pre]
梦石
0
星屑
39236
在线时间
11155 小时
注册时间
2009-3-15
回帖
4768
发表于 2020-11-13 15:53:27 | 显示全部楼层
大佬怎么又来?
你有什么问题...

点评

我之前用了$game_actors[1].name = $game_actors[1].level.to_s,这样,但是在文章中\n[1],就是等级的数字,而不是等级名称  发表于 2020-11-13 16:16
对话框中,显示文章,怎么把等级的名称显示出来,而不是代入等级的数字  发表于 2020-11-13 16:09
回复

使用道具 举报

梦石
0
星屑
8003
在线时间
1184 小时
注册时间
2007-7-29
回帖
2014
发表于 2020-11-13 16:04:21 | 显示全部楼层
同楼上疑惑……
文章显示说的是对话框?
没记错对话框没有显示等级功能吧。

点评

嗯,没有,所以只能用变量或者角色的名称来代入,我之前用了$game_actors[1].name = $game_actors[1].level.to_s,但是在文章中\n[1],是数字不是等级名称  发表于 2020-11-13 16:18
对话框中,显示文章,怎么把等级的名称显示出来,而不是代入等级的数字  发表于 2020-11-13 16:10
回复

使用道具 举报

梦石
0
星屑
8003
在线时间
1184 小时
注册时间
2007-7-29
回帖
2014
发表于 2020-11-13 16:22:01 | 显示全部楼层
  1. class Interpreter
  2.   def levelName(varId, actorId)
  3.     list = {
  4.       1=>"菜鸡",
  5.       2=>"小菜鸡",
  6.     }
  7.     actor = $game_actors[actorId]
  8.     gv = $game_variables[varId]
  9.     if (actor and gv and list[actor.level])
  10.       $game_variables[varId] = list[actor.level]
  11.     else
  12.       $game_variables[varId] = 0
  13.     end
  14.   end
  15. end
复制代码

在显示文章前使用脚本:
  1. levelName(变量号,角色编号)
复制代码

例子:
  1. levelName(5, 1)
复制代码

这样要是1号角色的等级为1的时候5号变量会变成菜鸡,接着在文章显示使用\v[5]就可以把变量显示出。

点评

用了这个也没反应,无奈>_<  发表于 2020-11-13 16:38

评分

参与人数 1赞 +1 收起 理由
l734273398 + 1 塞糖

查看全部评分

回复

使用道具 举报

梦石
0
星屑
6412
在线时间
1700 小时
注册时间
2018-1-16
回帖
364
 楼主| 发表于 2020-11-13 16:32:32 | 显示全部楼层
enghao_lim 发表于 2020-11-13 16:22
在显示文章前使用脚本:

例子:

我是用搭配这个的,在不影响开关的前提下,在文章中又能显示出境界的名字

  1. LEVEL_LIST = {
  2.   1=>"菜鸡",
  3.   2=>"小菜鸡",

  4. }
  5. LEVEL_LIST2 = {
  6.   1=>"勇士",
  7.   2=>"小勇士",

  8. }
  9. class Window_Base < Window
  10.   def draw_actor_level(actor, x, y)
  11.     if LEVEL_LIST.has_key?(actor.level) or LEVEL_LIST2.has_key?(actor.level)
  12.       self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level]) if $game_switches[1]
  13.       self.contents.draw_text(x, y, 128, 32, LEVEL_LIST2[actor.level]) if $game_switches[2]
  14.     else
  15.       self.contents.font.color = system_color
  16.       self.contents.draw_text(x, y, 32, 32, "Lv")
  17.       self.contents.font.color = normal_color
  18.       self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  19.     end
  20.   end
  21. end
复制代码
回复

使用道具 举报

梦石
0
星屑
6412
在线时间
1700 小时
注册时间
2018-1-16
回帖
364
 楼主| 发表于 2020-11-13 17:14:10 | 显示全部楼层
enghao_lim 发表于 2020-11-13 16:22
在显示文章前使用脚本:

例子:

在脚本中加入这行脚本$game_variables[1] = LEVEL_LIST[actor.level]直接在文章中用变量就可以实现了,感谢回复
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部