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

Project1

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

[已经解决] data文件覆盖后的工程出错

[复制链接]

Lv3.寻梦者

梦石
0
星屑
4221
在线时间
1879 小时
注册时间
2010-12-21
帖子
2334
跳转到指定楼层
1
发表于 2011-1-8 12:46:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 黄亦天 于 2011-1-8 13:29 编辑

没事闲的想参加那个地图大赛去……
然后我把我原来游戏的data文件夹直接覆盖到了新建的工程下,也添加了原先需要的素材,但是测试的时候,就会弹出一行“
RGSS'Scene_Map' 的22 行NameError 发生错误
uninitialized consant Scene_Map::Type_Field

这个是什么问题?求解~~
  1. #==============================================================================
  2. # ■ Scene_Map
  3. #------------------------------------------------------------------------------
  4. #  处理地图画面的类。
  5. #==============================================================================

  6. class Scene_Map < Scene_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 开始处理
  9.   #--------------------------------------------------------------------------

  10.   def start
  11.     super
  12.     $game_map.refresh
  13.     @spriteset = Spriteset_Map.new
  14.     @message_window = Window_Message.new

  15.   #========================================
  16.   
  17.       @v = Viewport.new(120,120,320,20)
  18.       @v.color.set(0,0,0,120)
  19.       @tf = Type_Field.new(@v,"",16)
  20.       @tf.active = false
  21.       @v.visible = false

  22.    #=========================================
  23.    
  24. end
  25.    

  26.   #--------------------------------------------------------------------------
  27.   # ● 执行渐变
  28.   #--------------------------------------------------------------------------
  29.   def perform_transition
  30.     if Graphics.brightness == 0       # 战斗後或载入後等
  31.       fadein(30)
  32.     else                              # 从菜单中回来等
  33.       Graphics.transition(15)
  34.     end
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 结束处理
  38.   #--------------------------------------------------------------------------
  39.   def terminate
  40.     super
  41.     if $scene.is_a?(Scene_Battle)     # 切换至战斗场景的场合
  42.       @spriteset.dispose_characters   # 隐藏角色来生成战斗背景
  43.     end
  44.     snapshot_for_background
  45.     @spriteset.dispose
  46.     @message_window.dispose
  47.    
  48.         # 输入法测试
  49.     @v.dispose
  50.     @tf.dispose
  51.    
  52.     if $scene.is_a?(Scene_Battle)     # 切换至战斗场景的场合
  53.       perform_battle_transition       # 执行战斗渐变
  54.     end
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 基本更新处理
  58.   #--------------------------------------------------------------------------
  59.   
  60.   
  61.   def update_basic
  62.     Graphics.update                   # 更新游戏画面
  63.     Input.update                      # 更新输入信息
  64.     $game_map.update                  # 更新地图
  65.     @spriteset.update                 # 更新活动块组
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # ● 更新画面
  69.   #--------------------------------------------------------------------------
  70.   def call_tf_active
  71.     case $old_name
  72.       when 1
  73.       @tf = Type_Field.new(@v,$game_actors[1].name,16)
  74.       when 2
  75.       @tf = Type_Field.new(@v,$game_actors[2].name,16)
  76.       when 3
  77.       @tf = Type_Field.new(@v,$game_actors[3].name,16)
  78.       when 4
  79.       @tf = Type_Field.new(@v,$game_actors[4].name,16)
  80.       else
  81.       @tf = Type_Field.new(@v,"",16)
  82.     end
  83.       @tf.active = true
  84.   end
  85.   def update
  86.     super
  87.     @tf.update
  88.     @v.visible = @tf.active
  89.    if @tf.active
  90.       return
  91.     end
  92.     $game_map.interpreter.update      # 更新解释器
  93.     $game_map.update                  # 更新地图
  94.     $game_player.update               # 更新主角
  95.     $game_system.update               # 更新计时器
  96.     @spriteset.update                 # 更新活动块组
  97.     @message_window.update            # 更新信息窗口
  98.     unless $game_message.visible      # 信息窗口显示中除外
  99.       update_transfer_player
  100.       update_encounter
  101.       update_call_menu
  102.       update_call_debug
  103.       update_scene_change
  104.     end
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   # ● 淡入画面
  108.   #     duration : 时间
  109.   #    如果直接使用 Graphics.fadeout 的话会出现一些状况,如天候效果和远景
  110.   #    滚动都会被强迫停止,所以用动态的 fade-in 效果会好些。
  111.   #--------------------------------------------------------------------------
  112.   def fadein(duration)
  113.     Graphics.transition(0)
  114.     for i in 0..duration-1
  115.       Graphics.brightness = 255 * i / duration
  116.       update_basic
  117.     end
  118.     Graphics.brightness = 255
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 淡出画面
  122.   #     duration : 时间
  123.   #    与上面的 fadein 一样,不是直接调用 Graphics.fadein。
  124.   #--------------------------------------------------------------------------
  125.   def fadeout(duration)
  126.     Graphics.transition(0)
  127.     for i in 0..duration-1
  128.       Graphics.brightness = 255 - 255 * i / duration
  129.       update_basic
  130.     end
  131.     Graphics.brightness = 0
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 场所移动处理
  135.   #--------------------------------------------------------------------------
  136.   def update_transfer_player
  137.     return unless $game_player.transfer?
  138.     fade = (Graphics.brightness > 0)
  139.     fadeout(30) if fade
  140.     @spriteset.dispose              # 释放活动块组
  141.     $game_player.perform_transfer   # 执行场所移动
  142.     $game_map.autoplay              # 自动更改 BGM 和 BGS
  143.     $game_map.update
  144.     Graphics.wait(15)
  145.     @spriteset = Spriteset_Map.new  # 重新生成活动块组
  146.     fadein(30) if fade
  147.     Input.update
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 遇敌处理
  151.   #--------------------------------------------------------------------------
  152.   def update_encounter
  153.     return if $game_player.encounter_count > 0        # 检查步数
  154.     return if $game_map.interpreter.running?          # 判断是否有事件正在执行
  155.     return if $game_system.encounter_disabled         # 判断是否禁止遇敌
  156.     troop_id = $game_player.make_encounter_troop_id   # 判断敌人队伍
  157.     return if $data_troops[troop_id] == nil           # 判断队伍是否无效
  158.     $game_troop.setup(troop_id)
  159.     $game_troop.can_escape = true
  160.     $game_temp.battle_proc = nil
  161.     $game_temp.next_scene = "battle"
  162.     preemptive_or_surprise
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● 判断先下手或被偷袭
  166.   #--------------------------------------------------------------------------
  167.   def preemptive_or_surprise
  168.     actors_agi = $game_party.average_agi
  169.     enemies_agi = $game_troop.average_agi
  170.     if actors_agi >= enemies_agi
  171.       percent_preemptive = 5
  172.       percent_surprise = 3
  173.     else
  174.       percent_preemptive = 3
  175.       percent_surprise = 5
  176.     end
  177.     if rand(100) < percent_preemptive
  178.       $game_troop.preemptive = true
  179.     elsif rand(100) < percent_surprise
  180.       $game_troop.surprise = true
  181.     end
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 判断是否呼叫菜单(按下B键)
  185.   #--------------------------------------------------------------------------
  186.   def update_call_menu
  187.     if Input.trigger?(Input::B)
  188.       return if $game_map.interpreter.running?        # 判断是否有事件正在执行
  189.       return if $game_system.menu_disabled            # 判断是否禁止菜单呼叫
  190.       $game_temp.menu_beep = true                     # 设置音效标志
  191.       $game_temp.next_scene = "menu"
  192.     end
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ● 判断是否呼叫DEBUG场景(按下F9键)
  196.   #--------------------------------------------------------------------------
  197.   def update_call_debug
  198.     if $TEST and Input.press?(Input::F9)    # 游戏测试并按下F9
  199.       $game_temp.next_scene = "debug"
  200.     end
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # ● 执行场景交替
  204.   #--------------------------------------------------------------------------
  205.   def update_scene_change
  206.     return if $game_player.moving?    # 判断主角是否移动中
  207.     case $game_temp.next_scene
  208.     when "battle"
  209.       call_battle
  210.     when "shop"
  211.       call_shop
  212.     when "name"
  213.       call_name
  214.     when "menu"
  215.       call_menu
  216.     when "save"
  217.       call_save
  218.     when "debug"
  219.       call_debug
  220.     when "gameover"
  221.       call_gameover
  222.     when "title"
  223.       call_title
  224.     else
  225.       $game_temp.next_scene = nil
  226.     end
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ● 切换至战斗画面
  230.   #--------------------------------------------------------------------------
  231.   def call_battle
  232.     @spriteset.update
  233.     Graphics.update
  234.     $game_player.make_encounter_count
  235.     $game_player.straighten
  236.     $game_temp.map_bgm = RPG::BGM.last
  237.     $game_temp.map_bgs = RPG::BGS.last
  238.     RPG::BGM.stop
  239.     RPG::BGS.stop
  240.     Sound.play_battle_start
  241.     $game_system.battle_bgm.play
  242.     $game_temp.next_scene = nil
  243.     $scene = Scene_Battle.new
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● 切换至商店画面
  247.   #--------------------------------------------------------------------------
  248.   def call_shop
  249.     $game_temp.next_scene = nil
  250.     $scene = Scene_Shop.new
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ● 切换至名称输入画面
  254.   #--------------------------------------------------------------------------
  255.   def call_name
  256.     $game_temp.next_scene = nil
  257.     $scene = Scene_Name.new
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● 切换至菜单画面
  261.   #--------------------------------------------------------------------------
  262.   def call_menu
  263.     if $game_temp.menu_beep
  264.       Sound.play_decision
  265.       $game_temp.menu_beep = false
  266.     end
  267.     $game_temp.next_scene = nil
  268.     $scene = Scene_Menu.new
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● 切换至存档画面
  272.   #--------------------------------------------------------------------------
  273.   def call_save
  274.     $game_temp.next_scene = nil
  275.     $scene = Scene_File.new(true, false, true)
  276.   end
  277.   #--------------------------------------------------------------------------
  278.   # ● 切换至DEBUG画面
  279.   #--------------------------------------------------------------------------
  280.   def call_debug
  281.     Sound.play_decision
  282.     $game_temp.next_scene = nil
  283.     $scene = Scene_Debug.new
  284.   end
  285.   #--------------------------------------------------------------------------
  286.   # ● 切换至游戏结束画面
  287.   #--------------------------------------------------------------------------
  288.   def call_gameover
  289.     $game_temp.next_scene = nil
  290.     $scene = Scene_Gameover.new
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 切换至标题画面
  294.   #--------------------------------------------------------------------------
  295.   def call_title
  296.     $game_temp.next_scene = nil
  297.     $scene = Scene_Title.new
  298.     fadeout(60)
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 执行战斗渐变
  302.   #--------------------------------------------------------------------------
  303.   def perform_battle_transition
  304.     Graphics.transition(80, "Graphics/System/BattleStart", 80)
  305.     Graphics.freeze
  306.   end
  307. end
复制代码

点评

表示缺少 Type_Field 这个类。可以去原来的工程把这个复制过来~~  发表于 2011-1-8 13:17

Lv2.观梦者

神隐的主犯

梦石
0
星屑
273
在线时间
271 小时
注册时间
2008-2-22
帖子
7691

贵宾

2
发表于 2011-1-8 12:51:49 | 只看该作者
Scene_Map 里找不到 Type_Field 属性。

原来的工程应该也有类似的问题吧~~


八云紫于2011-1-8 12:51补充以下内容:
Scene_Map 里找不到 Type_Field 属性。

原来的工程应该也有类似的问题吧~~

点评

唔…… 发现了……原来是全键盘脚本的问题……  发表于 2011-1-8 13:24
脚本已发,如果没什么问题我就再发工程好了……  发表于 2011-1-8 13:10
不了解,不清楚,不知道的说。没遇到过这种情况。看看脚本直接改吧~~  发表于 2011-1-8 13:06
那这个问题是神马情况……最近我的工程各种诡异……我整个人都杯具了TUT……  发表于 2011-1-8 13:04
脚本文件应该是直接覆盖掉的。原来的没问题,那么覆盖后也应该没问题。  发表于 2011-1-8 13:00

评分

参与人数 2星屑 +760 收起 理由
DeathKing + 700
黄亦天 + 60 个人认可

查看全部评分


《天空之城 —— 破碎的命运》
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-25 06:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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