RGSS菜市場(最近更新2008/9/1)
RGSS菜市場(最近更新2008/9/1)
XP實現裝備劍才能用使用劍法屬性的效果
[ 脚本說明 ]︰
由於XP沒有2K3那種技能為某武器屬性,角色沒裝該屬性的武器就不能使用的
功能,所以在下自己提供自寫的RGSS供大家參考
[ 使用方法 ]︰
1.請將要使用的技能屬性勾選為"劍"(或其他,自行設定)
2.裝備的武器若勾選"劍"(或其他,自行設定)屬性,可以使用,反之不能
3.技能設定裡的=>攻擊力f和力量f這兩項數值只要任一個>0就判定為受武器屬性限制的技能.
4.要製作魔法技能時請將攻擊力f和力量f這兩項數值設為0,就能無視武器屬性使用
5.將以下腳本內容貼在Main之前
[ 脚本内容 ]︰
[ 脚本說明 ]︰
由於XP沒有2K3那種技能為某武器屬性,角色沒裝該屬性的武器就不能使用的
功能,所以在下自己提供自寫的RGSS供大家參考
[ 使用方法 ]︰
1.請將要使用的技能屬性勾選為"劍"(或其他,自行設定)
2.裝備的武器若勾選"劍"(或其他,自行設定)屬性,可以使用,反之不能
3.技能設定裡的=>攻擊力f和力量f這兩項數值只要任一個>0就判定為受武器屬性限制的技能.
4.要製作魔法技能時請將攻擊力f和力量f這兩項數值設為0,就能無視武器屬性使用
5.將以下腳本內容貼在Main之前
[ 脚本内容 ]︰
- 代碼:
class Game_Battler
#--------------------------------------------------------------------------
# ● 可以使用特技的判斷
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# SP 不足的情況下不能使用該技能
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# 無法戰鬥的情況下不能使用
if dead?
return false
end
# 沉默狀態的情況下、只能使用物理特技
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# 讀取技能攻擊力f和力量f
atk_f = $data_skills[skill_id].atk_f
str_f = $data_skills[skill_id].str_f
# 使用者是主角與技能為物理攻擊系時
if self.is_a?(Game_Actor) && (atk_f>0 or str_f>0)
element1 = []
if $data_weapons[@weapon_id] != nil
element1 = $data_weapons[@weapon_id].element_set
end
element2 = $data_skills[skill_id].element_set
# 技能屬性不為空的情況下
if element2 != []
k = 0
for i in element2
if element1.include?(i)
k = 1
break
end
end
# 沒有對應的屬性判定無法使用
return false if k == 0
end
end
# 取得可以使用的時機
occasion = $data_skills[skill_id].occasion
# 戰鬥中的情況下
if $game_temp.in_battle
# [平時] 或者是 [戰鬥中] 可以使用
return (occasion == 0 or occasion == 1)
# 不是戰鬥中的情況下
else
# [平時] 或者是 [選單中] 可以使用
return (occasion == 0 or occasion == 2)
end
end
end
愚零鬥武多 在 周一 9月 01, 2008 3:32 pm 作了第 9 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
技能等級與熟練度設置(內建戰鬥版)
[腳本說明]
此腳本可實現技能累積使用次數增加熟練度藉以提升技能等級的功能
每位角色會自動在程式中建立專屬技能熟練與等級的資料庫,跟隨存檔
適合想脫離常規技能製作的製作者,難度中等
PS:技能後面的LV和說明窗口內的熟練度為自動生成
[使用方法]
請將腳本內容複製並插在Main之前,並參閱腳本開頭設置自行設定
[腳本內容]
[腳本說明]
此腳本可實現技能累積使用次數增加熟練度藉以提升技能等級的功能
每位角色會自動在程式中建立專屬技能熟練與等級的資料庫,跟隨存檔
適合想脫離常規技能製作的製作者,難度中等
PS:技能後面的LV和說明窗口內的熟練度為自動生成
[使用方法]
請將腳本內容複製並插在Main之前,並參閱腳本開頭設置自行設定
[腳本內容]
- 代碼:
#==============================================================================
# ★★★★★★★★ 技能等級設定腳本 BY:愚零鬥武多 ★★★★★★★★
# ■想要用別客氣就直接拿去吧,腳本這種東西哪有版權可言=.=|||
#==============================================================================
# 此腳本可實現技能累積使用次數增加熟練度藉以提升技能等級的功能
# 每位角色會自動在程式中建立專屬技能熟練與等級的資料庫,跟隨存檔
# 適合想脫離常規技能製作的製作者,難度中等
# 目前只有攻擊和回復技能威力會受等級影響,其他狀態添加類或地圖技能
# 有興趣者可自行在def skill_effect(user, skill)添加功能
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能的設定法:
# SKILL_EXP_LIST =
# {
# 技能ID=>[等級2累積熟練度,等級3累積熟練度,等級4累積熟練度..],
# "END"=>0}
# ◆範例:
# SKILL_EXP_LIST =
# {
# 1=>[2,4,6],
# 2=>[4,8],
# 10=>[12,18,22,38],
# "END"=>0}
# ◆說明:
#1號技能=>[LV2熟練度須達2,LV3熟練度須達4,LV4熟練度須達6],
#2號技能=>[LV2熟練度須達4,LV3熟練度須達8],
#10號技能=>[LV2熟練度須達12,LV3熟練度須達18,LV4熟練度須達22,LV4熟練度須達38],
#[ ]裏的內容數量+1就是該技能的最高等級
#末尾要加"END"=>0}沒啥意義,方便設定而已
#沒有設定到的技能ID不受影響就照正常顯示
#有設定到的技能在技能名稱後面會自動顯示其等級,說明後面會自動出現熟練度
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能熟練度的增加:
# 只要傷害或回復值不為Miss成功使用的狀態下熟練度就+1
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能的威力設定:
# 內建為技能威力+技能威力*技能等級*倍率
# 倍率可以在腳本中搜尋S_PLUS = 0.5,請自行修改,值越大等級影響威力越顯著
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能經驗值與等級用語設定:
# 請在腳本中搜尋
# S_EXP = "熟練度:"
# S_LV = "LV"
# 請自行修改用語
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ 所有技能升級所需list列表設定
#==============================================================================
SKILL_EXP_LIST =
{
1=>[2,4,6,8],
2=>[20,40],
3=>[20,40,60,80,100],
57=>[2,4,6,8,10],
"END"=>0}
#==============================================================================
# ■ 技能經驗值與等級用語設定
#==============================================================================
S_EXP = "熟練度:"
S_LV = "LV"
#==============================================================================
# ■ 每提升1級等級的技能威力倍率
#==============================================================================
S_PLUS = 0.5
#==============================================================================
# ■ Game_Actor添加可存取的技能等級與熟練度資料
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 讀取技能附加威力
#--------------------------------------------------------------------------
def skill_power_plus(skill)
# 技能威力*角色對應該技能等級*倍率
return Integer(skill.power*self.skill_lv[skill.id]*S_PLUS)
end
#--------------------------------------------------------------------------
# ● 讀取技能經驗值資料
#--------------------------------------------------------------------------
def skill_exps
# 初始化@skill_exps
@skill_exps = [] if @skill_exps == nil
# 生成技能經驗值資料
for i in 1...$data_skills.size
if @skill_exps[i] == nil
@skill_exps[i] = 0
end
end
return @skill_exps
end
#--------------------------------------------------------------------------
# ● 寫入技能經驗值資料
#--------------------------------------------------------------------------
def push_skill_exps(id,exp)
self.skill_exps
if SKILL_EXP_LIST[id] != nil
t_max = SKILL_EXP_LIST[id][SKILL_EXP_LIST[id].size-1]
@skill_exps[id] = [@skill_exps[id]+exp,t_max].min
end
end
#--------------------------------------------------------------------------
# ● 讀取技能等級
#--------------------------------------------------------------------------
def skill_lv
# 初始化@skill_lv
@skill_lv = [] if @skill_lv == nil
# 生成並計算技能等級資料
for i in 1...$data_skills.size
list = SKILL_EXP_LIST[i]
# 沒有被規劃到的技能list就設為[0]
list = [0] if list == nil
exp = skill_exps[i]
# 計算對應熟練度的等級
@skill_lv[i] = 0
for index in 0...list.size
if exp >= list[index]
@skill_lv[i] = [@skill_lv[i]+1,list.size].min
end
end
end
return @skill_lv
end
end
#==============================================================================
# ■ Window_Skill技能help窗口說明增設exp與lv字串
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 描繪項目
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
# 技能熟練list存在時,技能名稱添加等級字串
if SKILL_EXP_LIST[skill.id] != nil
id = skill.id
lv = @actor.skill_lv[id]
list = SKILL_EXP_LIST
t_lv = lv >= list[id].size ? "MAX" : (lv+1).to_s
text = S_LV+t_lv
else
text = ""
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name+text, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 更新提示內容
#--------------------------------------------------------------------------
def update_help
# 有按下按鈕的情形才update
if Input.dir4 != 0 or Input.press?(Input::C) or Input.press?(Input::B)
# 技能為空的情況,說明設為空
if self.skill == nil
text = ""
else
# 技能熟練list存在時,說明添加熟練度字串
if SKILL_EXP_LIST[self.skill.id] != nil
id = self.skill.id
lv = @actor.skill_lv[id]
list = SKILL_EXP_LIST
m_exp = list[id][[lv,list[id].size-1].min].to_s
exp = S_EXP+@actor.skill_exps[id].to_s+"/"+m_exp
text = self.skill.description+"("+exp+")"
else
text = self.skill.description
end
end
# 設定help窗口
@help_window.set_text(text)
end
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 應用特技效果
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# 清除會心一擊標誌
self.critical = false
# 特技的效果範圍是 HP 1 以上的我方、自己的 HP 為 0、
# 或者特技的效果範圍是 HP 0 的我方、自己的 HP 為 1 以上的情況下
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# 過程結束
return false
end
# 清除有效標誌
effective = false
# 共通事件 ID 是有效的情況下,設定為有效標誌
effective |= skill.common_event_id > 0
# 第一命中判斷
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# 不確定特技的情況下設定為有效標誌
effective |= hit < 100
# 命中的情況下
if hit_result == true
# 計算威力
power = skill.power + user.atk * skill.atk_f / 100
# 我方使用的情形
if user.is_a?(Game_Actor)
# 計算技能等級的附加威力
power += user.skill_power_plus(skill)
end
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# 計算倍率
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# 計算基本傷害
self.damage = power * rate / 20
# 屬性修正
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# 傷害符號正確的情況下
if self.damage > 0
# 防禦修正
if self.guarding?
self.damage /= 2
end
end
# 分散
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判斷
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# 不確定特技的情況下設定為有效標誌
effective |= hit < 100
end
# 命中的情況下
if hit_result == true
# 威力 0 以外的物理攻擊的情況下
if skill.power != 0 and skill.atk_f > 0
# 狀態衝擊解除
remove_states_shock
# 設定有效標誌
effective = true
end
# HP 的傷害減法運算
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# 狀態變化
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# 威力為 0 的場合
if skill.power == 0
# 傷害設定為空的字串
self.damage = ""
# 狀態沒有變化的情況下
unless @state_changed
# 傷害設定為 "Miss"
self.damage = "Miss"
end
end
# Miss 的情況下
else
# 傷害設定為 "Miss"
self.damage = "Miss"
end
# 不在戰鬥中的情況下
unless $game_temp.in_battle
# 傷害設定為 nil
self.damage = nil
end
# 使用者是我方的情形
if user.is_a?(Game_Actor)
# 有效使用的情況,熟練度+1
if effective && self.damage != "Miss"
user.push_skill_exps(skill.id,1)
end
end
# 過程結束
return effective
end
end
愚零鬥武多 在 周日 8月 10, 2008 5:35 pm 作了第 2 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
XP實現取得指定位置事件ID的做法
1.在事件中依下列範例操作使用:(須配合在下寫的簡易腳本)
◆變數操作:[0010] = 5
◆變數操作:[0011] = 8
◆腳本:get_id(10,11,12)
◆文字:\v[12]
--------------------------------------------
說明:get_id(x座標值的變數編號,y座標值的變數編號,寫入結果的變數編號)
上例變數[10]=5,變數[11]=8也就是座標為(5,8)
變數[12]會被寫入位置座標為(5,8)的事件id
若該位置上沒有事件則變數[12]=0
以此類推....
在下提供這個功能分享應該沒有拒絕使用XP的理由吧(一行腳本指令就搞定)?@@
2.將下列腳本內容插在Main之前
1.在事件中依下列範例操作使用:(須配合在下寫的簡易腳本)
◆變數操作:[0010] = 5
◆變數操作:[0011] = 8
◆腳本:get_id(10,11,12)
◆文字:\v[12]
--------------------------------------------
說明:get_id(x座標值的變數編號,y座標值的變數編號,寫入結果的變數編號)
上例變數[10]=5,變數[11]=8也就是座標為(5,8)
變數[12]會被寫入位置座標為(5,8)的事件id
若該位置上沒有事件則變數[12]=0
以此類推....
在下提供這個功能分享應該沒有拒絕使用XP的理由吧(一行腳本指令就搞定)?@@
2.將下列腳本內容插在Main之前
- 代碼:
class Interpreter
#---------------------------------------------------------------------
# ● 取得指定位置之事件id
#---------------------------------------------------------------------
def get_id(v1,v2,v3)
# 變數v3歸零
$game_variables[v3] = 0
# 全部事件的循環
for event in $game_map.events.values
# 事件座標與給予參數一致的情況下
if event.x == $game_variables[v1] && event.y == $game_variables[v2]
# 變數v3代入該事件的id
$game_variables[v3] = event.id
break
end
end
end
end
愚零鬥武多 在 周二 7月 22, 2008 12:09 am 作了第 5 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
特殊狀態(反噬)=>如果被回復HP則會受到對等的傷害
EX :
A 受到這個狀態
某B對A此補血 200
A就會受到傷害200
然後A的特殊狀態解除
特殊狀態的ID請設為17
請將下列腳本內容貼在Main之前(只針對內建腳本)
EX :
A 受到這個狀態
某B對A此補血 200
A就會受到傷害200
然後A的特殊狀態解除
特殊狀態的ID請設為17
請將下列腳本內容貼在Main之前(只針對內建腳本)
- 代碼:
class Scene_Battle
#--------------------------------------------------------------------------
# ● 製作特技行動結果
#--------------------------------------------------------------------------
def make_skill_action_result
# 取得特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 如果不是強制行動
unless @active_battler.current_action.forcing
# 因為SP耗盡而無法使用的情況下
unless @active_battler.skill_can_use?(@skill.id)
# 清除強制行動目標的戰鬥者
$game_temp.forcing_battler = nil
# 移至步驟1
@phase4_step = 1
return
end
end
# 消耗SP
@active_battler.sp -= @skill.sp_cost
# 更新狀態視窗
@status_window.refresh
# 在提示視窗顯示特技名稱
@help_window.set_text(@skill.name, 1)
# 設定動畫 ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# 設定共通事件 ID
@common_event_id = @skill.common_event_id
# 設定目標側戰鬥者
set_target_battlers(@skill.scope)
# 設置新暫存參數
@temp_skill_tagret = {} if @temp_skill_tagret == nil
# 應用特技效果
for target in @target_battlers
# 符合回復反而扣血的條件目標時
if @skill.power < 0 && target.states.include?(17)
@temp_skill_tagret[target] = -@skill.power
# 正常狀況
else
target.skill_effect(@active_battler, @skill)
end
end
end
#--------------------------------------------------------------------------
# ● 製作物品行動結果
#--------------------------------------------------------------------------
def make_item_action_result
# 取得物品
@item = $data_items[@active_battler.current_action.item_id]
# 因為物品耗盡而無法使用的情況下
unless $game_party.item_can_use?(@item.id)
# 移至步驟1
@phase4_step = 1
return
end
# 消耗品的情況下
if @item.consumable
# 使用的物品減1
$game_party.lose_item(@item.id, 1)
end
# 在提示視窗顯示物品名稱
@help_window.set_text(@item.name, 1)
# 設定動畫 ID
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# 設定共通事件 ID
@common_event_id = @item.common_event_id
# 確定目標
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# 設定目標側戰鬥者
set_target_battlers(@item.scope)
# 設置新暫存參數
@temp_item_tagret = {} if @temp_item_tagret == nil
# 應用物品效果
for target in @target_battlers
# 符合回復反而扣血的條件目標時
if @item.recover_hp > 0 && target.states.include?(17)
@temp_item_tagret[target] = @item.recover_hp
# 正常狀況
else
target.item_effect(@item)
end
end
end
#--------------------------------------------------------------------------
# ● 更新畫面 (主回合步驟 4 : 對像方動畫)
#--------------------------------------------------------------------------
def update_phase4_step4
# 設置新暫存參數
@temp_skill_tagret = {} if @temp_skill_tagret == nil
@temp_item_tagret = {} if @temp_item_tagret == nil
# 執行技能具回復扣血的目標損傷數值寫入
if @temp_skill_tagret != {}
for i in @temp_skill_tagret.keys
i.hp -= @temp_skill_tagret[i]
i.damage = @temp_skill_tagret[i]
# 移除狀態
i.remove_state(17)
end
@temp_skill_tagret = {}
end
# 執行道具回復扣血的目標損傷數值寫入
if @temp_item_tagret != {}
for i in @temp_item_tagret.keys
i.hp -= @temp_item_tagret[i]
i.damage = @temp_item_tagret[i]
# 移除狀態
i.remove_state(17)
end
@temp_item_tagret = {}
end
# 目標方動畫
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
# 限制動畫長度、最低8幅畫面
@wait_count = 8
# 移至步驟5
@phase4_step = 5
end
end
愚零鬥武多 在 周五 7月 18, 2008 10:58 am 作了第 1 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
商店實現只能買不能賣或只能賣不能買的特殊功能
1.請在腳本開頭SHOPVAR = X修改X的值(特殊變數的編號)
本例變數100號=1時只能買入,變數100號=2時只能賣出,變數100號=其他值則為正常買賣
2.請將下列內容貼在腳本Main之前
1.請在腳本開頭SHOPVAR = X修改X的值(特殊變數的編號)
本例變數100號=1時只能買入,變數100號=2時只能賣出,變數100號=其他值則為正常買賣
2.請將下列內容貼在腳本Main之前
- 代碼:
# 設定特殊變數為100號
SHOPVAR = 100
class Window_ShopCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化目標
#--------------------------------------------------------------------------
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
# 根據指定變數設置參數
case $game_variables[SHOPVAR]
when 1
max = 2
commands = ["買入", "取消"]
when 2
max = 2
commands = ["賣出", "取消"]
else
max = 3
commands = ["買入", "賣出", "取消"]
end
@item_max = max
@column_max = max
@commands = commands
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 描繪項目
# index : 項目編號
#--------------------------------------------------------------------------
def draw_item(index)
ch = 448/@item_max
x = ch * index
self.contents.draw_text(x, 0, ch, 32, @commands[index],1)
end
end
class Scene_Shop
#--------------------------------------------------------------------------
# ● 更新畫面 (指令視窗啟動的情況下)
#--------------------------------------------------------------------------
def update_command
# 按下 B 鍵的情況下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切換到地圖畫面
$scene = Scene_Map.new
return
end
# 根據指定變數設置參數
case $game_variables[SHOPVAR]
when 1
a,b,c = 0,-10,1
when 2
a,b,c = -10,0,1
else
a,b,c = 0,1,2
end
# 按下 C 鍵的情況下
if Input.trigger?(Input::C)
# 命令視窗游標位置分歧
case @command_window.index
when a # 購買
# 演奏確定 SE
$game_system.se_play($data_system.decision_se)
# 視窗狀態轉向購買模式
@command_window.active = false
@dummy_window.visible = false
@buy_window.active = true
@buy_window.visible = true
@buy_window.refresh
@status_window.visible = true
when b # 賣出
# 演奏確定 SE
$game_system.se_play($data_system.decision_se)
# 視窗狀態轉向賣出模式
@command_window.active = false
@dummy_window.visible = false
@sell_window.active = true
@sell_window.visible = true
@sell_window.refresh
when c # 取消
# 演奏確定 SE
$game_system.se_play($data_system.decision_se)
# 切換到地圖畫面
$scene = Scene_Map.new
end
return
end
end
end
愚零鬥武多 在 周五 7月 18, 2008 10:59 am 作了第 1 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
切換地圖時自動顯示地名
[使用方法]
1.在腳本開頭可調文字尺寸與座標
2.將以下內容貼到Main之前
[使用方法]
1.在腳本開頭可調文字尺寸與座標
2.將以下內容貼到Main之前
- 代碼:
MAP_X = 0 # 文字顯示X座標設定
MAP_Y = 0 # 文字顯示Y座標設定
FONT_SIZE = 50 # 文字尺寸設定
class Scene_Map
#--------------------------------------------------------------------------
# ● 主處理
#--------------------------------------------------------------------------
def main
# 製作活動區塊
@spriteset = Spriteset_Map.new
# 製作訊息窗口
@message_window = Window_Message.new
# 製作地圖文字
@map_name = Sprite.new
@map_name.bitmap = Bitmap.new(640,480)
@map_name.bitmap.font.size = FONT_SIZE
@map_name.opacity = 0
@map_name.z = 99999
# 執行過渡
Graphics.transition
# 主循環
loop do
# 更新遊戲畫面
Graphics.update
# 更新輸入訊息
Input.update
# 更新地圖文字
map_name_update
# 更新畫面
update
# 如果畫面切換的話就中斷循環
if $scene != self
break
end
end
# 準備過渡
Graphics.freeze
# 釋放活動區塊所佔的記憶體空間
@spriteset.dispose
# 釋放訊息窗口所佔的記憶體空間
@message_window.dispose
@map_name.dispose
# 標題畫面切換中的情況下
if $scene.is_a?(Scene_Title)
# 淡入淡出畫面
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# ● 更新地圖文字
#--------------------------------------------------------------------------
def map_name_update
@map_name.opacity -= 1 if @map_name.opacity > 0
end
#--------------------------------------------------------------------------
# ● 主角的場所移動
#--------------------------------------------------------------------------
def transfer_player
# 清除主角場所移動除錯標誌
$game_temp.player_transferring = false
# 移動目標與現在的地圖有差異的情況下
if $game_map.map_id != $game_temp.player_new_map_id
# 設定新地圖
$game_map.setup($game_temp.player_new_map_id)
# 讀取地圖ID
id = $game_map.map_id
# 讀取地圖名稱
map = load_data(sprintf("Data/MapInfos.rxdata"))
map_name = map[id].name
@map_name.bitmap.clear
@map_name.bitmap.draw_text(MAP_X,MAP_Y,640,FONT_SIZE,map_name,0)
end
# 設定主角位置
$game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
# 設定主角面向
case $game_temp.player_new_direction
when 2 # 下
$game_player.turn_down
when 4 # 左
$game_player.turn_left
when 6 # 右
$game_player.turn_right
when 8 # 上
$game_player.turn_up
end
# 矯正主角位置
$game_player.straighten
# 更新地圖 (執行平行事件)
$game_map.update
# 在製作活動區塊
@spriteset.dispose
@spriteset = Spriteset_Map.new
# 處理過渡中的情況下
if $game_temp.transition_processing
# 清除過渡處理中標誌
$game_temp.transition_processing = false
# 執行過渡
Graphics.transition(20)
end
# 執行地圖設定的 BGM、BGS 的自動切換
$game_map.autoplay
# 設置地圖文字透明度
@map_name.opacity = 255
# 設定畫面
Graphics.frame_reset
# 更新輸入訊息
Input.update
end
end
愚零鬥武多 在 周二 7月 22, 2008 12:22 am 作了第 2 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
傳送術選單
[功能概述]
1.可輕易製作有到過某個地點就能使用選單選擇該地點並傳送的功能
2.沒有到過的地方就不會出現在選單裡
[使用方法]
1.在場所移動的指令後使用,以下為範例:
◆場所移動:[0010:大沙漠],(009,010)
◆腳本:save_map(9,10)
這樣當你移動到大沙漠之後,大沙漠座標9,10的點就是傳送點,可自行修改
2.製作一個公共事件,假設名稱叫做傳送,內容
◆腳本:$scene = Scene_Travel.new
3.製作一個特殊道具或魔法,使用時觸發公共事件傳送即可
4.有到過的地點被紀錄下來就會在選單裡出現,選擇即可進行傳送
[腳本]
1.在腳本開頭可調傳送音效TRAVEL_SE = SE名稱
2.將以下內容貼到Main之前
[功能概述]
1.可輕易製作有到過某個地點就能使用選單選擇該地點並傳送的功能
2.沒有到過的地方就不會出現在選單裡
[使用方法]
1.在場所移動的指令後使用,以下為範例:
◆場所移動:[0010:大沙漠],(009,010)
◆腳本:save_map(9,10)
這樣當你移動到大沙漠之後,大沙漠座標9,10的點就是傳送點,可自行修改
2.製作一個公共事件,假設名稱叫做傳送,內容
◆腳本:$scene = Scene_Travel.new
3.製作一個特殊道具或魔法,使用時觸發公共事件傳送即可
4.有到過的地點被紀錄下來就會在選單裡出現,選擇即可進行傳送
[腳本]
1.在腳本開頭可調傳送音效TRAVEL_SE = SE名稱
2.將以下內容貼到Main之前
- 代碼:
TRAVEL_SE = "014-Move02" # 音效設定
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :travel # 傳送參數
end
#==============================================================================
# ■ Window_Travel(傳送魔法專用地圖選擇窗口)
#==============================================================================
class Window_Travel < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化對象
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 1
refresh
self.index = 0
self.opacity = 160
self.back_opacity = 255
end
#--------------------------------------------------------------------------
# ● 讀取地圖資料
#--------------------------------------------------------------------------
def travel_data
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@travel_index = []
@data = []
for i in $game_system.travel.keys
@travel_index.push(i)
end
# 地圖id由大到小排列
@travel_index.sort!
for i in @travel_index
@data.push($game_system.travel[i])
end
# 如果項目數不是0就生成位圖.重新描繪項目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描繪項目
#--------------------------------------------------------------------------
def draw_item(index)
name = @data[index][0]
y = index * 32
self.contents.font.color = Color.new(0,0,0)
self.contents.draw_text(1, y+1, 608, 32, name, 1)
self.contents.font.color = normal_color
self.contents.draw_text(0, y, 608, 32, name, 1)
self.contents.draw_text(0, y, 608, 32, name, 1)
end
end
#==============================================================================
# ■ class Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# ● 記錄地圖資料(執行地圖傳送用)
#--------------------------------------------------------------------------
def save_map(x,y)
# 初始化傳送參數
$game_system.travel = {} if $game_system.travel == nil
# 讀取地圖ID
id = $game_map.map_id
# 讀取地圖名稱
map = load_data(sprintf("Data/MapInfos.rxdata"))
map_name = map[id].name
# 地圖ID在資料庫中不存在就寫入資料
unless $game_system.travel.include?(id)
$game_system.travel[id] = [map_name,id,x,y]
# 地圖ID在資料庫中存在但數據與現在不符合就寫入資料
else
if $game_system.travel[id] != [map_name,id,x,y]
$game_system.travel[id] = [map_name,id,x,y]
end
end
end
end
#==============================================================================
# ■ Scene_Travel(執行傳送魔法)
#==============================================================================
class Scene_Travel
#--------------------------------------------------------------------------
# ● 主處理
#--------------------------------------------------------------------------
def main
# 初始化傳送參數
$game_system.travel = {} if $game_system.travel == nil
# 生成地圖選擇窗口
@travel_window = Window_Travel.new
@travel_window.index = 0
# 生成幫助窗口
@help_window = Window_Help.new
if $game_system.travel != {}
@help_window.set_text("請選擇要移動的地點")
else
@help_window.set_text("目前沒有可以去的地點")
end
@help_window.back_opacity = 160
# 製作活動區塊
@spriteset = Spriteset_Map.new
# 執行過渡
Graphics.transition
# 主循環
loop do
# 刷新遊戲畫面
Graphics.update
# 刷新輸入訊息
Input.update
# 刷新畫面
update
# 如果畫面切換就中斷循環
if $scene != self
break
end
end
# 準備過渡
Graphics.freeze
# 釋放活動區塊所佔的記憶體空間
@spriteset.dispose
# 釋放窗口
@travel_window.dispose
@help_window.dispose
end
#--------------------------------------------------------------------------
# ● 刷新畫面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@travel_window.update
@help_window.update
# 轉移特效
if $game_temp.transition_processing
@travel_window.contents_opacity -= 20
@help_window.contents_opacity = @travel_window.contents_opacity
if @travel_window.contents_opacity == 0
# 切換到地圖畫面
$scene = Scene_Map.new
end
return
end
# 按下B鍵時
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切換到地圖畫面
$scene = Scene_Map.new
return
end
# 讀取地圖資料
data = @travel_window.travel_data
# 按下確定鍵時
if Input.trigger?(Input::C)
if data == nil
# 演奏凍結 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 設置場所移動標誌
$game_temp.player_transferring = true
# 設置主角的移動目標
$game_temp.player_new_map_id = data[1]
$game_temp.player_new_x = data[2]
$game_temp.player_new_y = data[3]
# 設置處理過渡中標誌
$game_temp.transition_processing = true
# 演奏傳送音效 SE
Audio.se_play("Audio/SE/"+TRAVEL_SE, 100, 100)
# 關閉窗口
@travel_window.active = false
end
end
end
愚零鬥武多 在 周五 7月 18, 2008 11:00 am 作了第 1 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
武器防具限制裝備等級
[功能概述]
可透過資料庫設置名稱去改變特定武器防具的裝備等級(等級未達無法裝備)
[使用法]
在資料庫的武器防具直接在名稱後面加,數字
數字就是裝備等級
例
青銅劍,5
青銅盾牌,5
可裝備的角色等級須為5以上(含5)才能裝備
沒有設定的武器防具裝備等級都是1
請以此類推設定
[腳本]
將下列腳本插在Main之前
[功能概述]
可透過資料庫設置名稱去改變特定武器防具的裝備等級(等級未達無法裝備)
[使用法]
在資料庫的武器防具直接在名稱後面加,數字
數字就是裝備等級
例
青銅劍,5
青銅盾牌,5
可裝備的角色等級須為5以上(含5)才能裝備
沒有設定的武器防具裝備等級都是1
請以此類推設定
[腳本]
將下列腳本插在Main之前
- 代碼:
module RPG
#==============================================================================
# ■class Weapon(武器名,裝備等級)
#==============================================================================
class Weapon
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def equip_lv
equip_lv = @name.split(/,/)[1]
return equip_lv != nil ? equip_lv.to_i : 1
end
end
#==============================================================================
# ■class Armor(防具名,裝備等級)
#==============================================================================
class Armor
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def equip_lv
equip_lv = @name.split(/,/)[1]
return equip_lv != nil ? equip_lv.to_i : 1
end
end
end
#==============================================================================
# ■class Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 可以裝備判斷
# item : 物品
#--------------------------------------------------------------------------
def equippable?(item)
# 武器的情況
if item.is_a?(RPG::Weapon)
# 包含當前的職業可以裝備武器的場合
if $data_classes[@class_id].weapon_set.include?(item.id)
# 檢查裝備等級
if self.level >= item.equip_lv
return true
end
end
end
# 防具的情況
if item.is_a?(RPG::Armor)
# 不包含當前的職業可以裝備武器的場合
if $data_classes[@class_id].armor_set.include?(item.id)
# 檢查裝備等級
if self.level >= item.equip_lv
return true
end
end
end
return false
end
end
#==============================================================================
# ■class Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 更新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加可以裝備的武器
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
# 檢查裝備等級
if @actor.level >= $data_weapons[i].equip_lv
@data.push($data_weapons[i])
end
end
end
end
# 添加可以裝備的防具
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
# 檢查裝備等級
if @actor.level >= $data_armors[i].equip_lv
@data.push($data_armors[i])
end
end
end
end
end
# 添加空白
@data.push(nil)
# 製作位圖、描繪全部項目
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
續恢(HP自動回復)或猛毒等特殊狀態的製作
[功能概述]
簡單的RGSS代碼設置即能達到敵我附加些特殊狀態就能有續恢(HP自動回復)或猛毒等效果
[使用法]
請參閱腳本開頭說明(有內建腳本版本與RTAB兩種版本)
RTAB版請至此下載RTAB戰鬥腳本
http://members.jcom.home.ne.jp/cogwheel/script/rtab.html
[腳本1]
內建戰鬥腳本版,插在Main之前即可使用
[腳本2]
RTAB戰鬥腳本版,插在Main之前即可使用
PS:位置必須在RTAB戰鬥腳本之下
[功能概述]
簡單的RGSS代碼設置即能達到敵我附加些特殊狀態就能有續恢(HP自動回復)或猛毒等效果
[使用法]
請參閱腳本開頭說明(有內建腳本版本與RTAB兩種版本)
RTAB版請至此下載RTAB戰鬥腳本
http://members.jcom.home.ne.jp/cogwheel/script/rtab.html
[腳本1]
內建戰鬥腳本版,插在Main之前即可使用
- 代碼:
RECOVE_STATE_ID = {}
#==============================================================================
# ◆續恢或猛毒狀態ID設定內建腳本版◆
# 此腳本位置必須放在RTAB腳本下方
# ◆設置法:
# RECOVE_STATE_ID[狀態ID] = 回復比例(%)
# ◆規則概述:
# 如果回復比例為正數為回復;負值為損傷
# 回復和損傷狀態存在時以損傷為優先處理
# 回復的狀態同時存在多個時以最大回復比例計算回復量
# 損傷的狀態同時存在多個時以最大損傷比例計算損傷量
# ◆其他:
# 請參考腳本開頭設置自行添加狀態ID與比例設置
# 有設置到的狀態ID冶請務必在資料庫中=>狀態裡自行添加設定
#==============================================================================
#◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 續恢術ID與回復比例設置
#◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
RECOVE_STATE_ID[17] = 20 # 17號狀態附加時每回合恢復20%HP
RECOVE_STATE_ID[18] = 25 # 18號狀態附加時每回合恢復25%HP
RECOVE_STATE_ID[19] = -40 # 19號狀態附加時每回合損傷40%HP
#==============================================================================
# class Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 判斷狀態 [連續傷害]
#--------------------------------------------------------------------------
def slip_damage?
for i in @states
if $data_states[i].slip_damage or RECOVE_STATE_ID.include?(i)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 應用連續傷害效果
#--------------------------------------------------------------------------
def slip_damage_effect
states_pass = false
damage1 = []
damage2 = []
# 計算傷害或回復比例
for i in self.states
if RECOVE_STATE_ID.include?(i)
states_pass = true
range = [[RECOVE_STATE_ID[i],-100].max,100].min / 100.0
if self.hp > 0
r_hp = (self.maxhp * range).truncate
if r_hp > 0
damage1.push(r_hp)
else
damage2.push(r_hp)
end
end
end
end
# 少血狀態為優先執行傷害
if damage2 != []
self.damage = -damage2.min
else
self.damage = -damage1.max
end
# 判斷沒有特殊狀態的情況下
unless states_pass
# 設定傷害
self.damage = self.maxhp / 10
end
# 分散
if self.damage.abs > 0
amp = [self.damage.abs * 15 / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# HP 的傷害減法運算
self.hp -= self.damage
# 過程結束
return true
end
end
[腳本2]
RTAB戰鬥腳本版,插在Main之前即可使用
PS:位置必須在RTAB戰鬥腳本之下
- 代碼:
RECOVE_STATE_ID = {}
#==============================================================================
# ◆續恢或猛毒狀態ID設定RTAB戰鬥腳本版◆
# 此腳本位置必須放在RTAB腳本下方
# ◆設置法:
# RECOVE_STATE_ID[狀態ID] = 回復比例(%)
# ◆規則概述:
# 如果回復比例為正數為回復;負值為損傷
# 回復和損傷狀態存在時以損傷為優先處理
# 回復的狀態同時存在多個時以最大回復比例計算回復量
# 損傷的狀態同時存在多個時以最大損傷比例計算損傷量
# ◆其他:
# 請參考腳本開頭設置自行添加狀態ID與比例設置
# 有設置到的狀態ID冶請務必在資料庫中=>狀態裡自行添加設定
#==============================================================================
#◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 續恢術ID與回復比例設置
#◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
RECOVE_STATE_ID[17] = 20 # 17號狀態附加時每回合恢復20%HP
RECOVE_STATE_ID[18] = 25 # 18號狀態附加時每回合恢復25%HP
RECOVE_STATE_ID[19] = -40 # 19號狀態附加時每回合損傷40%HP
#==============================================================================
# class Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 判斷狀態 [連續傷害]
#--------------------------------------------------------------------------
def slip_damage?
for i in @states
if $data_states[i].slip_damage or RECOVE_STATE_ID.include?(i)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 應用連續傷害效果
#--------------------------------------------------------------------------
def slip_damage_effect
states_pass = false
damage1 = []
damage2 = []
# 計算傷害或回復比例
for i in self.states
if RECOVE_STATE_ID.include?(i)
states_pass = true
range = [[RECOVE_STATE_ID[i],-100].max,100].min / 100.0
if self.hp > 0
r_hp = (self.maxhp * range).truncate
if r_hp > 0
damage1.push(r_hp)
else
damage2.push(r_hp)
end
end
end
end
# 少血狀態為優先執行傷害
if damage2 != []
self.damage["slip"] = -damage2.min
else
self.damage["slip"] = -damage1.max
end
# 判斷沒有特殊狀態的情況下
unless states_pass
# 設定傷害
self.damage["slip"] = self.maxhp / 10
end
# 分散
if self.damage["slip"].abs > 0
amp = [self.damage["slip"].abs * 15 / 100, 1].max
self.damage["slip"] += rand(amp+1) + rand(amp+1) - amp
end
# HP 的傷害減法運算
self.hp -= self.damage["slip"]
# 過程結束
return true
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
防止滑鼠腳本選項暴衝BUG補強RGSS
[功能概述]
66RPG的滑鼠腳本一直有令人詬病的BUG,那就是在選擇選項數量超出頁面時
滑鼠光標往下拉會有暴衝失控的情形導致難以操作
為了使使用者能充分的利用滑鼠腳本,整理出補強RGSS
[使用法]
1.沒有滑鼠腳本者請至66RPG下載
66RPG完整鼠標系統載點
2.腳本開頭可調整滑鼠光標靈敏度的參數請自行設置
3.插在Main之前即可使用(位置須在滑鼠腳本的下方)
[功能概述]
66RPG的滑鼠腳本一直有令人詬病的BUG,那就是在選擇選項數量超出頁面時
滑鼠光標往下拉會有暴衝失控的情形導致難以操作
為了使使用者能充分的利用滑鼠腳本,整理出補強RGSS
[使用法]
1.沒有滑鼠腳本者請至66RPG下載
66RPG完整鼠標系統載點
2.腳本開頭可調整滑鼠光標靈敏度的參數請自行設置
3.插在Main之前即可使用(位置須在滑鼠腳本的下方)
- 代碼:
#==============================================================================
#------------------------------------------------------------------------------
# ■ 防止滑鼠腳本選項暴衝BUG補強RGSS BY 愚零鬥武多
#------------------------------------------------------------------------------
#==============================================================================
# 滑鼠控制光標的靈敏度,數字越小越靈敏
MOUSE_MOVE_CURSOR_SPEED = 20
#==============================================================================
# ■ module Input
#==============================================================================
module Input
@a_count = 0 if @a_count == nil
@b_count = 0 if @b_count == nil
@c_count = 0 if @c_count == nil
@d_count = 0 if @d_count == nil
@e_count = 0 if @e_count == nil
@f_count = 0 if @f_count == nil
@down = false if @down == nil
@up = false if @up == nil
@left = false if @left == nil
@right = false if @right == nil
def self.down
@down = true
end
def self.up
@up = true
end
def self.left
@left = true
end
def self.right
@right = true
end
def self.update
@self_update.call
Mouse.update
end
def self.press?(key_code)
@a_count -= 1 if @a_count > 0
@d_count -= 1 if @d_count > 0
if @self_press.call(key_code)
return true
end
a = MOUSE_MOVE_CURSOR_SPEED
if @a_count <= 0
if key_code == UP
if @up
@a_count = a
@up = false
return true
end
end
if key_code == DOWN
if @down
@a_count = a
@down = false
return true
end
end
end
if @d_count <= 0
if key_code == LEFT
if @left
@d_count = a
@left = false
return true
end
end
if key_code == RIGHT
if @right
@d_count = a
@right = false
return true
end
end
end
if key_code == C
return Mouse.press?(Mouse::LEFT)
elsif key_code == B
return Mouse.press?(Mouse::RIGHT)
else
return @self_press.call(key_code)
end
end
def self.trigger?(key_code)
@b_count -= 1 if @b_count > 0
@e_count -= 1 if @e_count > 0
if @self_trigger.call(key_code)
return true
end
a = MOUSE_MOVE_CURSOR_SPEED
if @b_count <= 0
if key_code == UP
if @up
@b_count = a
@up = false
return true
end
end
if key_code == DOWN
if @down
@b_count = a
@down = false
return true
end
end
end
if @e_count <= 0
if key_code == LEFT
if @left
@e_count = a
@left = false
return true
end
end
if key_code == RIGHT
if @right
@e_count = a
@right = false
return true
end
end
end
if key_code == C
return Mouse.trigger?(Mouse::LEFT)
elsif key_code == B
return Mouse.trigger?(Mouse::RIGHT)
else
return @self_trigger.call(key_code)
end
end
def self.repeat?(key_code)
@c_count -= 1 if @c_count > 0
@f_count -= 1 if @f_count > 0
if @self_repeat.call(key_code)
return true
end
a = MOUSE_MOVE_CURSOR_SPEED
if @c_count <= 0
if key_code == UP
if @up
@c_count = a
@up = false
return true
end
end
if key_code == DOWN
if @down
@c_count = a
@down = false
return true
end
end
end
if @f_count <= 0
if key_code == LEFT
if @left
@f_count = a
@left = false
return true
end
end
if key_code == RIGHT
if @right
@f_count = a
@right = false
return true
end
end
end
if key_code == C
return Mouse.repeat?(Mouse::LEFT)
elsif key_code == B
return Mouse.repeat?(Mouse::RIGHT)
else
return @self_repeat.call(key_code)
end
end
end
#==============================================================================
# ■ class Window_Selectable
#==============================================================================
class Window_Selectable
if @self_alias == nil
alias self_update update
@self_alias = true
end
def update
self_update
@action = true if @action == nil
# 方向鍵被按下的情況下
if Input.dir8 != 0
@action = false
end
if self.active && @item_max > 0
mouse_x, mouse_y = Mouse.get_mouse_pos
if @mouse_target != [mouse_x,mouse_y]
@mouse_target = [mouse_x,mouse_y]
@action = true
end
unless @action
return
end
update_cursor_rect
top_x = self.cursor_rect.x + self.x + 16
top_y = self.cursor_rect.y + self.y + 16
bottom_x = top_x + self.cursor_rect.width
bottom_y = top_y + self.cursor_rect.height
if mouse_x < self.width+self.x && mouse_x > self.x &&
mouse_y < self.height+self.y && mouse_y > self.y
if mouse_y > bottom_y
Input.down
end
if mouse_y < top_y
Input.up
end
if mouse_x > bottom_x
Input.right
end
if mouse_x < top_x
Input.left
end
Mouse.click_unlock
else
Mouse.click_lock
end
end
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
武器或技能勾選特定附加屬性會消耗道具(內建戰鬥版)
[功能概述]
1.可做出裝備弓或使用弓技就消耗道具箭的系統
2.勾選武器或技能附加屬性即可設定
[使用法]
1.設定規則請參閱腳本開頭說明
2.將腳本貼在Main上方即可使用
[功能概述]
1.可做出裝備弓或使用弓技就消耗道具箭的系統
2.勾選武器或技能附加屬性即可設定
[使用法]
1.設定規則請參閱腳本開頭說明
2.將腳本貼在Main上方即可使用
- 代碼:
#==============================================================================
# ◆武器或技能勾選特定附加屬性會消耗道具的腳本(對應內建戰鬥)◆
#==============================================================================
ITEM_COST_ELEMENT_ID = {}
#==============================================================================
# ■ 設置消耗性屬性說明
# 設置法
# ITEM_COST_ELEMENT_ID[屬性ID] = 消耗道具ID
# 例:
# ITEM_COST_ELEMENT_ID[1] = 5
# 裝備的武器青銅劍勾選1號屬性(炎)時,普攻會消耗5號道具
# 使用的技能十字斬勾選1號屬性(炎)時,使用該技能會消耗5號道具
# ITEM_COST_ELEMENT_ID[2] = 6
# 裝備的武器青銅劍勾選2號屬性(冰)時,普攻會消耗6號道具
# 使用的技能十字斬勾選2號屬性(冰)時,使用該技能會消耗6號道具
#
# 沒有對應道具時普攻會一直MISS,技能會無法使用
#
# 使用者可以自行在資料庫=>系統新增弓箭屬性強化戰鬥系統
# ◆ 下方為設置區,請自行更改添加設定
ITEM_COST_ELEMENT_ID[1] = 5
ITEM_COST_ELEMENT_ID[2] = 6
#==============================================================================
#==============================================================================
# ■ class Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 可以使用特技的判斷
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# 使用者是我方
if self.is_a?(Game_Actor)
# 檢查消耗性屬性
for id in ITEM_COST_ELEMENT_ID.keys
# 檢查技能附加屬性
if $data_skills[skill_id].element_set.include?(id)
# 讀取消耗道具ID
item_id = ITEM_COST_ELEMENT_ID[id]
# 沒有對應道具的情形不能使用該技能
if $game_party.item_number(item_id) == 0
return false
end
end
end
end
# SP 不足的情況下不能使用該技能
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# 無法戰鬥的情況下不能使用
if dead?
return false
end
# 沉默狀態的情況下、只能使用物理特技
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# 取得可以使用的時機
occasion = $data_skills[skill_id].occasion
# 戰鬥中的情況下
if $game_temp.in_battle
# [平時] 或者是 [戰鬥中] 可以使用
return (occasion == 0 or occasion == 1)
# 不是戰鬥中的情況下
else
# [平時] 或者是 [選單中] 可以使用
return (occasion == 0 or occasion == 2)
end
end
end
#==============================================================================
# ■ class Scene_Battler
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 製作基本行動結果
#--------------------------------------------------------------------------
def make_basic_action_result
miss_attack = false
# 攻擊的情況下
if @active_battler.current_action.basic == 0
# 設定攻擊 ID
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# 行動方的戰鬥者是敵人的情況下
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# 行動方的戰鬥者是角色的情況下
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
# 檢查消耗性屬性
for id in ITEM_COST_ELEMENT_ID.keys
# 檢查我方武器附加屬性
if @active_battler.element_set.include?(id)
# 讀取消耗道具ID
item_id = ITEM_COST_ELEMENT_ID[id]
# 有對應道具的情形
if $game_party.item_number(item_id) > 0
# 物品減1
$game_party.lose_item(item_id, 1)
# 沒有對應道具的情形
else
# 設置MISS
miss_attack = true
end
break
end
end
end
# 設定目標方的戰鬥者序列
@target_battlers = [target]
# 應用通常攻擊效果
for target in @target_battlers
# 可以攻擊
unless miss_attack
target.attack_effect(@active_battler)
# MISS攻擊
else
target.damage = "Miss"
end
end
return
end
# 防禦的情況下
if @active_battler.current_action.basic == 1
# 提示視窗顯示"防禦"
@help_window.set_text($data_system.words.guard, 1)
return
end
# 逃跑的情況下
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# 提示視窗顯示"逃跑"
@help_window.set_text("逃跑", 1)
# 逃跑
@active_battler.escape
return
end
# 什麼也不做的情況下
if @active_battler.current_action.basic == 3
# 清除強制行動目標的戰鬥者
$game_temp.forcing_battler = nil
# 移至步驟1
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
# ● 製作特技行動結果
#--------------------------------------------------------------------------
def make_skill_action_result
miss_attack = false
# 取得特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 如果不是強制行動
unless @active_battler.current_action.forcing
# 因為SP耗盡而無法使用的情況下
unless @active_battler.skill_can_use?(@skill.id)
# 清除強制行動目標的戰鬥者
$game_temp.forcing_battler = nil
# 移至步驟1
@phase4_step = 1
return
end
end
# 檢查消耗性屬性
for id in ITEM_COST_ELEMENT_ID.keys
# 檢查使用技能附加屬性
if @skill.element_set.include?(id)
# 讀取消耗道具ID
item_id = ITEM_COST_ELEMENT_ID[id]
# 有對應道具的情形
if $game_party.item_number(item_id) > 0
# 物品減1
$game_party.lose_item(item_id, 1)
# 沒有對應道具的情形
else
# 設置MISS
miss_attack = true
end
break
end
end
# 消耗SP
@active_battler.sp -= @skill.sp_cost
# 更新狀態視窗
@status_window.refresh
# 在提示視窗顯示特技名稱
@help_window.set_text(@skill.name, 1)
# 設定動畫 ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# 設定共通事件 ID
@common_event_id = @skill.common_event_id
# 設定目標側戰鬥者
set_target_battlers(@skill.scope)
# 應用特技效果
for target in @target_battlers
# 可以攻擊
unless miss_attack
target.skill_effect(@active_battler, @skill)
# MISS攻擊
else
target.damage = "Miss"
end
end
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
武器或技能勾選特定附加屬性會消耗道具(RTAB戰鬥版)
[功能概述]
1.可做出裝備弓或使用弓技就消耗道具箭的系統
2.勾選武器或技能附加屬性即可設定
[使用法]
1.設定規則請參閱腳本開頭說明
2.將腳本貼在Main上方即可使用
齒車之城RTABVer1.16載點
[功能概述]
1.可做出裝備弓或使用弓技就消耗道具箭的系統
2.勾選武器或技能附加屬性即可設定
[使用法]
1.設定規則請參閱腳本開頭說明
2.將腳本貼在Main上方即可使用
齒車之城RTABVer1.16載點
- 代碼:
#==============================================================================
# ◆武器或技能勾選特定附加屬性會消耗道具的腳本(對應RTAB戰鬥)◆
#==============================================================================
ITEM_COST_ELEMENT_ID = {}
#==============================================================================
# ■ 設置消耗性屬性說明
# 設置法
# ITEM_COST_ELEMENT_ID[屬性ID] = 消耗道具ID
# 例:
# ITEM_COST_ELEMENT_ID[1] = 5
# 裝備的武器青銅劍勾選1號屬性(炎)時,普攻會消耗5號道具
# 使用的技能十字斬勾選1號屬性(炎)時,使用該技能會消耗5號道具
# ITEM_COST_ELEMENT_ID[2] = 6
# 裝備的武器青銅劍勾選2號屬性(冰)時,普攻會消耗6號道具
# 使用的技能十字斬勾選2號屬性(冰)時,使用該技能會消耗6號道具
#
# 沒有對應道具時普攻會一直MISS,技能會無法使用
#
# 使用者可以自行在資料庫=>系統新增弓箭屬性強化戰鬥系統
# ◆ 下方為設置區,請自行更改添加設定
ITEM_COST_ELEMENT_ID[1] = 5
ITEM_COST_ELEMENT_ID[2] = 6
#==============================================================================
#==============================================================================
# ■ class Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 可以使用特技的判斷
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# 使用者是我方
if self.is_a?(Game_Actor)
# 檢查消耗性屬性
for id in ITEM_COST_ELEMENT_ID.keys
# 檢查技能附加屬性
if $data_skills[skill_id].element_set.include?(id)
# 讀取消耗道具ID
item_id = ITEM_COST_ELEMENT_ID[id]
# 沒有對應道具的情形不能使用該技能
if $game_party.item_number(item_id) == 0
return false
end
end
end
end
# SP 不足的情況下不能使用該技能
if $data_skills[skill_id].sp_cost > self.sp
return false
end
# 無法戰鬥的情況下不能使用
if dead?
return false
end
# 沉默狀態的情況下、只能使用物理特技
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# 取得可以使用的時機
occasion = $data_skills[skill_id].occasion
# 戰鬥中的情況下
if $game_temp.in_battle
# [平時] 或者是 [戰鬥中] 可以使用
return (occasion == 0 or occasion == 1)
# 不是戰鬥中的情況下
else
# [平時] 或者是 [選單中] 可以使用
return (occasion == 0 or occasion == 2)
end
end
end
#==============================================================================
# ■ class Scene_Battler
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 基本アクション 結果作成
#--------------------------------------------------------------------------
def make_basic_action_result(battler)
miss_attack = false
# 攻撃の場合
if battler.current_action.basic == 0
# アニメーション ID を設定
battler.anime1 = battler.animation1_id
battler.anime2 = battler.animation2_id
# 行動側バトラーがエネミーの場合
if battler.is_a?(Game_Enemy)
if battler.restriction == 3
target = $game_troop.random_target_enemy
elsif battler.restriction == 2
target = $game_party.random_target_actor
else
index = battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# 行動側バトラーがアクターの場合
if battler.is_a?(Game_Actor)
if battler.restriction == 3
target = $game_party.random_target_actor
elsif battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
# 檢查消耗性屬性
for id in ITEM_COST_ELEMENT_ID.keys
# 檢查我方武器附加屬性
if battler.element_set.include?(id)
# 讀取消耗道具ID
item_id = ITEM_COST_ELEMENT_ID[id]
# 有對應道具的情形
if $game_party.item_number(item_id) > 0
# 物品減1
$game_party.lose_item(item_id, 1)
# 沒有對應道具的情形
else
# 設置MISS
miss_attack = true
end
break
end
end
end
# 対象側バトラーの配列を設定
battler.target = [target]
# 通常攻撃の効果を適用
for target in battler.target
# 可以攻擊
unless miss_attack
target.attack_effect(battler)
# MISS攻擊
else
target.damage[battler] = "Miss"
end
end
return
end
# 防御の場合
if battler.current_action.basic == 1
return
end
# 逃げるの場合
if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
return
end
# 何もしないの場合
if battler.current_action.basic == 3
# ステップ 6 に移行
battler.phase = 6
return
end
end
#--------------------------------------------------------------------------
# ● スキルアクション 結果作成
#--------------------------------------------------------------------------
def make_skill_action_result(battler)
miss_attack = false
# スキルを取得
@skill = $data_skills[battler.current_action.skill_id]
# 連携スキルであるかどうか確認
speller = synthe?(battler)
# 強制アクションでなければ
unless battler.current_action.forcing
# SP 切れなどで使用できなくなった場合
if speller == nil
unless battler.skill_can_use?(@skill.id)
# ステップ 6 に移行
battler.phase = 6
return
end
end
end
# 檢查消耗性屬性
for id in ITEM_COST_ELEMENT_ID.keys
# 檢查使用技能附加屬性
if @skill.element_set.include?(id)
# 讀取消耗道具ID
item_id = ITEM_COST_ELEMENT_ID[id]
# 有對應道具的情形
if $game_party.item_number(item_id) > 0
# 物品減1
$game_party.lose_item(item_id, 1)
# 沒有對應道具的情形
else
# 設置MISS
miss_attack = true
end
break
end
end
# SP 消費
temp = false
if speller != nil
for spell in speller
if spell.current_action.spell_id == 0
spell.sp -= @skill.sp_cost
else
spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
end
# ステータスウィンドウをリフレッシュ
status_refresh(spell)
end
else
battler.sp -= @skill.sp_cost
# ステータスウィンドウをリフレッシュ
status_refresh(battler)
end
# アニメーション ID を設定
battler.anime1 = @skill.animation1_id
battler.anime2 = @skill.animation2_id
# コモンイベント ID を設定
battler.event = @skill.common_event_id
# 対象側バトラーを設定
set_target_battlers(@skill.scope, battler)
# スキルの効果を適用
for target in battler.target
if speller != nil
damage = 0
d_result = false
effective = false
state_p = []
state_m = []
for spell in speller
if spell.current_action.spell_id != 0
@skill = $data_skills[spell.current_action.spell_id]
end
effective |= target.skill_effect(spell, @skill)
if target.damage[spell].class != String
d_result = true
damage += target.damage[spell]
elsif effective
effect = target.damage[spell]
end
state_p += target.state_p[spell]
state_m += target.state_m[spell]
target.damage.delete(spell)
target.state_p.delete(spell)
target.state_m.delete(spell)
end
if d_result
target.damage[battler] = damage
elsif effective
target.damage[battler] = effect
else
target.damage[battler] = 0
end
target.state_p[battler] = state_p
target.state_m[battler] = state_m
else
# 可以攻擊
unless miss_attack
target.skill_effect(battler, @skill)
# MISS攻擊
else
target.damage[battler] = "Miss"
end
end
end
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
技能等級與熟練度設置(RTAB戰鬥版)
[腳本說明]
此腳本可實現技能累積使用次數增加熟練度藉以提升技能等級的功能
每位角色會自動在程式中建立專屬技能熟練與等級的資料庫,跟隨存檔
適合想脫離常規技能製作的製作者,難度中等
PS:技能後面的LV和說明窗口內的熟練度為自動生成
[使用方法]
請將腳本內容複製並插在Main之前,並參閱腳本開頭設置自行設定
[腳本內容]
[腳本說明]
此腳本可實現技能累積使用次數增加熟練度藉以提升技能等級的功能
每位角色會自動在程式中建立專屬技能熟練與等級的資料庫,跟隨存檔
適合想脫離常規技能製作的製作者,難度中等
PS:技能後面的LV和說明窗口內的熟練度為自動生成
[使用方法]
請將腳本內容複製並插在Main之前,並參閱腳本開頭設置自行設定
[腳本內容]
- 代碼:
#==============================================================================
# ★★★★★★★★ 技能等級設定腳本(RTAB戰鬥版) BY:愚零鬥武多 ★★★★★★★★
# ■想要用別客氣就直接拿去吧,腳本這種東西哪有版權可言=.=|||
#==============================================================================
# 此腳本可實現技能累積使用次數增加熟練度藉以提升技能等級的功能
# 每位角色會自動在程式中建立專屬技能熟練與等級的資料庫,跟隨存檔
# 適合想脫離常規技能製作的製作者,難度中等
# 目前只有攻擊和回復技能威力會受等級影響,其他狀態添加類或地圖技能
# 有興趣者可自行在def skill_effect(user, skill)添加功能
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能的設定法:
# SKILL_EXP_LIST =
# {
# 技能ID=>[等級2累積熟練度,等級3累積熟練度,等級4累積熟練度..],
# "END"=>0}
# ◆範例:
# SKILL_EXP_LIST =
# {
# 1=>[2,4,6],
# 2=>[4,8],
# 10=>[12,18,22,38],
# "END"=>0}
# ◆說明:
#1號技能=>[LV2熟練度須達2,LV3熟練度須達4,LV4熟練度須達6],
#2號技能=>[LV2熟練度須達4,LV3熟練度須達8],
#10號技能=>[LV2熟練度須達12,LV3熟練度須達18,LV4熟練度須達22,LV4熟練度須達38],
#[ ]裏的內容數量+1就是該技能的最高等級
#末尾要加"END"=>0}沒啥意義,方便設定而已
#沒有設定到的技能ID不受影響就照正常顯示
#有設定到的技能在技能名稱後面會自動顯示其等級,說明後面會自動出現熟練度
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能熟練度的增加:
# 只要傷害或回復值不為Miss成功使用的狀態下熟練度就+1
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能的威力設定:
# 內建為技能威力+技能威力*技能等級*倍率
# 倍率可以在腳本中搜尋S_PLUS = 0.5,請自行修改,值越大等級影響威力越顯著
# ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆
# 技能經驗值與等級用語設定:
# 請在腳本中搜尋
# S_EXP = "熟練度:"
# S_LV = "LV"
# 請自行修改用語
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ 所有技能升級所需list列表設定
#==============================================================================
SKILL_EXP_LIST =
{
1=>[2,4,6,8],
2=>[20,40],
3=>[20,40,60,80,100],
57=>[2,4,6,8,10],
"END"=>0}
#==============================================================================
# ■ 技能經驗值與等級用語設定
#==============================================================================
S_EXP = "熟練度:"
S_LV = "LV"
#==============================================================================
# ■ 每提升1級等級的技能威力倍率
#==============================================================================
S_PLUS = 0.5
#==============================================================================
# ■ Game_Actor添加可存取的技能等級與熟練度資料
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 讀取技能附加威力
#--------------------------------------------------------------------------
def skill_power_plus(skill)
# 技能威力*角色對應該技能等級*倍率
return Integer(skill.power*self.skill_lv[skill.id]*S_PLUS)
end
#--------------------------------------------------------------------------
# ● 讀取技能經驗值資料
#--------------------------------------------------------------------------
def skill_exps
# 初始化@skill_exps
@skill_exps = [] if @skill_exps == nil
# 生成技能經驗值資料
for i in 1...$data_skills.size
if @skill_exps[i] == nil
@skill_exps[i] = 0
end
end
return @skill_exps
end
#--------------------------------------------------------------------------
# ● 寫入技能經驗值資料
#--------------------------------------------------------------------------
def push_skill_exps(id,exp)
self.skill_exps
if SKILL_EXP_LIST[id] != nil
t_max = SKILL_EXP_LIST[id][SKILL_EXP_LIST[id].size-1]
@skill_exps[id] = [@skill_exps[id]+exp,t_max].min
end
end
#--------------------------------------------------------------------------
# ● 讀取技能等級
#--------------------------------------------------------------------------
def skill_lv
# 初始化@skill_lv
@skill_lv = [] if @skill_lv == nil
# 生成並計算技能等級資料
for i in 1...$data_skills.size
list = SKILL_EXP_LIST[i]
# 沒有被規劃到的技能list就設為[0]
list = [0] if list == nil
exp = skill_exps[i]
# 計算對應熟練度的等級
@skill_lv[i] = 0
for index in 0...list.size
if exp >= list[index]
@skill_lv[i] = [@skill_lv[i]+1,list.size].min
end
end
end
return @skill_lv
end
end
#==============================================================================
# ■ Window_Skill技能help窗口說明增設exp與lv字串
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 描繪項目
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
# 技能熟練list存在時,技能名稱添加等級字串
if SKILL_EXP_LIST[skill.id] != nil
id = skill.id
lv = @actor.skill_lv[id]
list = SKILL_EXP_LIST
t_lv = lv >= list[id].size ? "MAX" : (lv+1).to_s
text = S_LV+t_lv
else
text = ""
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name+text, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 更新提示內容
#--------------------------------------------------------------------------
def update_help
# 有按下按鈕的情形才update
if Input.dir4 != 0 or Input.press?(Input::C) or Input.press?(Input::B)
# 技能為空的情況,說明設為空
if self.skill == nil
text = ""
else
# 技能熟練list存在時,說明添加熟練度字串
if SKILL_EXP_LIST[self.skill.id] != nil
id = self.skill.id
lv = @actor.skill_lv[id]
list = SKILL_EXP_LIST
m_exp = list[id][[lv,list[id].size-1].min].to_s
exp = S_EXP+@actor.skill_exps[id].to_s+"/"+m_exp
text = self.skill.description+"("+exp+")"
else
text = self.skill.description
end
end
# 設定help窗口
@help_window.set_text(text)
end
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● スキルの効果適用
# user : スキルの使用者 (バトラー)
# skill : スキル
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# クリティカルフラグをクリア
self.critical[user] = false
state_p[user] = []
state_m[user] = []
# スキルの効果範囲が HP 1 以上の味方で、自分の HP が 0、
# またはスキルの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# メソッド終了
return false
end
# 有効フラグをクリア
effective = false
# コモンイベント ID が有効の場合は有効フラグをセット
effective |= skill.common_event_id > 0
# 第一命中判定
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# 不確実なスキルの場合は有効フラグをセット
effective |= hit < 100
# 命中の場合
if hit_result == true
# 威力を計算
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# 倍率を計算
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# 基本ダメージを計算
self.damage[user] = power * rate / 20
# 属性修正
self.damage[user] *= elements_correct(skill.element_set)
self.damage[user] /= 100
# ダメージの符号が正の場合
if self.damage[user] > 0
# 防御修正
if self.guarding?
self.damage[user] /= 2
end
end
# 分散
if skill.variance > 0 and self.damage[user].abs > 0
amp = [self.damage[user].abs * skill.variance / 100, 1].max
self.damage[user] += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# 不確実なスキルの場合は有効フラグをセット
effective |= hit < 100
end
# 命中の場合
if hit_result == true
# 威力 0 以外の物理攻撃の場合
if skill.power != 0 and skill.atk_f > 0
# ステート衝撃解除
remove_states_shock
# 有効フラグをセット
effective = true
end
# HP の変動判定
last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max
# 効果判定
effective |= self.hp != last_hp
# ステート変化
@state_changed = false
effective |= states_plus(user, skill.plus_state_set)
effective |= states_minus(user, skill.minus_state_set)
unless $game_temp.in_battle
self.damage_effect(user, 1)
end
# 威力が 0 の場合
if skill.power == 0
# ダメージに空文字列を設定
self.damage[user] = ""
# ステートに変化がない場合
unless @state_changed
# ダメージに "Miss" を設定
self.damage[user] = "Miss"
end
end
# ミスの場合
else
# ダメージに "Miss" を設定
self.damage[user] = "Miss"
end
# 戦闘中でない場合
unless $game_temp.in_battle
# ダメージに nil を設定
self.damage[user] = nil
end
# 使用者是我方的情形
if user.is_a?(Game_Actor)
# 有效使用的情況,熟練度+1
if effective && self.damage != "Miss"
user.push_skill_exps(skill.id,1)
end
end
# メソッド終了
return effective
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
仿線上遊戲式自動存檔
1.詳細使用法請參閱腳本開頭說明
2.將以下內容貼到Main之前
1.詳細使用法請參閱腳本開頭說明
2.將以下內容貼到Main之前
- 代碼:
#============================================================================
# ★★★★★★★★ 仿線上遊戲式自動存檔 BY:愚零鬥武多 ★★★★★★★★
#============================================================================
#■功能概述■
#1.使用簡單腳本指令配合平行事件即可進行自動存檔功能
#2.會自動根據玩家LOAD的檔案文件編號進行存檔,例如玩家進遊戲時是呼叫第二組存檔那就會自動存在第二組。
#3.若是新遊戲的狀況是會自動存在第一個檔案文件。
#--------------------------------------------------------------------------
#■使用方法■
#1.[全程自動存檔]
# 設一個目標為平行處理的公共事件,並將對應開關打開
# 內容寫法:
#
#◆腳本:auto_save
#◆等待:40畫面
#
#PS1:該公共事件在執行平行處理時,每40禎進行一次自動存檔。
#PS2:由於自動存檔會造成些許的LAG,因此盡量不要將等待時間調的過小,
# 否則過於頻繁存取檔案會拖垮效能。
#
#2.[特定事件自動存檔]
# 例如衝裝備事件後不想讓玩家反悔馬上SAVE
# 內容寫法:
#
#◆.......(選擇要進行衝裝的物品)
#◆.......(衝裝動作)
#◆腳本:auto_save
#
#==============================================================================
# ■ Interpreter
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# ● 自動存檔
#--------------------------------------------------------------------------
def auto_save
# 讀取當前是第幾組檔案
filename = "save/Save#{$game_temp.last_file_index + 1}.rxdata"
# 寫入存檔資料
file = File.open(filename, "wb")
# 製作描繪存檔文件用的角色圖形
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# 寫入描繪存檔文件用的角色資料
Marshal.dump(characters, file)
# 寫入測量遊戲時間用畫面計數
Marshal.dump(Graphics.frame_count, file)
# 增加 1 次存檔次數
$game_system.save_count += 1
# 保存魔法編號
# (將編輯器保存的值以隨機值替換)
$game_system.magic_number = $data_system.magic_number
# 寫入各種遊戲目標
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
戰鬥動畫播放角色挨打音效
[功能概述]
1.利用動畫資料庫SE與閃爍效果即可設置角色挨打時播放音效的功能
2.RGSS代碼簡易設置對應音效,播放時機設定自由,可做到連續播放挨打音效
[使用方法]
1.以下為要播放挨打音效的動畫資料庫SE與閃爍效果設置範例截圖
設置規則
2.詳細使用法請參閱腳本開頭說明
3.將以下內容貼到Main之前
[功能概述]
1.利用動畫資料庫SE與閃爍效果即可設置角色挨打時播放音效的功能
2.RGSS代碼簡易設置對應音效,播放時機設定自由,可做到連續播放挨打音效
[使用方法]
1.以下為要播放挨打音效的動畫資料庫SE與閃爍效果設置範例截圖
設置規則
2.詳細使用法請參閱腳本開頭說明
3.將以下內容貼到Main之前
- 代碼:
#============================================================================
# ★★★★★★★★ 戰鬥動畫播放角色挨打音效 BY:愚零鬥武多 ★★★★★★★★
#============================================================================
#■使用說明■
#1.在動畫資料庫SE與閃爍效果設置一個R(紅色).G(綠色).B(藍色).S(強度)為(0,0,0,0)
# ,條件為[擊中],閃爍目標為[對象],時間為[1畫面數]的閃爍時機
#2.戰鬥中動畫撥放到該時機時若顯示動畫的對象是我方角色,而且是命中時
# 就會撥放對應音效
#3.音效設置法DAMAGESE[角色ID] = 對應的SE檔名
# 例:DAMAGESE[1] = "089-Attack01" => 1號角色播放089-Attack01的SE
# 例:DAMAGESE[2] = "090-Attack02" => 2號角色播放090-Attack02的SE
# 請以此類推自行添加設定之
#4.以下為設置區
DAMAGESE = {}
DAMAGESE[1] = "089-Attack01"
DAMAGESE[2] = "090-Attack02"
DAMAGESE[3] = "091-Attack03"
DAMAGESE[4] = "092-Attack04"
#==============================================================================
# ■ module RPG
#==============================================================================
module RPG
class Sprite < ::Sprite
#--------------------------------------------------------------------------
# ● SE與閃爍效果設置
#--------------------------------------------------------------------------
def animation_process_timing(timing, hit)
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
if timing.se.name != ""
se = timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
case timing.flash_scope
when 1
# 戰鬥中
if $game_temp.in_battle
# 挨打叫聲條件判斷成功
if timing.flash_color == Color.new(0,0,0,0) && timing.flash_duration == 1
# 挨打方為我方時
if self.battler.is_a?(Game_Actor)
play_damage_se(self.battler.id)
end
end
end
self.flash(timing.flash_color, timing.flash_duration * 2)
when 2
if self.viewport != nil
self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
end
when 3
self.flash(nil, timing.flash_duration * 2)
end
end
end
#--------------------------------------------------------------------------
# ● 播放挨打音效處理
#--------------------------------------------------------------------------
def play_damage_se(id)
if DAMAGESE[id] != nil
Audio.se_play("Audio/SE/" + DAMAGESE[id], 100, 100)
end
end
end
end
愚零鬥武多 在 周一 9月 01, 2008 3:32 pm 作了第 4 次修改
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
回復: RGSS菜市場(最近更新2008/9/1)
對話時可移動主角
[功能概述]
1.可實現對話框出現時可自由移動主角的功能
[使用方法]
1.詳細使用法請參閱腳本開頭說明
2.將以下內容貼到Main之前
[功能概述]
1.可實現對話框出現時可自由移動主角的功能
[使用方法]
1.詳細使用法請參閱腳本開頭說明
2.將以下內容貼到Main之前
- 代碼:
#============================================================================
# ★★★★★★★★ 對話時可移動主角 BY:愚零鬥武多 ★★★★★★★★
#============================================================================
#■功能概述■
#1.可實現對話框出現時可自由移動主角的功能
#■使用說明■
#1.設定方式TALK_CAN_MOVE_SWITCH_ID = 開關編號
# 例 : TALK_CAN_MOVE_SWITCH_ID = 10
# 開關10開啟在對話時主角可以移動
# 開關10關閉在對話時主角無法移動
#
#2.以下為設定區
TALK_CAN_MOVE_SWITCH_ID = 10
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 畫面更新
#--------------------------------------------------------------------------
def update
# 本地變量記錄移動訊息
last_moving = moving?
# 開關[TALK_CAN_MOVE_SWITCH_ID]決定對話時主角是否可移動
# (on時可移動)
unless $game_switches[TALK_CAN_MOVE_SWITCH_ID]
stop_move = ($game_system.map_interpreter.running? or $game_temp.message_window_showing)
else
stop_move = false
end
# 不是移動中、不是強制移動路線中、stop_move為false
unless moving? or @move_route_forcing or stop_move
# 如果方向鍵被按下、主角就朝那個方向移動
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
# 本地變量記憶座標
last_real_x = @real_x
last_real_y = @real_y
super
# 角色向下移動、畫面上的位置在中央下方的情況下
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# 畫面向下捲動
$game_map.scroll_down(@real_y - last_real_y)
end
# 角色向左移動、畫面上的位置在中央左方的情況下
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# 畫面向左捲動
$game_map.scroll_left(last_real_x - @real_x)
end
# 角色向右移動、畫面上的位置在中央右方的情況下
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# 畫面向右捲動
$game_map.scroll_right(@real_x - last_real_x)
end
# 角色向上移動、畫面上的位置在中央上方的情況下
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# 畫面向上捲動
$game_map.scroll_up(last_real_y - @real_y)
end
# 不在移動中的情況下
unless moving?
# 上次主角移動中的情況
if last_moving
# 與同位置的事件接觸就判斷為事件啟動
result = check_event_trigger_here([1,2])
# 沒有可以啟動的事件的情況下
if result == false
# 除錯模式為 ON 並且按下 CTRL 鍵的情況下除外
unless $DEBUG and Input.press?(Input::CTRL)
# 遇敵計算數值下降
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# 按下 C 鍵的情況下
if Input.trigger?(Input::C)
# 判斷為同位置以及正面的事件啟動
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
愚零鬥武多- 不正常人類研究中心自慰隊員
- 文章數 : 421
注冊日期 : 2008-04-06
這個論壇的權限:
您 無法 在這個版面回復文章
|
|