Project1
标题:
四格掉宝脚本和升级提示脚本互相覆盖,求帮助
[打印本页]
作者:
muxue327
时间:
2011-5-30 17:35
标题:
四格掉宝脚本和升级提示脚本互相覆盖,求帮助
本帖最后由 精灵使者 于 2011-5-31 11:21 编辑
我使用了一个升级提示脚本(提示升级能力变化和习得技能的)和四格掉宝,但是如果把四格掉宝优先更靠近Main,则得到设定的随机宝物,但是战斗结束没有显示得到的经验金钱和得到的物品,且升级提示也不显示了。如果升级提示更靠近Main,则四格掉宝无效化。搜索了一下没发现有人提出这两个脚本冲突,真的两种效果都想要,我是脚本半文盲,求高人解答,谢谢。下面是我使用的两个脚本:
升级提示
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :not_new_skill
alias old_setup setup
def setup(actor_id)
old_setup(actor_id)
@not_new_skill = []
end
def exp=(exp)
@not_new_skill = []
@exp = [[exp, 9999999].min, 0].max
# 升级
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@hp = maxhp
@sp = maxsp
# 学会特技
for j in $data_classes[@class_id].learnings
if j.level == @level
@not_new_skill.push(j.skill_id) if @skills.include?(j.skill_id)
learn_skill(j.skill_id)
end
end
end
# 降级
while @exp < @exp_list[@level]
@level -= 1
end
# 修正当前的 HP 与 SP 超过最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
# ————————————————————————————————————
# ▼▲▼ XRXS_BP10. LEVEL UP!能力上昇表示ウィンドウ plus ▼▲▼
# by 桜雅 在土
#——以下3个如果需要修改,直接输入文件名即可
$data_system_level_up_se = "" #升级时的音效设置
$data_system_level_up_me = "Audio/ME/007-Fanfare01" # 升级时播放的ME
$data_system_skilllearn_se = "Audio/SE/106-Heal02" # 学会特技时播放的声效。
#==============================================================================
# ■ Window_LevelUpWindow
#------------------------------------------------------------------------------
# バトル終了時、レベルアップした場合にステータスを表示するウィンドウです。
#==============================================================================
class Window_LevelUpWindow < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
super(0, 128, 160, 192)
self.contents = Bitmap.new(width - 32, height - 32)
self.visible = false
self.back_opacity = 160
refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(actor, last_lv, up_hp, up_sp, up_str, up_dex, up_agi, up_int)
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 14
self.contents.draw_text( 0, 0, 160, 24, "LEVEL UP!!")
self.contents.font.size = 18
self.contents.draw_text( 0, 28, 160, 24, $data_system.words.hp)
self.contents.draw_text( 0, 50, 160, 24, $data_system.words.sp)
self.contents.font.size = 14
self.contents.draw_text( 0, 72, 80, 24, $data_system.words.str)
self.contents.draw_text( 0, 94, 80, 24, $data_system.words.dex)
self.contents.draw_text( 0, 116, 80, 24, $data_system.words.agi)
self.contents.draw_text( 0, 138, 80, 24, $data_system.words.int)
self.contents.draw_text(92, 0, 128, 24, "→")
self.contents.draw_text(76, 28, 128, 24, "=")
self.contents.draw_text(76, 50, 128, 24, "=")
self.contents.draw_text(76, 72, 128, 24, "=")
self.contents.draw_text(76, 94, 128, 24, "=")
self.contents.draw_text(76, 116, 128, 24, "=")
self.contents.draw_text(76, 138, 128, 24, "=")
self.contents.font.color = normal_color
self.contents.draw_text( 0, 0, 88, 24, last_lv.to_s, 2)
self.contents.draw_text( 0, 28, 72, 24, "+" + up_hp.to_s, 2)
self.contents.draw_text( 0, 50, 72, 24, "+" + up_sp.to_s, 2)
self.contents.draw_text( 0, 72, 72, 24, "+" + up_str.to_s, 2)
self.contents.draw_text( 0, 94, 72, 24, "+" + up_dex.to_s, 2)
self.contents.draw_text( 0, 116, 72, 24, "+" + up_agi.to_s, 2)
self.contents.draw_text( 0, 138, 72, 24, "+" + up_int.to_s, 2)
self.contents.font.size = 20
self.contents.draw_text( 0, 0, 128, 24, actor.level.to_s, 2)
self.contents.draw_text( 0, 26, 128, 24, actor.maxhp.to_s, 2)
self.contents.draw_text( 0, 48, 128, 24, actor.maxsp.to_s, 2)
self.contents.draw_text( 0, 70, 128, 24, actor.str.to_s, 2)
self.contents.draw_text( 0, 92, 128, 24, actor.dex.to_s, 2)
self.contents.draw_text( 0, 114, 128, 24, actor.agi.to_s, 2)
self.contents.draw_text( 0, 136, 128, 24, actor.int.to_s, 2)
end
end
#==============================================================================
# ■ Window_SkillLearning
#------------------------------------------------------------------------------
# レベルアップ時などにスキルを習得した場合にそれを表示するウィンドウです。
#==============================================================================
class Window_SkillLearning < Window_Base
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :learned # スキルを習得したかどうか
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(class_id, last_lv, now_lv, actor)
super(160, 64, 320, 64)
self.contents = Bitmap.new(width - 32, height - 28) # わざと▽を表示
self.visible = false
self.back_opacity = 160
@actor = actor
@learned = false
refresh(class_id, last_lv, now_lv)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(class_id, last_lv, now_lv)
for i in 0...$data_classes[class_id].learnings.size
learn_lv = $data_classes[class_id].learnings[i].level
# 今回のレベルアップ範囲で習得するスキルの場合
if learn_lv > last_lv and learn_lv <= now_lv
@learned = true
# SEの再生
if $data_system_skilllearn_se != ""
Audio.se_play($data_system_skilllearn_se)
end
unless @actor.not_new_skill.include?($data_classes[class_id].learnings[i].skill_id) #←←←←←←←←←←←←←
# 各描写
skill_name = $data_skills[$data_classes[class_id].learnings[i].skill_id].name
self.contents.clear
self.contents.font.color = text_color(0)
self.contents.draw_text(0,0,448,32, "学会特技:"+skill_name)
self.contents.font.color = text_color(6)
self.contents.draw_text(0,0,448,32, " "+skill_name)
self.contents.font.color = text_color(0)
self.visible = true
end
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if @learned == false
break
end
end
# メインループここまで
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# C ボタンが押された場合
if Input.trigger?(Input::C)
@learned = false
self.visible = false
end
end
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 追加?公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :level_up_flags # LEVEL UP!表示
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 追加?公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :exp_gain_ban # EXP取得一時禁止
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias xrxs_bp10_initialize initialize
def initialize
@exp_gain_ban = false
xrxs_bp10_initialize
end
#--------------------------------------------------------------------------
# ● ステート [EXP を獲得できない] 判定
#--------------------------------------------------------------------------
alias xrxs_bp10_cant_get_exp? cant_get_exp?
def cant_get_exp?
if @exp_gain_ban == true
return true
else
return xrxs_bp10_cant_get_exp?
end
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● アフターバトルフェーズ開始
#--------------------------------------------------------------------------
alias xrxs_bp10_start_phase5 start_phase5
def start_phase5
# EXP 獲得禁止
for i in 0...$game_party.actors.size
$game_party.actors[i].exp_gain_ban = true
end
xrxs_bp10_start_phase5
# EXP 獲得禁止の解除
for i in 0...$game_party.actors.size
$game_party.actors[i].exp_gain_ban = false
end
# EXPを初期化
@exp_gained = 0
for enemy in $game_troop.enemies
# 獲得 EXPを追加 # エネミーが隠れ状態でない場合
@exp_gained += enemy.exp if not enemy.hidden
end
# 設定
@phase5_step = 1
@exp_gain_actor = -1
# リザルトウィンドウを表示
@result_window.visible = true
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アフターバトルフェーズ)
#--------------------------------------------------------------------------
#alias xrxs_bp10_update_phase5 update_phase5
def update_phase5
case @phase5_step
when 1
update_phase5_step1
else
# ウェイトカウントが 0 より大きい場合
if @phase5_wait_count > 0
# ウェイトカウントを減らす
@phase5_wait_count -= 1
# ウェイトカウントが 0 になった場合
if @phase5_wait_count == 0
# リザルトウィンドウを表示
#@result_window.visible = true
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# ステータスウィンドウをリフレッシュ
@status_window.refresh
end
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# バトル終了
battle_end(0)
end
# レベルアップしている場合は強制バトル終了
battle_end(0) if @levelup_window != nil and @phase5_wait_count <= 0
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アフターバトルフェーズ 1 : レベルアップ)
#--------------------------------------------------------------------------
def update_phase5_step1
# C ボタンが押された場合
if Input.trigger?(Input::C)
# ウィンドウを閉じて次のアクターへ
@levelup_window.visible = false if @levelup_window != nil
@status_window.level_up_flags[@exp_gain_actor] = false
phase5_next_levelup
end
end
#--------------------------------------------------------------------------
# ● 次のアクターのレベルアップ表示へ
#--------------------------------------------------------------------------
def phase5_next_levelup
begin
# 次のアクターへ
@exp_gain_actor += 1
# 最後のアクターの場合
if @exp_gain_actor >= $game_party.actors.size
# アフターバトルフェーズ開始
@phase5_step = 0
return
end
actor = $game_party.actors[@exp_gain_actor]
if actor.cant_get_exp? == false
# 現在の能力値を保持
last_level = actor.level
last_maxhp = actor.maxhp
last_maxsp = actor.maxsp
last_str = actor.str
last_dex = actor.dex
last_agi = actor.agi
last_int = actor.int
# 経験値取得の決定的瞬間(謎
actor.exp += @exp_gained
# 判定
if actor.level > last_level
# レベルアップした場合
@status_window.level_up(@exp_gain_actor)
# リザルトウィンドウを消す
@result_window.visible = false
# SEの再生
if $data_system_level_up_se != ""
Audio.se_play($data_system_level_up_se)
end
# MEの再生
if $data_system_level_up_me != ""
Audio.me_stop
Audio.me_play($data_system_level_up_me)
end
# LEVEL-UPウィンドウの設定
@levelup_window = Window_LevelUpWindow.new(actor, last_level,
actor.maxhp - last_maxhp, actor.maxsp - last_maxsp, actor.str - last_str,
actor.dex - last_dex, actor.agi - last_agi, actor.int - last_int)
@levelup_window.x = 160 * @exp_gain_actor
@levelup_window.visible = true
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# スキル習得ウィンドウの設定
@skilllearning_window = Window_SkillLearning.new(actor.class_id, last_level, actor.level, actor)
# ウェイトカウントを設定
@phase5_wait_count = 40
@phase5_step = 1
return
end
end
end until false
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
复制代码
四格掉宝是这个
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
# ============================================================================
# 四格掉宝设定 by SailCat
# ============================================================================
# 脚本使用说明:
# 1.复制后插入到Main前面
# 2.数据库设定额外掉宝的概率,在敌人名称那里
# 格式: 敌人名称,宝物2,宝物3,宝物4
# 宝物写法: (I|W|A)n 分别对应: n号道具,n号武器,n号防具 I W A必须大写
# 例: Cockatrice,A5,I5,W3
# Fishman,I2,I3
# 三栏中任一栏留空不写时,取前一格的设定,全都不写时,取默认宝物设定
# 3.186行是四格概率比设定,在那里填上4个数字就可以更改概率了,该行内容:
# rarity = [178, 51, 15, 12]
# ============================================================================
#--------------------------------------------------------------------------
# □ RPG::Enemy
#--------------------------------------------------------------------------
module RPG
class Enemy
def name
name = @name.split(/,/)[0]
return name != nil ? name : ""
end
def treasure2
treasure = @name.split(/,/)[1]
return treasure.to_s
end
def treasure3
treasure = @name.split(/,/)[2]
return treasure.to_s
end
def treasure4
treasure = @name.split(/,/)[3]
return treasure.to_s
end
end
end
#==============================================================================
# ■ Game_Enemy
#------------------------------------------------------------------------------
# 处理敌人的类。本类在 Game_Troop 类 ($game_troop) 的
# 内部使用。
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 获取物品 ID2
#--------------------------------------------------------------------------
def item2_id
if $data_enemies[@enemy_id].treasure2 == ""
return item_id
elsif $data_enemies[@enemy_id].treasure2[0,1] != "I"
return 0
else
return $data_enemies[@enemy_id].treasure2[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取武器 ID2
#--------------------------------------------------------------------------
def weapon2_id
if $data_enemies[@enemy_id].treasure2 == ""
return weapon_id
elsif $data_enemies[@enemy_id].treasure2[0,1] != "W"
return 0
else
return $data_enemies[@enemy_id].treasure2[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取防具 ID2
#--------------------------------------------------------------------------
def armor2_id
if $data_enemies[@enemy_id].treasure2 == ""
return armor_id
elsif $data_enemies[@enemy_id].treasure2[0,1] != "A"
return 0
else
return $data_enemies[@enemy_id].treasure2[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取物品 ID3
#--------------------------------------------------------------------------
def item3_id
if $data_enemies[@enemy_id].treasure3 == ""
return item2_id
elsif $data_enemies[@enemy_id].treasure3[0,1] != "I"
return 0
else
return $data_enemies[@enemy_id].treasure3[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取武器 ID3
#--------------------------------------------------------------------------
def weapon3_id
if $data_enemies[@enemy_id].treasure3 == ""
return weapon2_id
elsif $data_enemies[@enemy_id].treasure3[0,1] != "W"
return 0
else
return $data_enemies[@enemy_id].treasure3[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取防具 ID3
#--------------------------------------------------------------------------
def armor3_id
if $data_enemies[@enemy_id].treasure3 == ""
return armor2_id
elsif $data_enemies[@enemy_id].treasure3[0,1] != "A"
return 0
else
return $data_enemies[@enemy_id].treasure3[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取物品 ID4
#--------------------------------------------------------------------------
def item4_id
if $data_enemies[@enemy_id].treasure4 == ""
return item3_id
elsif $data_enemies[@enemy_id].treasure4[0,1] != "I"
return 0
else
return $data_enemies[@enemy_id].treasure4[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取武器 ID4
#--------------------------------------------------------------------------
def weapon4_id
if $data_enemies[@enemy_id].treasure4 == ""
return weapon3_id
elsif $data_enemies[@enemy_id].treasure4[0,1] != "W"
return 0
else
return $data_enemies[@enemy_id].treasure4[/[0-9]+/].to_i
end
end
#--------------------------------------------------------------------------
# ● 获取防具 ID4
#--------------------------------------------------------------------------
def armor4_id
if $data_enemies[@enemy_id].treasure4 == ""
return armor3_id
elsif $data_enemies[@enemy_id].treasure4[0,1] != "A"
return 0
else
return $data_enemies[@enemy_id].treasure4[/[0-9]+/].to_i
end
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始结束战斗回合
#--------------------------------------------------------------------------
def start_phase5
# 转移到回合 5
@phase = 5
# 演奏战斗结束 ME
$game_system.me_play($game_system.battle_end_me)
# 还原为战斗开始前的 BGM
$game_system.bgm_play($game_temp.map_bgm)
# 初始化 EXP、金钱、宝物
exp = 0
gold = 0
treasures = []
# 循环
for enemy in $game_troop.enemies
# 敌人不是隐藏状态的情况下
unless enemy.hidden
# 获得 EXP、增加金钱
exp += enemy.exp
gold += enemy.gold
# 出现宝物判定
if rand(100) < enemy.treasure_prob
rarity = [178, 51, 15, 12]
case rand(rarity[0] + rarity[1] + rarity[2] + rarity[3])
when 0..rarity[0] - 1
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
when rarity[0]..rarity[0] + rarity[1] - 1
if enemy.item2_id > 0
treasures.push($data_items[enemy.item2_id])
end
if enemy.weapon2_id > 0
treasures.push($data_weapons[enemy.weapon2_id])
end
if enemy.armor2_id > 0
treasures.push($data_armors[enemy.armor2_id])
end
when rarity[0] + rarity[1]..rarity[0] + rarity[1] + rarity[2] - 1
if enemy.item3_id > 0
treasures.push($data_items[enemy.item3_id])
end
if enemy.weapon3_id > 0
treasures.push($data_weapons[enemy.weapon3_id])
end
if enemy.armor3_id > 0
treasures.push($data_armors[enemy.armor3_id])
end
else
if enemy.item4_id > 0
treasures.push($data_items[enemy.item4_id])
end
if enemy.weapon4_id > 0
treasures.push($data_weapons[enemy.weapon4_id])
end
if enemy.armor4_id > 0
treasures.push($data_armors[enemy.armor4_id])
end
end
end
end
end
# 限制宝物数为 8 个
treasures = treasures[0..7]
# 获得 EXP
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# 获得金钱
$game_party.gain_gold(gold)
# 获得宝物
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# 生成战斗结果窗口
@result_window = Window_BattleResult.new(exp, gold, treasures)
# 设置等待计数
@phase5_wait_count = 100
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
复制代码
帮忙整合一下或者告诉我怎么整合我自己来,实在整合不起的话事件方法也可以……看到有人说可以战斗结束调用公共事件,可是我没明白,数据库敌人那栏怎么挂公共事件啊?
期待解答,谢谢。
muxue327于2011-5-31 22:53补充以下内容:
大家都很忙的么……自顶一下,期待回答!
作者:
jhhuang
时间:
2011-6-1 00:24
看了半天....结果自己测试了一下,升级脚本放在掉宝脚本后面,并无问题= =升级提示显示,掉落物品也是每次不同.LZ你其他地方出问题了吧?
作者:
muxue327
时间:
2011-6-1 12:40
jhhuang 发表于 2011-6-1 00:24
看了半天....结果自己测试了一下,升级脚本放在掉宝脚本后面,并无问题= =升级提示显示,掉落物品也是每次不同 ...
呃……试了一下,好像是和另外一个冲突了,我把四格掉宝插在新加的脚本的最前面结不行了,紧挨着升级提示是没问题的……我自己再研究下,谢谢。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1