赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 0 |
最后登录 | 2013-3-22 |
在线时间 | 3 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 145
- 在线时间
- 3 小时
- 注册时间
- 2013-3-9
- 帖子
- 1
|
本帖最后由 hcm 于 2013-3-25 12:48 编辑
美丽晨露 发表于 2013-3-8 08:18
麻烦楼主把脚本贴出来,这样才能让我们帮助你噢
我也想知道.- class Scene_NameGen
- def main
- # 产生命令窗口
- @command_window = Window_Command.new(250, ["输出为文本", "选择", "离开", "重新产生"])
- @command_window.x = 320 - @command_window.width
- @command_window.y = 240 - @command_window.height
- @command_window.z = 300
- @command_window.index = 0
- @command_window.visible = false
- @command_window.active = false
-
- # 产生询问窗口
- @ask_window = Window_Base.new(120, **, 400, 64)
- @ask_window.contents = Bitmap.new(368, 32)
- string = "要生产哪种名称:"
- @ask_window.contents.font.name = "SimHei"
- @ask_window.contents.font.size = 24
- @ask_window.contents.draw_text(4, 0, 368, 32, string)
- @ask_window.visible = true
- @ask_window.z = 1500
-
- # 产生选择窗口
- @select_window = Window_Command.new(200, ["随机", "武器/武功", "物品", "装备", "技能"])
- @select_window.visible = true
- @select_window.active = true
- @select_window.index = 0
- @select_window.x = 270
- @select_window.y = 252
- @select_window.z = 1500
-
- @name_window = Window_NameGen.new
- @name_window.x = 0
- @name_window.y = 0
- @name_window.index = -1
-
- @name_selected = []
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入情报
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @command_window.dispose
- @ask_window.dispose
- @select_window.dispose
- @name_window.dispose
- # 如果在标题画面切换中的情况下
- if $scene.is_a?(Scene_Title)
- # 淡入淡出画面
- Graphics.transition
- Graphics.freeze
- end
- end
-
- #--------------------------------------------------------------------------
- # * 更新画面
- #--------------------------------------------------------------------------
- def update
- # 更新窗口
- @command_window.update
- @ask_window.update
- @select_window.update
- @name_window.update
-
- # 命令窗口被激活的情况下: 调用 update_command
- if @command_window.active
- update_command
- return
- end
- # 选择窗口被激活的情况下: 调用 update_select
- if @select_window.active
- update_select
- return
- end
-
- # 选择窗口被激活的情况下: 调用 update_name
- if @name_window.active
- update_name
- return
- end
- end
-
- # 更新命令窗口
- def update_command
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- case @command_window.index
- when 0 # 输出为文本
- @name_window.output_text
- when 1 # 选择
- @command_window.active = false
- @command_window.visible = false
- @name_window.active = true
- @name_window.index = 0
- when 2 # 离开
- exit
- #$scene = Scene_Map.new
- when 3 # 重新产生
- @command_window.visible = false
- @command_window.active = false
- @ask_window.visible = true
- @select_window.active = true
- @select_window.visible = true
- @name_window.active = true
- end
- return
- end # end if Input.trigger?(Input::C)
-
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 无效化命令窗口
- @command_window.visible = false
- @command_window.active = false
- @name_window.active = true
- return
- end
- end
-
- # 更新选择窗口
- def update_select
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 產生名稱
- @name_window.generate(@select_window.index)
- # 无效化选择窗口
- @ask_window.visible = false
- @select_window.active = false
- @select_window.visible = false
- return
- end # end if Input.trigger?(Input::C)
- end
-
- def update_name
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 纪录文字
- @name_window.input_text(@name_window.index)
- return
- end
-
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 有效化命令窗口
- @command_window.active = true
- @command_window.visible = true
- # 无效化名称产生窗口
- @name_window.active = false
- @name_window.index = -1
- return
- end
- end
- end
- class Window_NameGen < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 640, 480)
- @column_max = 4
- @item_max = 60
- @name_selected = ""
- self.index = 0
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- # 生产
- def generate(type)
- self.contents.font.color = system_color
- self.contents.clear
- i = 0
- @name = []
-
- material_1_rand = $material_1.size
- material_2_rand = $material_2.size
- color_rand = $color_name.size
- chara_rand = $chara_name.size
- pattern_rand = $pattern_name.size
- weapon_rand = $weapon_name.size
- item_rand = $item_name.size
- equip_rand = $equip_name.size
- skill_rand = $skill_name.size
- while i < 56
- # 确认产生类型
- type = rand(4)+1 if type == 0
- case type
- when 1
- end_word = $weapon_name[rand(weapon_rand)]
- when 2
- end_word = $item_name[rand(item_rand)]
- when 3
- end_word = $equip_name[rand(equip_rand)]
- when 4
- end_word = $skill_name[rand(skill_rand)]
- end
-
- # 随机数选择文字
- mat_word_1a = $material_1[rand(material_1_rand)]
- mat_word_2a = $material_2[rand(material_2_rand)]
- mat_word_1b = $material_1[rand(material_1_rand)]
- mat_word_2b = $material_2[rand(material_2_rand)]
- color_word = $color_name[rand(color_rand)]
- chara_word = $chara_name[rand(chara_rand)]
- pattern_word = $pattern_name[rand(pattern_rand)]
-
- # 随机数排列
- case rand(11)
- when 0
- name_gend = mat_word_1a + mat_word_2a + color_word + chara_word + end_word
- when 1
- name_gend = mat_word_1b + mat_word_2b + color_word + chara_word + end_word
- when 2
- name_gend = mat_word_2a + mat_word_1a + color_word + chara_word + end_word
- when 3
- name_gend = mat_word_1a + mat_word_2a + mat_word_1b + mat_word_2b + color_word + chara_word + end_word
- when 4
- name_gend = mat_word_2a + pattern_word + end_word
- when 5
- name_gend = color_word + pattern_word + end_word
- when 6
- name_gend = color_word + mat_word_2a + end_word
- when 7
- name_gend = pattern_word + chara_word + end_word
- when 8
- name_gend = pattern_word + mat_word_2a + end_word
- when 9
- name_gend = chara_word + mat_word_2a + end_word
- when 10
- name_gend = mat_word_1a + mat_word_2a + mat_word_1b + end_word
- end
-
- # 显示文字
- self.contents.draw_text(i%4*160, i/4*32, 152, 32, name_gend, 0)
- @name.push(name_gend)
- # 产生下一个
- i += 1
- end
- end
-
- # 纪录文字
- def input_text(index)
- # 纪录所选择的文字
- @name_selected += @name[index] + " "
- end
-
- # 输出为文本
- def output_text
- # 输出
- @namefile = File.open("./NameGen.txt","w")
- @namefile.write(@name_selected)
- return
- end
- end
- 文字部分:
-
- #材质1
- $material_1 = ["",
- "檀", "梧", "桐", "桦", "楠", "柳", "梨", "枫", "松", "柏",
- "雕", "碉", "雕", "凋", "陨", "殒", "冽", "飞", "仙", "魔",
- "神", "鬼", "天", "地", "阴", "阳", "古", "鱼", "龙", "鲷",
- "虎", "豹", "麟", "龟", "鲸", "狼", "鹿", "貂", "燕", "雁",
- "鸟", "莺", "鹦", "鹰", "鵰", "凤", "凰", "雀", "鹊", "鸿",
- "蜂", "螳", "蝶", "蜘", "蛛", "蜈", "蚣", "蛇", "蟒", "蟾",
- "蝉", "缨", "婴", "瑛", "一", "二", "三", "四", "五", "六",
- "七", "八", "九", "十", "百", "千", "万", "亿", "兆", "霸",
- "王", "帝", "皇", "狂", "冷", "绝", "明", "暗", "艳", "艳",
- "热", "炎", "焰", "炎", "焱", "焰", "纤", "婵", "玉", "淑",
- "圣", "盛", "胜", "烈", "列", "大", "重", "巨", "宽", "无",
- "有", "仙", "腾", "刚", "柔", "太", "连", "罗", "猎", "萝",
- "箩", "镙", "武", "斗", "战", "想", "动", "静", "净", "浊",
- "灼", "翔", "祥", "降", "隐", "饮", "引", "飘", "漂", "极",
- "追", "感", "赶", "敢", "消", "销", "霄", "宵", "萧", "嚣",
- "硝", "逍", "凝", "宁", "断", "踏", "驭", "御", "驾", "破",
- "毁", "怨", "恨", "希", "望", "愿", "忘", "妄", "灵", "巧",
- "温", "文", "秀", "细", "风", "云", "雨", "月", "雪", "日",
- "语", "破", "卷", "卷", "圈", "遥"]
- #材质2
- $material_2 = ["",
- "金", "银", "铜", "铁", "锡", "钢", "木", "藤", "藤", "根",
- "干", "枝", "芽", "叶", "花", "草", "蕊", "丝", "绸", "缎",
- "缕", "水", "油", "泉", "波", "浪", "冰", "晶", "月", "云",
- "霞", "露", "雾", "霖", "血", "泪", "珠", "火", "炎", "焱",
- "焰", "焰", "星", "雷", "电", "霆", "日", "土", "玉", "石",
- "岩", "琉", "璃", "硫", "瘤", "牙", "沙", "砂", "尘", "光",
- "影", "音", "氤", "韵", "蕴", "酝", "韵", "韫", "鳞", "爪",
- "皮", "革", "甲", "布", "羽", "毛", "片", "目", "眼", "睛",
- "精", "神", "空", "仙", "魔", "神", "鬼", "天", "地", "阴",
- "阳", "男", "女", "凤", "凰", "皇", "帝", "王", "风", "笑",
- "啸", "乐", "肠", "血", "灵", "魂", "魄", "骨", "肉", "筋",
- "脑", "毒", "阙" ]
- #性质
- $chara_name = ["",
- "软", "硬", "长", "短", "宽", "窄", "广", "狭", "轻", "重",
- "佛", "魔", "妖", "仙", "神", "奇", "宝", "破", "粗", "细" ]
- #颜色
- $color_name = ["",
- "红", "赤", "朱", "血", "火", "绯", "橙", "橘", "黄", "金",
- "绿", "碧", "青", "清", "蓝", "靛", "紫", "玄", "闇", "暗",
- "黑", "白", "光", "素", "雪", "粉", "银", "虹", "彩", "艳" ]
- #花纹
- $pattern_name = ["",
- "纹", "鳞", "形", "花", "样", "貌", "如", "似", "影", "音",
- "吟", "吻", "舌", "尾", "首", "神", "牙" ]
- #武器/武功
- $weapon_name = ["",
- "刀", "枪", "鎗", "剑", "戟", "斧", "戎", "弓", "环", "圈",
- "琴", "瑟", "鼓", "刺", "勾", "钩", "钩", "爪", "抓", "挝",
- "拳", "掌", "腿", "箭", "镖", "刃", "杖", "棍", "棒", "铲",
- "钯", "尺", "匕", "笔", "叉", "轰", "雷", "殳", "针", "鞭",
- "鐗", "弩", "矛", "盾", "釽", "钺", "功", "法", "手", "诀",
- "劲", "经", "咒" ]
- #物品
- $item_name = ["",
- "药", "丸", "散", "胶", "汤", "丹", "茶", "酒", "露", "果",
- "粉", "脂", "粥", "糕", "膏", "饮", "草", "蜜", "香", "精",
- "箭", "镖", "匕", "毒", "镖", "针", "剑", "刀", "爪", "吻",
- "舌", "花", "鳞", "环", "符", "咒", "珠", "铃", "蛊", "羽",
- "钉", "芒", "石", "砂", "沙", "煞", "杀", "痧", "硝", "销",
- "锁", "根", "水", "油", "草", "芽", "胆", "葵", "玉", "髓",
- "蜕", "退", "藤", "藤", "絮", "火", "涎", "绫", "翎", "丝",
- "皮", "木", "目", "晶", "睛", "瞳", "线", "炭", "金", "星",
- "蕊", "刺", "莿", "液", "齿", "牙", "爪", "酮", "醇", "壳",
- "矿", "骨", "糊", "瑚", "弧", "壶"]
- # 装备
- # 第一组是头部
- # 第二组是身体
- # 第三组是足部
- # 第四组是饰品
- $equip_name = ["",
- "帽", "盔", "冠", "顶", "带", "巾", "襟", "帼", "丝", "帕",
- "簪", "翎", "绫", "莎", "纱",
- "裳", "衣", "装", "铠", "甲", "衫", "缕", "披", "风", "氅",
- "罗", "裙", "裤", "毡", "褂", "袍",
- "靴", "鞋", "履", "屐", "轮", "踏",
- "扣", "铃", "牌", "指", "扳", "佩" ]
- # 技能
- $skill_name = ["",
- "咒", "法", "术", "方", "门", "操", "气", "闪", "破", "败",
- "界", "结", "体", "避", "闭", "毕", "壁", "碧", "锋", "封",
- "定", "禁", "狂", "爆", "暴", "息", "宁", "生", "隐", "飞",
- "袭", "障", "瘴", "毒", "流", "派", "道", "魔", "功", "夺"]
复制代码 |
|