Project1
标题:
为什么我VX已进入商店,脚本就出错?
[打印本页]
作者:
南宫无尘
时间:
2009-9-19 10:52
标题:
为什么我VX已进入商店,脚本就出错?
作者:
小幽的马甲
时间:
2009-9-19 10:56
把Scene_Map贴出来吧
作者:
南宫无尘
时间:
2009-9-19 11:02
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 处理地图画面的类。
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
$game_map.refresh
@spriteset = Spriteset_Map.new
@message_window = Window_Message.new
end
#--------------------------------------------------------------------------
# ● 执行变换
#--------------------------------------------------------------------------
def perform_transition
if Graphics.brightness == 0 # 战斗后、载入后
fadein(30)
else # 返回至菜单
Graphics.transition(15)
end
end
#--------------------------------------------------------------------------
# ● 结束处理
#--------------------------------------------------------------------------
def terminate
super
if $scene.is_a?(Scene_Battle) # 正在切换战斗画面的情况下
@spriteset.dispose_characters # 为了生成背景隐藏角色
end
snapshot_for_background
@spriteset.dispose
@message_window.dispose
if $scene.is_a?(Scene_Battle) # 正在切换战斗画面的情况下
perform_battle_transition # 执行战斗前变换
end
end
#--------------------------------------------------------------------------
# ● 基本更新处理
#--------------------------------------------------------------------------
def update_basic
Graphics.update # 更新游戏画面
Input.update # 更新输入信息
$game_map.update # 更新地图
@spriteset.update # 更新活动块元件
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
$game_map.interpreter.update # 更新解释器
$game_map.update # 更新滴入
$game_player.update # 更新玩家
$game_system.update # 更新计时器
@spriteset.update # 更新活动块元件
@message_window.update # 更新消息窗口
unless $game_message.visible # 正在显示消息以外的情况
update_transfer_player
update_encounter
update_call_menu
update_call_debug
update_scene_change
end
end
#--------------------------------------------------------------------------
# ● 画面淡入
# duration : 时间
# 在地图画面、Graphics.fadeout 直接使用会造成天气效果与远景卷动等不正常的
# 现象、所以执行动态淡入。
#--------------------------------------------------------------------------
def fadein(duration)
Graphics.transition(0)
for i in 0..duration-1
Graphics.brightness = 255 * i / duration
update_basic
end
Graphics.brightness = 255
end
#--------------------------------------------------------------------------
# ● 画面淡出
# duration : 时间
# 与上面的淡入相同、不直接使用 Graphics.fadein。
#--------------------------------------------------------------------------
def fadeout(duration)
Graphics.transition(0)
for i in 0..duration-1
Graphics.brightness = 255 - 255 * i / duration
update_basic
end
Graphics.brightness = 0
end
#--------------------------------------------------------------------------
# ● 处理场所移动
#--------------------------------------------------------------------------
def update_transfer_player
return unless $game_player.transfer?
fade = (Graphics.brightness > 0)
fadeout(30) if fade
@spriteset.dispose # 释放活动块元件
$game_player.perform_transfer # 执行场所移动
$game_map.autoplay # 自动切换 BGM 与 BGS
$game_map.update
Graphics.wait(15)
@spriteset = Spriteset_Map.new # 在生成活动块元件
fadein(30) if fade
Input.update
end
#--------------------------------------------------------------------------
# ● 遇敌处理
#--------------------------------------------------------------------------
def update_encounter
return if $game_player.encounter_count > 0 # 未满遭遇步数?
return if $game_map.interpreter.running? # 正在执行事件?
return if $game_system.encounter_disabled # 禁止遇敌?
troop_id = $game_player.make_encounter_troop_id # 确定敌方队伍
return if $data_troops[troop_id] == nil # 敌方队伍无效?
$game_troop.setup(troop_id)
$game_troop.can_escape = true
$game_temp.battle_proc = nil
$game_temp.next_scene = "battle"
preemptive_or_surprise
end
#--------------------------------------------------------------------------
# ● 确定先行攻击和被偷袭的概率
#--------------------------------------------------------------------------
def preemptive_or_surprise
actors_agi = $game_party.average_agi
enemies_agi = $game_troop.average_agi
if actors_agi >= enemies_agi
percent_preemptive = 5
percent_surprise = 3
else
percent_preemptive = 3
percent_surprise = 5
end
if rand(100) < percent_preemptive
$game_troop.preemptive = true
elsif rand(100) < percent_surprise
$game_troop.surprise = true
end
end
#--------------------------------------------------------------------------
# ● 判断取消按钮调用菜单
#--------------------------------------------------------------------------
def update_call_menu
if Input.trigger?(Input::B)
return if $game_map.interpreter.running? # 正在执行事件?
return if $game_system.menu_disabled # 禁止菜单?
$game_temp.menu_beep = true # 设置播放 SE 标志
$game_temp.next_scene = "menu"
end
end
#--------------------------------------------------------------------------
# ● 判断 F9 键调用调试模式
#--------------------------------------------------------------------------
def update_call_debug
if $TEST and Input.press?(Input::F9) # 测试游戏中 F9 键
$game_temp.next_scene = "debug"
end
end
#--------------------------------------------------------------------------
# ● 执行画面切换
#--------------------------------------------------------------------------
def update_scene_change
return if $game_player.moving? # 角色正在移动?
case $game_temp.next_scene
when "battle"
call_battle
when "shop"
call_shop
when "name"
call_name
when "menu"
call_menu
when "save"
call_save
when "debug"
call_debug
when "gameover"
call_gameover
when "title"
call_title
else
$game_temp.next_scene = nil
end
end
#--------------------------------------------------------------------------
# ● 切换至战斗画面
#--------------------------------------------------------------------------
def call_battle
@spriteset.update
Graphics.update
$game_player.make_encounter_count
$game_player.straighten
$game_temp.map_bgm = RPG::BGM.last
$game_temp.map_bgs = RPG::BGS.last
RPG::BGM.stop
RPG::BGS.stop
Sound.play_battle_start
$game_system.battle_bgm.play
$game_temp.next_scene = nil
$scene = Scene_Battle.new
end
#--------------------------------------------------------------------------
# ● 切换至商店画面
#--------------------------------------------------------------------------
def call_shop
$game_temp.next_scene = nil
$scene = Scene_Shop.new
end
#--------------------------------------------------------------------------
# ● 切换至名称输入画面
#--------------------------------------------------------------------------
def call_name
$game_temp.next_scene = nil
$scene = Scene_Name.new
end
#--------------------------------------------------------------------------
# ● 切换至菜单画面
#--------------------------------------------------------------------------
def call_menu
if $game_temp.menu_beep
Sound.play_decision
$game_temp.menu_beep = false
end
$game_temp.next_scene = nil
$scene = Scene_Menu.new
end
#--------------------------------------------------------------------------
# ● 切换至存档画面
#--------------------------------------------------------------------------
def call_save
$game_temp.next_scene = nil
$scene = Scene_File.new(true, false, true)
end
#--------------------------------------------------------------------------
# ● 切换至调试画面
#--------------------------------------------------------------------------
def call_debug
Sound.play_decision
$game_temp.next_scene = nil
$scene = Scene_Debug.new
end
#--------------------------------------------------------------------------
# ● 切换至游戏结束画面
#--------------------------------------------------------------------------
def call_gameover
$game_temp.next_scene = nil
$scene = Scene_Gameover.new
end
#--------------------------------------------------------------------------
# ● 切换至标题画面
#--------------------------------------------------------------------------
def call_title
$game_temp.next_scene = nil
$scene = Scene_Title.new
fadeout(60)
end
#--------------------------------------------------------------------------
# ● 执行战斗前变换
#--------------------------------------------------------------------------
def perform_battle_transition
Graphics.transition(80, "Graphics/System/BattleStart", 80)
Graphics.freeze
end
end
作者:
小幽的马甲
时间:
2009-9-19 11:14
DZ的Wap版不能看长回贴…不过从错误上来看是用了未定义变量
作者:
南宫无尘
时间:
2009-9-19 11:33
那要怎么解决?
作者:
小幽的马甲
时间:
2009-9-19 11:41
你是不是把Scene_Shop名字改了?Ctrl+Shift+F搜索下class Scene_Shop看看有没有
作者:
南宫无尘
时间:
2009-9-19 12:57
没找到指定文本,有件事没说清楚,我是在切换到商店画面时脚本出错。
作者:
小幽的马甲
时间:
2009-9-19 13:06
是啊…所以你的Scene_Shop大概被误删了,新建个工程把Scene_Shop拷到你工程里面试试
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1