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

Project1

 找回密码
 注册会员
搜索
查看: 2448|回复: 10

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
5197
在线时间
1256 小时
注册时间
2018-1-16
帖子
366
发表于 2020-11-13 15:10:43 | 显示全部楼层 |阅读模式

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

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

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

如题:劳烦大佬们帮帮忙

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

RUBY 代码复制
  1. LEVEL_LIST = {
  2.   1=>"菜鸡",
  3.   2=>"小菜鸡",
  4.  
  5. }
  6. LEVEL_LIST2 = {
  7.   1=>"勇士",
  8.   2=>"小勇士",
  9.  
  10. }
  11. class Window_Base < Window
  12.   def draw_actor_level(actor, x, y)
  13.     if LEVEL_LIST.has_key?(actor.level) or LEVEL_LIST2.has_key?(actor.level)
  14.       self.contents.draw_text(x, y, 128, 32, LEVEL_LIST[actor.level]) if $game_switches[1]
  15.       self.contents.draw_text(x, y, 128, 32, LEVEL_LIST2[actor.level]) if $game_switches[2]
  16.     else
  17.       self.contents.font.color = system_color
  18.       self.contents.draw_text(x, y, 32, 32, "Lv")
  19.       self.contents.font.color = normal_color
  20.       self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
  21.     end
  22.   end
  23. end

Lv5.捕梦者

梦石
0
星屑
33043
在线时间
10470 小时
注册时间
2009-3-15
帖子
4756
发表于 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
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7926
在线时间
1181 小时
注册时间
2007-7-29
帖子
2055
发表于 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
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7926
在线时间
1181 小时
注册时间
2007-7-29
帖子
2055
发表于 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 塞糖

查看全部评分

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
5197
在线时间
1256 小时
注册时间
2018-1-16
帖子
366
 楼主| 发表于 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
复制代码
回复 支持 反对

使用道具 举报

Lv4.逐梦者

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

例子:

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 18:03

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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