Lanzer Counter
Authors: LANZER
Version: 1
Type: Custom status
Key Term: Battle Add-on
Introduction 8) Ok here goes
lurking on the page I found some bit convincent scripts that do a counter-attack
obviously activated by a "attack" or "action kind 0"
then searching in the web i found one but was: old , forgotten and pretty useless
so taking that script i made MY FIRST SCRIPT!! :naughty:
Features
- Allows you to counter-attack(not reflect) normal attacks
- modificable proc an strength ratio
- It`s a state (means that its linkeable to autostates or health states, skills etc)
ScreenshotsHow do you SS a "state"?!
DemoLazyness
Script#==========================================================================
# ** UL Counter Attack
#==========================================================================
# Uncle Lanzer
# Version 1
# 21.09.10
#==========================================================================
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# 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.
# #
# #----------------------------------------------------------------------------
#################
# #
# CONFIGURATION #
# #
#################
# IT`S PRETTY SIMPLE........ JUST KILL THE BATMAN! <-- FORGET THAT -.-U
# MAKE A "(YOUR COUNTER NAME)" STATE
# UL_COUNTER_STATES = { A => [ B,C]}
# A = THE COUNTER STATE
# B = RATE OF SUCCESS
# C = STRENGHT OF COUNTER ( % OF A NORMAL ATTACK)
Scene_Battle::UL_Counter_States = { 48 => [100,100]} #ADD MORE BY THE SAME SYNTAX
# MESSAGGE WHEN COUNTER
Scene_Battle::UL_Counter_Messages = ['\m Counter!']
# CHECKING SCRIPT
if !@ul_counterattack_disabled
# START
class Game_Battler
alias lanzer_counter_battler_atkeff attack_effect
def attack_effect(attacker)
lanzer_counter_battler_atkeff(attacker)
if $scene.active_battler == attacker
$scene.ul_atkcounter_test(self)
end
end
end
class Scene_Battle
attr_accessor :active_battler
def ul_atkcounter_test(battler)
ul_temp = UL_Counter_States.keys
for i in 0...ul_temp.size
if battler.state?(ul_temp[i])
if UL_Counter_States[ul_temp[i]][0] > rand(99)
@ul_counter = UL_Counter_States[ul_temp[i]][1]
@ul_countertarget = battler
return
end
end
end
end
alias lanzer_counter_battle_up4s5 update_phase4_step5
def update_phase4_step5
lanzer_counter_battle_up4s5
if @ul_countertarget != nil
@phase4_step = 1337 # LEET
@ul_atkcounter = 28
end
end
def ul_counter_update
if @ul_countertarget.dead? or @ul_atkcounter == 0
@ul_atkcounter = nil
@ul_counter = nil
@ul_countertarget = nil
@phase4_step = 6
return
end
@ul_atkcounter -= 1
if @ul_atkcounter == 10
@ul_countertarget.animation_id = @ul_countertarget.animation1_id
@active_battler.animation_id = @ul_countertarget.animation2_id
ul_temp = rand(UL_Counter_Messages.size)
ul_temp = UL_Counter_Messages[ul_temp].clone
ul_temp.gsub!(/\\[Mm]/) { @ul_countertarget.name }
@help_window.set_text(ul_temp, 1)
@active_battler.attack_effect(@ul_countertarget)
if !@active_battler.damage.is_a?(String)
@active_battler.hp += @active_battler.damage
@active_battler.damage = @active_battler.damage * @ul_counter / 100
@active_battler.hp -= @active_battler.damage
@status_window.refresh
end
@active_battler.damage_pop = true
end
end
alias lanzer_counter_battle_update update
def update
if @ul_atkcounter != nil
ul_counter_update
end
lanzer_counter_battle_update
end
end
#--------------------------------------------------------------------------#
end
Instructions Paste above main.Other instructions in the script
Compatibility-100% compatible with default battle system
-it should be compatible with RTAB because it´s a state
-Non tested and maybe incompatible with Self Destruction Kit (cuz it sucks and i hate it)
-NON tested with BABS
Credits and Thanks
- Thanks to the web were i found this script and the original author (NOT the guy who posted it , cuz he can`t remove the SDK)
- Thanks to me for successfully removed the SDK bomb
- Thanks to you,Yes you! for use my remix and level me up
Author's NotesI HATE Self Destruction Kit(SDK). That`s all
I'll need to test it some more because I put it in one of my projects and the enemies attack me again after i've countered. Other than that, no script issues which i'm REALLY thankful for!
I've been looking for a counter script for forever, and i'm glad that you made one that works.
It's probably too much, but, think it could be edited to counter physical skills as well? That'd be awesome but for now this is great! :D
Yeah ! no problem , but if you want a counter system for skills just use the Blizz`s full reflecyion system. Only edit this part of the script
#----------------------------------------------------------------------------
# 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) && #this part change the INT_F, MDEF_F for other values
@states.include?(BlizzCFG::REFLECT_ID) &&
!BlizzCFG::BREAK_REFLECT.include?(skill.id) &&
!skill.minus_state_set.include?(BlizzCFG::REFLECT_ID))
end
end
Blizz full reflection system
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 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 = 18
REFLECT_ANIMATION = 61
BREAK_REFLECT = []
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
enjoy
Well, skills can be defined as "Magic" or "Physical" depending on what stats the skill uses to determine damage output. I'm already using Blizz's reflection script for reflecting magic, but having a counter script like this is nice too, to help give characters more variety of attacks ya know?
Still, thanks MUCHLY for posting this script! :D
this should be go on the data base?
Quote from: Lanzer on October 13, 2010, 07:27:49 pm
this should be go on the data base?
Usually moving scripts into the database is G_G's job, but he's MIA around here lately. Hopefully he'll come around once he gets a new computer. Anyway, in the meantime, you can either wait for him to get back or maybe one of the gmods will move it for you.
Congratulations on your first script. I was happy when I made my first working script. One suggestion I have after scanning the script real quick is the config. Using a hash in this manner is very ineffecient. You actually do not even need the constant, just create a method in Game_Battler that the player can configure.
See this example:
def ul_counter_states(A)
return case A
when 1 then [B, C]
when 2 then [B, C]
end
end
This is much more efficient, easier to configure, and much more over-viewable.
I'll check the script out in full later on, but good job!
i made so it can be very customizable
let`s say we have a warrior and a rogue
warrior have a greater counter damage
but rogue have a greater counter succe rate
and can be linked to skills states etc
retaliation, counter, riposte, bonebreaker , asdasdadasd
Your config is really bad...
Do what ForeverZer0 suggest please. @.@
Give more credit to the guy who originally made the script...
Like... his name perhaps... XD
I won't move this until I see those changes
:whistle:
Credits and Thanks
•Thanks to the web were i found this script and the original author (NOT the guy who posted it , cuz he can`t remove the SDK)
•Thanks to me for successfully removed the SDK bomb
•Thanks to you,Yes you! for use my remix and level me up
i don´t know the guy who originally made teh script
and i don´t want to post the page where i found the scritp cuz that´s SPAM right??
well my config is kindda lame but is over-customizable
it only counters the ATTACK order not physical skills , for that purpose just edit the blizz full reflect system
u2(not the group , you two) have a whole lot of experiencie on scripting =( , i only waiting for someone who can find a bug a problem , an incompatibility with BABS, etc so my soul can peaceful rest :3
enjoy
PD: hey aqua <3 did you read my request in your weapon specific skills =) ??
You are apparently not grasping the idea here for the config.
- It does not change the actual values returned at all.
- It takes nothing away from the customability of the script, except sloppiness and inefficiency.
- It looks better.
- It is easier to configure.
- Because I said so.
These are all valid points as to why you should do this. If you do not understand or doubt me, just try it out following the template I made above and test it. I'd be more than happy to give you a pointer if you need it. :P