Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Xelias

1
RMXP Script Database / [XP] Passive Augments
December 06, 2009, 09:47:49 am
Passive Augments
Authors: Xelias
Version: 1.01
Type: Skill Enhancement
Key Term: Custom Skill System



Introduction

This script allows to make passive abilities. These abilities are made from skills. They affect attacks, skills, and equipment. More information in the script.


Features


  • Allows multiple special effects, such as Demi MP, Brawler, Once more... And many others.
  • Need special passive abilities to cast magic.
  • Need special passive abilities to equip weapons and armors.
  • Allows attacking without weapons.



Screenshots

Spoiler: ShowHide



Demo

Not really.


Script

Spoiler: ShowHide

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Passive Augments by Xelias
# Version: 1.01
# Type: Skill Enhacement
# Date v1.01:   18.12.2009
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# #  
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #  
# #  You are free:
# #  
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# #  
# #  Under the following conditions:
# #  
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# #  
# #  Noncommercial. You may not use this work for commercial purposes.
# #  
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# #  
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# #  
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# #  
# #  - Nothing in this license impairs or restricts the author's moral rights.
# #  
# #----------------------------------------------------------------------------
##
##  Version history
##
## 1.01
##
##  *Added new Passive Skills (From RESIST_STATES to GEOMANCY)
##  *Fixed a bug
##
# #----------------------------------------------------------------------------
#  This script creates "Passive Skills". The "Passive Skills" you list in
#  PASSIVE_SKILLS_IDS = [] are displayed in a separate menu.
#  They are simple skills you can give an Icon, a name, a description...
#  You can change the menu's name in PASSIVE_WORD = "Augments"
#  Replace "Augments" by whatever name you want.
#
#  Passive Skills only work on actors !
#
#  Passive skills effects are listed here :
#
#  GUARD_PLUS will decrease even more the damage taken while defending.
#  MP_SHIELD will allow damage to be inflicted on SP instead of HP until you run out of SP.
#  MARTYR allows the character to gain SP when taking damage
#  INQUISITOR allows the character to gain SP when dealing physical damage.
#  WARMAGE allows the character to gain SP when dealing damage with spells.
#  BLOOD_PRICE allows the character to pay HP instead of SP. HP cost is SP cost*5
#  DEMI_MP allows the character to cast spells for half the SP cost
#  TURBO_MP doubles the SP cost as well as the power of the skills.
#  SPELLBREAKER increases the damage dealt by spells when you have low HP
#  ADRENALINE increases the damage dealt by attacks when you have low HP
#  LAST_STAND decreases the damage taken when you have low HP
#  CHARGED_ATTACKS increases the power of physical attacks for 6 SP a hit until you run out of SP.
#  BRAWLER allows you to inflict more damage when no weapons are equipped. Note that
#  thanks to this script, bare-handed attacks are available. Just modify the BARE_ANIMATION_SELF_ID
#  and BARE_ANIMATION_ID to modify the animations that play on the attacker and on the enemy
#  while attacking without weapons, respectively.
#  CRITICAL_BOOST increases the critical hit ratio
#  FOCUS slightly increases the damage dealt by attacks when at full HP
#  SERENITY slightly increases the damage dealt by spells when at full HP
#  ONCE_MORE allows the actor to survive all hits when his HP are higher than 1 : then his
#  HP will become 1, and next strike will be deadly. Think about Kingdom Hearts for this one.
#  LEARNING allows the actor to learn blue magic. This blue magic is set in BLUE_SKILLS_IDS = []
#  HEALER increases the potency of healing spells and objects on the actor.
#  STATE_RESIST halves the chances the actor will be affected by a status effect
#  BLOOD_SWORD absorbs  1/4 of damage done by physical attacks as HP for the actor.
#  ELEMENTALISM reduces an enemy's resistance to elemental spells
#  GEOMANCY increases the user's resistance to elemental spells.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

PASSIVE_SKILLS_IDS = [81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101]

PASSIVE_WORD = "Augments"

GUARD_PLUS_ID = 81
MP_SHIELD_ID = 82
MARTYR_ID = 83
INQUISITOR_ID = 84
WARMAGE_ID = 85
BLOOD_PRICE_ID = 86
DEMI_MP_ID = 87
TURBO_MP_ID = 88
SPELLBREAKER_ID = 89
ADRENALINE_ID = 90
LAST_STAND_ID = 91
CHARGED_ATTACKS_ID =  92
BRAWLER_ID = 93
CRITICAL_BOOST_ID = 94
FOCUS_ID = 95
SERENITY_ID = 96
ONCE_MORE_ID = 97
LEARNING_ID = 98
HEALER_ID = 99
STATE_RESIST_ID = 100
BLOOD_SWORD_ID = 101
ELEMENTALISM_ID = 102
GEOMANCY_ID = 103

BLUE_SKILLS_IDS = [61,62]

BARE_ANIMATION_SELF_ID = 0
BARE_ANIMATION_ID = 4


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
#  Passive skills can also be used to equip weapons and armors, and to be able to use skills.
#  Configure it like that :
#
#  When [weapon/armor id] then return [passive skill id]
#  When [skill id] then return [passive skill id]
#
#  Note that passive skills overwrite class restrictions : if a warrior gets a "Equip Staffs"
#  passive ability, he will be able to equip staffs.
#
#  On a sad note, all weapons/armors need to be set to a skill in order to be equipped.
#  If you put "nil"  or "0", the game will crash.
#  So set a skill for each different weapon or armor. Default is 100
#  The same applies for skills. Skills won't crash, but won't be able to be used. Which is bad.
#  However if you put "when skill X then return skill X", the skill will be usable if you have it, which
#  means you won't have to learn another passive skill.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

module Xelias

  def self.ers_config(item)
   # weapon configuration
   if item.is_a?(RPG::Weapon)
     case item.id
     # START Weapon Configuration
     when 2 then return [100]
     # END Weapon Configuration
     end
   elsif item.is_a?(RPG::Armor)
     case item.id
     # START Armor Configuration
     when 2 then return [100]
     # END Armor Configuration
     end
   end
   return [100]
 end

 def self.req_skill(id)
   case id
     # START Skill Configuration
     when 8 then return 101
   end
   return
 end
 
end


class Game_Battler

def states_plus(plus_state_set)
   # 有効フラグをクリア
   effective = false
   # ループ (付加するステート)
   for i in plus_state_set
     # このステートが防御されていない場合
     unless self.state_guard?(i)
       # このステートがフルでなければ有効フラグをセット
       effective |= self.state_full?(i) == false
       # ステートが [抵抗しない] の場合
       if $data_states[i].nonresistance
         # ステート変化フラグをセット
         @state_changed = true
         # ステートを付加
         add_state(i)
       # このステートがフルではない場合
       elsif self.state_full?(i) == false
         # ステート有効度を確率に変換し、乱数と比
 if self.is_a?(Game_Actor) && self.skill_learn?(STATE_RESIST_ID)
   if rand(100) < [0,50,40,30,20,10,0][self.state_ranks[i]]
           # ステート変化フラグをセット
           @state_changed = true
           # ステートを付加
           add_state(i)
         end
         end
       unless self.is_a?(Game_Actor) && self.skill_learn?(STATE_RESIST_ID)
         if rand(100) < [0,100,80,60,40,20,0][self.state_ranks[i]]
         @state_changed = true
           # ステートを付加
           add_state(i)
         end
         end
       end
     end
   end
   # メソッド終了
   return effective
 end

#==============================================================================
# ■ Game_Battler (分割定義 3)
#------------------------------------------------------------------------------
#  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
# スのスーパークラスとして使用されます。
#==============================================================================

def attack_effect(attacker)
   # クリティカルフラグをクリア
   self.critical = false
   # 第一命中判定
   hit_result = (rand(100) < attacker.hit)
   # 命中の場合
   if hit_result == true
     # 基本ダメージを計算
           atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
   if attacker.is_a?(Game_Actor) && attacker.atk == 0
       atk = [100 + attacker.str/8 - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
     if attacker.skill_learn?(BRAWLER_ID)
         atk = [100 + attacker.str/3 - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
     end
     # 属性修正
     self.damage *= elements_correct(attacker.element_set)
     self.damage /= 100
     # ダメージの符号が正の場合
     if self.damage > 0
       # クリティカル修正
     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(CRITICAL_BOOST_ID)
       if rand(100) < 6 * attacker.dex / self.agi
         self.damage *= 2
         self.critical = true
       end
       else
             if rand(100) < 4 * attacker.dex / self.agi
         self.damage *= 2
         self.critical = true
       end
     end
     end
       # 防御修正
       if self.guarding?
         self.damage /= 2
       end
       if self.is_a?(Game_Actor) && self.guarding? && self.skill_learn?(GUARD_PLUS_ID)
         self.damage /= 2
         end
     end
     # 分散
     if self.damage.abs > 0
       amp = [self.damage.abs * 15 / 100, 1].max
       self.damage += rand(amp+1) + rand(amp+1) - amp
     end
     # 第二命中判定
     eva = 8 * self.agi / attacker.dex + self.eva
     hit = self.damage < 0 ? 100 : 100 - eva
     hit = self.cant_evade? ? 100 : hit
     hit_result = (rand(100) < hit)
   end
   # 命中の場合
   if hit_result == true
     # ステート衝撃解除
     remove_states_shock
     # HP からダメージを減算        
     if self.is_a?(Game_Actor) && self.skill_learn?(MARTYR_ID)
     sp_recovery = self.damage/10
     self.sp += sp_recovery
   end
     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(INQUISITOR_ID)
     sp_recovery = self.damage/10
     attacker.sp += sp_recovery
   end
   if attacker.is_a?(Game_Actor) && attacker.skill_learn?(BLOOD_SWORD_ID)
     hp_recovery = self.damage/4
     attacker.hp += hp_recovery
   end
     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(ADRENALINE_ID) && ((attacker.hp*100)/attacker.maxhp) < 30
     self.damage*= 2
   end
     if attacker.is_a?(Game_Actor) && attacker.skill_learn?(FOCUS_ID) && attacker.hp = attacker.maxhp
     self.damage*= 2
   end
   if self.is_a?(Game_Actor) && self.skill_learn?(LAST_STAND_ID) && ((self.hp*100)/self.maxhp) < 30
     self.damage/= 2
   end
   if attacker.is_a?(Game_Actor) && attacker.skill_learn?(CHARGED_ATTACKS_ID) && attacker.sp > 0
     attacker.sp -= 6
     self.damage += self.damage/3
   end
   if self.is_a?(Game_Actor) && self.skill_learn?(ONCE_MORE_ID) && self.hp > 1 && self.damage > self.hp
   self.damage = self.hp - 1  
   end
    if self.is_a?(Game_Actor) && self.skill_learn?(MP_SHIELD_ID) && self.sp > 0
     self.sp -= self.damage
 else
      self.hp -= self.damage
      end
     # ステート変化
     @state_changed = false
     states_plus(attacker.plus_state_set)
     states_minus(attacker.minus_state_set)
   # ミスの場合
   else
     # ダメージに "Miss" を設定
     self.damage = "Manqué!"
     # クリティカルフラグをクリア
     self.critical = false
   end
   # メソッド終了
   return true
 end
 #--------------------------------------------------------------------------
 # ● スキルの効果適用
 #     user  : スキルの使用者 (バトラー)
 #     skill : スキル
 #--------------------------------------------------------------------------
 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 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
     # 属性修正
     elements = (elements_correct(skill.element_set))
     if user.is_a?(Game_Actor) && user.skill_learn?(ELEMENTALISM_ID) && skill.mdef_f > 0
     elements += 100
     end
     if self.is_a?(Game_Actor) && self.skill_learn?(GEOMANCY_ID) && skill.mdef_f > 0
       elements -= 50
       end
       self.damage *= elements
     self.damage /= 100
     # ダメージの符号が正の場合
     if self.damage > 0
       # 防御修正
       if self.guarding?
         self.damage /= 2
       end
       if self.is_a?(Game_Actor) && self.guarding? && self.skill_learn?(GUARD_PLUS_ID)
         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
       if self.is_a?(Game_Actor) && self.skill_learn?(MARTYR_ID)
     sp_recovery = self.damage/10
     self.sp += sp_recovery
   end
       if user.is_a?(Game_Actor) && user.skill_learn?(WARMAGE_ID)  && self.damage > 0 && skill.mdef_f > 0
     sp_recovery = self.damage/10
     user.sp += sp_recovery
   end
     if user.is_a?(Game_Actor) && user.skill_learn?(BLOOD_SWORD_ID)  && skill.pdef_f > 0
     hp_recovery = self.damage/4
     user.hp += hp_recovery
   end
     if user.is_a?(Game_Actor) && user.skill_learn?(TURBO_MP_ID) && skill.mdef_f > 0
     self.damage*=2
   end
     if user.is_a?(Game_Actor) && user.skill_learn?(SPELLBREAKER_ID) && skill.mdef_f > 0 && ((user.hp*100)/ user.maxhp) < 30
     self.damage*=2
   end
     if user.is_a?(Game_Actor) && user.skill_learn?(ADRENALINE_ID) && skill.pdef_f > 0 && ((user.hp*100)/ user.maxhp) < 30
     self.damage*=2
   end
     if user.is_a?(Game_Actor) && user.skill_learn?(SERENITY_ID) && skill.mdef_f > 0 && user.hp = user.maxhp
     self.damage += self.damage/3
   end
     if user.is_a?(Game_Actor) && user.skill_learn?(FOCUS_ID) && skill.pdef_f > 0 && user.hp = user.maxhp
     self.damage += self.damage/3
   end
     if self.is_a?(Game_Actor) && self.skill_learn?(LAST_STAND_ID) && ((self.hp*100)/self.maxhp) < 30
     self.damage/= 2
   end
     if self.is_a?(Game_Actor) && self.skill_learn?(ONCE_MORE_ID) && self.hp > 1 && self.damage > self.hp
   self.damage = self.hp - 1  
 end
     if self.is_a?(Game_Actor) && self.skill_learn?(HEALER_ID) && self.damage < 0
       self.damage *= 2
     end
   if self.is_a?(Game_Actor) && self.skill_learn?(LEARNING_ID) && BLUE_SKILLS_IDS.include?(skill.id)
   learn_skill(skill.id)
   end
     if self.is_a?(Game_Actor) && self.skill_learn?(MP_SHIELD_ID) && self.sp > 0
     self.sp -= self.damage
 else
      self.hp -= self.damage
    end
     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 = "Manqué!"
       end
     end
   # ミスの場合
   else
     # ダメージに "Miss" を設定
     self.damage = "Manqué!"
   end
   # 戦闘中でない場合
   unless $game_temp.in_battle
     # ダメージに nil を設定
     self.damage = nil
   end
   # メソッド終了
   return effective
 end
 #--------------------------------------------------------------------------
 # ● アイテムの効果適用
 #     item : アイテム
 #--------------------------------------------------------------------------
 def item_effect(item)
   # クリティカルフラグをクリア
   self.critical = false
   # アイテムの効果範囲が HP 1 以上の味方で、自分の HP が 0、
   # またはアイテムの効果範囲が HP 0 の味方で、自分の HP が 1 以上の場合
   if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
      ((item.scope == 5 or item.scope == 6) and self.hp >= 1)
     # メソッド終了
     return false
   end
   # 有効フラグをクリア
   effective = false
   # コモンイベント ID が有効の場合は有効フラグをセット
   effective |= item.common_event_id > 0
   # 命中判定
   hit_result = (rand(100) < item.hit)
   # 不確実なスキルの場合は有効フラグをセット
   effective |= item.hit < 100
   # 命中の場合
   if hit_result == true
     # 回復量を計算
     recover_hp = maxhp * item.recover_hp_rate / 100 + item.recover_hp
     recover_sp = maxsp * item.recover_sp_rate / 100 + item.recover_sp
     if recover_hp < 0
       recover_hp += self.pdef * item.pdef_f / 20
       recover_hp += self.mdef * item.mdef_f / 20
       recover_hp = [recover_hp, 0].min
     end
     # 属性修正
     recover_hp *= elements_correct(item.element_set)
     recover_hp /= 100
     recover_sp *= elements_correct(item.element_set)
     recover_sp /= 100
     # 分散
     if item.variance > 0 and recover_hp.abs > 0
       amp = [recover_hp.abs * item.variance / 100, 1].max
       recover_hp += rand(amp+1) + rand(amp+1) - amp
     end
     if item.variance > 0 and recover_sp.abs > 0
       amp = [recover_sp.abs * item.variance / 100, 1].max
       recover_sp += rand(amp+1) + rand(amp+1) - amp
     end
     # 回復量の符号が負の場合
     if recover_hp < 0
       # 防御修正
       if self.guarding?
         recover_hp /= 2
       end
     end
     # HP 回復量の符号を反転し、ダメージの値に設定
     if self.is_a?(Game_Actor) && self.skill_learn?(HEALER_ID) && recover.hp > 0
       recover_hp *= 2
       end
     self.damage = -recover_hp
     # HP および SP を回復
     last_hp = self.hp
     last_sp = self.sp
     self.hp += recover_hp
     self.sp += recover_sp
     effective |= self.hp != last_hp
     effective |= self.sp != last_sp
     # ステート変化
     @state_changed = false
     effective |= states_plus(item.plus_state_set)
     effective |= states_minus(item.minus_state_set)
     # パラメータ上昇値が有効の場合
     if item.parameter_type > 0 and item.parameter_points != 0
       # パラメータで分岐
       case item.parameter_type
       when 1  # MaxHP
         @maxhp_plus += item.parameter_points
       when 2  # MaxSP
         @maxsp_plus += item.parameter_points
       when 3  # 腕力
         @str_plus += item.parameter_points
       when 4  # 器用さ
         @dex_plus += item.parameter_points
       when 5  # 素早さ
         @agi_plus += item.parameter_points
       when 6  # 魔力
         @int_plus += item.parameter_points
       end
       # 有効フラグをセット
       effective = true
     end
     # HP 回復率と回復量が 0 の場合
     if item.recover_hp_rate == 0 and item.recover_hp == 0
       # ダメージに空文字列を設定
       self.damage = ""
       # SP 回復率と回復量が 0、パラメータ上昇値が無効の場合
       if item.recover_sp_rate == 0 and item.recover_sp == 0 and
          (item.parameter_type == 0 or item.parameter_points == 0)
         # ステートに変化がない場合
         unless @state_changed
           # ダメージに "Miss" を設定
           self.damage = "Manqué!"
         end
       end
     end
   # ミスの場合
   else
     # ダメージに "Miss" を設定
     self.damage = "Manqué!"
   end
   # 戦闘中でない場合
   unless $game_temp.in_battle
     # ダメージに nil を設定
     self.damage = nil
   end
   # メソッド終了
   return effective
 end
 #--------------------------------------------------------------------------
 # ● スリップダメージの効果適用
 #--------------------------------------------------------------------------
 def slip_damage_effect
   # ダメージを設定
   self.damage = self.maxhp / 10
   # 分散
   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

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
     if @active_battler.is_a?(Game_Actor) && @active_battler.skill_learn?(DEMI_MP_ID)
       @skill.sp_cost/=2
     end    
           if @active_battler.is_a?(Game_Actor) && @active_battler.skill_learn?(TURBO_MP_ID)
       @skill.sp_cost*=2
       end    
   # SP 消費
   if @active_battler.is_a?(Game_Actor) && @active_battler.skill_learn?(BLOOD_PRICE_ID)
   @active_battler.hp -= (@skill.sp_cost *5 )
 else
   @active_battler.sp -= @skill.sp_cost
   end
   # ステータスウィンドウをリフレッシュ
   @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
     target.skill_effect(@active_battler, @skill)
   end
 end
 end

#==============================================================================
# ■ Window_Passive
#------------------------------------------------------------------------------
#  スキル画面、バトル画面で、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================

class Window_Passive < Window_Selectable
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #     actor : アクター
 #--------------------------------------------------------------------------
 def initialize(actor)
   super(0, 128, 640, 352)
   @actor = actor
   @column_max = 2
   refresh
   self.index = 0
   # 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
   if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
 end
 #--------------------------------------------------------------------------
 # ● スキルの取得
 #--------------------------------------------------------------------------
 def skill
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # ● リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   for i in 0...@actor.skills.size
     skill = $data_skills[@actor.skills[i]]
     if skill != nil && PASSIVE_SKILLS_IDS.include?(skill.id)
       @data.push(skill)
     end
   end
   # 項目数が 0 でなければビットマップを作成し、全項目を描画
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     self.contents.font.name = $fontface
     self.contents.font.size = $fontsize
     for i in 0...@item_max
       draw_item(i)
     end
   end
 end
 #--------------------------------------------------------------------------
 # ● 項目の描画
 #     index : 項目番号
 #--------------------------------------------------------------------------
 def draw_item(index)
   skill = @data[index]
     self.contents.font.color = normal_color
   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, 0)
     end
 #--------------------------------------------------------------------------
 # ● ヘルプテキスト更新
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.skill == nil ? "" : self.skill.description)
 end
end

#==============================================================================
# ■ Scene_Skill
#------------------------------------------------------------------------------
#  スキル画面の処理を行うクラスです。
#==============================================================================

class Scene_Passive
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #     actor_index : アクターインデックス
 #--------------------------------------------------------------------------
 def initialize(actor_index = 0, equip_index = 0)
   @actor_index = actor_index
 end
 #--------------------------------------------------------------------------
 # ● メイン処理
 #--------------------------------------------------------------------------
 def main
   # アクターを取得
   @actor = $game_party.actors[@actor_index]
   # ヘルプウィンドウ、ステータスウィンドウ、スキルウィンドウを作成
   @help_window = Window_Help.new
   @status_window = Window_SkillStatus.new(@actor)
   @skill_window = Window_Passive.new(@actor)
   # ヘルプウィンドウを関連付け
   @skill_window.help_window = @help_window
   # ターゲットウィンドウを作成 (不可視・非アクティブに設定)
   @target_window = Window_Target.new
   @target_window.visible = false
   @target_window.active = false
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーム画面を更新
     Graphics.update
     # 入力情報を更新
     Input.update
     # フレーム更新
     update
     # 画面が切り替わったらループを中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # ウィンドウを解放
   @help_window.dispose
   @status_window.dispose
   @skill_window.dispose
   @target_window.dispose
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 def update
   # ウィンドウを更新
   @help_window.update
   @status_window.update
   @skill_window.update
   @target_window.update
   # スキルウィンドウがアクティブの場合: update_skill を呼ぶ
   if @skill_window.active
     update_skill
     return
   end
   # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
   if @target_window.active
     update_target
     return
   end
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (スキルウィンドウがアクティブの場合)
 #--------------------------------------------------------------------------
 def update_skill
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     # メニュー画面に切り替え
     $scene = Scene_Menu.new(2)
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     # スキルウィンドウで現在選択されているデータを取得
     @skill = @skill_window.skill
     # 使用できない場合
     if @skill == nil or not @actor.skill_can_use?(@skill.id)
       # ブザー SE を演奏
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     # 効果範囲が味方の場合
     if @skill.scope >= 3
       # ターゲットウィンドウをアクティブ化
       @skill_window.active = false
       @target_window.x = (@skill_window.index + 1) % 2 * 304
       @target_window.visible = true
       @target_window.active = true
       # 効果範囲 (単体/全体) に応じてカーソル位置を設定
       if @skill.scope == 4 || @skill.scope == 6
         @target_window.index = -1
       elsif @skill.scope == 7
         @target_window.index = @actor_index - 10
       else
         @target_window.index = 0
       end
     # 効果範囲が味方以外の場合
     else
       # コモンイベント ID が有効の場合
       if @skill.common_event_id > 0
         # コモンイベント呼び出し予約
         $game_temp.common_event_id = @skill.common_event_id
         # スキルの使用時 SE を演奏
         $game_system.se_play(@skill.menu_se)
         # SP 消費
         @actor.sp -= @skill.sp_cost
         # 各ウィンドウの内容を再作成
         @status_window.refresh
         @skill_window.refresh
         @target_window.refresh
         # マップ画面に切り替え
         $scene = Scene_Map.new
         return
       end
     end
     return
   end
   # R ボタンが押された場合
   if Input.trigger?(Input::R)
     # カーソル SE を演奏
     $game_system.se_play($data_system.cursor_se)
     # 次のアクターへ
     @actor_index += 1
     @actor_index %= $game_party.actors.size
     # 別のスキル画面に切り替え
     $scene = Scene_Skill.new(@actor_index)
     return
   end
   # L ボタンが押された場合
   if Input.trigger?(Input::L)
     # カーソル SE を演奏
     $game_system.se_play($data_system.cursor_se)
     # 前のアクターへ
     @actor_index += $game_party.actors.size - 1
     @actor_index %= $game_party.actors.size
     # 別のスキル画面に切り替え
     $scene = Scene_Skill.new(@actor_index)
     return
   end
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
 #--------------------------------------------------------------------------
 def update_target
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     # ターゲットウィンドウを消去
     @skill_window.active = true
     @target_window.visible = false
     @target_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 @target_window.index == -1
       # パーティ全体にスキルの使用効果を適用
       used = false
       for i in $game_party.actors
         used |= i.skill_effect(@actor, @skill)
       end
     end
     # ターゲットが使用者の場合
     if @target_window.index <= -2
       # ターゲットのアクターにスキルの使用効果を適用
       target = $game_party.actors[@target_window.index + 10]
       used = target.skill_effect(@actor, @skill)
     end
     # ターゲットが単体の場合
     if @target_window.index >= 0
       # ターゲットのアクターにスキルの使用効果を適用
       target = $game_party.actors[@target_window.index]
       used = target.skill_effect(@actor, @skill)
     end
     # スキルを使った場合
     if used
       # スキルの使用時 SE を演奏
       $game_system.se_play(@skill.menu_se)
       # SP 消費
       @actor.sp -= @skill.sp_cost
       # 各ウィンドウの内容を再作成
       @status_window.refresh
       @skill_window.refresh
       @target_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
         # マップ画面に切り替え
         $scene = Scene_Map.new
         return
       end
     end
     # スキルを使わなかった場合
     unless used
       # ブザー SE を演奏
       $game_system.se_play($data_system.buzzer_se)
     end
     return
   end
 end
end

 


#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  メニュー画面の処理を行うクラスです。
#==============================================================================

class Scene_Menu
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #     menu_index : コマンドのカーソル初期位置
 #--------------------------------------------------------------------------
 def initialize(menu_index = 0)
   @menu_index = menu_index
 end
 #--------------------------------------------------------------------------
 # ● メイン処理
 #--------------------------------------------------------------------------
 def main
   # コマンドウィンドウを作成
   s1 = $data_system.words.item
   s2 = $data_system.words.skill
   s3 = PASSIVE_WORD
   s4 = $data_system.words.equip
   s5 = "État"
   s6 = "Sauvegarder"
   s7 = "Quitter"
   @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
   @command_window.index = @menu_index
   # パーティ人数が 0 人の場合
   if $game_party.actors.size == 0
     # アイテム、スキル、装備、ステータスを無効化
     @command_window.disable_item(0)
     @command_window.disable_item(1)
     @command_window.disable_item(2)
     @command_window.disable_item(3)
   end
   # セーブ禁止の場合
   if $game_system.save_disabled
     # セーブを無効にする
     @command_window.disable_item(4)
   end
   # プレイ時間ウィンドウを作成
   @playtime_window = Window_PlayTime.new
   @playtime_window.x = 0
   @playtime_window.y = 224
   # 歩数ウィンドウを作成
   @steps_window = Window_Steps.new
   @steps_window.x = 0
   @steps_window.y = 320
   # ゴールドウィンドウを作成
   @gold_window = Window_Gold.new
   @gold_window.x = 0
   @gold_window.y = 416
   # ステータスウィンドウを作成
   @status_window = Window_MenuStatus.new
   @status_window.x = 160
   @status_window.y = 0
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーム画面を更新
     Graphics.update
     # 入力情報を更新
     Input.update
     # フレーム更新
     update
     # 画面が切り替わったらループを中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # ウィンドウを解放
   @command_window.dispose
   @playtime_window.dispose
   @steps_window.dispose
   @gold_window.dispose
   @status_window.dispose
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 def update
   # ウィンドウを更新
   @command_window.update
   @playtime_window.update
   @steps_window.update
   @gold_window.update
   @status_window.update
   # コマンドウィンドウがアクティブの場合: update_command を呼ぶ
   if @command_window.active
     update_command
     return
   end
   # ステータスウィンドウがアクティブの場合: update_status を呼ぶ
   if @status_window.active
     update_status
     return
   end
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (コマンドウィンドウがアクティブの場合)
 #--------------------------------------------------------------------------
 def update_command
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     # マップ画面に切り替え
     $scene = Scene_Map.new
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     # パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
     if $game_party.actors.size == 0 and @command_window.index < 4
       # ブザー SE を演奏
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # コマンドウィンドウのカーソル位置で分岐
     case @command_window.index
     when 0  # アイテム
       # 決定  SE を演奏
       $game_system.se_play($data_system.decision_se)
       # アイテム画面に切り替え
       $scene = Scene_Item.new
     when 1  # スキル
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # ステータスウィンドウをアクティブにする
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 2  # スキル
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # ステータスウィンドウをアクティブにする
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 3  # 装備
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # ステータスウィンドウをアクティブにする
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 4  # ステータス
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # ステータスウィンドウをアクティブにする
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 5  # セーブ
       # セーブ禁止の場合
       if $game_system.save_disabled
         # ブザー SE を演奏
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # セーブ画面に切り替え
       $scene = Scene_Save.new
     when 6  # ゲーム終了
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # ゲーム終了画面に切り替え
       $scene = Scene_End.new
     end
     return
   end
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (ステータスウィンドウがアクティブの場合)
 #--------------------------------------------------------------------------
 def update_status
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     # コマンドウィンドウをアクティブにする
     @command_window.active = true
     @status_window.active = false
     @status_window.index = -1
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     # コマンドウィンドウのカーソル位置で分岐
     case @command_window.index
     when 1  # スキル
       # このアクターの行動制限が 2 以上の場合
       if $game_party.actors[@status_window.index].restriction >= 2
         # ブザー SE を演奏
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # スキル画面に切り替え
       $scene = Scene_Skill.new(@status_window.index)
             when 2  # スキル
       # このアクターの行動制限が 2 以上の場合
       if $game_party.actors[@status_window.index].restriction >= 2
         # ブザー SE を演奏
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # スキル画面に切り替え
       $scene = Scene_Passive.new(@status_window.index)
     when 3  # 装備
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # 装備画面に切り替え
       $scene = Scene_Equip.new(@status_window.index)
     when 4  # ステータス
       # 決定 SE を演奏
       $game_system.se_play($data_system.decision_se)
       # ステータス画面に切り替え
       $scene = Scene_Status.new(@status_window.index)
     end
     return
   end
 end
end

#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
#  スキル画面、バトル画面で、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================

class Window_Skill < Window_Selectable
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #     actor : アクター
 #--------------------------------------------------------------------------
 def initialize(actor)
   super(0, 128, 640, 352)
   @actor = actor
   @column_max = 2
   refresh
   self.index = 0
   # 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
   if $game_temp.in_battle
     self.y = 64
     self.height = 256
     self.back_opacity = 160
   end
 end
 #--------------------------------------------------------------------------
 # ● スキルの取得
 #--------------------------------------------------------------------------
 def skill
   return @data[self.index]
 end
 #--------------------------------------------------------------------------
 # ● リフレッシュ
 #--------------------------------------------------------------------------
 def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   @data = []
   for i in 0...@actor.skills.size
     skill = $data_skills[@actor.skills[i]]
     if skill != nil && PASSIVE_SKILLS_IDS.include?(skill.id)
     elsif skill != nil
       @data.push(skill)
     end
     end
   # 項目数が 0 でなければビットマップを作成し、全項目を描画
   @item_max = @data.size
   if @item_max > 0
     self.contents = Bitmap.new(width - 32, row_max * 32)
     self.contents.font.name = $fontface
     self.contents.font.size = $fontsize
     for i in 0...@item_max
       draw_item(i)
     end
   end
 end
 #--------------------------------------------------------------------------
 # ● 項目の描画
 #     index : 項目番号
 #--------------------------------------------------------------------------
 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
   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, 0)
 if skill.sp_cost > 0
   self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
 end
end
 #--------------------------------------------------------------------------
 # ● ヘルプテキスト更新
 #--------------------------------------------------------------------------
 def update_help
   @help_window.set_text(self.skill == nil ? "" : self.skill.description)
 end
end


class Game_Actor < Game_Battler
 def animation1_id
   weapon = $data_weapons[@weapon_id]
   return weapon != nil ? weapon.animation1_id : BARE_ANIMATION_SELF_ID
 end

 def animation2_id
   weapon = $data_weapons[@weapon_id]
   return weapon != nil ? weapon.animation2_id : BARE_ANIMATION_ID
 end
end

class Scene_Equip

 alias update_item_ers_later update_item
 def update_item
     itemskill = Xelias.ers_config(@item_window.item)
     if Input.trigger?(Input::C)
      unless (@actor.skill_learn?(itemskill[0]))
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     end
   update_item_ers_later
 end
end

class Game_Battler
 
 alias skill_met? skill_can_use?
 if is_a?(Game_Actor)
 def skill_can_use?(skill_id)
   data = Xelias.req_skill(skill_id)
    unless   skill_learn?(data) ? false : skill_met?(skill_id)
       return data != nil
       end
   end
 end
end




Instructions

Place it above main. Other instructions in the script.


Compatibility

Causes problems with exotic CMS.
Although that can be fixed by :
Spoiler: ShowHide

*Deleting the "Scene_Menu", "Scene_Skill", "Window_Skill", "Window_Passive" and Scene_Passive" part of the script
*Copying and pasting your CMS's Scene_Skill and Window_Skill so you have two of them.
*Modifying its class from Scene_Skill to Scene_Passive and Window_Skill to Window_Passive
*Searching for the line
  if skill != nil
@data.push(skill)

in Window_Passive and replacing it by
   if skill != nil && PASSIVE_SKILLS_IDS.include?(skill.id)
       @data.push(skill)

*Searching for the line
   
@skill_window = Window_Skill.new(@actor)

in Scene_Passive and replacing it with
   
@skill_window = Window_Passive.new(@actor)

*Searching for the line
  if skill != nil
@data.push(skill)

in Window_Skill and replacing it by
   
 if skill != nil && PASSIVE_SKILLS_IDS.include?(skill.id)
     elsif skill != nil
       @data.push(skill)

*Going to Scene_Menu and adding the command
 Scene = Scene_Passive.new

I cannot explain to you where you should put it, cause the location changes with Menus...


For exotic CBS, I'm not sure...
Hopefully, works with Blizzard's Passive Skills.


Credits and Thanks


  • Xelias, for making this script
  • NAMKCOR, for allowing the "Equip Weapon/Armor" Passive Skills scriptlet, which is a derived of his "Equipment Requirement System"
  • [Faint], for allowing the "Use Skill" Passive Skills scriptlet, which is a derived of his "State Requirement Skills"



Author's Notes


  • On a side note, I modified a little something in the "Skill Menu" : if a skill has a SP cost of 0, the "0" is not displayed.
  • On another side, I would like a good scripter to help me solving a little problem : with the Demi MP ability, only half of the SP is paid, but the same SP cost is represented. Idem for Turbo MP.
2
RMXP Script Database / Re: [XP] Rain of Add-ons
November 27, 2009, 12:14:57 pm
That's quite logical :haha: ...But I don't see what's the point.
3
RMXP Script Database / Re: [XP] Rain of Add-ons
November 27, 2009, 12:02:04 pm
@Longfellow : Shame on me, I messed up, but it doesn't change...

75*6 is equal to 450
50*6 is equal to 300
And 300 is the 2/3 of 450, not the half.
4
RMXP Script Database / Re: Rain of Add-ons
November 27, 2009, 12:12:21 am
@Aqua : Thanks
@Blizzard :
QuoteProtect Status - Just make a normal status effect with double PDEF.


 atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20


If I apply this formula to an attack of 100, a strength of 100 and a PDEF of 50...

atk = (100 - 25) = 75
self.damage = 75 + (120/20) = 81

And is the PDef is doubled, it should halve damage taken ? So it would be 40,5... Let's just test...

atk = (100 - 50) = 50
self.damage = 50 + (120/20) = 56

Not exactly the half, and that's why I use it. And it's the same for MDEF and Shell. Plus you can put animations.

And Virus has more than one effect. I was looking at FF Wiki for scripting ideas...

For "Elemental Status", there is already a XRXS script that does all of that. And you can attach it to weapons, states and armors ! So it's useless for me to make one. And I just can't make one...

5
RMXP Script Database / [XP] Rain of Add-ons
November 26, 2009, 02:44:06 pm
Rain of Add-Ons
Authors: Xelias
Version: 1.00
Type: Add-on Collection Control Script
Key Term: Add-on Collection



Introduction

Basically, it is me messing up with some of Tons of Add-Ons scripts. Now, it just features status effect scripts, but more to come.


Features


  • Oil Status
  • Shell Status
  • Protect Status
  • Virus Status
  • MP Shield Status
  • Spikes Status



Screenshots

No screens. How can you screenshot a status effect ?  


Demo

No demo.


Script


Spoiler: ShowHide

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Rain of Add-ons by Xelias
# Version: 1.00
# Type: Add-on Collection Control Script
# Date v1.00b:   26.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#                                    
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# #  
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #  
# #  You are free:
# #  
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# #  
# #  Under the following conditions:
# #  
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# #  
# #  Noncommercial. You may not use this work for commercial purposes.
# #  
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# #  
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# #  
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# #  
# #  - Nothing in this license impairs or restricts the author's moral rights.
# #  
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

class Game_System
 
 alias init_rain_of_addons_later initialize
 def initialize
   init_rain_of_addons_later
   
   @OIL_STATUS            = false
   @SHELL_STATUS = false
   @PROTECT_STATUS = true
   @VIRUS_STATUS = false
   @MP_SHIELD_STATUS = false
   @SPIKES_STATUS = true
   
end  
   
 attr_accessor :OIL_STATUS
 attr_accessor :SHELL_STATUS
 attr_accessor :PROTECT_STATUS
 attr_accessor :VIRUS_STATUS
 attr_accessor :MP_SHIELD_STATUS
 attr_accessor :SPIKES_STATUS
 
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Oil Status Effect by Xelias
# Version: 1.0b
# Type: Enhanced Status
# Date: 24.9.2006
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Allows to create a status increasing damage taken by Fire Element.
#
#
# Configuration:
#
#   OIL_IDS       - the IDs of the Oil status effects
#   FIRE_ELEMENT_ID - the ID of the fire element
#   FIRE_MULTIPLIER : How much times Fire Attacks should be stronger
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

OIL_IDS = [19]
FIRE_ELEMENT_ID = 1
FIRE_MULTIPLIER = 3

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
 alias attack_effect_oil_later attack_effect
 def attack_effect(attacker)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   result = attack_effect_oil_later(attacker)
   oil_effect(last_hp, last_sr, attacker) if self.damage.is_a?(Numeric)
   return result
 end
 
 alias skill_effect_oil_later skill_effect
 def skill_effect(user, skill)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   result = skill_effect_oil_later(user, skill)
   oil_effect(last_hp, last_sr, skill) if self.damage.is_a?(Numeric)
   return result
 end
 
 alias item_effect_oil_later item_effect
 def item_effect(item, battler = nil)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   if battler == nil
     result = item_effect_oil_later(item)
   else
     result = item_effect_oil_later(item, battler)
   end
   oil_effect(last_hp, last_sr, item) if self.damage.is_a?(Numeric)
   return result
 end
 
 def oil_effect(last_hp, last_sr, object)
   if $game_system.OIL_STATUS && OIL_IDS.any? {|i| @states.include?(i)}
     self.hp = last_hp
     self.hp = self.hp                                                                                                                                                  
     self.sr = last_sr if last_sr != nil
     if object.element_set.include?(FIRE_ELEMENT_ID)
       self.damage = (self.damage * FIRE_MULTIPLIER).to_i
     end
     self.hp -= self.damage
   end
 end
 
end
   
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Shell Status by Xelias
# Version: 1.00
# Type: Enhanced Status
# Date: 26.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#
# Compatibility:
#
#   99% compatible with SDK v1.x. 90% compatible with SDK v2.x. Could cause
#   problems with exotic CBS-es.
#
#
# Instructions:
#
# - Explanation:
#
# Thanks to this, you can create a "Shell Status" that halves all Magic Damage you take.
# You can put an animation on the character affected with  Shell just before the magic hits
# - Configuration  
#  
#   SHELL_IDS - include any IDs of Shell Statuses and separate them with
#                 commas (i.e. [52, 53, 54])
#   SHELL_ANIMATION_ID - Put the animation id. If you don't want any, make it 0.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

SHELL_IDS = [30]
SHELL_ANIMATION_ID = 64

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
 alias skill_effect_shell_skill_later skill_effect
 def skill_effect(user, skill)
   last_hp = self.hp
   last_sr = self.sr if $crls && self.is_a?(Game_Actor)
   result = skill_effect_shell_skill_later(user, skill)
   if $game_system.SHELL_STATUS  
       self.hp = last_hp
     self.hp = self.hp
     self.sr = last_sr if $crls && self.is_a?(Game_Actor)
     if  self.damage.is_a?(Numeric)
    if  skill.int_f > 0 &&  SHELL_IDS.any? {|i| @states.include?(i)}
      self.damage = (self.damage/2).to_i
     self.animation_id = SHELL_ANIMATION_ID
    end
       self.hp -= self.damage
     end
   end
   return result
 end
 
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Protect Status by Xelias
# Version: 1.00
# Type: Enhanced Status
# Date: 26.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#
# Compatibility:
#
#   99% compatible with SDK v1.x. 90% compatible with SDK v2.x. Could cause
#   problems with exotic CBS-es.
#
#
# Instructions:
#
# - Explanation:
#
# Thanks to this, you can create a "Protect Status" that halves all Physical Damage you take.
# This includes both physical attacks and skills with an intelligence influence of 0.
# You can put an animation on the character affected with Protect just before the magic hits
# - Configuration  
#  
#   PROTECT_IDS - include any IDs of Protect Statuses and separate them with
#                 commas (i.e. [29])
#   PROTECT_ANIMATION_ID - Put the animation id. If you don't want any, make it 0.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

PROTECT_IDS = [28]
PROTECT_ANIMATION_ID = 65

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
 alias skill_effect_protect_skill_later skill_effect
 def skill_effect(user, skill)
   last_hp = self.hp
   last_sr = self.sr if $crls && self.is_a?(Game_Actor)
   result = skill_effect_protect_skill_later(user, skill)
   if $game_system.PROTECT_STATUS  
       self.hp = last_hp
     self.hp = self.hp
     self.sr = last_sr if $crls && self.is_a?(Game_Actor)
     if  self.damage.is_a?(Numeric)
    if  skill.int_f == 0 &&  PROTECT_IDS.any? {|i| @states.include?(i)}
      self.damage = (self.damage/2).to_i
     self.animation_id = PROTECT_ANIMATION_ID
    end
       self.hp -= self.damage
     end
   end
   return result
 end
 
 alias attack_effect_protect_later attack_effect
 def attack_effect(attacker)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   result = attack_effect_protect_later(attacker)
   protect_effect(last_hp, last_sr, attacker) if self.damage.is_a?(Numeric)
   return result
 end
 
   def protect_effect(last_hp, last_sr, object)
   if $game_system.PROTECT_STATUS && PROTECT_IDS.any? {|i| @states.include?(i)}
     self.hp = last_hp
     self.hp = self.hp                                                                                                                                                  
     self.sr = last_sr if last_sr != nil
      self.damage = (self.damage/2)
     self.animation_id = PROTECT_ANIMATION_ID
     self.hp -= self.damage
   end
 end
 
end


   
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Virus Status Effect by Xelias
# Version: 1.00
# Type: Game Experience Improvement
# Date: 26.9.2006
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Allows to create a status preventing healing.
#
#
# Configuration:
#
#   VIRUS_IDS - the IDs of the Virus status effects
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

VIRUS_IDS = [14]

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 

 alias skill_effect_virus_later skill_effect
 def skill_effect(user, skill)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   result = skill_effect_virus_later(user, skill)
   virus_effect(last_hp, last_sr, skill) if self.damage.is_a?(Numeric)
   return result
 end
 
 alias item_effect_virus_later item_effect
 def item_effect(item, battler = nil)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   if battler == nil
     result = item_effect_virus_later(item)
   else
     result = item_effect_virus_later(item, battler)
   end
   virus_effect(last_hp, last_sr, item) if self.damage.is_a?(Numeric)
   return result
 end
 
 def virus_effect(last_hp, last_sr, object)
   if $game_system.VIRUS_STATUS && VIRUS_IDS.any? {|i| @states.include?(i)}
     self.hp = last_hp
     self.hp = self.hp                                                                                                                                                  
     self.sr = last_sr if last_sr != nil
     if self.damage < 0
       self.damage = (self.damage*0).to_i
       end
     self.hp -= self.damage
   end
 end
 
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# MP Shield Status Effect by Xelias
# Version: 1.00
# Type: Game Experience Improvement
# Date: 26.9.2006
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# When under this status, you never lose HP. However, you lose SP instead. When
# your SP reach 0, this status becomes ineffective.
#
# Configuration:
#
#  MP_SHIELD_IDS - the IDs of the MP Shield status effects
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

MP_SHIELD_IDS = [14]
MP_SHIELD_ANIMATION_ID = 8


#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
  alias attack_effect_mpshield_later attack_effect
 def attack_effect(attacker)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   result = attack_effect_mpshield_later(attacker)
   mpshield_effect(last_hp, last_sr, attacker) if self.damage.is_a?(Numeric)
   return result
 end  
 
 alias skill_effect_mpshield_later skill_effect
 def skill_effect(user, skill)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   result = skill_effect_mpshield_later(user, skill)
   mpshield_effect(last_hp, last_sr, skill) if self.damage.is_a?(Numeric)
   return result
 end
 
 alias item_effect_mpshield_later item_effect
 def item_effect(item, battler = nil)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   if battler == nil
     result = item_effect_mpshield_later(item)
   else
     result = item_effect_mpshield_later(item, battler)
   end
   mpshield_effect(last_hp, last_sr, item) if self.damage.is_a?(Numeric)
   return result
 end
 
 def mpshield_effect(last_hp, last_sr, object)
   if $game_system.MP_SHIELD_STATUS && MP_SHIELD_IDS.any? {|i| @states.include?(i)}
     self.hp = last_hp
     self.hp = self.hp                                                                                                                                                  
     self.sr = last_sr if last_sr != nil
     if self.sp > 0 && self.damage > 0
     self.animation_id = MP_SHIELD_ANIMATION_ID
     self.sp -= self.damage
   else
     self.hp -= self.damage
     end
   end
 end
 
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Spike Status by Xelias
# Version: 1.00
# Type: Enhanced Status
# Date: 26.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#
# Compatibility:
#
#   99% compatible with SDK v1.x. 90% compatible with SDK v2.x. Could cause
#   problems with exotic CBS-es.
#
#
# Instructions:
#
# - Explanation:
#
#  This allows to create a Spike Status. It inflicts damage to your opponent every time
# he or she attacks or uses a special skill. You can also set a special animation to hit
# the opponent
# - Configuration  
#  
#   SPIKES_IDS - include any IDs of Spikes Statuses and separate them with
#                 commas (i.e. [29])
#   SPIKES_ANIMATION_ID - Put the animation id. If you don't want any, make it 0.
#   SPIKES_PROTECTION - Set to true if you want to lower the damage taken by the
#   damage inflected by the spikes. Set false if you don't.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

SPIKES_IDS = [29]
SPIKES_ANIMATION_ID =43
SPIKES_PROTECTION = false

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
 alias skill_effect_spikes_skill_later skill_effect
 def skill_effect(user, skill)
   last_hp = self.hp
   last_sr = self.sr if $crls && self.is_a?(Game_Actor)
   result = skill_effect_spikes_skill_later(user, skill)
   if $game_system.SPIKES_STATUS  
       self.hp = last_hp
     self.hp = self.hp
     self.sr = last_sr if $crls && self.is_a?(Game_Actor)
     if  self.damage.is_a?(Numeric)
    if  skill.int_f == 0 &&  SPIKES_IDS.any? {|i| @states.include?(i)}
         user.damage = ( ( [self.pdef - user.pdef / 2, 0].max )* (20 + self.str) / 20 ) /10
     user.hp -= user.damage
     user.animation_id = SPIKES_ANIMATION_ID
         if SPIKES_PROTECTION
       self.damage -= user.damage
       end
    end
       self.hp -= self.damage
     end
   end
   return result
 end
 
 alias attack_effect_spikes_later attack_effect
 def attack_effect(attacker)
   last_hp = self.hp
   last_sr = (($crls && self.is_a?(Game_Actor)) ? self.sr : nil)
   result = attack_effect_spikes_later(attacker)
   spikes_effect(last_hp, last_sr, attacker) if self.damage.is_a?(Numeric)
   return result
 end
 
   def spikes_effect(last_hp, last_sr, object)
   if $game_system.SPIKES_STATUS && SPIKES_IDS.any? {|i| @states.include?(i)}
     self.hp = last_hp
     self.hp = self.hp                                                                                                                                                  
     self.sr = last_sr if last_sr != nil
         object.damage = ( ( [self.pdef - object.pdef / 2, 0].max )* (20 + self.str) / 20 ) /10
     object.hp -= object.damage
     object.animation_id = SPIKES_ANIMATION_ID
         if SPIKES_PROTECTION
       self.damage -= object.damage
       end
     self.hp -= self.damage
   end
 end
 
end





Instructions

Paste it above main.


Compatibility

As it works like Blizzard's tons, I'd say it is "90% compatible with SDK v1.x. 80% compatible with SDK v2.x." to quote Blizzard. Also should work in Blizz-ABS... May cause problem with exotic CBS


Credits and Thanks


  • Xelias, for modifying Blizzard's scripts
  • Blizzard, for making his marvelous Tons of Add-Ons  



Author's Notes


  • Will add more... when I feel like it.
  • Due to the small number of add-ons, the title doesn't fit... It was just a tribute/parody to Blizzard's Tons... Hehehe... Sorry, Blizz...
6
Script Requests / Re: Skill in Command Menu
November 18, 2009, 12:32:05 am
Useful script, heh ?
However, I already have it.
No, because it just separes skills. I want a specific skill to be accessible directly via the command menu.
As for Double Attack, it was an example.
7
Script Requests / Re: Skill in Command Menu
November 17, 2009, 12:39:16 pm
I feel so... ignored  :^_^':.
Bump anyway
8
Script Requests / Skill in Command Menu
November 15, 2009, 01:20:01 am
  So that's a script I would request.

 Skills that can be selected directly in command menu - or replace actual commands.

Example : a "Steal" skill with the "add command" attribute would go in the fighting menu, like that
Fight
Steal
Skill
Item
Defend

Example² : a "Double Attack" skill with the "replace command = Fight" attribute would replace the Fight command, such as :
Double Attack
Skill
Item
Defend

I'd use the RTAB v1.16 with its plugins, and Tons, of course.

Thanks.



9
Phew ! I thought you were talking about a scripting error   :D
10
Thanks. Where was the error ? I'd like to know it.
11
I tried, but I got more bugs than a swarm of locusts !
But remember, I will merge 'almost' any of those if you ask it. Because some effects are polar opposites (Valiant Knife and Ultima Weapon) and cannot be merged.
12
RMXP Script Database / [XP] Alternate Attack Algorithms
November 07, 2009, 12:12:37 pm
Alternate Attack Algorithms
Authors: Xelias
Version: 1.00
Type: Battle Add-On
Key Term: Battle Add-on



Introduction

This script allows selected weapons to have special damage formulas. Think Final Fantasy's Ultima Weapon for this one. Effects are better described in the script


Features


  • Weapons inflict damage based on current HP
  • Weapons inflict damage based on HP difference
  • Weapons inflict damage based on current SP
  • Weapons inflict damage based on current Level
  • Weapons inflict damage based on enemy's HP
  • Weapons inflict damage ignoring Defense
  • Weapons inflict damage based on Intelligence
  • Weapons inflict damage based on Agility
  • Weapons drain a selected percent of damage inflicted
  • Weapons inflict damage to opponent's SP
  • Weapons inflict damage ignoring Guard State
  • Weapons increase Critical Hit Ratio
  • Weapons increase Critical Hit Power



Screenshots

No screens. I wonder why we would need some


Demo

No demo. However, I will put one if required.


Script

Put this above main.
Spoiler: ShowHide

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Alternative Attack Algorithms  by Xelias
# Version: 1.00
# Type: Battle Add-ON
# Date v1.00:   7.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# #  
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #  
# #  You are free:
# #  
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# #  
# #  Under the following conditions:
# #  
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# #  
# #  Noncommercial. You may not use this work for commercial purposes.
# #  
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# #  
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# #  
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# #  
# #  - Nothing in this license impairs or restricts the author's moral rights.
# #  
# #----------------------------------------------------------------------------
#   How to use this script :
# This allows your weapons to follow different damage algorithms. Before that, you
# MUST place your weapons following a normal algorithm in the
# NORMAL_WEAPONS_IDS, or else... It wouldn't be good for your game.
# Also place all weapons ID except SP damaging and absorbing ones, into the
# "ALL_WEAPONS_IDS", because if you don't, a nasty bug will prevent you from
# dealing damage with normal attack. Cool, huh ?
#
# ATMA_WEAPON_IDS = [X,X...] : A weapon with an ID equal to X will inflict
# more damage depending on the user's HP. If HP are full, attack power is doubled.
# If HP are at minimum, attack power is normal. If HP are equal to half, attack power
# is equal to 1,5 of the normal Attack power, and so on...
# VALIANT_KNIFE_IDS = [X, X...] : The opposite effect of Atma Weapon.
# If HP are at minimum, attack power is doubled, and so on...
# LIMITED_MOON_IDS = [X, X...] : Follows the same formula than Atma Weapon
# but works with SP
# CONFORMER_IDS = [X, X...] : Deals damage based on user's Level.
#At Level 1, attack power is normal. At Level 99, attack power is doubled. You get
# the idea
# MASAMUNE_IDS = [X, X...] : Deals more damage the weaker the enemy is
# For an enemy with 100% HP, attack power is normal. For an enemy with 1 HP,
# attack power is doubled (which is pretty useless). For an enemy with half HP,
# attack power is equal to 1,5 of the normal attack power, and so on...
# PROJECTILE_IDS = [X, X...] : Ignores the opponent's defense in the damage
# calculation. However, the Attack power is halved, preventing an attack to inflict
# max damage at an opponent with max defense. Otherwise, it wouldn't be fair.
# FFXII_KATANA_IDS = [X, X...] : Acts like a Final Fantasy XII Katana, which
# means it inflicts damage based on user's Intelligence instead of Strength
# FFXII_NINJA_SWORDS_IDS = [X, X...] : Acts like a Final Fantasy XII Ninja Sword,
# which means it inflicts damage based on user's Agility instead of Strength
# MIND_BLASTER_IDS = [X, X...] : Damage is inflicted to SP. Damage
# relies also on the opponent's Magic Defense and your Intelligence
# BLOOD_SWORD_IDS = [X, X...] & PERCENT_DRAINED = X :  
# some damage is absorbed from the attack. How many? PERCENT_DRAINED %
# GUARD_BREAKER_IDS = [X, X...] : Damage ignores if enemy is defending.  
# As simple as that.
# GENJI_WEAPON_IDS = [X, X...] : Critical Hit Ratio is doubled.
# KIKU_ICHIMONJI_IDS = [X, X...] : Critical Hit power is doubled.
#
#
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
 OTHER_WEAPONS_IDS = [11]
 ALL_WEAPONS_IDS = [10,12,13,14,15,16,17,18,21,22,23,24]

 ATMA_WEAPON_IDS = [10]
 VALIANT_KNIFE_IDS = [12]
 LIMITED_MOON_IDS = [13]
 CONFORMER_IDS = [14]
 MASAMUNE_IDS = [15]
 PROJECTILE_IDS = [16]
 FFXII_KATANA_IDS = [17]
 FFXII_NINJA_SWORDS_IDS = [18]
 MIND_BLASTER_IDS = [19]
 BLOOD_SWORD_IDS = [20]
 PERCENT_DRAINED = 50
 GUARD_BREAKER_IDS = [21]
 GENJI_WEAPON_IDS = [23]
 KIKU_ICHIMONJI_IDS = [24]
 
class Game_Battler

def attack_effect(attacker)
   # Clear critical flag
   self.critical = false
   # First hit detection
   hit_result = (rand(100) < attacker.hit)
   # If hit occurs
   if hit_result == true
     # Calculate basic damage
         if attacker.is_a?(Game_Actor)
   if OTHER_WEAPONS_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.str) / 20
  end
  if ATMA_WEAPON_IDS.include?(attacker.weapon_id)
    atk = [attacker.atk - self.pdef / 2,0].max
    atk2 = atk * (20 + attacker.str) / 20
   self.damage = atk2 + ((atk2*((attacker.hp*100)/attacker.maxhp))/100)
   end
      if VALIANT_KNIFE_IDS.include?(attacker.weapon_id)
    atk = [attacker.atk - self.pdef / 2,0].max
    atk2 = atk * (20 + attacker.str) / 20
    minushp = attacker.maxhp - attacker.hp
   self.damage = atk2 + ((atk2*((minushp*100)/attacker.maxhp))/100)
   end
    if LIMITED_MOON_IDS.include?(attacker.weapon_id)
    atk = [attacker.atk - self.pdef / 2,0].max
    atk2 = atk * (20 + attacker.str) / 20
   self.damage = atk2 + ((atk2*((attacker.sp*100)/attacker.maxsp))/100)
 end
      if CONFORMER_IDS.include?(attacker.weapon_id)
    atk = [attacker.atk - self.pdef / 2,0].max
    atk2 = atk * (20 + attacker.str) / 20
   self.damage = atk2 + (atk2*(((attacker.level*100) / 99)/100))
 end
     if MASAMUNE_IDS.include?(attacker.weapon_id)
    atk = [attacker.atk - self.pdef / 2,0].max
    atk2 = atk * (20 + attacker.str) / 20
    minushp = self.maxhp - self.hp
   self.damage = atk2 + ((atk2*((minushp*100)/self.maxhp))/100)
 end
       if PROJECTILE_IDS.include?(attacker.weapon_id)
    atk = [attacker.atk,0].max
    self.damage = atk * (20 + attacker.str) / 20
  end
     if FFXII_KATANA_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.int) / 20
  end
     if FFXII_NINJA_SWORDS_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.agi) / 20
  end
     if BLOOD_SWORD_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.str) / 20
  end
     if MIND_BLASTER_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - ((self.pdef+self.mdef)) / 4, 0].max
    self.damage = atk * (20 + ((attacker.str + attacker.int)/2)) / 20
  end
     if GUARD_BREAKER_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.str) / 20
  end
     if GENJI_WEAPON_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.str) / 20
  end
     if KIKU_ICHIMONJI_IDS.include?(attacker.weapon_id)
   atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.str) / 20
  end
     end
  if attacker.is_a?(Game_Enemy)
     atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.str) / 20
  end
     # Element correction
   self.damage *= elements_correct(attacker.element_set)
     self.damage /= 100
     # If damage value is strictly positive
     if self.damage > 0
       # Critical correction
       if attacker.is_a?(Game_Actor)
   if GENJI_WEAPON_IDS.include?(attacker.weapon_id)
       if rand(100) < 8 * attacker.dex / self.agi
         self.damage *= 2
         self.critical = true
       end
       end
     if KIKU_ICHIMONJI_IDS.include?(attacker.weapon_id)
       if rand(100) < 4 * attacker.dex / self.agi
         self.damage *= 4
         self.critical = true
       end
     end
   elsif rand(100) < 4 * attacker.dex / self.agi
         self.damage *= 2
         self.critical = true
       end
       # Guard correction
       if self.guarding?
       if GUARD_BREAKER_IDS.include?(attacker.weapon_id)
      self.damage /=1
         end
    else
      self.damage /=2
    end
     # Dispersion
  if self.damage.abs > 0
       amp = [self.damage.abs * 15 / 100, 1].max
       self.damage += rand(amp+1) + rand(amp+1) - amp
     end
     # Second hit detection
     eva = 8 * self.agi / attacker.dex + self.eva
     hit = self.damage < 0 ? 100 : 100 - eva
     hit = self.cant_evade? ? 100 : hit
     hit_result = (rand(100) < hit)
   end
    # If hit occurs
   if hit_result == true
     # State Removed by Shock
     remove_states_shock
     # Substract damage from HP
      if attacker.is_a?(Game_Actor)
     if MIND_BLASTER_IDS.include?(attacker.weapon_id)
       self.sp -= self.damage
       self.damage = sprintf('%+d %s', -self.damage, $data_system.words.sp)
       end
     if BLOOD_SWORD_IDS.include?(attacker.weapon_id)
      healing = (self.damage*PERCENT_DRAINED)/100
       self.hp -= self.damage
       attacker.hp += healing
     end
     if ALL_WEAPONS_IDS.include?(attacker.weapon_id)
       self.hp -= self.damage
   end
   else self.hp -= self.damage
 end
 end
     # State change
     @state_changed = false
     states_plus(attacker.plus_state_set)
     states_minus(attacker.minus_state_set)
   # When missing
   else
     # Set damage to "Miss"
     self.damage = "Miss"
     # Clear critical flag
     self.critical = false
   end
   # End Method
   return true
 end
end








Instructions

Just set up the weapons' ID at the beginning of the script. And enjoy.


Compatibility

May cause compatibility problem with CBS... maybe ?


Credits and Thanks


  • Xelias, for making this script
  • Game_Guy and Ryexander for helping me with a bug that, well... bugged me.



Author's Notes

If you have ideas for new formulas, just send them. I'll do them... if I can.
On another note : special effects do not stack ! If you want to have two effects (Ex : Blood Sword Ultima Weapon), ask it and I'll make it.  
13
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 07, 2009, 12:10:44 pm
Thanks, but you're a little to late. It works now.  :haha:
14
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 07, 2009, 09:21:11 am
I don't understand where I should place them. I tried after the formula ; I tried after BOTH formulas ; I tried at the end of the script and all of those tries  create strange bugs. Can you help me by putting the "End"s directly in my script please?  
EDIT : ...Whatever. I modified something in the defending part, and it worked. Thanks.
15
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 07, 2009, 08:28:00 am
Spoiler: ShowHide
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Alternative Attack Algorithms  by Xelias
# Version: 7.39b
# Type: Battle Add-ON
# Date v1.00b:   7.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#   
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#  How to use this script :
# This allows your weapons to follow different damage algorithms.
# ATMA_WEAPON_ID = X ; The weapon with an ID equal to X will inflict
# more damage depending on the user's HP. If HP are full, attack power is doubled.
# If HP are at minimum, attack power is normal. If HP are equal to half, attack power
# is equal to 1,5 of the normal Attack power, and so on...
#
#
#
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

  ATMA_WEAPON_ID = 10

class Game_Battler

def attack_effect(attacker)
    # Clear critical flag
    self.critical = false
    # First hit detection
    hit_result = (rand(100) < attacker.hit)
    # If hit occurs
    if hit_result == true
      # Calculate basic damage
          if attacker.is_a?(Game_Actor)
      if attacker.weapon_id == ATMA_WEAPON_ID
        # Code here
     atk = [attacker.atk - self.pdef / 2,0].max
     atk2 = atk * (20 + attacker.str) / 20
    self.damage = atk2 + (atk2*(attacker.hp/attacker.maxhp))
  else 
    atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
   end
      # Element correction
      self.damage *= elements_correct(attacker.element_set)
      self.damage /= 100
      # If damage value is strictly positive
      if self.damage > 0
        # Critical correction
        if rand(100) < 4 * attacker.agi / self.pdef
          self.damage *= 2
          self.critical = true
        end
        # Guard correction
        if self.guarding?
        if rand(100) < ((self.pdef*10)/25)
          self.damage = 0
        end
        end
      end
      # Dispersion
      if self.damage.abs > 0
        amp = [self.damage.abs * 15 / 100, 1].max
        self.damage += rand(amp+1) + rand(amp+1) - amp
      end
      # Second hit detection
      eva = 8 * self.agi / attacker.dex + self.eva
      hit = self.damage < 0 ? 100 : 100 - eva
      hit = self.cant_evade? ? 100 : hit
      hit_result = (rand(100) < hit)
    end
     # If hit occurs
    if hit_result == true
      # State Removed by Shock
      remove_states_shock
      # Substract damage from HP
      self.hp -= self.damage
      # State change
      @state_changed = false
      states_plus(attacker.plus_state_set)
      states_minus(attacker.minus_state_set)
    # When missing
    else
      # Set damage to "Miss"
      self.damage = "Miss"
      # Clear critical flag
      self.critical = false
    end
    # End Method
    return true
  end
end
end


16
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 07, 2009, 08:23:46 am
It works, but...
after the attack with the special weapon, I get an error
"Nil can't be coerced into fixnum"
at "self.hp -= self.damage"
17
RPG Maker Scripts / Re: General RGSS/RGSS2/RGSS3 Help
November 07, 2009, 07:59:02 am
In class Game Battler, what is the syntax for
"If the attacker's Weapon Id is equal to..."
I tried "If attacker.weapon_id = ..." and it doesn't work:
I wanted to modify the algorithm of ONE weapon and all my weapons are changed !
18
RMXP Script Database / Re: [XP] Tons of Add-ons
November 02, 2009, 11:58:00 pm
Okay Thanks
19
RMXP Script Database / Re: [XP] Tons of Add-ons
November 02, 2009, 02:31:36 pm
Can I suggest a new version for your Blue Magic, both via Skills and Status ?

Spoiler: ShowHide

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Blue Magic via Status Effect by Blizzard and edited by Xelias
# Version: 1.1
# Type: Skill Learning Status Effect
# Date: 02.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#   This actor will learn the enemy's skill he was attacked with while this
#   status effect is inflicted. If an actor is inflicted with more than one
#   "learning" status effect at the same time, every one of them contributes
#   to the chance of learning the skill.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#==============================================================================
# module BlizzCFG
#==============================================================================

module BlizzCFG
 
  def self.blue_states(id)
    case id
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Blue Status Database
#   
#   Set up the database below using following template:
#   
#     when STATE_ID then return [CHANCE, GROUP_1, GROUP_2, ...]
#     
#   STATE_ID - the state ID in the database
#   CHANCE   - the probability in % that the skill will be learned
#   GROUP    - "class" from which skills can be learned
#   
#   Every status effect that is not defined here has a chance of 0% to make the
#   attacked actor learn the skill of the attacker. Depending on the state,
#   only enemies', actors' or both groups' skills can be learned. Add one or
#   more of the following classes after the probability factor:
#     
#     Game_Enemy - represents enemies
#     Game_Actor - represents actors
#   
#   Keep in mind that you need at least one group from which skills can be
#   learned.
#
#   LEARNING_SKILL_IDS - include any IDs of Skills that can be learned by Blue Magic and separate them with
#                      commas (i.e. [20, 21]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    when 27 then return [100, Game_Enemy] # 50% chance to learn from enemies
    when 28 then return [10, Game_Actor, Game_Enemy] # 10% chance to learn from enemies or actors
    when 29 then return [20, Game_Actor] # 20% chance to learn from actors
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Blue Status Database
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    end
    return [0]
  end
 
end

LEARNING_SKILLS_IDS = [20,21]

#==============================================================================
# Game_Battler
#==============================================================================

class Game_Battler
 
  alias skill_effect_bluestatus_later skill_effect
  def skill_effect(user, skill)
    if $game_system.BLUE_MAGIC_STATUS && self.is_a?(Game_Actor)
      @states.each {|id|
          data = BlizzCFG.blue_states(id)
          if data.size > 1 && rand(100) < data[0] &&
              data[1, data.size-1].include?(user.class)
if LEARNING_SKILLS_IDS.include?(skill.id)
            learn_skill(skill.id)
            break
          end
            end}
    end
    return skill_effect_bluestatus_later(user, skill)
  end
 
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Blue Magic via Skill by Blizzard and edited by Xelias
# Version: 1.6
# Type: Skill Learning Skill
# Date: 14.11.2006
# Date v1.6: 02.11.2009
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
#   This actor will learn one of the target's skills. Making this skill target
#   all allies/enemies, ONLY ONE SKILL WILL BE LEARNED FROM A RANDOM TARGET!
#   Make the skill do no damage to the target and use the hit rate to determine
#   the success chance of the skill.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

BLUE_MAGIC_IDS = [65] # add any Skill IDs and separate them with commas
BLUESKILLS_SKILLS_IDS = [66] #add any Skill IDS of skills that can be learned via BM Skills.
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle
 
  alias make_skill_action_result_blue_later make_skill_action_result
  def make_skill_action_result(battler = nil, plus_id = nil)
    if battler == nil
      make_skill_action_result_blue_later
      battler, targets = @active_battler, @target_battlers
    elsif plus_id == nil
      make_skill_action_result_blue_later(battler)
      targets = battler.target
    else
      make_skill_action_result_blue_later(battler, plus_id)
      targets = battler.target
    end
    if $game_system.BLUE_MAGIC_SKILL &&
        BLUE_MAGIC_IDS.include?(battler.current_action.skill_id)
      targets.each {|target| target.damage = nil}
      target = targets[rand(targets.size)]
      if rand(100) < $data_skills[battler.current_action.skill_id].hit
        if target.is_a?(Game_Enemy)
          ids = []
          target.actions.each {|act| ids.push(act.skill_id) if act.kind == 1}
        elsif target.is_a?(Game_Actor)
          ids = target.skills.clone
        end
        if ids.size > 0
          skill = $data_skills[ids[rand(ids.size)]]
          if battler.skills.include?(skill.id)
            target.damage = "#{skill.name} known"
          else
           if BLUESKILLS_SKILLS_IDS.include?(skill.id)
            battler.learn_skill(skill.id)
            target.damage = "#{skill.name} learned"
            end
          end
        else
          target.damage = 'None available'
        end
      else
        target.damage = 'Miss'
      end
    end
  end
   
end


Now you can choose which skills you can learn via Skills/Status. Of course, you can setup different learnable. skills for Skills and Status. Is it worth an update ?

20
RMXP Script Database / Re: [XP] Blizz-ABS
October 28, 2009, 01:10:51 pm
Quote from: winkio on October 28, 2009, 12:16:57 pm
Anything that can kill you in 0.1 seconds is the most dangerous.  period.

Well I can. I win.
Back to the topic... Bosss with 999999 HP don't worry about 10000 damage. They worry about white mages. This is why they should be killed first.