Creating weapons with custom properties (SOLVED)

Joined
Oct 26, 2018
Messages
7
Reaction score
2
First Language
English (AUS)
Primarily Uses
RM2k3
I'm trying to make weapons and armour with custom properties that cannot be defined just by the engine's database, so of course, I'm going to be using scripts. The script is going to read a .txt file and therefore come up with properties such as this:

Code:
[0]
name="Bronze Sword"
might=10
acc=100
crit=-50
strbonus=0
magbonus=0
spdbonus=0
skillbonus=0
luckbonus=0
defbonus=0
resbonus=0
avobonus=0
ddgbonus=10
elements=1,8
eqclass=1,2,3
actoroverride=1
desc="A very basic sword, but it will do."
buy=100
sell=50
icon="Bronzesword.png"
animation=[0,0] #Note: These values point to Attacker Animation and Target Animation respectively.
The first line is the ID, which will use the ID of the standard RMXP weapon, to make it easier to incorporate into the game. But I don't quite know where to start with actually incorporating this data into script to make properties. I know how to read the file and I know how to split it line by line, but I still don't know how and where to use things such as attr_accessor in this case. Can someone give me some pointers?
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
14,301
Reaction score
7,878
First Language
English
Primarily Uses
RMMV

I've moved this thread to Learning Ruby. Please be sure to post your threads in the correct forum next time. Thank you.

 
Joined
Oct 26, 2018
Messages
7
Reaction score
2
First Language
English (AUS)
Primarily Uses
RM2k3
Welp, since no one has helped me yet, I decided to do some of it myself.
Using the help of a Ruby Shell, I managed to get this code:

Ruby:
class Weapon_Extended
  $weapontxt = File.read("Data/weapons.txt")
  $wproperties = $weapontxt.split("\n")
 
  attr_reader :id
  attr_reader :name
  attr_reader :might
  attr_reader :acc
  attr_reader :crit
  attr_reader :strbonus
  attr_reader :magbonus
  attr_reader :spdbonus
  attr_reader :skillbonus
  attr_reader :luckbonus
  attr_reader :defbonus
  attr_reader :resbonus
  attr_reader :avobonus
  attr_reader :ddgbonus
  attr_reader :elements
  attr_reader :eqclass
  attr_reader :actoroverride
  attr_reader :desc
  attr_reader :buy
  attr_reader :sell
  attr_reader :icon
  attr_reader :animation

  def initialize(weaponex_id)
    weaponex = $data_weapons[@weapon_id]
    @id = $data_weapons[@weapon_id]
    @name = ""
    @might = 0
    @acc = 0
    @crit = 0
    @strbonus = 0
    @magbonus = 0
    @spdbonus = 0
    @skillbonus = 0
    @luckbonus = 0
    @defbonus = 0
    @resbonus = 0
    @avobonus = 0
    @ddgbonus = 0
    @elements = []
    @eqclass = []
    @actoroverride = []
    @desc = ""
    @buy = 0
    @sell = 0
    @icon = ""
    @animation = []
  end
 
  def id
    @id = @weapon_id
  end
 
  def name
    @name = $wproperties[(@id-1)*22+1].split("\"")[1]
  end
 
  def might
    tempvar = $wproperties[(@id-1)*22+2].split("=")[1]
    @might = tempvar.to_i
  end
 
  def acc
    tempvar = $wproperties[(@id-1)*22+3].split("=")[1]
    @acc = tempvar.to_i
  end
 
  def crit
    tempvar = $wproperties[(@id-1)*22+4].split("=")[1]
    @crit = tempvar.to_i
  end
 
  def strbonus
    n = $wproperties[(@id-1)*22+5].split("=")[1]
    @strbonus = n.to_i
  end
 
  def magbonus
    n = $wproperties[(@id-1)*22+6].split("=")[1]
    @magbonus = n.to_i
  end
 
  def spdbonus
    n = $wproperties[(@id-1)*22+7].split("=")[1]
    @spdbonus = n.to_i
  end
 
  def skillbonus
    n = $wproperties[(@id-1)*22+8].split("=")[1]
    @skillbonus = n.to_i
  end
 
  def luckbonus
    n = $wproperties[(@id-1)*22+9].split("=")[1]
    @luckbonus = n.to_i
  end
 
  def defbonus
    n = $wproperties[(@id-1)*22+10].split("=")[1]
    @defbonus = n.to_i
  end
 
  def resbonus
    n = $wproperties[(@id-1)*22+11].split("=")[1]
    @resbonus = n.to_i
  end
 
  def avobonus
    n = $wproperties[@id*22+12].split("=")[1]
    @avobonus = n.to_i
  end
 
  def ddgbonus
    n = $wproperties[@id*22+13].split("=")[1]
    @ddgbonus = n.to_i
  end
 
  def elements
    tempvar = $wproperties[@id*22+14].split("=")[1]
    convert = tempvar.split(",")
    i = 0
    array = []
    loop do
      n = convert[i]
      if i == convert.length
        break
      else
        array.push(n.to_i)
        i += 1
      end
    end
    @elements = array
  end
 
  def eqclass
    tempvar = $wproperties[@id*22+15].split("=")[1]
    convert = tempvar.split(",")
    i = 0
    array = []
    loop do
      n = convert[i]
      if i == convert.length
        break
      else
        array.push(n.to_i)
        i += 1
      end
    end
    @eqclass = array
  end
 
  def actoroverride
    tempvar = $wproperties[@id*22+16].split("=")[1]
    convert = tempvar.split(",")
    i = 0
    array = []
    loop do
      n = convert[i]
      if i == convert.length
        break
      else
        array.push(n.to_i)
        i += 1
      end
    end
    @actoroverride = array
  end
 
  def desc
    n = $wproperties[(@id-1)*22+17].split("\"")[1]
    @desc = n
  end
 
  def buy
    n = $wproperties[(@id-1)*22+18].split("=")[1]
    @buy = n
  end
 
  def sell
    n = $wproperties[(@id-1)*22+19].split("=")[1]
    @sell = n
  end
 
  def icon
    n = $wproperties[(@id-1)*22+20].split("\"")[1]
    @icon = n
  end
 
  def animation
    tempvar = $wproperties[@id*22+21].split("=")[1]
    convert = tempvar.split(",")
    i = 0
    array = []
    loop do
      n = convert[i]
      if i == convert.length
        break
      else
        array.push(n.to_i)
        i += 1
      end
    end
    @animation = array
  end

end
Code:
[1]
name="Bronze Sword"
might=10
acc=100
crit=-50
strbonus=0
magbonus=0
spdbonus=0
skillbonus=0
luckbonus=0
defbonus=0
resbonus=0
avobonus=0
ddgbonus=10
elements=1,8
eqclass=1,2,3
actoroverride=1
desc="A very basic sword, but it will do."
buy=100
sell=50
icon="sword.png"
animation=5
For reference:
- The values are based off Fire Emblem mechanics, and the base stats that I have defined are already in the game because I altered the scripts a bit.
- "elements", "eqclass" and "actoroverride" are for Element ID, Class ID and Actor ID, respectively. FYI "eqclass" is for the classes that can wield the weapon and "actoroverride" is for Actors who can wield the weapon regardless of their class.
- The value for animation is the Animation ID.

Here's what I have for now, and I think it's going well. But how exactly should I incorporate this into the game so these weapons are treated as the standard weapons, except with more stats?
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
570
Reaction score
392
First Language
English
Primarily Uses
RMVXA
Is there any particular reason why it needs to be in a .txt file and not, for example, a hash in its own module? I would personally do something like the following:
Ruby:
module WeaponExtension # or whatever name you want to call it

  WEAPONS = {}
  # ^ ^ ^ Make a hash to store all the weapons extra info
  # there are multiple ways to make a hash, but I think this will be easiest to
  # read and copy/paste
 
  WEAPONS[1] = { # Set up another hash for each weapon ID
  # list each bit of data as a hash pair like so:
  # symbol: data,
    name: "Bronze Sword", # each bit of data needs to be followed by a comma
    might: 10,
    acc: 100,
    crit: -50,
    strbonus: 0,
    magbonus: 0,
    spdbonus: 0,
    skillbonus: 0,
    luckbonus: 0,
    defbonus: 0,
    resbonus: 0,
    avobonus: 0,
    ddgbonus: 10,
    elements: [1,8], # if you have multiple numbers, put them in an array [1,2,3],
    eqclass: [1,2,3],
    actoroverride: 1,
    desc: "A very basic sword, but it will do.",
    buy: 100,
    sell: 50,
    icon: "sword.png",
    animation: 5,
  } # don't forget the closing bracket
 
  # and then you just copy and paste each hash and change the info as need be.
end

=begin

Then, to access the information from your module, you do the following:
    WeaponExtension::WEAPONS[1]
to access stuff for weapon 1, the bronze sword

To get, for example, the :spdbonus for weapon 1, you would do the following:
    WeaponExtension::WEAPONS[1][:spdbonus]
In the case of the :spdbonus for weapon 1, this would return 0

Don't forget that each symbol must be called like so   :symbol

=end

Let me know if you need any further explanation about modules and hashes. I'm not exactly sure what reading a file is like in terms of performance, but I think this would be the easier option.

In terms of implementing it in-game, which engine are you using?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,847
Reaction score
5,525
First Language
Indonesian
Primarily Uses
RMVXA
Are you trying to make your game moddable from the outside that you need an external text file so the player does not need RPG Maker editor? If no, just write it inside the script editor is sufficient like what AMN did.
 
Joined
Oct 26, 2018
Messages
7
Reaction score
2
First Language
English (AUS)
Primarily Uses
RM2k3
I was trying to follow the example of Pokemon Essentials, which had the information for all the Pokemon, moves, abilities, etc. stored inside .txt files and scripts that would read this information somehow. I decided that I would replicate that. But hey, the solution you provided looks a lot easier, and definitely more secure (as in, you can't hack it easily without the game engine). I'll give it a go.

EDIT: As for game engine, I'm using RPG Maker XP.

UPDATE: I used A-Moonless-Night's idea, but all it does is crash, with either one of these errors:
Ruby:
WEAPONS[1] = {
    name: "Bronze Sword", #syntax error
    might=> 10 #undefined local variable 'might' for ConquestExeWeapon:Module
}
The former line (syntax error) does not occur in Repl.it's Ruby Shell. This script is probably incompatiable with RPG Maker XP's RGSS...
 
Last edited:

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
570
Reaction score
392
First Language
English
Primarily Uses
RMVXA
You need to either do:
Ruby:
WEAPONS[1] = {
    :might => 10,
}

# OR

WEAPONS[1] = {
    might: 10,
}
If the latter doesn't work, then do the former. It's probably not recognised in the earlier version of Ruby that RGSS uses.

I haven't done much coding with XP, but on first glance, it looks like you should set everything up under RPG::Weapon. Something like so:
Ruby:
module RPG
  class Weapon

    def setup_default_extension_values
      @might = 0 # set up each default value here just in case
    end
    
    def might
      setup_weapon_extension if @might.nil?
      return @might
    end
    
    def setup_weapon_extension
      setup_default_extension_values
      extension = WeaponExtension::WEAPONS
      if extension.key?(@id)
        @might = extension[@id][:might] # give each variable a value according to
        # what is in the hash
      end
    end
    
  end
end
XP doesn't seem to have a neat way of loading all the data at the start, so we do what's called 'lazy loading' and load the information when it's called if it hasn't been loaded before. Hope this puts you in the right direction.
 
Joined
Oct 26, 2018
Messages
7
Reaction score
2
First Language
English (AUS)
Primarily Uses
RM2k3
Huh, seems to be working. I didn't even need to edit the RPG::Weapon Module as it turned out that there was a slight problem with my hash pair syntax anyway (even though I had used the => syntax). No more syntax errors!

Ruby:
# Wrong code:
WEAPONS[1] = {
    might=> 10, #undefined method 'might'. Notive how the colon is missing?
}
#Right code:
WEAPONS[1] = {
    :might=> 10, #Notice the colon before the variable?
}
Now just calling the data is a problem: I used the WeaponExtension::WEAPONS[weapon_id][:stat] snytax to add the weapon's stats to the actor's stats, like so:

Ruby:
  def base_luck
    base = $data_actors[@actor_id].parameters[2, 13]
    final = $data_actors[@actor_id].parameters[2, 14]
    accel = $data_actors[@actor_id].parameters[2, 15]
    growth = (final - base)
    currlevel = @level-1
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    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]
#    luck1 = weapon != nil ? weapon.luck : 0
    luck1 = WeaponExtension::WEAPONS[weapon][:luckbonus]  #This is line 478, where it goes wrong.
#    luck2 = armor1 != nil ? armor1.luck : 0
#    luck3 = armor2 != nil ? armor2.luck : 0
#    luck4 = armor3 != nil ? armor3.luck : 0
#    luck5 = armor4 != nil ? armor4.luck : 0
    return n + luck1
    #+ luck1 + luck2 + luck3 + luck4 + luck5
  end
but now it comes up with this error:

Script 'Game_Actor' line 478: NameError occurred:
uninitialised constant Game_Actor::WeaponExtension

The game is trying to call the weapon's stats from within the Actor class. How do I stop that?
 

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
570
Reaction score
392
First Language
English
Primarily Uses
RMVXA
Can you show me the full script? That will help determine where the error is coming from. Right now, it seems like you've set the hash up somewhere else and not in a module called WeaponExtension, or you've put the module in the wrong place.

Also, you'll probably get an error because you're using the full weapon object here:
Ruby:
luck1 = WeaponExtension::WEAPONS[weapon][:luckbonus]
You should be using the ID of the weapon, so something like:
Ruby:
luck1 = WeaponExtension::WEAPONS[@weapon_id][:luckbonus]
 
Joined
Oct 26, 2018
Messages
7
Reaction score
2
First Language
English (AUS)
Primarily Uses
RM2k3
Ah, just realised that I renamed the module from WeaponExtension to ConquestExeWeapon (My game is called "Conquest.exe")

Aaaaand now it's coming up with a different error, so I'll paste all my code here:
Ruby:
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :name                     # name
  attr_reader   :character_name           # character file name
  attr_reader   :character_hue            # character hue
  attr_reader   :class_id                 # class ID
  attr_reader   :weapon_id                # weapon ID
  attr_reader   :armor1_id                # shield ID
  attr_reader   :armor2_id                # helmet ID
  attr_reader   :armor3_id                # body armor ID
  attr_reader   :armor4_id                # accessory ID
  attr_reader   :level                    # level
  attr_reader   :exp                      # EXP
  attr_reader   :skills                   # skills
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    super()
    setup(actor_id)
  end
  #--------------------------------------------------------------------------
  # * Setup
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def setup(actor_id)
    actor = $data_actors[actor_id]
    @actor_id = actor_id
    @name = actor.name
    @character_name = actor.character_name
    @character_hue = actor.character_hue
    @battler_name = actor.battler_name
    @battler_hue = actor.battler_hue
    @class_id = actor.class_id
    @weapon_id = actor.weapon_id
    @armor1_id = actor.armor1_id
    @armor2_id = actor.armor2_id
    @armor3_id = actor.armor3_id
    @armor4_id = actor.armor4_id
    @level = actor.initial_level
    @exp_list = Array.new(101)
    make_exp_list
    @exp = @exp_list[@level]
    @skills = []
    @hp = maxhp
    @sp = maxsp
    @states = []
    @states_turn = {}
    @maxhp_plus = 0
    @maxsp_plus = 0
    @str_plus = 0
    @dex_plus = 0
    @agi_plus = 0
    @int_plus = 0
    # Learn skill
    for i in 1..@level
      for j in $data_classes[@class_id].learnings
        if j.level == i
          learn_skill(j.skill_id)
        end
      end
    end
    # Update auto state
    update_auto_state(nil, $data_armors[@armor1_id])
    update_auto_state(nil, $data_armors[@armor2_id])
    update_auto_state(nil, $data_armors[@armor3_id])
    update_auto_state(nil, $data_armors[@armor4_id])
  end
  #--------------------------------------------------------------------------
  # * Get Actor ID
  #--------------------------------------------------------------------------
  def id
    return @actor_id
  end
  #--------------------------------------------------------------------------
  # * Get Index
  #--------------------------------------------------------------------------
  def index
    return $game_party.actors.index(self)
  end
  #--------------------------------------------------------------------------
  # * Calculate EXP
  #--------------------------------------------------------------------------
  def make_exp_list
    actor = $data_actors[@actor_id]
    @exp_list[1] = 0
    pow_i = 2.4 + actor.exp_inflation / 100.0
    for i in 2..100
      if i > actor.final_level
        @exp_list[i] = 0
      else
        n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
        @exp_list[i] = @exp_list[i-1] + Integer(n)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Get Element Revision Value
  #     element_id : element ID
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    # Get values corresponding to element effectiveness
    table = [0,200,150,100,50,0,-100]
    result = table[$data_classes[@class_id].element_ranks[element_id]]
    # If this element is protected by armor, then it's reduced by half
    for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
      armor = $data_armors[i]
      if armor != nil and armor.guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # If this element is protected by states, then it's reduced by half
    for i in @states
      if $data_states[i].guard_element_set.include?(element_id)
        result /= 2
      end
    end
    # End Method
    return result
  end
  #--------------------------------------------------------------------------
  # * Get State Effectiveness
  #--------------------------------------------------------------------------
  def state_ranks
    return $data_classes[@class_id].state_ranks
  end
  #--------------------------------------------------------------------------
  # * Determine State Guard
  #     state_id : state ID
  #--------------------------------------------------------------------------
  def state_guard?(state_id)
    for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
      armor = $data_armors[i]
      if armor != nil
        if armor.guard_state_set.include?(state_id)
          return true
        end
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # Attack type and effectiveness:
  #--------------------------------------------------------------------------
  def element_set
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.element_set : [1] #sets attack type to
  end                                     #physical if there's no weapon
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (+)
  #--------------------------------------------------------------------------
  def plus_state_set
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.plus_state_set : []
  end
  #--------------------------------------------------------------------------
  # * Get Normal Attack State Change (-)
  #--------------------------------------------------------------------------
  def minus_state_set
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.minus_state_set : []
  end
  #--------------------------------------------------------------------------
  # * Get Maximum HP
  #--------------------------------------------------------------------------
  def maxhp
    n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
    for i in @states
      n *= $data_states[i].maxhp_rate / 100.0
    end
    n = [[Integer(n), 1].max, 9999].min
    return n
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum HP
  #--------------------------------------------------------------------------
  def base_maxhp
    return $data_actors[@actor_id].parameters[0, @level]
  end
  #--------------------------------------------------------------------------
  # * Get Basic Maximum SP
  #--------------------------------------------------------------------------
  def base_maxsp
    return $data_actors[@actor_id].parameters[1, @level]
  end
  #--------------------------------------------------------------------------
  # * From here, the game will use a mathematical calculation to determine
  #   base stats. Thus you must do the following to define each stat:
  # * Each stat has uses a parameter's levels to determine each stat:
  #   - The first level used is the stat value at Level 1
  #   - The second level used is the stat value at Level 99
  #   - The third level used is the acceleration/growth rate
  # * The following stats use the following levels:
  #   - Strength   uses Levels 1-3   in the STR param
  #   - Magic      uses Levels 4-6   in the STR psram
  #   - Speed      uses Levels 7-9   in the STR param
  #   - Skill      uses Levels 10-12 in the STR param
  #   - Luck       uses Levels 13-15 in the STR param
  #   - Defence    uses Levels 16-18 in the STR param
  #   - Resistance uses Levels 19-21 in the STR param
  # * These comments exist for organisational purposes.
  #--------------------------------------------------------------------------
  # * Get Basic Strength
  #--------------------------------------------------------------------------
  def base_str
    base = $data_actors[@actor_id].parameters[2, 1]
    final = $data_actors[@actor_id].parameters[2, 2]
    accel = $data_actors[@actor_id].parameters[2, 3]
    growth = (final - base)
    currlevel = (@level-1)
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    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]
    n += weapon != nil ? weapon.str_plus : 0
    n += armor1 != nil ? armor1.str_plus : 0
    n += armor2 != nil ? armor2.str_plus : 0
    n += armor3 != nil ? armor3.str_plus : 0
    n += armor4 != nil ? armor4.str_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Skill
  #--------------------------------------------------------------------------
  def base_dex
    base = $data_actors[@actor_id].parameters[2, 10] #base = Str param at lv 1
    final = $data_actors[@actor_id].parameters[2, 11] #base = Str param at lv 2
    accel = $data_actors[@actor_id].parameters[2, 12]
    growth = (final - base)
    currlevel = @level-1
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    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]
    n += weapon != nil ? weapon.dex_plus : 0
    n += armor1 != nil ? armor1.dex_plus : 0
    n += armor2 != nil ? armor2.dex_plus : 0
    n += armor3 != nil ? armor3.dex_plus : 0
    n += armor4 != nil ? armor4.dex_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Speed
  #--------------------------------------------------------------------------
  def base_agi
    base = $data_actors[@actor_id].parameters[2, 7] #base = Str param at lv 1
    final = $data_actors[@actor_id].parameters[2, 8] #base = Str param at lv 2
    accel = $data_actors[@actor_id].parameters[2, 9]
    growth = (final - base)
    currlevel = @level-1
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*20-accela*1)/20
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    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]
    n += weapon != nil ? weapon.agi_plus : 0
    n += armor1 != nil ? armor1.agi_plus : 0
    n += armor2 != nil ? armor2.agi_plus : 0
    n += armor3 != nil ? armor3.agi_plus : 0
    n += armor4 != nil ? armor4.agi_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Get Basic Magic
  #--------------------------------------------------------------------------
  def base_int
    base = $data_actors[@actor_id].parameters[2, 4] #base = Str param at lv 1
    final = $data_actors[@actor_id].parameters[2, 5] #base = Str param at lv 2
    accel = $data_actors[@actor_id].parameters[2, 6]
    growth = (final - base)
    currlevel = @level-1
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*10-accela)/10
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    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]
    n += weapon != nil ? weapon.int_plus : 0
    n += armor1 != nil ? armor1.int_plus : 0
    n += armor2 != nil ? armor2.int_plus : 0
    n += armor3 != nil ? armor3.int_plus : 0
    n += armor4 != nil ? armor4.int_plus : 0
    return [[n, 1].max, 999].min
  end
  #--------------------------------------------------------------------------
  # * Do you use Str or Mag?
  #--------------------------------------------------------------------------
  def actor_atk
    isitmagic = element_set.include?(2) #Is the weapon physical or magical?
    if isitmagic == true then
      return base_int
    else
      return base_str
    end
  end
  #--------------------------------------------------------------------------
  # * Get Basic Attack Power
  #--------------------------------------------------------------------------
  def base_atk
    weapon = $data_weapons[@weapon_id]
    pdef1 = weapon != nil ? weapon.atk : 0 #Defines weapon Might
    pdef2 = actor_atk
    return pdef1 + pdef2 #adds Str/Mag to weapon Might
  end
  #--------------------------------------------------------------------------
  # * Get Basic Defence
  #--------------------------------------------------------------------------
  def base_pdef
    base = $data_actors[@actor_id].parameters[2, 16]
    final = $data_actors[@actor_id].parameters[2, 17]
    accel = $data_actors[@actor_id].parameters[2, 18]
    growth = (final - base)
    currlevel = @level-1
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    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 != nil ? weapon.pdef : 0
    pdef2 = armor1 != nil ? armor1.pdef : 0
    pdef3 = armor2 != nil ? armor2.pdef : 0
    pdef4 = armor3 != nil ? armor3.pdef : 0
    pdef5 = armor4 != nil ? armor4.pdef : 0
    return n + pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  end
  #--------------------------------------------------------------------------
  # * Get Basic Resistance
  #--------------------------------------------------------------------------
  def base_mdef
    base = $data_actors[@actor_id].parameters[2, 19]
    final = $data_actors[@actor_id].parameters[2, 20]
    accel = $data_actors[@actor_id].parameters[2, 21]
    growth = (final - base)
    currlevel = @level-1
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    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 != nil ? weapon.mdef : 0
    mdef2 = armor1 != nil ? armor1.mdef : 0
    mdef3 = armor2 != nil ? armor2.mdef : 0
    mdef4 = armor3 != nil ? armor3.mdef : 0
    mdef5 = armor4 != nil ? armor4.mdef : 0
    return n + mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  end
  #--------------------------------------------------------------------------
  # * Get Basic Luck
  #--------------------------------------------------------------------------
  def base_luck
    base = $data_actors[@actor_id].parameters[2, 13]
    final = $data_actors[@actor_id].parameters[2, 14]
    accel = $data_actors[@actor_id].parameters[2, 15]
    growth = (final - base)
    currlevel = @level-1
    if accel == 5
      n = (((growth)*(currlevel)) + base*98)/98
    elsif accel > 5
      accela = 20+((accel-5)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel-98)**accela)/((currlevel-98)**accelb)
      nb = (98**accela)/(98**accelb)
      n = final - (na/nb)
    else
      accela = 20+((5-accel)*4)
      accelb = (accela*20-accela)/20
      na = growth*((currlevel**accela)/(currlevel**accelb))
      nb = (98**accela)/(98**accelb)
      n = base + (na/nb)
    end
    theweapon = $data_weapons[@weapon_id]
    armor1 = $data_armors[@armor1_id]
    armor2 = $data_armors[@armor2_id]
    armor3 = $data_armors[@armor3_id]
    armor4 = $data_armors[@armor4_id]
#    luck1 = weapon != nil ? weapon.luck : 0
    luck1 = ConquestExeWeapon::WEAPONS[theweapon][:luckbonus] #<-- undefined method '[]' for nil:NilClass
#    luck2 = armor1 != nil ? armor1.luck : 0
#    luck3 = armor2 != nil ? armor2.luck : 0
#    luck4 = armor3 != nil ? armor3.luck : 0
#    luck5 = armor4 != nil ? armor4.luck : 0
    return n + luck1
    #+ luck1 + luck2 + luck3 + luck4 + luck5
  end
  #--------------------------------------------------------------------------
  # * Get Basic Avoid
  #--------------------------------------------------------------------------
  def base_eva
    n = base_agi
    #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]
    eva0 = 0
    #eva0 = weapon != nil ? weapon.eva : 0
    eva1 = armor1 != nil ? armor1.eva : 0
    eva2 = armor2 != nil ? armor2.eva : 0
    eva3 = armor3 != nil ? armor3.eva : 0
    eva4 = armor4 != nil ? armor4.eva : 0
    return n + eva0 + eva1 + eva2 + eva3 + eva4
  end
  #--------------------------------------------------------------------------
  # * Get Basic Hit Rate
  #--------------------------------------------------------------------------
  def base_hit
    n = base_dex
    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]
    hit1 = weapon !=nil ? weapon.hit : 0
    hit2 = armor1 !=nil ? armor1.hit : 0
    hit3 = armor2 !=nil ? armor2.hit : 0
    hit4 = armor3 !=nil ? armor3.hit : 0
    hit5 = armor4 !=nil ? armor4.hit : 0
    return n + hit1 + hit2 + hit3 + hit4 + hit5
  end
  #--------------------------------------------------------------------------
  # * Get Offensive Animation ID for Normal Attacks
  #--------------------------------------------------------------------------
  def animation1_id
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.animation1_id : 0
  end
  #--------------------------------------------------------------------------
  # * Get Target Animation ID for Normal Attacks
  #--------------------------------------------------------------------------
  def animation2_id
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.animation2_id : 0
  end
  #--------------------------------------------------------------------------
  # * Get Class Name
  #--------------------------------------------------------------------------
  def class_name
    return $data_classes[@class_id].name
  end
  #--------------------------------------------------------------------------
  # * Get EXP String
  #--------------------------------------------------------------------------
  def exp_s
    return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
  end
  #--------------------------------------------------------------------------
  # * Get Next Level EXP String
  #--------------------------------------------------------------------------
  def next_exp_s
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
  end
  #--------------------------------------------------------------------------
  # * Get Until Next Level EXP String
  #--------------------------------------------------------------------------
  def next_rest_exp_s
    return @exp_list[@level+1] > 0 ?
      (@exp_list[@level+1] - @exp).to_s : "-------"
  end
  #--------------------------------------------------------------------------
  # * Update Auto State
  #     old_armor : unequipped armor
  #     new_armor : equipped armor
  #--------------------------------------------------------------------------
  def update_auto_state(old_armor, new_armor)
    # Forcefully remove unequipped armor's auto state
    if old_armor != nil and old_armor.auto_state_id != 0
      remove_state(old_armor.auto_state_id, true)
    end
    # Forcefully add unequipped armor's auto state
    if new_armor != nil and new_armor.auto_state_id != 0
      add_state(new_armor.auto_state_id, true)
    end
  end
  #--------------------------------------------------------------------------
  # * Determine Fixed Equipment
  #     equip_type : type of equipment
  #--------------------------------------------------------------------------
  def equip_fix?(equip_type)
    case equip_type
    when 0  # Weapon
      return $data_actors[@actor_id].weapon_fix
    when 1  # Shield
      return $data_actors[@actor_id].armor1_fix
    when 2  # Head
      return $data_actors[@actor_id].armor2_fix
    when 3  # Body
      return $data_actors[@actor_id].armor3_fix
    when 4  # Accessory
      return $data_actors[@actor_id].armor4_fix
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Change Equipment
  #     equip_type : type of equipment
  #     id    : weapon or armor ID (If 0, remove equipment)
  #--------------------------------------------------------------------------
  def equip(equip_type, id)
    case equip_type
    when 0  # Weapon
      if id == 0 or $game_party.weapon_number(id) > 0
        $game_party.gain_weapon(@weapon_id, 1)
        @weapon_id = id
        $game_party.lose_weapon(id, 1)
      end
    when 1  # Shield
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor1_id], $data_armors[id])
        $game_party.gain_armor(@armor1_id, 1)
        @armor1_id = id
        $game_party.lose_armor(id, 1)
      end
    when 2  # Head
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor2_id], $data_armors[id])
        $game_party.gain_armor(@armor2_id, 1)
        @armor2_id = id
        $game_party.lose_armor(id, 1)
      end
    when 3  # Body
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor3_id], $data_armors[id])
        $game_party.gain_armor(@armor3_id, 1)
        @armor3_id = id
        $game_party.lose_armor(id, 1)
      end
    when 4  # Accessory
      if id == 0 or $game_party.armor_number(id) > 0
        update_auto_state($data_armors[@armor4_id], $data_armors[id])
        $game_party.gain_armor(@armor4_id, 1)
        @armor4_id = id
        $game_party.lose_armor(id, 1)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Determine if Equippable
  #     item : item
  #--------------------------------------------------------------------------
  def equippable?(item)
    # If weapon
    if item.is_a?(RPG::Weapon)
      # If included among equippable weapons in current class
      if $data_classes[@class_id].weapon_set.include?(item.id)
        return true
      end
    end
    # If armor
    if item.is_a?(RPG::Armor)
      # If included among equippable armor in current class
      if $data_classes[@class_id].armor_set.include?(item.id)
        return true
      end
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Change EXP
  #     exp : new EXP
  #--------------------------------------------------------------------------
  def exp=(exp)
    @exp = [[exp, 9999999].min, 0].max
    # Level up
    while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
      @level += 1
      # Learn skill
      for j in $data_classes[@class_id].learnings
        if j.level == @level
          learn_skill(j.skill_id)
        end
      end
    end
    # Level down
    while @exp < @exp_list[@level]
      @level -= 1
    end
    # Correction if exceeding current max HP and max SP
    @hp = [@hp, self.maxhp].min
    @sp = [@sp, self.maxsp].min
  end
  #--------------------------------------------------------------------------
  # * Change Level
  #     level : new level
  #--------------------------------------------------------------------------
  def level=(level)
    # Check up and down limits
    level = [[level, $data_actors[@actor_id].final_level].min, 1].max
    # Change EXP
    self.exp = @exp_list[level]
  end
  #--------------------------------------------------------------------------
  # * Learn Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def learn_skill(skill_id)
    if skill_id > 0 and not skill_learn?(skill_id)
      @skills.push(skill_id)
      @skills.sort!
    end
  end
  #--------------------------------------------------------------------------
  # * Forget Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def forget_skill(skill_id)
    @skills.delete(skill_id)
  end
  #--------------------------------------------------------------------------
  # * Determine if Finished Learning Skill
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_learn?(skill_id)
    return @skills.include?(skill_id)
  end
  #--------------------------------------------------------------------------
  # * Determine if Skill can be Used
  #     skill_id : skill ID
  #--------------------------------------------------------------------------
  def skill_can_use?(skill_id)
    if not skill_learn?(skill_id)
      return false
    end
    return super
  end
  #--------------------------------------------------------------------------
  # * Change Name
  #     name : new name
  #--------------------------------------------------------------------------
  def name=(name)
    @name = name
  end
  #--------------------------------------------------------------------------
  # * Change Class ID
  #     class_id : new class ID
  #--------------------------------------------------------------------------
  def class_id=(class_id)
    if $data_classes[class_id] != nil
      @class_id = class_id
      # Remove items that are no longer equippable
      unless equippable?($data_weapons[@weapon_id])
        equip(0, 0)
      end
      unless equippable?($data_armors[@armor1_id])
        equip(1, 0)
      end
      unless equippable?($data_armors[@armor2_id])
        equip(2, 0)
      end
      unless equippable?($data_armors[@armor3_id])
        equip(3, 0)
      end
      unless equippable?($data_armors[@armor4_id])
        equip(4, 0)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Change Graphics
  #     character_name : new character file name
  #     character_hue  : new character hue
  #     battler_name   : new battler file name
  #     battler_hue    : new battler hue
  #--------------------------------------------------------------------------
  def set_graphic(character_name, character_hue, battler_name, battler_hue)
    @character_name = character_name
    @character_hue = character_hue
    @battler_name = battler_name
    @battler_hue = battler_hue
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen X-Coordinate
  #--------------------------------------------------------------------------
  def screen_x
    # Return after calculating x-coordinate by order of members in party
    if self.index != nil
      return self.index * 160 + 80
    else
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Y-Coordinate
  #--------------------------------------------------------------------------
  def screen_y
    return 464
  end
  #--------------------------------------------------------------------------
  # * Get Battle Screen Z-Coordinate
  #--------------------------------------------------------------------------
  def screen_z
    # Return after calculating z-coordinate by order of members in party
    if self.index != nil
      return 4 - self.index
    else
      return 0
    end
  end
end
The complicated formula for the base stats works on its own. Don't worry about that.
Ruby:
#------------------------------------------------------------------------------
# * Weapons Module
# * Credit for this basic Module Script goes to A-Moonless-Night
#------------------------------------------------------------------------------
#=begin
=begin
module RPG
  class Weapon

    def setup_default_extension_values
      @might = 0 # set up each default value here just in case
    end
  
    def might
      setup_weapon_extension if @might.nil?
      return @might
    end
  
    def setup_weapon_extension
      setup_default_extension_values
      extension = WeaponExtension::WEAPONS
      if extension.key?(@id)
        @might = extension[@id][:might] # give each variable a value according to
        # what is in the hash
      end
    end
  
  end
end
=end

module ConquestExeWeapon

  WEAPONS = {}

  WEAPONS[1] = {
    :name=> "Bronze Sword",
    :might=> 10,
    :acc=> 100,
    :crit=> -50,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 0,
    :skillbonus=> 0,
    :luckbonus=> 50,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> 0,
    :ddgbonus=> 25,
    :elements=> [1,8],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "A very basic sword, but it will do.",
    :buy=> 100,
    :sell=> 50,
    :icon=> "sword.png",
    :animation=> 6,
  }

  WEAPONS[2] = {
    :name=> "Iron Sword",
    :might=> 30,
    :acc=> 90,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 0,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> 0,
    :ddgbonus=> 0,
    :elements=> [1,8],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "A common sword.",
    :buy=> 250,
    :sell=> 100,
    :icon=> "sword.png",
    :animation=> 6,
  }
  WEAPONS[3] = {
    :name=> "Steel Sword",
    :might=> 50,
    :acc=> 85,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> -10,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> -5,
    :ddgbonus=> 0,
    :elements=> [1,8],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "This sword is heavy, and reduces your speed.",
    :buy=> 500,
    :sell=> 200,
    :icon=> "sword.png",
    :animation=> 6,
  }
  WEAPONS[4] = {
    :name=> "Silver Sword",
    :might=> 75,
    :acc=> 90,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 0,
    :skillbonus=> -10,
    :luckbonus=> 0,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> 0,
    :ddgbonus=> -5,
    :elements=> [1,8],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "This sword is powerful, but hard to use.",
    :buy=> 1000,
    :sell=> 450,
    :icon=> "sword.png",
    :animation=> 8,
  }
  WEAPONS[5] = {
    :name=> "Brave Sword",
    :might=> 100,
    :acc=> 85,
    :crit=> 10,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 40,
    :skillbonus=> 0,
    :luckbonus=> -10,
    :defbonus=> -25,
    :resbonus=> -25,
    :avobonus=> -10,
    :ddgbonus=> -10,
    :elements=> [1,8],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "Only the most skilled heroes may wield this sword.",
    :buy=> 2500,
    :sell=> 1200,
    :icon=> "sword.png",
    :animation=> 8,
  }
  WEAPONS[6] = {
    :name=> "Brass Katana",
    :might=> 15,
    :acc=> 100,
    :crit=> -50,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 20,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> -15,
    :resbonus=> -15,
    :avobonus=> 5,
    :ddgbonus=> 25,
    :elements=> [1,8,14],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "A basic katana, but it will do.",
    :buy=> 100,
    :sell=> 50,
    :icon=> "katana.png",
    :animation=> 7,
  }
  WEAPONS[7] = {
    :name=> "Iron Katana",
    :might=> 40,
    :acc=> 90,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 20,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> -15,
    :resbonus=> -15,
    :avobonus=> 5,
    :ddgbonus=> 0,
    :elements=> [1,8,14],
    :eqclass=> [1,2,3],
    :actoroverride=> 1,
    :desc=> "Katana weapons increase your speed, but reduce your defences.",
    :buy=> 300,
    :sell=> 120,
    :icon=> "katana.png",
    :animation=> 7,
  }
  WEAPONS[8] = {
    :name=> "Steel Katana",
    :might=> 60,
    :acc=> 80,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 10,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> -15,
    :resbonus=> -15,
    :avobonus=> 0,
    :ddgbonus=> -5,
    :elements=> [1,8,14],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "This katana is powerful, but its weight makes you slow.",
    :buy=> 600,
    :sell=> 250,
    :icon=> "katana.png",
    :animation=> 7,
  }
  WEAPONS[9] = {
    :name=> "Silver Katana",
    :might=> 80,
    :acc=> 90,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 20,
    :skillbonus=> -10,
    :luckbonus=> 0,
    :defbonus=> -20,
    :resbonus=> -20,
    :avobonus=> 0,
    :ddgbonus=> -5,
    :elements=> [1,8,14],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "This katana is powerful, but hard to use.",
    :buy=> 1200,
    :sell=> 500,
    :icon=> "katana.png",
    :animation=> 9,
  }
  WEAPONS[10] = {
    :name=> "Nintendium Katana",
    :might=> 110,
    :acc=> 85,
    :crit=> 10,
    :strbonus=> 0,
    :magbonus=> 20,
    :spdbonus=> 60,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> -30,
    :resbonus=> -30,
    :avobonus=> 10,
    :ddgbonus=> -10,
    :elements=> [1,8,14],
    :eqclass=> [1,2,3],
    :actoroverride=> [1],
    :desc=> "Only the strongest warriors may wield this katana.",
    :buy=> 3000,
    :sell=> 1400,
    :icon=> "katana.png",
    :animation=> 9,
  }
  WEAPONS[11] = {
    :name=> "Rajinto",
    :might=> 90,
    :acc=> 95,
    :crit=> 10,
    :strbonus=> 60,
    :magbonus=> 0,
    :spdbonus=> 30,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> -10,
    :resbonus=> -10,
    :avobonus=> 20,
    :ddgbonus=> 5,
    :elements=> [1,8,14,26,28],
    :eqclass=> [1],
    :actoroverride=> [1,2],
    :desc=> "A divine katana with the power of lightning. It lends its strength to its chosen wielder.",
    :buy=> -9,
    :sell=> -9,
    :icon=> "rajinto1.png",
    :animation=> 1,
  }
  WEAPONS[12] = {
    :name=> "Alpha Yato",
    :might=> 90,
    :acc=> 90,
    :crit=> 15,
    :strbonus=> 30,
    :magbonus=> 30,
    :spdbonus=> 20,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 30,
    :resbonus=> 30,
    :avobonus=> 10,
    :ddgbonus=> 20,
    :elements=> [1,8,26],
    :eqclass=> [1],
    :actoroverride=> [1],
    :desc=> "An awakened Yato that grants power to its Chosen One.",
    :buy=> -9,
    :sell=> -9,
    :icon=> "yato1.png",
    :animation=> 2,
  }
  WEAPONS[13] = {
    :name=> "Seigfried",
    :might=> 85,
    :acc=> 100,
    :crit=> 10,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 0,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 60,
    :resbonus=> 0,
    :avobonus=> 0,
    :ddgbonus=> 10,
    :elements=> [1,8,15,26,33],
    :eqclass=> [1],
    :actoroverride=> [1],
    :desc=> "A divine longsword imbued with the power of night. It lends its vitality to its chosen wielder.",
    :buy=> -9,
    :sell=> -9,
    :icon=> "seigfried1.png",
    :animation=> 3,
  }
  WEAPONS[14] = {
    :name=> "Bronze Lance",
    :might=> 12,
    :acc=> 90,
    :crit=> -50,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 0,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> 0,
    :ddgbonus=> 25,
    :elements=> [1,9],
    :eqclass=> [1],
    :actoroverride=> [1],
    :desc=> "Bronze weapons make it harder to receive crits, but also harder to inflict them.",
    :buy=> 100,
    :sell=> 50,
    :icon=> "lance.png",
    :animation=> 10,
  }
  WEAPONS[15] = {
    :name=> "Iron Lance",
    :might=> 40,
    :acc=> 80,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 0,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> 0,
    :ddgbonus=> 0,
    :elements=> [1,9],
    :eqclass=> [1],
    :actoroverride=> [1],
    :desc=> "A common lance.",
    :buy=> 250,
    :sell=> 100,
    :icon=> "lance.png",
    :animation=> 10,
  }
  WEAPONS[16] = {
    :name=> "Steel Lance",
    :might=> 65,
    :acc=> 75,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> -10,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> -5,
    :ddgbonus=> 0,
    :elements=> [1,9],
    :eqclass=> [1],
    :actoroverride=> [1],
    :desc=> "This lance weighs you down, reducing your speed.",
    :buy=> 500,
    :sell=> 200,
    :icon=> "lance.png",
    :animation=> 10,
  }

end
#=end
=begin

Then, to access the information from your module, you do the following:
    WeaponExtension::WEAPONS[1]
to access stuff for weapon 1, the bronze sword

To get, for example, the :spdbonus for weapon 1, you would do the following:
    WeaponExtension::WEAPONS[1][:spdbonus]
In the case of the :spdbonus for weapon 1, this would return 0

Don't forget that each symbol must be called like so   :symbol

Template:

  WEAPONS[] = {
    :name=> "",
    :might=> ,
    :acc=> ,
    :crit=> ,
    :strbonus=> ,
    :magbonus=> ,
    :spdbonus=> ,
    :skillbonus=> ,
    :luckbonus=> ,
    :defbonus=> ,
    :resbonus=> ,
    :avobonus=> ,
    :ddgbonus=> ,
    :elements=> [],
    :eqclass=> [1],
    :actoroverride=> [1],
    :desc=> "",
    :buy=> ,
    :sell=> ,
    :icon=> ".png"
    :animation=> ,
  }
=end
 
Last edited:

A-Moonless-Night

WINTER IS COMING
Veteran
Joined
Mar 17, 2012
Messages
570
Reaction score
392
First Language
English
Primarily Uses
RMVXA
That's because you're still using the whole weapon object. You just want to use the ID.
Ruby:
luck1 = ConquestExeWeapon::WEAPONS[@weapon_id][:luckbonus]
 
Joined
Oct 26, 2018
Messages
7
Reaction score
2
First Language
English (AUS)
Primarily Uses
RM2k3
Yep, seems to work now. Just thought that the variable "theweapon" had the weapon's ID. Then again, the default syntax was already confusing.

I even set up a nil weapon for if someone does not have a weapon:
Ruby:
  WEAPONS[0] = {
    :name=> "Bare Hands",
    :might=> 0,
    :acc=> 0,
    :crit=> 0,
    :strbonus=> 0,
    :magbonus=> 0,
    :spdbonus=> 0,
    :skillbonus=> 0,
    :luckbonus=> 0,
    :defbonus=> 0,
    :resbonus=> 0,
    :avobonus=> 0,
    :ddgbonus=> 0,
    :elements=> [1],
    :eqclass=> [1,2,3],
    :actoroverride=> [1,2],
    :desc=> "Your bare hands.",
    :buy=> 0,
    :sell=> 0,
    :icon=> "fist.png",
    :animation=> 1,
  }
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

My plan after learning to make my voice girly "Wow! You sounds cute!" "But actually I'm a man!" "Nooooo!!!" hehehe...
I get haunted from bugs that emit a terrible stench after being killed.
At first, I was going to put player objectives on the screen labeling it as "Helpful voices"... But that's dumb, I have a madness system. It will simply whisper objectives.... I mean they're probably objectives. The voices wouldn't lie right? They're friendly, and ...helpful. So clearly you should do what they say. Just watch the dark corners of your screen for advice and it will all work out! :LZSexcite:
Take care of your immune system: Go to sleep. If you looked at the clock an hour ago or four and it was way late then maybe now is the time. Mmm sleep...

Forum statistics

Threads
95,667
Messages
930,911
Members
126,005
Latest member
Rbennin
Top