|
|
|
|
将事件里面的几个选项随机排布 ( 66RPG, RPG MAKER XP教程 )
本站首页→制作教程→RMVX 中级教程 |
|
将事件里面的几个选项随机排布
教程作者:柳柳
首发网址:点此进入本教学的原始帖
适宜用户:需要此效果 技术通用度:★★ 技术应用复杂度:50 (满分150分) 学习的理解难度:50 (满分150分)
|
作者的话: 做着玩的……
Game_Interpreter的def setup_choices(params)这个函数,稍微修改一下算法:
教学正文:
#-------------------------------------------------------------------------- # ● 设置选择项 #-------------------------------------------------------------------------- def setup_choices(params) if $game_message.texts.size <= 4 - params[0].size $game_message.choice_start = $game_message.texts.size $game_message.choice_max = params[0].size random_choices = {} choice_array = [] actually_array = [] i = 0 for s in params[0] random_choices[i] = s choice_array.push(i) i += 1 # $game_message.texts.push(s) end # choice_array = [0, 1, 2] for i in 0...$game_message.choice_max if choice_array.size > 1 j = rand(choice_array.size) else j = 0 end actually_array.push(choice_array[j]) choice_array.delete_at(j) end j = 0 realparams = 0 for i in actually_array $game_message.texts.push(random_choices[i]) if params[1] - 1 == i and realparams == 0 realparams = j + 1 end j += 1 end $game_message.choice_cancel_type = realparams # params[1] $game_message.choice_proc = Proc.new { |n| @branch[@indent] = actually_array[n] } @index += 1 end end 这样事件里面的选项就会按随机顺序排列了,不影响正常使用,包括选择和取消的情况都应该是可以的。
本来想用于制作一个问答游戏,现在发帖时候又觉得似乎做问答也不好用
关键字:RMVX 特殊效果
发布日期:2008-8-7 19:09:53 点击量:1
上一篇:VX用寻路算法. 下一篇:没有下一条记录
|
|