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

Project1

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

[已经解决] 对话自动匹配肖像图

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
141 小时
注册时间
2011-8-29
帖子
47
跳转到指定楼层
1
 楼主| 发表于 2013-1-22 18:42:31 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 jerrypan 于 2013-1-24 18:37 编辑

话说vx有过这么一个帖子 这里 这里
像这样对话时头像自动匹配到队伍中第x号角色va也能做到吗?
以下是我从原帖上提取的核心脚本,把它放到va中运行立即
就出错了。(改了几次都失败了,看来还是不会脚本{:2_283:} )
还请大侠翻译。
  1. class Game_Interpreter

  2.   def command_101
  3.     unless $game_message.busy
  4.       if @params[0] == "MAIN"    #索引图片的名称
  5.         actor = $game_party.members[@params[1]]
  6.         face_name = actor.character_name
  7.         face_index = actor.character_index
  8.       else
  9.         face_name = @params[0]
  10.         face_index = @params[1]
  11.       end
  12.       $game_message.face_name = face_name
  13.       $game_message.face_index = face_index
  14.       $game_message.background = @params[2]
  15.       $game_message.position = @params[3]
  16.       @index += 1
  17.       while @list[@index].code == 401       # 文章数据
  18.         $game_message.texts.push(@list[@index].parameters[0])
  19.         @index += 1
  20.       end
  21.       if @list[@index].code == 102          # 显示选择项
  22.         setup_choices(@list[@index].parameters)
  23.       elsif @list[@index].code == 103       # 数值输入处理
  24.         setup_num_input(@list[@index].parameters)
  25.       end
  26.       set_message_waiting                   # 设置等待信息结束
  27.     end
  28.     return false
  29.   end
  30.   
  31. end
复制代码

Lv2.观梦者 (暗夜天使)

梦石
0
星屑
266
在线时间
2355 小时
注册时间
2009-3-13
帖子
2309

贵宾

2
发表于 2013-1-22 23:20:19 | 只看该作者
本帖最后由 Sion 于 2013-1-22 23:45 编辑
  1. params[0] == "MAIN"
复制代码
就是新建一个图片命名为MAIN放到头像的文件夹里,要显示角色头像的时候选这个图片。这下明白了吧。报错的话,重写一下,把if.......end那段插到原方法wait_for_message之后。
回复 支持 反对

使用道具 举报

Lv2.观梦者 (暗夜天使)

梦石
0
星屑
266
在线时间
2355 小时
注册时间
2009-3-13
帖子
2309

贵宾

3
发表于 2013-1-23 12:23:33 | 只看该作者
这样改应该可以吧
  1.   def command_101
  2.       wait_for_message
  3.       if @params[0] == "MAIN"    #索引图片的名称
  4.         actor = $game_party.members[@params[1]]
  5.          face_name = actor.character_name
  6.          face_index = actor.character_index
  7.       else
  8.         face_name = @params[0]
  9.         face_index = @params[1]
  10.      end
  11.     $game_message.face_name = face_name
  12.     $game_message.face_index = face_index
  13.     $game_message.background = @params[2]
  14.     $game_message.position = @params[3]
  15.     while next_event_code == 401       # 文字数据
  16.       @index += 1
  17.       $game_message.add(@list[@index].parameters[0])
  18.     end
  19.     case next_event_code
  20.     when 102  # 显示选项
  21.       @index += 1
  22.       setup_choices(@list[@index].parameters)
  23.     when 103  # 数值输入的处理
  24.       @index += 1
  25.       setup_num_input(@list[@index].parameters)
  26.     when 104  # 物品选择的处理
  27.       @index += 1
  28.       setup_item_choice(@list[@index].parameters)
  29.     end
  30.     wait_for_message
  31.   end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
141 小时
注册时间
2011-8-29
帖子
47
4
 楼主| 发表于 2013-1-23 18:32:07 | 只看该作者
Sion 发表于 2013-1-23 12:23
这样改应该可以吧


不行啊,是不是要加
  1. class Window_Base < Window

  2. end
复制代码
貌似加了也没反应)

点评

楼上的是告诉您去改 Game_Interpreter 的 def command_101 那一段,不是叫您另外放脚本...  发表于 2013-1-23 18:36
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
141 小时
注册时间
2011-8-29
帖子
47
5
 楼主| 发表于 2013-1-23 18:48:25 | 只看该作者
本帖最后由 jerrypan 于 2013-1-24 18:29 编辑

貌似又犯了一个小小的错误,再次谢谢狮子,更感谢Sion的帮助。


完整版已更正
  1. # coding: utf-8
  2. =begin
  3. 对话自动匹配肖像

  4. 首先,不再使用角色在角色表中的索引,即不使用id,而使用角色在当前队伍中的编号,即你需
  5. 要知道当前主角应该在队伍中排第几.于是设置事件时,选择头像时,选择索引文件,然后主角
  6. 在队伍中第X位,就选择第X个(8个框框嘛)然后这样的话,对话时会显示队伍中第X位的头像。
  7. 然后,至于角色的头像显示,提供的方法中,需要加入一个素材,即在Face文件夹中加入一张图
  8. (内容没有任何要求),文件名命为“MAIN”(当然,这个也无所谓),称这张图为索引图片
  9. 下面是脚本:
  10. =end
  11. class Game_Interpreter
  12.   def command_101
  13.       wait_for_message
  14.       if @params[0] == "MAIN"    #索引图片的名称
  15.         actor = $game_party.members[@params[1]]
  16.          face_name = actor.face_name
  17.          face_index = actor.face_index
  18.       else
  19.         face_name = @params[0]
  20.         face_index = @params[1]
  21.      end
  22.     $game_message.face_name = face_name
  23.     $game_message.face_index = face_index
  24.     $game_message.background = @params[2]
  25.     $game_message.position = @params[3]
  26.     while next_event_code == 401       # 文字数据
  27.       @index += 1
  28.       $game_message.add(@list[@index].parameters[0])
  29.     end
  30.     case next_event_code
  31.     when 102  # 显示选项
  32.       @index += 1
  33.       setup_choices(@list[@index].parameters)
  34.     when 103  # 数值输入的处理
  35.       @index += 1
  36.       setup_num_input(@list[@index].parameters)
  37.     when 104  # 物品选择的处理
  38.       @index += 1
  39.       setup_item_choice(@list[@index].parameters)
  40.     end
  41.     wait_for_message
  42.   end
  43. end
复制代码
下面附几张图







无聊做了一张MAIN
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
141 小时
注册时间
2011-8-29
帖子
47
6
 楼主| 发表于 2013-1-23 19:02:56 | 只看该作者
Sion 发表于 2013-1-23 12:23
这样改应该可以吧

等一下
  1.          face_name = actor.character_name

  2.          face_index = actor.character_index
复制代码
是不是
  1.          face_name = actor.face_name
  2.          face_index = actor.face_index
复制代码
更好一点?

点评

不对,楼主的是正确的,我没注意到图片的角色脸图未完全对应数据库的顺序...  发表于 2013-1-23 20:03
貌似用 actor.face_index 也一样会有问题,我建议用 actor.index 吧。  发表于 2013-1-23 19:44
actor.character_index 的话,选MAIN的最右边的脸图,好像会显示成左下的脸。  发表于 2013-1-23 19:42
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 07:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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