diablosbud
Member
Basically, what I am doing for my game is rewriting my custom gameover so that it has a sweet new respawn system, built into it. I need to make it call a common event, and make a penalty for each choice. I have put the choices together properly, but I am having a problem with the penalties, I do not know how to call a common event through script (this will be used for making the penalties), and I do not know how to make the player respawn without him dying instantly on the map. Also I need some help with the penalties I need to take all the held gold away from party (is 9999999 gold the max because I may be able to do this with events), I need to know how to take off a percentage of a specific actor's EXP with a script (this is 10% of the EXP for this level, and this cannot decrease levels), and how to randomly select a random slot of equipment the certain actor has equipped, and delete that piece of equipment from the player. I know this is quite a bit, but not all of it is hard, pretty much only the equipment penalty. Could someone please help me put this together? Sorry if the gameover menu is a bit confusing, it's my own script, built with command_rotate, a cool different way of displaying options.
I am also using Guillame777's Multi-Slot Equipment, here are the 4 scripts:
Code:
#===============================================================================
# Game Over Menu Script V1.0 ~By Diablosbud~
#-------------------------------------------------------------------------------
# Make your Gameover screen easier to use, and cooler with this script I made
# for Command_Rotate. This script allows the player, on Gameover to choose if
# they would like to "Load Game" or "Exit Game". A special feature has been added
# to the "Exit Game" choice, now you can either exit to the titlescreen or
# shutdown the game (This is an edit of LordSmith's Gameover Menu re-made with
# Command_Rotate to make it much cooler). Many features about this are customizable
# too, such as font, font size, disabled item color, etc.
#
# Requirements:
# -Command_Rotate script
# -This script
#
# Compatibility:
# -I am unsure yet if this script is compatible with the SDK
#
# Credit
# -Diablosbud
# -KHMP
# -LordSmith
#===============================================================================
#=========================================================
# Command_Rotate
#---------------------------------------------------------
#
# Created by LordSith
# email: lordsith@globetrotter.net
# Version: 1.1
# Date: 2007-06-08
#---------------------------------------------------------
#
#=========================================================
#==============================================================================
# ** Sprite_Text
#------------------------------------------------------------------------------
# This class draws text on the screen without the need of a window.
#==============================================================================
class Sprite_Text
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :sprite, # The sprite used to draw.
:vx, # The velocity in the x direction.
:vy # The velocity in the y direction.
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(text = 'nil', size = 50, font = 'Times New Roman', disabled = false,
disabledcolor = Color.new(255, 255, 255, 108),
vx = 0, vy = 0)
# Turn the text into a string even if it already is a string.
text = text.to_s
# Create the sprite that will allow drawing.
@sprite = Sprite.new
@sprite.bitmap = Bitmap.new(1,1)
# Initialize the sprite's bitmap's font properties.
@sprite.bitmap.font.name = font
@sprite.bitmap.font.size = size
# Find out the size of the text so the sprite doesn't waste empty space.
lx = @sprite.bitmap.text_size(text).width
ly = @sprite.bitmap.text_size(text).height
# Initialize the velocity vector
@vx, @vy = vx, vy
# The offset of the shadow for the text.
shadow = 1
# Reinitialize the bitmap with the proper size.
@sprite.bitmap = Bitmap.new(lx + shadow, ly + shadow)
# Make the z outstanding.
@sprite.z = 5000
@sprite.x = @x = 320.0
@sprite.y = @y = 240.0
# Draw the shadow first.
@sprite.bitmap.font.color = Color.new(0,0,0,255)
@sprite.bitmap.draw_text(Rect.new(shadow, shadow, lx + shadow,ly + shadow),
text, 0)
# If the sprite is disabled change the text color appropriately.
@sprite.bitmap.font.color = disabled ? disabledcolor :
Color.new(255,255,255,255) # White if not disabled.
# Draw the text onto the bitmap finally.
@sprite.bitmap.draw_text(Rect.new(0, 0, lx, ly), text)
end
#--------------------------------------------------------------------------
# * Defining X, Y
#--------------------------------------------------------------------------
def xy(x, y)
@x = x
@y = y
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
angle = Math.atan2(@vx,@vy)
vx = 2 * Math.sin(angle)
vy = 2 * Math.cos(angle)
@x += vx
@y += vy
@sprite.x = @x
@sprite.y = @y
@sprite.opacity -= 4
if @x > 640 or @x < 0 or @y > 480 or @y < 0 or @sprite.opacity <= 0
@sprite.bitmap.dispose unless @sprite.bitmap.disposed?
@sprite.dispose unless @sprite.disposed?
return true
end
return false
end
#--------------------------------------------------------------------------
# * Disposal
#--------------------------------------------------------------------------
def dispose
@sprite.bitmap.dispose unless @sprite.bitmap.disposed?
@sprite.dispose unless @sprite.disposed?
end
end
def coords(x=0,y="")
if y.is_a?(String)
if x==0
x=$game_player.screen_x
y=$game_player.screen_y
else
y=$game_map.events[x].screen_y
x=$game_map.events[x].screen_x
end
return [x,y]
elsif x.is_a?(String)
if y == 0
x = $game_player.screen_x
y = $game_player.screen_y
else
x = $game_map.events[y].screen_x
y = $game_map.events[y].screen_y
end
return [x,y]
end
return [x,y]
end
def angle(x1,y1,x2,y2)
return 180*Math.atan2(x2-x1,y2-y1)/Math::PI
end
def ecart(id1,id2=0,y1="",y2="")
x1=coords(id1,y1).at(0)
y1=coords(id1,y1).at(1)
x2=coords(id2,y2).at(0)
y2=coords(id2,y2).at(1)
return ((x1-x2)**2 + (y1-y2)**2)**0.5
end
#==============================================================================
# ** Command_Rotate
#------------------------------------------------------------------------------
# This class presents options in circuitous manner.
#==============================================================================
class Command_Rotate
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(choices, x = 400, y = 240, ray = 200, choices0 = 0,
size = 50, font = 'Times New Roman', disabled_items = nil,
disabledcolor = Color.new(255, 255, 255, 108))
# By default visible.
@visible = true
@text_sprites = []
@positions = []
@options = choices
@disabledcolor = disabledcolor
@ray = ray
@angle = 0
@disabled_items = disabled_items
@x, @y = coords(x, y)
n = 0
for choice in choices
# Don't check for disabled items if it's nil.
if !disabled_items.nil? && disabled_items.include?(n)
text_sprite = Sprite_Text.new(choice, size, font, true, @disabledcolor)
else
text_sprite = Sprite_Text.new(choice, size, font)
end
text_sprite.sprite.ox = text_sprite.sprite.bitmap.width / 2
text_sprite.sprite.oy = text_sprite.sprite.bitmap.height / 2
teta = n * 360 / choices.size
@text_sprites << text_sprite
@positions << teta
@delay=0
n+=1
end
@angle = (@options.size-choices0) * 2 * Math::PI / @options.size
@selected = @options[choices0]
@index_self = 0
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@angle -= (@angle - (@options.size - @index_self) * 2 * Math::PI /
@options.size) / 8
i = 0
@text_sprites.each do |text_sprite|
a = @positions.at(i) * Math::PI / 180
text_sprite.sprite.x = 0
text_sprite.sprite.x += @x
text_sprite.sprite.y = @ray * Math.sin(a + @angle) / 2
text_sprite.sprite.y+=@y
text_sprite.sprite.zoom_x = text_sprite.sprite.zoom_y = (Math.cos(a + @angle) + 3) / 4
text_sprite.sprite.opacity = (1 + Math.cos(a + @angle)) * 255 / 2
i += 1
end
@delay-=1
if @delay<=0
if Input.trigger?(Input::DOWN) or Input.trigger?(Input::RIGHT)
@index_self += 1
@selected = @options[@index_self % @text_sprites.size]
@index = @options.index(@selected)
end
if Input.trigger?(Input::UP) or Input.trigger?(Input::LEFT)
@index_self -= 1
@selected = @options[@index_self % @text_sprites.size]
@index = @options.index(@selected)
end
@delay=1
end
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
@text_sprites.each {|sprite| sprite.dispose}
end
#--------------------------------------------------------------------------
# * Visible
#--------------------------------------------------------------------------
def visible=(visible)
return if @visible == visible
@visible = visible
@text_sprites[@options.index(@selected)].sprite.visible = @visible
end
#--------------------------------------------------------------------------
# * Visible Accessor
#--------------------------------------------------------------------------
def visible
return @visible
end
end
#==============================================================================
# ** Scene_Gameover
#------------------------------------------------------------------------------
# This class performs game over screen processing.
#==============================================================================
class Scene_Gameover
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# By default we assume there are no save games.
@continue_enabled = false
# Loop through the possible save indexes and determine if a save exist.
#for i in 0..3
#if FileTest.exist?("Save#{i+1}.rxdata")
#@continue_enabled = true
#end
#end
@continue_enabled = (0...CPSL::Save_number).any? {|i|FileTest.exist?(CPSL.make_savename(i))}
# The possible options to select.
s1 = 'Loose 10% of Experience'
s2 = 'Loose all Held Illyum'
s3 = 'Loose all in Inventory (non-quest)'
s4 = 'Loose a Piece of Equipment'
s5 = 'Exit Game'
# Creating a command rotate object.
@commands1 = Command_Rotate.new([s1, s2, s3, s4, s5], # Possible options
320, # X Starting point
380, # Y Starting point
100, # Ray to rotate around?
0, # Starting choice
40, # Font size to use
'Times New Roman', # Font name to use
@continue_enabled ? nil : [0], # Disabled items array.
Color.new(255, 0, 0, 108)) # Color of disabled items
# Change the strings to fit the new window.
s1 = 'Load Game'
s2 = 'To Titlescreen'
s3 = 'Shutdown'
# Creating a command rotate object.
@commands2 = Command_Rotate.new([s1, s2, s3], # Possible options
320, # X Starting point
380, # Y Starting point
100, # Ray to rotate around?
0, # Starting choice
40, # Font size to use
'Times New Roman') # Font name to use
@commands2.visible = false
# Make game over graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.gameover($data_system.gameover_name)
# Play game over ME
$game_system.me_play($data_system.gameover_me)
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of Command_Rotate
@commands1.dispose
@commands2.dispose
# Dispose of title graphic
@sprite.bitmap.dispose unless @sprite.bitmap.disposed?
@sprite.dispose unless @sprite.disposed?
end
#--------------------------------------------------------------------------
# Frame Update
#--------------------------------------------------------------------------
def update
# Update Command_Rotate only if it's visible.
@commands1.update if @commands1.visible
@commands2.update if @commands2.visible
# If the initial Command_Rotate is visible.
if @commands1.visible
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @commands1.index
when 0 # Load game
command_experience
when 1 # Exit Game
command_illyum
when 2
command_equipment
when 3
command_inventory
when 4
command_exit
end
end
else
# If the B button was pressed, go back.
if Input.trigger?(Input::B)
@commands1.visible = true
@commands2.visible = false
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @commands2.index
when 0 # Load
command_continue
when 1 # Title
command_to_title
when 2 # Shutdown
command_shutdown
end
end
end
end
#--------------------------------------------------------------------------
# * Command: Experience
#--------------------------------------------------------------------------
def command_experience
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Illyum
#--------------------------------------------------------------------------
def command_illyum
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Equipment
#--------------------------------------------------------------------------
def command_equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Inventory
#--------------------------------------------------------------------------
def command_inventory
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Loadslot.new
end
#--------------------------------------------------------------------------
# Command: Exit
#--------------------------------------------------------------------------
def command_exit
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Alter the viewing of what windows.
@commands1.visible = false
@commands2.visible = true
end
#--------------------------------------------------------------------------
# Command: To Titlescreen
#--------------------------------------------------------------------------
def command_to_title
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = Scene_GYouSure.new
end
#--------------------------------------------------------------------------
# Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = Scene_GYouSure2.new
end
end
I am also using Guillame777's Multi-Slot Equipment, here are the 4 scripts:
Code:
#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 1: Modules
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.2
# 2006/02/14
#==============================================================================
# To change slots of character
# $game_actors[1].weapon_slots = [0,0]
# $game_actors[1].armor_slots = [2,3,4,5,6,7]
#
# To make armor equipable in new slot :
# Add (5) in its name, where 5 is its slot number
# To make 2handed weapons :
# Add an element called 2handed to a weapon
# or, adds its id in TWO_HANDED_WEAPONS = []
# or, adds (2handed) in its name
# To make a weapon double attack
# Add an element called 2attacks to a weapon
# or, adds its id in DOUBLE_ATTACK_WEAPONS = []
# or, adds (2atks) in its name
# To make a weapon/armor cursed
# Adds its id in CURSED_WEAPONS or CURSED_ARMORS, or
# put (cursed) in its name
# To make a weapon require an offhand instead of any weapon
# Adds its id in NEEDS_OFFHAND or
# Adds (needs_offhand) in its name
#==============================================================================
# *** MODULE: Guillaume777's Multi-Slot Module
#------------------------------------------------------------------------------
# This is the configuration module of the Multi-Slot system. It allows you to
# set the default names of your slots, tag your weapons and/or armors for many
# types of enhancements and features, and etc.
#==============================================================================
module G7_MS_MOD
#--------------------------------------------------------------------------
# * Configuration Section
#--------------------------------------------------------------------------
#========Set weapon/armor properties ======================================
CURSED_WEAPONS = [] # ids of weapons to be cursed
CURSED_ARMORS = [] # ids of armors to be cursed
TWO_HANDED_WEAPONS = [2,6,7,8,9,12,13,14,15,16,17,18,26,27,29,31,33,34,36,38,37,39,40,41,48,55,56,67,69,70,71] # ids of 2handed weapons
DOUBLE_ATTACK_WEAPONS = [] # ids of double attack weapons
NEEDS_OFFHAND = [] # ids of weapons requiring an offhand
SWITCH_EQUIP_WEAPONS = [[], []] # ids of weapons switched when equipped
SWITCH_EQUIP_ARMORS = [[], []] # ids of switched armors(same above)
# Use 1 array, first value of array = false item, second value = true item
#
# First value in the above arrays is displayed in the weapons/armors you can
# choose. When the weapon/armor is chosen, the second id value IS the weapon
# or armor that you've chosen. Example: Trick someone to equip a cursed bow.
#=========Set weapon/armor properties with element tagging and name edit===
CURSED_STRING = 'Soul Bound' # put (cursed) in item name for it to be cursed
HANDS_ELEMENT = 'Handed' # no. of hands in front of HANDS_ELEMENT in database
HANDS_STRING = '2-Handed' # name of string in item name like (2handed)
MULTI_ATTACK_ELEMENT = 'Dual Attack' # name of element to tag to multi attacks
# like (2attacks)
MULTI_ATTACK_STRING = 'One-Handed' # string in item name, like (3atks)
NEEDS_OFFHAND_STRING = 'Needs an Offhand' #string in item name if the weapon
#needs an offhand like (needs_offhand)
#=====Set character slots properties =======================================
WEAPON_KINDS = [0] # number of weapons, 0 = weapon
WEAPON_KIND_NAMES = ['Weapon'] # custom name of extra weapon slots
WEAPON_KIND_POWERS = [100, 100] # 100 = normal power, 90 = 90% power
# Leave empty or put nil inside
# if you want the default names.
ARMOR_KINDS = [1,2,3,4,5,6,7,8,9,10]
# 1 = Shield
# 2 = helmet
# 3 = armor
# 4 = acc
# 5 = and more : extra slot
EXTRA_SLOT_NAMES = ['Shoulders','Gloves','Boots','Belt','Ring','Amulet']
# Name of the extra slots in equip window
# You need as many words as there are '5' or more in armor_kinds
# The first order of the slots names reflect the order of the 5 in armor_kinds
# Put (5) or more to in the armor name to have it assigned to the extra slot
#=============Set multi-weapon behavior====================================
IGNORE_OFFHAND = false # ignore off_hand support
TWOHANDED_IN_OFFHAND = true # If false don't show two handed weapons in
# the offhand window
ALL_WEAPONS_FOR_SKILLS = true # true = combined pwr of all weaps for skills
# false = only power of first weapon
SHIELD_HAND_SLOT = 1 # slot number to be used for shield hand
WEAPON_SHIELD_SHARE = false # if true, can't use a shield and a second
# weapon at the same time
SHIELD_HAND_WIELD = true # true = can use shield hand for 2handed weap.
WEAPON_HAND_WIELD = true # true = can use weapon hand for 2handed weap.
MULTI_WEAPONS_PENALITY = 0 # percent of atk that will be subtracted if
# you use two weapons at the same time.
#============Set appearance properties ====================================
FONT_NAME = 'Times New Roman' # Font to use
CURSED_COLOR = Color.new(255, 50, 50) # Color of cursed equiped items
SHOW_REMOVE = false # Show empty in offhand window
WINDOWS_STRETCH = true # true : equip_right stretch to adjust to # of slots
MAX_SHOW_SLOTS = 6 # Maximum number of slots in 1 screen in equip right
# window. Useless if windows_stretch = false
HELP_AT_BOTTOM = false # If true, will leave place for help window at bot-
# tom. Useless if you didn't modify the help window
# y-coordinate.
STATUS_WINDOW_ARRANGE = true # If true, you get a new status window.
STATUS_WINDOW_SPACING = 24 # Space between each item in new status window.
EVADE = false # If draw_actor_parameter is configured to
# receive parameter number 7 (evade), then it
# will show in new status window.
# EVADE = true has no effect if STATUS_WINDOW_ARRANGE is false
#================ end of settings =========================================
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super
RPG.set_new_item_types #fix armor and weapon properties at start of game
end
#--------------------------------------------------------------------------
# * End of MODULE: Guillaume777's Multi-Slot Module
#--------------------------------------------------------------------------
end
#============================================================================
# ** MODULE: RPG Module
#----------------------------------------------------------------------------
# This sprite is used as an arrow cursor for the battle screen. This class
# is used as a superclass for the Arrow_Enemy and Arrow_Actor classes.
#============================================================================
module RPG
#--------------------------------------------------------------------------
# * Set New Item Types
#--------------------------------------------------------------------------
def RPG.set_new_item_types
if @initialized_item_types then return end
for armor in $data_armors # for each armor
unless armor == nil # if armor
armor.set_adv_type # set new type
armor.set_cursed # set if item is cursed or not
end
end
for weapon in $data_weapons # for each armor
unless weapon == nil # if armor
weapon.set_needs_offhand # set if it needs an offhand or not
weapon.set_nb_hands # set the number of hands to wield it
weapon.set_nb_attacks # set the number of attacks it can do
weapon.set_cursed # set if item is cursed or not
end
end
@initialized_item_types = true
end
#--------------------------------------------------------------------------
# * Initialized Item Types
# bool : boolean value (true/false)
#--------------------------------------------------------------------------
def RPG.initialized_item_types=(bool)
@initialized_item_types = bool
end
#==========================================================================
# ** Armor
#--------------------------------------------------------------------------
# Data class for armors, adds new armor types
#==========================================================================
class Armor
attr_accessor :cursed
#------------------------------------------------------------------------
# * Set Adv Type
#------------------------------------------------------------------------
def set_adv_type
pattern = /\((\d+)\)/
if @name.sub!(pattern, '') != nil
# Set kind to the number in name of armor
@kind = $1.to_i - 1
end
end
#------------------------------------------------------------------------
# * Set Cursed
#------------------------------------------------------------------------
def set_cursed
pattern = '('+G7_MS_MOD::CURSED_STRING+')'
if @name.sub!(pattern, '') != nil then cursed = true end
if G7_MS_MOD::CURSED_ARMORS.include?(@id) then cursed = true end
@cursed = cursed
end
#------------------------------------------------------------------------
# * End of Armor Class
#------------------------------------------------------------------------
end
#==========================================================================
# ** Weapon
#--------------------------------------------------------------------------
# Data class for weapons, adds new weapon types
#==========================================================================
class Weapon
#------------------------------------------------------------------------
# * Public Instance Variables
#------------------------------------------------------------------------
attr_accessor :needs_offhand # does it need an offhand weapon
attr_accessor :nb_hands # numbers of hands it requires
attr_accessor :nb_attacks # number of attacks it can do
attr_accessor :cursed # true if item is cursed
#------------------------------------------------------------------------
# * Set Cursed
#------------------------------------------------------------------------
def set_cursed
pattern = '('+G7_MS_MOD::CURSED_STRING+')'
if @name.sub!(pattern, '') != nil then cursed = true end
if G7_MS_MOD::CURSED_WEAPONS.include?(@id) then cursed = true end
@cursed = cursed
end
#------------------------------------------------------------------------
# * Set Needs OffHand
#------------------------------------------------------------------------
def set_needs_offhand
pattern = '('+G7_MS_MOD::NEEDS_OFFHAND_STRING+')'
if @name.sub!(pattern, '') != nil then
@needs_offhand = true
elsif G7_MS_MOD::NEEDS_OFFHAND.include?(self.id) then
@needs_offhand = true
elsif @needs_offhand== nil then
@needs_offhand = false
end
end
#------------------------------------------------------------------------
# * Returns number of hands needed for weapons
#------------------------------------------------------------------------
def set_nb_hands
if G7_MS_MOD::TWO_HANDED_WEAPONS.include?(self.id) then
nb_hands = 2
end
pattern = /\((\d+)#{G7_MS_MOD::HANDS_STRING}\)/
if @name.sub!(pattern, '') != nil
nb_hands = $1.downcase.delete('a-z')
nb_hands = $1.to_i
end
# Search through the elements
for elementnb in self.element_set
elementname = $data_system.elements[elementnb].downcase
# If the weapon has an element for another attack
if elementname.delete('0-9') == G7_MS_MOD::HANDS_ELEMENT.downcase
# Get the number of attacks
elementname = elementname.delete('a-z')
if elementname != '' then
nb_hands = elementname.to_i
# Delete the element
self.element_set.delete(elementnb)
end
end
end
if nb_hands.is_a?(Integer) == false or nb_hands <= 0 then nb_hands = 1 end
@nb_hands = nb_hands
end
#------------------------------------------------------------------------
# * Returns the number of attack the weapon can do
#------------------------------------------------------------------------
def set_nb_attacks
if G7_MS_MOD::DOUBLE_ATTACK_WEAPONS.include?(self.id) then
nb_attacks = 2
else
nb_attacks = 1
end
pattern = /\((\d+)#{G7_MS_MOD::MULTI_ATTACK_STRING}\)/
if @name.sub!(pattern, '') != nil
nb_attacks = $1.downcase.delete('a-z')
nb_attacks = $1.to_i
end
# Search elements that could add more attacks
for elementnb in self.element_set
elementname = $data_system.elements[elementnb].downcase
# If the weapon has an element for another attack
if elementname.delete('0-9') == G7_MS_MOD::MULTI_ATTACK_ELEMENT.downcase
# Get the number of attacks
elementname = elementname.delete('a-z')
if elementname != '' then
nb_attacks = elementname.to_i
# Delete the element
self.element_set.delete(elementnb)
end
end
end
if nb_attacks.is_a?(Integer) == false or nb_attacks <= 0 then nb_attacks = 1 end
@nb_attacks = nb_attacks
end
#------------------------------------------------------------------------
# * End of CLASS: Weapon
#------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# * End of MODULE: RPG Module
#--------------------------------------------------------------------------
end