02-06-2016, 07:56 PM
Hi sorry if this isn't the right section to ask for this but firstly I have started using this script for my XP Project not too long ago and the variety of different weapon attack type gives my game a lot of versatility options. However I also ran into a bug from using this amazing script, that bug being displaying damage onto actor/enemy when it should be showing Miss due to Evading the attack. Here's the bug recreation process:
1) Use a skill/item that boost Evasion state, default RMXP is Blink.
2) Actor/enemy use it's default 'Attack' option onto target with Blink state.
3) The damage number is displayed to actor/enemy as if taken damage, however no damage is applied as the game recognizes it as 'Miss'.
While not game breaking, it really shows annoyance. Anyone kind enough to help with this bug solution will be thanked gracefully! Here is the script that I'm using:
Once again thanks in advanced for providing assistance.
1) Use a skill/item that boost Evasion state, default RMXP is Blink.
2) Actor/enemy use it's default 'Attack' option onto target with Blink state.
3) The damage number is displayed to actor/enemy as if taken damage, however no damage is applied as the game recognizes it as 'Miss'.
While not game breaking, it really shows annoyance. Anyone kind enough to help with this bug solution will be thanked gracefully! Here is the script that I'm using:
Code:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 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
Once again thanks in advanced for providing assistance.