Help - Search - Members - Calendar
Full Version: Ari's Alternative Battle Algorithms (Work in progress)
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
Hechara!

Version 0.1
Author Hechara!/ Arielle/ Ari


Introduction

This is a very simple script of new battle algorithms based on four stats: attack, defense, agility, and magic. It is based mainly on the battle systems of the Dragon Quest games, as well as Rm2k3. It does include major changes to how some information is entered in the database and how that information is handled, so please take time to read this entire post before using the script. It's also still in development, so expect to see more features in the future. biggrin.gif

Features

- Characters have a natural attack and defense stat rather than it coming soley from weapons/ armor and multiplied with strength for damage calculations.
- Characters can make unarmed attacks (animation for unarmed attacks is currently not available.)
- "Physical" skill power is based of a direct multiplier with the character's attack stat.
- "Magic" power and defense is based off a single stat
- Crtical hits are totally random, rather than being based off the stats. Critcals deal triple damage.

A few things to be aware of

- This script was designed for "small" HP figures, typical of old-school style RPGs (Probably closest to Dragon Quest), the damage done by a single action rarely if ever exceeds 999. I have not tested this with larger figures.
- When editing the database, one should make note of a few factors:
- The "STR" stat in the database becomes the physical attack power, and the "DEX" stat defense. This carries over to all aspects in the database EXCEPT skills. (i.e. when creating weapons you will want to use the "STR+" box to designate the weapon's attack bonus. See the next bullet for skill info.)
- The "Power" box in the skill tab determines how much attack is added to the character's base attack when using the skill (a power of 1 has a base power of the character's attack + 1), and the "STR-F is a multiplier in increments of 10 (A STR-F of 10 is normal power, 5 is half power, 20 is double power, etc.)
- The current version of this sript only changes the actual algorithms, not the way the stats are displayed in the menu, etc. I will be working on that in the future.

Features Coming Soon

- Changing stat displays in the menu, equip scene, etc.
- Skills with an agility factor
- Skills that always strike first in the round
- Skills the ignore the target's defense stat.

Script/Installationt

This is not a new class but rather making changes to some specific lines in Game_Battler_3.

Normal Attack algorithm:

Find the "def attack_effect" method (lines 42-97 in the default script, delete it, and replace with this new one.

[Show/Hide] def attack_effect
CODE
def attack_effect(attacker)
self.critical = false
hit_result = (rand(100) < attacker.hit)
if hit_result == true
atk = attacker.str
self.damage = (attacker.str / 2) - (self.dex / 4)
if self.damage <= 1
self.damage = 1
end
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
if self.damage > 0
critrate = rand(60) + 1
if critrate == 60
self.damage *= 3
self.critical = true
end
if self.guarding?
self.damage /= 4
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.agi + 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


Skill algorithm:

Find the "def skill_effect" method, located directuly under def attack_effect (lines 103-204 in the default script.)

[Show/Hide] def skill_effect
CODE
def skill_effect(user, skill)
self.critical = false
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
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.str / 2) - (self.dex / 4)) * (skill.str_f / 10)) + (self.int / 40 * skill.int_f)
self.damage = power
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
if self.damage > 0
if self.guarding?
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
if skill.power != 0 and skill.atk_f > 0
remove_states_shock
effective = true
end
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
if skill.power == 0
self.damage = ""
unless @state_changed
self.damage = "Miss"
end
end
else
self.damage = "Miss"
end
unless $game_temp.in_battle
self.damage = nil
end
return effective
end


Compatibility

This should work with most battle systems, as nothing visual is changed. To use larger HP figures with these algorithms, you will probably need to multiply them.


Terms and Conditions

Simply mention me, Hechara! in the credits of your game. I would also appreciate if you would post here or pm me saying that you are using this script in your game because I want to see how popular it is. This is optional, however.
Diogotav
I like it im probaly gona use it thank you.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.