[XP] Attack without Weapon and personal ATK/PDEF/MDEF/EVA statistics (v0.2)

Started by PrinceEndymion88, March 12, 2017, 08:42:30 am

Previous topic - Next topic

PrinceEndymion88

Attack without Weapon and personal ATK/PDEF/MDEF/EVA statistics
Authors: PrinceEndymion88
Version: 0.2
Type: More Actor Base Stats
Key Term: Actor Add-on



Introduction

This script was created for those who want to add in their project the possibility to have a base attack, physical defense, magical defense, and evasion. So your hero, for example, can attack without a weapon and can defend himself without armor.


Features


  • You can customize your hero base attack power

  • You can customize your hero base phisical defence

  • You can customize your hero base magical defence

  • You can customize your hero base evasion

  • You can select a personal animation for the attack without weapon or you can choose a default one.





Updates
v0.2

  • Now you could define a default base attack value, a default phisical defence value, a default magical defence value and a default evasion value for those heroes which haven't a personalized value for the calculation of statistics.





Screenshots

None.


Demo

http://sailormoonanotherstory2.altervista.org/attack-without-weapon-and-personal-atkpdefmdefeva-statistics/


Script

v0.2
Spoiler: ShowHide

##Attack without Weapon and personal ATK/PDEF/MDEF/EVA statistics
##Created by PrinceEndymion88
##http://sailormoonanotherstory2.altervista.org
##version 0.2
##Thanks to ValentinoAvon for his base script

#{ID_HERO => ID ANIMATION}
#Instruction:
#First of all copy the script above Main
#This define the animation displayed when an hero have no weapon assigned.
#For example, if you want to assign the animation 386 at hero 1 you have to insert 1=>386
#You have to use comma to separe every personal animation.
#For example ANIMATION_NO_WEAPON = {1=>386, 2=>300, 3=>150}
#Istruzioni:
#Prima di tutto copiare lo script sopra Main
#Questa parte definisce l'animazione visualizzata quando un eroe attacca e non ha un'arma assegnata.
#Per esempio, se vuoi assegnare l'animazione 386 all'eroe 1 dovrai inserire 1=>386
#Devi usare la virgola per separare ogni animazione personalizzata
#Per esempio ANIMATION_NO_WEAPON = {1=>386, 2=>300, 3=>150}
ANIMATION_NO_WEAPON = {1=>10, 5=>11}

#Here you can define the default animation for the heroes which have no animation assigned.
#Qui potrai definire l'animazione personalizzata per gli eroi che non ne hanno una assegnata
ANIMATION_NO_WEAPON_DEFAULT = 12

#Here you have to insert the multiplier for your personal statistics.
#ATK, PDEF, MDEF and EVA will be calculated with the following formula:
#ATK= HERO_LEVEL * MULTIPLIER_ATK (for example if your hero level is 25 and your MULTIPLIER_ATK is 2, at level 25 your hero will have a base attack = 50)
#PDEF = HERO_LEVEL * MULTIPLIER_PDEF (for example if your hero level is 25 and your MULTIPLIER_PDEF is 3, at level 25 your hero will have a base phisical defence = 75)
#MDEF = HERO_LEVEL * MULTIPLIER_MDEF (for example if your hero level is 25 and your MULTIPLIER_MDEF is 2, at level 25 your hero will have a base magical defence = 50)
#EVA = HERO_LEVEL * MULTIPLIER_EVA (for example if your hero level is 25 and your MULTIPLIER_EVA is 4, at level 25 your hero will have a base evasion = 100)
#Naturally if you equip your hero with weapons or armor, statistics will be summet to base statistics (base statistics + additional statistics)
#Qui dovrai inserire i moltiplicatori per le tue statistiche personali
#Attacco (ATK), Difesa fisica (PDEF), Difesa magica (MDEF) ed evasione (EVA) verranno calcolate con la formula seguente:
#ATK= HERO_LEVEL * MULTIPLIER_ATK (per esempio se il tuo eroe è al livello 25 e il valore MULTIPLIER_ATK è 2, al livello 25 avrà un attacco base pari a = 50)
#PDEF = HERO_LEVEL * MULTIPLIER_PDEF (per esempio se il tuo eroe è al livello 25 e il valore MULTIPLIER_PDEF è 3, al livello 25 avrà una difesa fisica pari a = 75)
#MDEF = HERO_LEVEL * MULTIPLIER_MDEF (per esempio se il tuo eroe è al livello 25 e il valore MULTIPLIER_MDEF è 2, al livello 25 avrà una difesa magica pari a = 50)
#EVA = HERO_LEVEL * MULTIPLIER_EVA (per esempio se il tuo eroe è al livello 25 e il valore MULTIPLIER_EVA è 4, al livello 25 avrà un valore di evasione pari a = 100)
#Naturalmente se equipaggerai il tuo eroe con armi o armature le statistiche verranno sommate a quelle base
MULTIPLIER_ATK =  {1=>2, 5=>3}
MULTIPLIER_PDEF =  {1=>3, 5=>2}
MULTIPLIER_MDEF = {1=>2, 5=>3}
MULTIPLIER_EVA =  {1=>4, 5=>5}
#In base puoi definire un valore di attacco di base, un valore di difesa fisica di base, un valore di difesa magica di base e un valore di evasione di base per quegli
#eroi che non hanno alcun valore personalizzato per il calcolo delle statistiche
#Below you could define a default base attack value, a default phisical defence value, a default magical defence value and a default evasion value for those heroes
#which haven't a personalized value for the calculation of statistics.
MULTIPLIER_ATK_DEF = 5
MULTIPLIER_PDEF_DEF = 5
MULTIPLIER_MDEF_DEF = 5
MULTIPLIER_EVA_DEF = 5

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Define Attack Power with and without weapon
#--------------------------------------------------------------------------

  def base_atk
    n = 0
    weapon = $data_weapons[@weapon_id]
    n += weapon.atk if weapon != nil
if MULTIPLIER_ATK[@actor_id] != nil
    n += (@level *MULTIPLIER_ATK[@actor_id])
else
n += (@level * MULTIPLIER_ATK_DEF)
end
    return n
  end
  alias personal_animation2_id animation2_id
   def animation2_id
    weapon = $data_weapons[@weapon_id]
  if ANIMATION_NO_WEAPON[@actor_id] != nil
    return ANIMATION_NO_WEAPON[@actor_id] if weapon == nil
  else
    return ANIMATION_NO_WEAPON_DEFAULT if weapon == nil
  end
    personal_animation2_id
  end
 
#--------------------------------------------------------------------------
# * Define Physical Defense with and without weapon/armor
#--------------------------------------------------------------------------
  def base_pdef
n = 0
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    pdef1 = weapon
    pdef2 = armor1 != nil ? armor1.pdef : 0
    pdef3 = armor2 != nil ? armor2.pdef : 0
    pdef4 = armor3 != nil ? armor3.pdef : 0
    pdef5 = armor4 != nil ? armor4.pdef : 0
    n += weapon.pdef if weapon != nil
if MULTIPLIER_PDEF[@actor_id] != nil
    n += (@level *MULTIPLIER_PDEF[@actor_id])
else
n += MULTIPLIER_PDEF_DEF
end
return n + pdef2 + pdef3 + pdef4 + pdef5
  end
 
#--------------------------------------------------------------------------
# * Define Magic Defense with and without weapon/armor
#--------------------------------------------------------------------------
  def base_mdef
n = 0
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    mdef1 = weapon
    mdef2 = armor1 != nil ? armor1.mdef : 0
    mdef3 = armor2 != nil ? armor2.mdef : 0
    mdef4 = armor3 != nil ? armor3.mdef : 0
    mdef5 = armor4 != nil ? armor4.mdef : 0
n += weapon.mdef if weapon != nil
if MULTIPLIER_MDEF[@actor_id] != nil
    n += (@level *MULTIPLIER_MDEF[@actor_id])
else
n += MULTIPLIER_MDEF_DEF
end
    return n + mdef2 + mdef3 + mdef4 + mdef5
  end
 
#--------------------------------------------------------------------------
# * Define Evasion Correction with and without armor
#--------------------------------------------------------------------------
  def base_eva
n = 0
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    eva1 = armor1 != nil ? armor1.eva : 0
    eva2 = armor2 != nil ? armor2.eva : 0
    eva3 = armor3 != nil ? armor3.eva : 0
    eva4 = armor4 != nil ? armor4.eva : 0
if MULTIPLIER_EVA[@actor_id] != nil
    n += (@level *MULTIPLIER_EVA[@actor_id])
else
n += MULTIPLIER_EVA_DEF
end
    return n + eva1 + eva2 + eva3 + eva4
  end
end

v0.1
Spoiler: ShowHide

##Attack without Weapon and personal ATK/PDEF/MDEF/EVA statistics
##Created by PrinceEndymion88
##http://sailormoonanotherstory2.altervista.org
##version 0.1
##Thanks to ValentinoAvon for his base script

#{ID_HERO => ID ANIMATION}
#Instruction:
#First of all copy the script above Main
#This define the animation displayed when an hero have no weapon assigned.
#For example, if you want to assign the animation 386 at hero 1 you have to insert 1=>386
#You have to use comma to separe every personal animation.
#For example ANIMATION_NO_WEAPON = {1=>386, 2=>300, 3=>150}
ANIMATION_NO_WEAPON = {1=>10}

#Here you can define the default animation for the heroes which have no animation assigned.
ANIMATION_NO_WEAPON_DEFAULT = 11

#Here you have to insert the multiplier for your personal. Statistics.
#ATK, PDEF, MDEF and EVA will be calculated with the following formula:
#ATK= HERO_LEVEL * MULTIPLIER_ATK (for example if your hero level is 25 and your MULTIPLIER_ATK is 2, at level 25 your hero will have a base attack = 50)
#PDEF = HERO_LEVEL * MULTIPLIER_PDEF (for example if your hero level is 25 and your MULTIPLIER_PDEF is 3, at level 25 your hero will have a base phisical defence = 75)
#MDEF = HERO_LEVEL * MULTIPLIER_MDEF (for example if your hero level is 25 and your MULTIPLIER_MDEF is 2, at level 25 your hero will have a base magical defence = 50)
#EVA = HERO_LEVEL * MULTIPLIER_EVA (for example if your hero level is 25 and your MULTIPLIER_EVA is 4, at level 25 your hero will have a base evasion = 100)
#Naturally if you equip your hero with weapons or armor you have to sum base statistics + additional statistics
MULTIPLIER_ATK =  {1=>2}
MULTIPLIER_PDEF =  {1=>3}
MULTIPLIER_MDEF = {1=>2}
MULTIPLIER_EVA =  {1=>4}

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Define Attack Power with and without weapon
#--------------------------------------------------------------------------

  def base_atk
    n = 0
    weapon = $data_weapons[@weapon_id]
    n += weapon.atk if weapon != nil
    n += (@level *MULTIPLIER_ATK[@actor_id])
    return n
  end
  alias personal_animation2_id animation2_id
   def animation2_id
    weapon = $data_weapons[@weapon_id]
  if ANIMATION_NO_WEAPON[@actor_id] != nil
    return ANIMATION_NO_WEAPON[@actor_id] if weapon == nil
  else
    return ANIMATION_NO_WEAPON_DEFAULT if weapon == nil
  end
    personal_animation2_id
  end
 
#--------------------------------------------------------------------------
# * Define Physical Defense with and without weapon/armor
#--------------------------------------------------------------------------
  def base_pdef
n = 0
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    pdef1 = weapon
    pdef2 = armor1 != nil ? armor1.pdef : 0
    pdef3 = armor2 != nil ? armor2.pdef : 0
    pdef4 = armor3 != nil ? armor3.pdef : 0
    pdef5 = armor4 != nil ? armor4.pdef : 0
    n += weapon.pdef if weapon != nil
    n += (@level *MULTIPLIER_PDEF[@actor_id])
return n + pdef2 + pdef3 + pdef4 + pdef5
  end
 
#--------------------------------------------------------------------------
# * Define Magic Defense with and without weapon/armor
#--------------------------------------------------------------------------
  def base_mdef
n = 0
    weapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    mdef1 = weapon
    mdef2 = armor1 != nil ? armor1.mdef : 0
    mdef3 = armor2 != nil ? armor2.mdef : 0
    mdef4 = armor3 != nil ? armor3.mdef : 0
    mdef5 = armor4 != nil ? armor4.mdef : 0
n += weapon.mdef if weapon != nil
    n += (@level *MULTIPLIER_MDEF[@actor_id])
    return n + mdef2 + mdef3 + mdef4 + mdef5
  end
 
#--------------------------------------------------------------------------
# * Define Evasion Correction with and without armor
#--------------------------------------------------------------------------
  def base_eva
n = 0
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
    eva1 = armor1 != nil ? armor1.eva : 0
    eva2 = armor2 != nil ? armor2.eva : 0
    eva3 = armor3 != nil ? armor3.eva : 0
    eva4 = armor4 != nil ? armor4.eva : 0
    n += (@level *MULTIPLIER_EVA[@actor_id])
    return n + eva1 + eva2 + eva3 + eva4
  end
end



Instructions

Instructions are in the script.


Compatibility

No issue found.


Credits and Thanks


  • ValentinoAvon




Author's Notes
-None-

orochii

Yeah, this is something EB should had made from the start. I think most of the people that start scripting do something about this issue in one way or another heh. I.e. make it based on your strength, dexterity or whatever.

So thanks for sharing. :^)

PrinceEndymion88


KK20

fixes formatting and grammar
You were missing Key Term, which should have been "Actor Add-on". I changed the Type of your script to make it more meaningful.

That's a helluva name for a script lol

I also suggest putting in a default multiplier for actors that are not configured as this will crash the game.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

PrinceEndymion88


PrinceEndymion88

A version 0.2 is available. :) You can see the changelog in the first page