Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Bubble shield
#1
In addition to the skill tree in my other thread, I am trying to spice up my battle mechanics for my project.

I am currently working on the second actor, which is a priest.
For this actor, I am looking for a script that can allow skills/states to create a bubble shield, similar to WoW.

Example: 
Priest casts bubble shield on actor 1. 
Actor will negate 300 damage (or a different amount) before the shield runs out and his HP will be damaged.

I have found multiple scripts that could help me do this, like KStates from Kyonides and Passive Augments from Xelias.
However, both are pretty big with a lot of options and I was looking for something lightweight.

I found one in this thread that does exactly what I am looking for: https://save-point.org/thread-771.html?highlight=absorb

But when I test it, the numbers don't match up.
The damage shown does not add up to the amount of the bubble and even when it pops, 
the actor's HP goes down by an amount that is different from the damage shown.

Demo link for the script: https://gofile.io/?c=1IGLR9

I hope someone can help me out with this.
Reply
#2
Bump.

Can anyone help me with this?
I'm willing to pay 5 euros for a functional script.
Reply
#3
I looked around a bit and found this.
I haven't tested it but maybe it works for you?

Code:
#==============================================================================
# ** Power Word: Shield Status Effect
#------------------------------------------------------------------------------
# The_Falcon
# 1.0
# 1.1.07
# SDK Version : 2.3 - Parts 1
#==============================================================================
# This script overwrites the following methods:
#------------------------------------------------------------------------------
# Game_Battler : attack_effect , skill_effect , slip_damage_effect
#------------------------------------------------------------------------------
# This script aliases the following methods:
#------------------------------------------------------------------------------
# Game Battler : initialize , add_state
#==============================================================================
#How to use:
#
#Add the script under the SDK. Then you'll need to make a new state and change the PWS_ID #in the script to the ID of the effect. Then make the skills and whatnot so you can use the #new effect goofy
#Also, keep in mind, the shield is NOT meant to be dispelled, so any dispel effects will #probably screw the system up a bit.
#==============================================================================
#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Power Word: Shield Status Effect', 'The_Falcon', 1.0, '01.01.08')
SDK.check_requirements(2.3, [], [])
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Power Word: Shield Status Effect')
 PWS_ID = 17 #ID of the power word shield state
 PWS_PERCENT = 0.2 #The percent of health you want PWS to absorb
#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================
class Game_Battler
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :pws_hp           # Strength of PWS
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias pws_init initialize
 SDK.log_alias(:Game_Battler, :initialize, :pws_init)
 #--------------------------------------------------------------------------
 def initialize
   pws_init
   @pws_hp = 0
 end
 #--------------------------------------------------------------------------
 # * Add State
 #     state_id : state ID
 #     force    : forcefully added flag (used to deal with auto state)
 #--------------------------------------------------------------------------
 alias pws_add_state add_state
 SDK.log_alias(:Game_Battler, :add_state, :pws_add_state)
 #--------------------------------------------------------------------------
 def add_state(state_id, force = false)
   if state_id == PWS_ID
     @pws_hp = Integer(self.maxhp * PWS_PERCENT)
   end
   pws_add_state(state_id, force)
 end
 # log the overwrite
 SDK.log_overwrite(:Game_Battler, :attack_effect)
 #--------------------------------------------------------------------------
 # * Applying Normal Attack Effects
 #     attacker : 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
     atk = [attacker.atk - self.pdef / 2, 0].max
     self.damage = atk * (20 + attacker.str) / 20
     # 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.dex / self.agi
         self.damage *= 2
         self.critical = true
       end
       # Guard correction
       if self.guarding?
         self.damage /= 2
       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
     #-------------------------------------------
     #If the shield has strength
     if state?(PWS_ID)
       if pws_hp > self.damage
         # Substract damage from the shield's strength
         @pws_hp -= self.damage
         self.damage = "Absorb"
       else
         # Substract remaining strength from damage
         self.damage -= @pws_hp
         # Substract damage from HP
         self.hp -= self.damage
         remove_state(PWS_ID)
       end
     else
       # Substract damage from HP
       self.hp -= self.damage
     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
 # log the overwrite
 SDK.log_overwrite(:Game_Battler, :skill_effect)
 #--------------------------------------------------------------------------
 # * Apply Skill Effects
 #     user  : the one using skills (battler)
 #     skill : skill
 #--------------------------------------------------------------------------
 def skill_effect(user, skill)
   # Clear critical flag
   self.critical = false
   # If skill scope is for ally with 1 or more HP, and your own HP = 0,
   # or skill scope is for ally with 0, and your own HP = 1 or more
   if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
      ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
     # End Method
     return false
   end
   # Clear effective flag
   effective = false
   # Set effective flag if common ID is effective
   effective |= skill.common_event_id > 0
   # First hit detection
   hit = skill.hit
   if skill.atk_f > 0
     hit *= user.hit / 100
   end
   hit_result = (rand(100) < hit)
   # Set effective flag if skill is uncertain
   effective |= hit < 100
   # If hit occurs
   if hit_result == true
     # Calculate power
     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
     # Calculate rate
     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)
     # Calculate basic damage
     self.damage = power * rate / 20
     # Element correction
     self.damage *= elements_correct(skill.element_set)
     self.damage /= 100
     # If damage value is strictly positive
     if self.damage > 0
       # Guard correction
       if self.guarding?
         self.damage /= 2
       end
     end
     # Dispersion
     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
     # Second hit detection
     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)
     # Set effective flag if skill is uncertain
     effective |= hit < 100
   end
   # If hit occurs
   if hit_result == true
     # If physical attack has power other than 0
     if skill.power != 0 and skill.atk_f > 0
       # State Removed by Shock
       remove_states_shock
       # Set to effective flag
       effective = true
     end
     #-------------------------------------------
     #If the shield has strength
     if state?(PWS_ID)
       if pws_hp > self.damage
         last_hp = @pws_hp
         # Substract damage from the shield's strength
         @pws_hp -= self.damage
         self.damage = "Absorb"
         effective |= @pws_hp != last_hp
       else
         # Substract damage from HP
         last_hp = @pws_hp
         # Subtract shield's last strength from damage
         self.damage -= @pws_hp
         self.hp -= self.damage
         remove_state(PWS_ID)
         effective |= self.hp != last_hp
       end
     else
       # Substract damage from HP
       last_hp = self.hp
       self.hp -= self.damage
       effective |= self.hp != last_hp
     end
     #-------------------------------------------
     # State change
     @state_changed = false
     effective |= states_plus(skill.plus_state_set)
     effective |= states_minus(skill.minus_state_set)
     # If power is 0
     if skill.power == 0
       # Set damage to an empty string
       self.damage = ""
       # If state is unchanged
       unless @state_changed
         # Set damage to "Miss"
         self.damage = "Miss"
       end
     end
   # If miss occurs
   else
     # Set damage to "Miss"
     self.damage = "Miss"
   end
   # If not in battle
   unless $game_temp.in_battle
     # Set damage to nil
     self.damage = nil
   end
   # End Method
   return effective
 end
 # log the overwrite
 SDK.log_overwrite(:Game_Battler, :slip_damage_effect)
 #--------------------------------------------------------------------------
 # * Application of Slip Damage Effects
 #--------------------------------------------------------------------------
 def slip_damage_effect
   # Set damage
   self.damage = self.maxhp / 10
   # Dispersion
   if self.damage.abs > 0
     amp = [self.damage.abs * 15 / 100, 1].max
     self.damage += rand(amp+1) + rand(amp+1) - amp
   end
   #-------------------------------------------
   #If the shield has strength
   if state?(PWS_ID)
     if pws_hp > self.damage
       # Substract damage from the shield's strength
       @pws_hp -= self.damage
       self.damage = "Absorb"
     else
       # Subtract shield's last strength from damage
       self.damage -= @pws_hp
       self.hp -= self.damage
       remove_state(PWS_ID)
     end
   else
     # Substract damage from HP
     last_hp = self.hp
     self.hp -= self.damage
   end
   #-------------------------------------------
   # End Method
   return true
 end
end
#--------------------------------------------------------------------------
# End SDK Enabled Test
#--------------------------------------------------------------------------
end
Reply
#4
It has content designed for the RMXP SDK. If you're using it, you're fine. If not.... well, you're still fine. You'll just need to remove the statements that have 'SDK.' in them like
Code:
if SDK.enabled?('Power Word: Shield Status Effect')
And you'll need to remove the last 'end' statement as the sample SDK line I mentioned is the start of an IF block.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]

Reply
#5
Nice! Thank you both.
I don't use SDK, so I'm glad that you mentioned, VVulf.

I will test the script today or tomorrow and let you know about the results  Very cheery
Reply
#6
Okay, I did some testing and the script works great by itself!
The numbers for the shield seem to add up now and the "absorbed" message is neat.

However, I have three more questions  Happy with a sweat

First of all, I would like to make at least 2 different shield skills (preferably more) with different values.
Is it possible to turn the state id and shield value into an array?

Also, if I want to use fixed values for the shield, rather than % of maxhp, is the following replacement for line 63 correct?


Code:
    @pws_hp = PWS_PERCENT

Finally, the following script is the only one I'm using that seems to conflict with this one.

Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Full Reflection System by Blizzard
# Version: 3.01b
# Type: Game Experience Improvement
# Date: 5.9.2006
# Date v1.4: 16.1.2007
# Date v2.0b: 12.3.2007
# Date v2.1b: 13.11.2007
# Date v3.0b: 13.7.2008
# Date v3.01b: 5.12.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#  
#  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.
# #  
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# new in v1.4:
#   - overworked code and fixed all the glitches
#   - the power comes back X times stronger if it is reflected from X battlers
#     (i.e. like in the Final Fantasy series)
#   - spells now get reflected to anybody from the enemy party, not only the
#     user (makes it possible to split damage from the FF feature mentioned
#     above)
#   - added a fix so it works with HP/SP Absorb
#
# new in v2.0b:
#   - completely overworked and fixed
#
# new in v2.1b:
#   - overworked and independent from Tons of Add-ons
#
# new in v3.0b:
#   - fixed a little bug based on HP/SP Absorb Skills
#   - better coding
#   - commented code
#   - now compatible with Blizz-ABS 1.99 or higher
#
# new in v3.01b:
#   - now compatible with Blizz-ABS 2.11 or higher
#
#
# Compatibility:
#
#   97% compatible with SDK v1.x. 80% compatible with SDK v2.x. You might
#   experience problems with exotic CBS-es.
#
#
# Configuration:
#
#   Make a status effect and call it "Reflect". Remember the ID number. Now
#   make an animation that should be displayed when reflecting magic.
#
#     REFLECT_ID        - the ID of the reflect status
#     REFLECT_ANIMATION - the ID of animation displayed when magic is being
#                         reflecting
#     BREAK_REFLECT     - IDs of skills that go through Reflection no matter
#                         what
#     MISS_DAMAGE       - what is displayed in your game if somebody gets
#                         missed (usually 'Miss')
#
# Notes:
#
#   A magical skill is considered a skill that has a either INT-F greater than
#   zero or MDEF-F greater than zero. Please note that skills that can disable
#   the reflection status break through the reflection automatically. Also, it
#   is better if you don't use sounds and screen/target flashing in the
#   animation for the reflecting effect.
#  
#  
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

$full_reflection_system = 3.01

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

module BlizzCFG

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START COnfiguration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 REFLECT_ID = 68
 REFLECT_ANIMATION = 61
 BREAK_REFLECT = [145, 147]
 MISS_DAMAGE = 'Miss'

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END COnfiguration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 #----------------------------------------------------------------------------
 # reflection_effect
 #  battler - battler using the skill
 #  targets - targeted battlers
 #  skill   - the skill being used
 #  Executes complete replacement processing of targeted battlers when
 #  reflecting.
 #----------------------------------------------------------------------------
 def self.reflection_effect(battler, targets, skill)
   # old targets
   old_targets = []
   # for each target
   targets.each_index {|i|
       # if skill exists, using skill and target reflects
       if skill != nil && battler.current_action.kind == 1 &&
           targets[i].test_reflection(skill)
         # swap the targtet with a new one
         new_target = self.swap_target(battler, targets[i], skill)
         # if the new target is different from the one before
         if targets[i] != new_target
           # remember old target
           old_targets.push(targets[i])
           # set new target
           targets[i] = new_target
         end
       end}
   # remove nils
   targets.compact!
   # for each target
   targets.each {|target|
       # get damage
       dam = (target.damage.is_a?(Numeric) ? target.damage : 0)
       # execute skill and override reflection
       target.skill_effect(battler, skill, true)
       # add damage if already damaged
       target.damage += dam if target.damage.is_a?(Numeric)
       # set hit animation if not missed
       target.animation_hit = (target.damage != MISS_DAMAGE)}
   # return old targets
   return old_targets
 end
 #----------------------------------------------------------------------------
 # swap_target
 #  b1    - battler using skill
 #  b2    - battler being attacked
 #  skill - the skill being used
 #  Swaps the targeted battler with another one so a reflection effect is
 #  achieved.
 #----------------------------------------------------------------------------
 def self.swap_target(b1, b2, skill)
   # if enemy is targeted
   if b2.is_a?(Game_Enemy)
     # get valid actor targets
     bs = $game_party.actors.find_all {|actor| actor.exist?}
   # if actor is targeted
   elsif b2.is_a?(Game_Actor)
     # get valid enemy targets
     bs = $game_troop.enemies.find_all {|enemy| enemy.exist?}
   else
     # target doesn't change
     bs = [b2]
   end
   # return a random target of all possible targets
   return bs[rand(bs.size)]
 end
 #----------------------------------------------------------------------------
 # reflection_effect_blizzabs
 #  battler - battler using the skill
 #  targets - targeted battlers
 #  other   - alternative targets
 #  skill   - the skill being used
 #  Replaces all battlers that have reflection with other battlers.
 #----------------------------------------------------------------------------
 def self.reflection_effect_blizzabs(battler, targets, other, skill)
   # old targets
   old_targets = []
   # for each target
   targets.each_index {|i|
       # if skill exists, using skill and target reflects
       if skill != nil && targets[i].battler.test_reflection(skill)
         # swap the target with a new one
         new_target = self.swap_target_blizzabs(battler, targets[i], other, skill)
         # if the new target is different from the one before
         if targets[i] != new_target
           # remember old target
           old_targets.push(targets[i])
           # set new target
           targets[i] = new_target
         end
       end}
   # if animations are being used
   if BlizzABS::Config::ANIMATIONS
     # set animation to reflecting for all old targets
     old_targets.each {|target| target.animation_id = REFLECT_ANIMATION}
   end
 end
 #----------------------------------------------------------------------------
 # swap_target_blizzabs
 #  b1    - battler using skill
 #  b2    - battler being attacked
 #  other - alternative targets
 #  skill - the skill being used
 #  Swaps the targeted map battler with another one so a reflection effect is
 #  achieved.
 #----------------------------------------------------------------------------
 def self.swap_target_blizzabs(b1, b2, other, skill)
   # find all targets that are negative aligned from the targeted battler
   bs = other.find_all {|b| b2.ai.negative.include?(b.ai.basic)}
   # set original target if no other targets exist
   bs = [b2] if bs.size == 0
   # return a random target of all possible targets
   return bs[rand(bs.size)]
 end
 
end

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

class Game_Battler
 
 #----------------------------------------------------------------------------
 # override skill_effect
 #----------------------------------------------------------------------------
 alias skill_effect_reflect_later skill_effect
 def skill_effect(user, skill, override_reflect = !$scene.is_a?(Scene_Battle))
   # if in Blizz-ABS mode on the map
   if $BlizzABS && BlizzABS::VERSION >= 1.99 && $scene.is_a?(Scene_Map)
     # set reflect inactive
     override_reflect = true
   end
   # if reflect is not active
   if override_reflect || !test_reflection(skill)
     # execute skill
     return skill_effect_reflect_later(user, skill)
   end
   # not skill execution
   return false
 end
 #----------------------------------------------------------------------------
 # test_reflection
 #  skill - the skill to be check
 #  Checks whether a skill should be reflected.
 #----------------------------------------------------------------------------
 def test_reflection(skill)
   return ((skill.int_f > 0 || skill.mdef_f > 0) &&
       @states.include?(BlizzCFG::REFLECT_ID) &&
       !BlizzCFG::BREAK_REFLECT.include?(skill.id) &&
       !skill.minus_state_set.include?(BlizzCFG::REFLECT_ID))
 end
 
end

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

class Scene_Battle
 
 #----------------------------------------------------------------------------
 # override main
 #----------------------------------------------------------------------------
 alias main_reflect_later main
 def main
   # initialize array of old targets
   @old_targets = []
   # call original method
   main_reflect_later
 end
 #----------------------------------------------------------------------------
 # override set_target_battlers
 #----------------------------------------------------------------------------
 alias set_target_battlers_reflect_later set_target_battlers
 def set_target_battlers(scope, battler = nil, override = false)
   # if skill can't break through reflection this time
   if !BlizzCFG::BREAK_REFLECT.include?(@skill.id) && !override &&
       @active_battler.current_action.kind == 1
     # no targets
     return []
   end
   # if RTAB is not installed
   if battler == nil
     # call original method
     return set_target_battlers_reflect_later(scope)
   else
     # call original method with RTAB compatibility
     return set_target_battlers_reflect_later(scope, battler)
   end
 end
 #----------------------------------------------------------------------------
 # override make_skill_action_result
 #----------------------------------------------------------------------------
 alias make_skill_action_result_reflect_later make_skill_action_result
 def make_skill_action_result(battler = nil, plus_id = nil)
   # if RTAB is not installed
   if battler == nil
     # call original method
     make_skill_action_result_reflect_later
     # set battler and targets
     tmp, targets = @active_battler, @target_battlers
   # additional compatibility
   elsif plus_id == nil
     # call original method with RTAB compatibility
     make_skill_action_result_reflect_later(battler)
     # set targets
     targets = battler.target
   else
     # call original method with higher RTAB compatibility
     make_skill_action_result_reflect_later(battler, plus_id)
     # set targets
     targets = battler.target
   end
   # if not breaking reflection skill
   unless BlizzCFG::BREAK_REFLECT.include?(@skill.id)
     # set targets allowing reflection
     set_target_battlers(@skill.scope, battler, true)
     # set battler if doesn't exist
     battler = tmp if battler == nil && tmp != nil
     # execute reflection effect and get old targets
     @old_targets = BlizzCFG.reflection_effect(battler, targets, @skill)
   end
 end
 #----------------------------------------------------------------------------
 # override make_skill_action_result
 #----------------------------------------------------------------------------
 alias update_phase4_step4_reflect_later update_phase4_step4
 def update_phase4_step4(battler = nil)
   # change animation to reflecting for all old targets
   @old_targets.each {|target|
       target.animation_id = BlizzCFG::REFLECT_ANIMATION}
   # empty old targets
   @old_targets = []
   # if RTAB not installed
   if battler == nil
     # call original method
     update_phase4_step4_reflect_later
   else
     # call original method with RTAB compatibility
     update_phase4_step4_reflect_later(battler)
   end
 end
 
end

I am getting the error "wrong number of arguments (3 for 2)" in this part of the Reflection script:

Code:
   # for each target
   targets.each {|target|
       # get damage
       dam = (target.damage.is_a?(Numeric) ? target.damage : 0)
       # execute skill and override reflection
       target.skill_effect(battler, skill, true) # This line <------
       # add damage if already damaged
       target.damage += dam if target.damage.is_a?(Numeric)
       # set hit animation if not missed
       target.animation_hit = (target.damage != MISS_DAMAGE)}

Is this easily fixable? If not, I will use the PWS script over the reflection one.
Reply
#7
To fix your 'compatability' issue between it and Blizzard's script, allow moi to go about a little teaching. Laughing

There are two ways to add new material to a method in Ruby Scripting. You either rewrite the whole method or you use the 'alias' technique which allows you to append new material without the need of rewriting the whole method.

The first method, the one where you rewrite a method, is destructive. For example, if you have two scripts that alter the 'attack_battler' method, and the last script in your list rewrites the method.... erm, all the prior ones are overwritten and ignored. A rewrite of the method is not preferred, but sometimes it is the only way to achieve what is desired.

The second method, the one using the alias techinique, is additive. For example, if you have two scripts that alter the 'attack_battler' method, and the last script in your list aliases new content.... Well, that material from the previous script is still present and the new aliased content joins it! It is more preferred, but can be prone to crashing if the script's author didn't take stack overflow into consideration. A rarity, but certain authors do ignore it.

NOW.... About the two scripts.

The one that Melana supplied rewrites the 'attack_effect' and 'skill_effect' methods as well as the 'slip_damage_effect' method. You can find these in the original code just by looking for the 'SDK.overwrite' statements. So this uses the first method of scripting, the rewrite method technique.

The second one, the one by blizzard, uses the alias technique upon the 'skill_effect' method. This is the more preferred technique and should be placed after the first. In fact, if you have any other script that alters 'skill_effect', this script should be last in the list. Why? Because blizzard added extra parameters into his 'skill_effect' call.

Normally, the skill_effect looks like this:
def skill_effect(user, skill)

Blizzard's variation looks like this:
def skill_effect(user, skill, override_reflect = !$scene.is_a?(Scene_Battle))

He added a new 'override_reflect' parameter that changes how things work. And any other script that aliases 'skill_effect' and gets posted after this will have the "wrong number of arguments (3 for 2)" error.




And I take it that your edit is to this?
Code:
if state_id == PWS_ID
     @pws_hp = Integer(self.maxhp * PWS_PERCENT)
   end

So... PWS_PERCENT will then be a fixed value for all shields or whatever it is. Sounds right, but I haven't examined the script. I'm just looking at it while working on forum stuff. Winking
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
[Image: QrnbKlx.jpg]

Reply
#8
Thanks for the explanation. When I put the PWS script in front of Blizzard's, there seems to be no problem.
Now it need to figure out if all my other combat add-on scripts are compatible.

Then I will try and (hopefully) adjust the script for it to manage multiple state id's.

But first, some sleep.
Reply
#9
Alright. I finished testing my combat add-on scripts for compatibility.
I had to fix some bugs (which weren't even compatibility related) and it seems that the scripts I am using are not in conflict with each other.
Most likely I won't add any more scripts other than the ones I have now, so I can finally focus on database, mapping, eventing, etc.

Anyway, I am still looking for someone who can help me with my earlier request:
Editing the PWS script so that I can use multiple shields / state id's.

Like I said before; I am willing to pay if a lot of effort is involved.
Reply




Users browsing this thread: