lvlercenary
Member
Hi i was wondering if it might be possible to make this script work for VX?
it would be much apreciated thank you!
here is a link to the systems OP
CW: DnD Battle Formula
i have tried to put it in, but errors out when i do
Code:
#==============================================================================
# ** CW: DnD Formula ** ver. 1.01 (02/04/08)
#------------------------------------------------------------------------------
# Clockwise [B.Gale]
# PLEASE GIVE CRIDIT IF YOU ARE GOING TO USE THIS SCRIPT
#
#==============================================================================
class Game_Battler
Default_Weapn = 'Melee'
Type = { 1 => 'Range', 5 => 'Range'}
#===============================================================================
# How to control the "dice" in the database...
# First we need to go to weapons.
# Here the value of ATT is broken down into two parts:
# > the first digit is the number of dice
# > the second digits are the number of side on the dice
# so for example...
# 106 = 1d6
# 210 = 2d10
# and so on
# this means if you had a weapon with 2d8 (ATT = 108) you could "roll" as much as
# 16 (plus modifiers) or as little as 2 (plus mods)
#===============================================================================
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects
# attacker : battler
#--------------------------------------------------------------------------
def attack_effect(attacker)
# Clear critical flag
self.critical = true
# Formulas #
atk_roll = rand(20)
atk_bonus = attacker.agi
dodge = ((self.dex - 10) / 2)
hit_con = attacker.hit
if Type.has_key?(attacker.weapon_id)
atk_mod = (attacker.dex - 10) / 2 #Range
else
atk_mod = (attacker.str - 10) / 2 #Melee or Enemy
end
#### CALCULATE #####========================================================
# Hit Detection #
hit_result = (hit_con * (atk_mod + atk_roll + atk_bonus) > 9 + self.pdef + dodge)
if hit_result == true or atk_roll == 19
# Calculate Base Damage #---------------------------------------------
atk = attacker.atk.to_s
dice = atk.chop.chop.to_i
side = atk[-2,2].to_i
self.damage = [dice * rand(side) + atk_mod,1].max
#---------------------------------------------------------------------
# Element correction
self.damage *= elements_correct(attacker.element_set)
self.damage /= 100
# If damage value is strictly positive
if self.damage > 0
# Critical Chance #-------------------------------------------------
if atk_roll == 19
crit_roll = rand(20)
crit_result = (atk_mod + crit_roll + atk_bonus > 9 + self.pdef + dodge)
if crit_result == true
self.damage *= 2
self.critical = true
end
end
#-------------------------------------------------------------------
# Guard correction
if self.guarding?
self.damage /= 2
end
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
#--------------------------------------------------------------------------
# * 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
#### SKILL FORMULAS #####================================================
# Basic Damage Roll #
b_atk = user.atk.to_s
b_dice = b_atk.chop.chop.to_i
b_side = b_atk[-2,2].to_i
base_dmg = [b_dice * rand(b_side),1].max
# Skill Damage Roll #
s_atk = skill.power.to_s
s_dice = s_atk.chop.chop.to_i
s_side = s_atk[-2,2].to_i
skill_dmg = s_dice * rand(s_side)
# Basic Damage Multiplier #
dmg_mod = skill.atk_f
# Stat Modifiers #
stat_mod = ((user.str - 10) / 2) * (skill.str_f / 100)
stat_mod += ((user.dex - 10) / 2) * (skill.dex_f / 100)
stat_mod += ((user.int - 10) / 2) * (skill.int_f / 100)
stat_mod += ((user.agi - 10) / 2) * (skill.agi_f / 100)
# Defenses #
skill_pdef = (self.pdef * skill.pdef_f / 100)
skill_mdef = (((user.int - 10) / 2) + self.mdef) * (skill.mdef_f / 100)
dodge = ((self.dex - 10) / 2)
#===========================================================================
# Hit Detection#
hit = skill.hit
if skill.power > 0 or skill.atk_f > 0
hit *= user.hit / 100
skill_roll = rand(20)
hit_result = (hit * (skill_roll + stat_mod) > skill_pdef + skill_mdef + dodge)
else
hit_result = (hit > rand(100))
stat_mod *= (-1)
end
# Set effective flag if skill is uncertain
effective |= hit < 100 # Set effective flag if skill is uncertain
# If hit occurs
if hit_result == true or skill_roll == 19
### DAMAGE ###------------------------------------------------------------
self.damage = (skill_dmg + (base_dmg * dmg_mod / 10) + stat_mod).to_i
#-------------------------------------------------------------------------
# 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
# 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
# Substract damage from HP
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# 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 and skill.atk_f == 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
end
it would be much apreciated thank you!
here is a link to the systems OP
CW: DnD Battle Formula
i have tried to put it in, but errors out when i do