赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 29785 |
最后登录 | 2008-11-3 |
在线时间 | 0 小时 |
Lv1.梦旅人 (禁止发言)
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 0 小时
- 注册时间
- 2005-10-24
- 帖子
- 48
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
【說明】
這個功能,雖說是善惡經驗設計,但是應用的範圍很廣,比如技能等級的提升設計等
這是把所有的運算都丟到RGSS腳本內運作,當然附上教學歡迎大家研究修改。
----------------以下是動用到的腳本---------------------
Game_Actor #用來初始化相關的變數值
Scene_Battle 2#用來運算當戰鬥結束後取得的經驗值,計算成善惡經驗/等級/上限值
Window_Status#用來在狀態頁面中顯示出善惡經驗/等級/上限值
=======================================================
----------------以下是Game_Actor的初始值設定-------------------
在第8行開始宣告改成以下:
class Game_Actor < Game_Battler
#----------------------------------------------------------------------
# ● 定義實例變量
#----------------------------------------------------------------------
attr_reader :name # 名稱
attr_reader :character_name # 角色 文件名
attr_reader :character_hue # 角色 色相
attr_reader :class_id # 人物 ID
attr_reader :weapon_id # 武器 ID
attr_reader :armor1_id # 盾 ID
attr_reader :armor2_id # 頭防具 ID
attr_reader :armor3_id # 身體體防具 ID
attr_reader :armor4_id # 裝飾品 ID
attr_reader :level # 水準
attr_reader :exp # EXP
attr_reader :skills # 特技
attr_accessor :good_evil_exp_lv #善惡等級
attr_accessor :good_evil_exp #善惡經驗
attr_accessor :good_evil_exp_limit #善惡經驗上限
請在下方初始設定內改成如下:
#--------------------------------------------------------------------------
# ● 初始化對像
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
setup(actor_id)
@good_evil_exp_lv = 0 #善惡等級
@good_evil_exp = 0 #善惡經驗
@good_evil_exp_limit = [100,200,400,600,1000]#善惡經驗上限
end
請在下方腳色類中改成如下:
#--------------------------------------------------------------------------
# ● 設置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
@good_evil_exp_lv = 0 #善惡等級
@good_evil_exp = 0 #善惡經驗
@good_evil_exp_limit = [100,200,400,600,1000]#善惡經驗上限
# 學會特技
以上增加的只有 good_evil 開頭的變數而已,並不複雜。
這是用來初始宣告,以及腳色新增類的宣告。
=======================================================================
------------------以下是修改 Scene_Battle 2 的運算--------------
這腳本的修正,主要是用來自動戰鬥完後算出所得的善惡經驗/等級/上限值
請由第132行開始修正:
#--------------------------------------------------------------------------
# ● 開始結束戰鬥回合
#--------------------------------------------------------------------------
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
good_evil_exp_limit = [100,200,300,400,500]
i = 0
treasures = []
# 循環
for enemy in $game_troop.enemies
# 敵人不是隱藏狀態的情況下
unless enemy.hidden
# 獲得 EXP、增加金錢
exp += enemy.exp
#------------------主要是這段for的迴圈計算-----------------
for actor in $game_party.actors
actor.good_evil_exp += (exp / 10)
if actor.good_evil_exp >= good_evil_exp_limit[actor.good_evil_exp_lv]
actor.good_evil_exp -= good_evil_exp_limit[actor.good_evil_exp_lv] # 把善惡升級的經驗直扣掉
actor.good_evil_exp_lv += 1 #這個角色善惡等級升一級
end
end
gold += enemy.gold
# 出現寶物判定
【說明】
看到for 這段迴圈:
actor.good_evil_exp += (exp / 10)#這是用來將戰鬥後取得的經驗除10換算成腳色的技能經驗
if actor.good_evil_exp >= good_evil_exp_limit[actor.good_evil_exp_lv]
actor.good_evil_exp -= good_evil_exp_limit[actor.good_evil_exp_lv] # 把善惡升級的經驗直扣掉
actor.good_evil_exp_lv += 1 #這個角色善惡等級升一級
end
這段判斷是用來換算腳色的善惡等級以及下ㄧ級的上限。
=======================================================================
------------------以下是修正Window_Status 用來在狀態頁面顯示相關值------
請由第37行開始修正:
self.contents.font.color = system_color
self.contents.draw_text(320, 48, 80, 32, "EXP")
self.contents.draw_text(320, 80, 80, 32, "NEXT")
self.contents.draw_text(320, 112, 80, 32, "善惡經驗") #善惡經驗
self.contents.draw_text(320, 144, 80, 32, "善惡上限") #善惡上限
self.contents.draw_text(320, 176, 80, 32, "善惡等級") #善惡等級
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.draw_text(320 + 80, 112, 84, 32, @actor.good_evil_exp.to_s, 2) #善惡點數
self.contents.draw_text(320 + 80, 144, 84, 32, @actor.good_evil_exp_limit[@actor.good_evil_exp_lv].to_s, 2) #善惡點數
self.contents.draw_text(320 + 80, 176, 84, 32, @actor.good_evil_exp_lv.to_s, 2) #善惡點數
self.contents.font.color = system_color
self.contents.draw_text(320, 224, 96, 32, "裝備")
draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
end
【說明】
self.contents.draw_text(320 + 80, 112, 84, 32, @actor.good_evil_exp.to_s, 2) #善惡點數
self.contents.draw_text(320 + 80, 144, 84, 32, @actor.good_evil_exp_limit[@actor.good_evil_exp_lv].to_s, 2) #善惡點數
--上面這行比較複雜:
@actor.good_evil_exp_limit[@actor.good_evil_exp_lv]
呼叫腳色的經驗值上限陣列並將陣列位址指向腳色善惡等級的值
self.contents.draw_text(320 + 80, 176, 84, 32, @actor.good_evil_exp_lv.to_s, 2) #善惡點數
===================================================================
修改腳本結束!!
【使用方法】:
設計一場戰鬥,戰鬥完看看腳色狀態吧!!
|
|