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

Project1

 找回密码
 注册会员
搜索
查看: 2908|回复: 5

[原创发布] 自製[善惡經驗值]成為[顯性值]的教學設計

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2005-10-24
帖子
48
发表于 2005-11-22 04:43:09 | 显示全部楼层 |阅读模式

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

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

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) #善惡點數

===================================================================
修改腳本結束!!
【使用方法】:
設計一場戰鬥,戰鬥完看看腳色狀態吧!!
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2005-10-24
帖子
48
 楼主| 发表于 2005-11-22 04:43:09 | 显示全部楼层 |阅读模式

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

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

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) #善惡點數

===================================================================
修改腳本結束!!
【使用方法】:
設計一場戰鬥,戰鬥完看看腳色狀態吧!!

Lv1.梦旅人

梦石
0
星屑
55
在线时间
1 小时
注册时间
2005-10-21
帖子
101
发表于 2005-11-22 04:48:58 | 显示全部楼层
合适偶合适偶..可是是GASS..不会的说..寒
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
260
在线时间
1373 小时
注册时间
2005-10-16
帖子
5113

贵宾

发表于 2005-11-22 05:22:09 | 显示全部楼层
提一点小问题,善恶值通常是一队拥有一个属性……是不是可以放到party里~~~

放到party里倒不如用变量了……寒……

LZ这个可以用作实现每个角色根据角色性质来进行某些特殊技能的学习等等吧……
我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2005-11-7
帖子
7
发表于 2005-11-22 05:34:39 | 显示全部楼层
以下引用轩辕文德于2005-11-21 20:48:58的发言:

合适偶合适偶..可是是GASS..不会的说..寒


朋友...RGSS...握手...
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2005-10-21
帖子
6
发表于 2005-11-23 03:37:29 | 显示全部楼层
有個小小要求...

未知可否把是新加入的腳本以另一種顏色顯示出來呢?這樣應該會容易看一些...
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 18:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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