DerVVulfman
Sponsor
Skills that Consume Items
Ver 1.00a*
Original version found at http://members.jcom.home.ne.jp/cogwheel/
NOT by DerVVulfman
v 1.00a due to my correction for 'inconsumable' items.
Introduction
Originally posted in japanese, this is a translation of a script addition that allows you (the creator) to design spells that use (or consume) items as well as SP.
Features
Screenshots
None. Just looks like a regular Skill selection screen.
Demo
CLICK HERE (V 1.16)
Based on...
Real Time Active Battle (RTAB)
... and with these add-on modules...
Officially Created Add-Ons: (from the creator of RTAB)
Connected Attacking v 1.03
Cooperative Skills Ver 1.02
Remodeled Damage Display v 1.02a
Skill Casting Time Counter v 1.00
Skill Learning v 1.00
Un-Official Add-Ons:
Animated Battlers - Enhanced
BattleStatus Modification (RTAB Version) v 1.1
Cogwheel RTAB Config System by minto
KGC OverDrive v 1.1
Skill Requirements v 1.0 (works with RTAB!)
Stealing, Mugging, and Scanning (RTAB version)
Mimi's Battle Music (I wrote it :D )
Script
In truth, the name was... paraphrased from the original Japanese version. Syntax differences and so on. So, I went with the closest definition.
Instructions
Just copy/paste this code right under the HP/SP/EXP Gauge Script v1.00 (yep, I translated it) which is the last script in Minkoff's adaption of Cogwheel's RTAB system.
This system allows you to use skills that rely on consuming items. If for example, you use a skill that relies on potions and perfumes, the specified items (and quantities) are used and reduced in your inventory.
As this system allows certain skills to RELY on items, these skills will be disabled if you do not have enough of the required items it needs.
In the below example, we have it coded so in order to use the "Heal" skill,
you will need to use a single "Potion" and 2 "High Perfume" items.
But, in the next example, you'll see the code to use a "Fire" skill merely using
a single "Molotov Cocktail" item (no... it's NOT part of the default items in RMXP).
Compatibility
This script IS pretty basic and has been in use quite a while... and still works with the newest versions of RTAB... even v 1.14.
Credits and Thanks
Thanks to Cogwheel for making such a wonderful system, that has many adaptable features.
Author's Notes
I'm NOT the author. Oh, well...
Ver 1.00a*
Original version found at http://members.jcom.home.ne.jp/cogwheel/
NOT by DerVVulfman
v 1.00a due to my correction for 'inconsumable' items.
Introduction
Originally posted in japanese, this is a translation of a script addition that allows you (the creator) to design spells that use (or consume) items as well as SP.
Features
- Can specify 1 or more different items needed per spell
- Can set it so multple quantities (potion x6) needed
- Skills show as disabled if not enough items available for use
- FIXED: so items that are NOT consumable (talismans) not consumed
Screenshots
None. Just looks like a regular Skill selection screen.
Demo
CLICK HERE (V 1.16)
Based on...
Real Time Active Battle (RTAB)
... and with these add-on modules...
Officially Created Add-Ons: (from the creator of RTAB)
Connected Attacking v 1.03
Cooperative Skills Ver 1.02
Remodeled Damage Display v 1.02a
Skill Casting Time Counter v 1.00
Skill Learning v 1.00
Un-Official Add-Ons:
Animated Battlers - Enhanced
BattleStatus Modification (RTAB Version) v 1.1
Cogwheel RTAB Config System by minto
KGC OverDrive v 1.1
Skill Requirements v 1.0 (works with RTAB!)
Stealing, Mugging, and Scanning (RTAB version)
Mimi's Battle Music (I wrote it :D )
Script
In truth, the name was... paraphrased from the original Japanese version. Syntax differences and so on. So, I went with the closest definition.
Code:
# Skills That Consume Items Ver 1.00
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Setting of medium
#--------------------------------------------------------------------------
def medium(skill_id)
case $data_skills[skill_id].name
when "Heal"
return [["Potion"], ["High Perfume", 2]]
end
return false
end
#--------------------------------------------------------------------------
# * Get Item Name
#--------------------------------------------------------------------------
def item_name(name)
for item in $data_items
if item != nil and name == item.name
return item.id
end
end
end
#--------------------------------------------------------------------------
# * Determine if Skill can be Used
# skill_id : skill ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
items = medium(skill_id)
if items
for item in items
id = item_name(item[0])
if $game_party.item_number(id) < (item[1] == nil ? 1 : item[1])
return false
end
end
end
return super
end
end
#==============================================================================
# ** Scene_Battle (part 4)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Make Skill Action Results
#--------------------------------------------------------------------------
def make_skill_action_result(battler)
# Get skill
@skill = $data_skills[battler.current_action.skill_id]
# Verification whether or not it is cooperation skill
speller = synthe?(battler)
# If not a forcing action
unless battler.current_action.forcing
# When with SP and so on is cut off and it becomes not be able to use
if speller == nil
unless battler.skill_can_use?(@skill.id)
# Shift to step 6
battler.phase = 6
return
end
end
end
# SP consumption
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
# Refreshing the status window
status_refresh(spell)
end
else
battler.sp -= @skill.sp_cost
# Refreshing the status window
status_refresh(battler)
end
# Setting animation ID
battler.anime1 = @skill.animation1_id
battler.anime2 = @skill.animation2_id
# Setting common event ID
battler.event = @skill.common_event_id
# Setting the object side battler
set_target_battlers(@skill.scope, battler)
# Applying the effect of skill
for target in battler.target
if speller != nil
damage = 0
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
damage += target.damage[spell]
elsif effective == true
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 damage != 0
target.damage[battler] = damage
elsif effective = true
target.damage[battler] = effect
end
target.state_p[battler] = state_p
target.state_m[battler] = state_m
else
target.skill_effect(battler, @skill)
end
end
# If item(s) are used
if battler.is_a?(Game_Actor)
items = battler.medium(@skill.id)
if items
for item in items
id = battler.item_name(item[0])
num = item[1] == nil ? 1 : item[1]
# Check if consumable
if $data_items[id].consumable
$game_party.gain_item(id, -num)
end
end
end
end
end
end
#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase target window
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @target_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @target_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @target_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# If item(s) are used
if @actor.is_a?(Game_Actor)
items = @actor.medium(@skill.id)
if items
for item in items
id = @actor.item_name(item[0])
num = item[1] == nil ? 1 : item[1]
# Check if consumable
if $data_items[id].consumable
$game_party.gain_item(id, -num)
end
end
end
end
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
Code:
# スã‚ル使用時媒体消費 Ver 1.00
# é…布元・サãƒãƒ¼ãƒˆURL
# http://members.jcom.home.ne.jp/cogwheel/
#==============================================================================
# â– Game_Actor
#------------------------------------------------------------------------------
#  アクターを扱ã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚ã“ã®ã‚¯ãƒ©ã‚¹ã¯ Game_Actors クラス ($game_actors)
# ã®å†…部ã§ä½¿ç”¨ã•れã€Game_Party クラス ($game_party) ã‹ã‚‰ã‚‚å‚ç…§ã•れã¾ã™ã€‚
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ◠媒体ã®è¨å®š
#--------------------------------------------------------------------------
def medium(skill_id)
case $data_skills[skill_id].name
when "ヒール"
return [["ãƒãƒ¼ã‚·ãƒ§ãƒ³"], ["ãƒã‚¤ãƒãƒ¼ã‚·ãƒ§ãƒ³", 2]]
end
return false
end
#--------------------------------------------------------------------------
# ◠アイテムåã‹ã‚‰ã‚¢ã‚¤ãƒ†ãƒ IDã¸ã®å¤‰æ›
#--------------------------------------------------------------------------
def item_name(name)
for item in $data_items
if item != nil and name == item.name
return item.id
end
end
end
#--------------------------------------------------------------------------
# ◠スã‚ルã®ä½¿ç”¨å¯èƒ½åˆ¤å®š
# skill_id : スã‚ル ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
items = medium(skill_id)
if items
for item in items
id = item_name(item[0])
if $game_party.item_number(id) < (item[1] == nil ? 1 : item[1])
return false
end
end
end
return super
end
end
#==============================================================================
# ■Scene_Battle (分割定義 4)
#------------------------------------------------------------------------------
#  ãƒãƒˆãƒ«ç”»é¢ã®å‡¦ç†ã‚’行ã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ◠スã‚ルアクション çµæžœä½œæˆ
#--------------------------------------------------------------------------
def make_skill_action_result(battler)
# スã‚ルをå–å¾—
@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
# 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
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
damage += target.damage[spell]
elsif effective == true
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 damage != 0
target.damage[battler] = damage
elsif effective = true
target.damage[battler] = effect
end
target.state_p[battler] = state_p
target.state_m[battler] = state_m
else
target.skill_effect(battler, @skill)
end
end
# 媒体使用
if battler.is_a?(Game_Actor)
items = battler.medium(@skill.id)
if items
for item in items
id = battler.item_name(item[0])
num = item[1] == nil ? 1 : item[1]
$game_party.gain_item(id, -num)
end
end
end
end
end
#==============================================================================
# â– Scene_Skill
#------------------------------------------------------------------------------
#  スã‚ル画é¢ã®å‡¦ç†ã‚’行ã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ◠フレーム更新 (ターゲットウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_target
# B ãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
# ターゲットウィンドウを消去
@skill_window.active = true
$scene.status_window.index = @actor.index
$scene.status_window.z = 6100
$scene.status_window.out_window.z = 6100
$scene.status_window.active = false
return
end
# C ãƒœã‚¿ãƒ³ãŒæŠ¼ã•れãŸå ´åˆ
if Input.trigger?(Input::C)
# SP 切れãªã©ã§ä½¿ç”¨ã§ããªããªã£ãŸå ´åˆ
unless @actor.skill_can_use?(@skill.id)
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# ターゲットãŒå…¨ä½“ã®å ´åˆ
if $scene.status_window.index == -2
# パーティ全体ã«ã‚¹ã‚ルã®ä½¿ç”¨åŠ¹æžœã‚’é©ç”¨
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# ターゲットãŒä½¿ç”¨è€…ã®å ´åˆ
if $scene.status_window.index < -2
# ターゲットã®ã‚¢ã‚¯ã‚¿ãƒ¼ã«ã‚¹ã‚ルã®ä½¿ç”¨åŠ¹æžœã‚’é©ç”¨
target = $game_party.actors[$scene.status_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# ターゲットãŒå˜ä½“ã®å ´åˆ
if $scene.status_window.index >= 0
# ターゲットã®ã‚¢ã‚¯ã‚¿ãƒ¼ã«ã‚¹ã‚ルã®ä½¿ç”¨åŠ¹æžœã‚’é©ç”¨
target = $game_party.actors[$scene.status_window.index]
used = target.skill_effect(@actor, @skill)
end
# スã‚ルを使ã£ãŸå ´åˆ
if used
# 媒体使用
if @actor.is_a?(Game_Actor)
items = @actor.medium(@skill.id)
if items
for item in items
id = @actor.item_name(item[0])
num = item[1] == nil ? 1 : item[1]
$game_party.gain_item(id, -num)
end
end
end
# スã‚ルã®ä½¿ç”¨æ™‚ SE ã‚’æ¼”å¥
$game_system.se_play(@skill.menu_se)
# SP 消費
@actor.sp -= @skill.sp_cost
# å„ウィンドウã®å†…容をå†ä½œæˆ
@status_window.refresh
@skill_window.refresh
$scene.status_window.refresh
# 全滅ã®å ´åˆ
if $game_party.all_dead?
# ゲームオーãƒãƒ¼ç”»é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Gameover.new
return
end
# コモンイベント ID ãŒæœ‰åйã®å ´åˆ
if @skill.common_event_id > 0
# コモンイベント呼ã³å‡ºã—予約
$game_temp.common_event_id = @skill.common_event_id
# マップ画é¢ã«åˆ‡ã‚Šæ›¿ãˆ
dispose
$scene = Scene_Map.new
return
end
end
# スã‚ルを使ã‚ãªã‹ã£ãŸå ´åˆ
unless used
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
Just copy/paste this code right under the HP/SP/EXP Gauge Script v1.00 (yep, I translated it) which is the last script in Minkoff's adaption of Cogwheel's RTAB system.
This system allows you to use skills that rely on consuming items. If for example, you use a skill that relies on potions and perfumes, the specified items (and quantities) are used and reduced in your inventory.
As this system allows certain skills to RELY on items, these skills will be disabled if you do not have enough of the required items it needs.
In the below example, we have it coded so in order to use the "Heal" skill,
you will need to use a single "Potion" and 2 "High Perfume" items.
Code:
when "Heal"
return [["Potion"], ["High Perfume", 2]]
a single "Molotov Cocktail" item (no... it's NOT part of the default items in RMXP).
Code:
when "Fire"
return [["Molotov cocktail"]]
Compatibility
This script IS pretty basic and has been in use quite a while... and still works with the newest versions of RTAB... even v 1.14.
Credits and Thanks
Thanks to Cogwheel for making such a wonderful system, that has many adaptable features.
Author's Notes
I'm NOT the author. Oh, well...