Lust Dragon
Member
Sorry for disturbing
When i try to merge ccoa side view CBS with Soul Rage Script this error is show up
Script'Soul Rage'Line 808 NoMethodError Occurred
undefined method `index' for nil : NilClass
This is Line 808
if @actor_command_window.index == 1 and Input.press?(Input::RIGHT)
Anyone can tell me what is the problem and solution?
Hope someone can help me
Thanks
ccoa side view cbs link
Soul Rage script
When i try to merge ccoa side view CBS with Soul Rage Script this error is show up
Script'Soul Rage'Line 808 NoMethodError Occurred
undefined method `index' for nil : NilClass
This is Line 808
if @actor_command_window.index == 1 and Input.press?(Input::RIGHT)
Anyone can tell me what is the problem and solution?
Hope someone can help me
Thanks
ccoa side view cbs link
Soul Rage script
Code:
#==============================================================================
# Soul Rage System by Blizzard
# Version 2.2b
# Date: 15.06.2006
#
#
# Compatibility:
#
# 99% chance of full compatibility with SDK, not tested altough. Can cause
# incompatibilty issues with following scripts and/or systems:
# -> Any script, that uses dummy elements
# -> Custom Battle system with HEAVILY modified menu
# -> Limit break systems
# -> Custom Equipment systems (e.g. 2 accessories)
# WILL corrupt your old savegames
#
#
# Features:
#
# - configure your database easily
# - optional gradient bar drawing with 2 different styles
# - contains universal font fix, never ever "I can´t see the letters"
#
# Advantages compared to older versions:
#
# - 40% shorter code
# - heavily increased compatibilty
# - new configurable gradient script
# - moving Soul Rage command in defineable color and a faster animated cursor
# - defineable gradient style
# - extremly simple gradient script, also possible to use it to display other
# stats like HP, SP, EXP, etc.
#
#
# Instructions:
#
# - Explanation:
# This script allows the player equipment to have built-in skills. If enemies
# attack a character a value (the Soul Rage or SR) will be increased. With
# a certain ammount of SR it is possible to perform special skills, that are
# implemented into equipment. Sould Rage is also know as "Ikari skill" from
# "Lufia 2 - Rise of the Sinistrals" for the SNES.
#
# - Configuration:
# Press CRTL+SHIFT+F and type into the window: FIND_THE_DATABASE
# You can jump now to the database directly. There are more instructions.
# Also please configure the following global variable found below:
#
# $SRS_rate - set the filling rate of the SR, 1000 is standard, 500 is 2
# times slower and 2000 would be 2 times faster
# $sr_element - set this variable to the ID of the dummy element use to
# determine if a skill is a SR skill
# $bar_style - set it either to 0 or 1 to use one out of two bar styles
# $RAGE_COLOR - set the values in the () to numbers between 0-255, also note
# that they determine the color ammount in the color like this
# example: (RED, GREEN, BLUE, ALPHA) - note: alpha = opacity
# $DRAW_BAR - set this value to false if you don´t want an SR bar at all
#
#
# Additional info:
#
# If you want to change the value of the SR bar ingame use the "Call script"
# event command and use this syntax:
# $game_actors[X].sr = Y
# X is the ID of the hero in the database and Y the ammount.
# You can also use another syntax:
# starts from 0 and NOT 1. The ammount is shown as 100,0%, this is 1000 S# $game_party.actors[X].sr = Y
# X is the postion of the hero in the party and Y the ammounR.
# e.g. 59,1% would be 591 SR.
#
# Also if you want to use my gradient script, it is the class called "Bitmap"
#
#
# IMPORTANT NOTE:
# DO NOT USE SOUL RAGE SKILLS AS NORMAL SKILLS! THE SYSTEM WORKS WITH TEMPORARY
# LEARNING AND FORGETTING OF THE SOULRAGE SKILL. IF YOU LET YOUR CHARACTER LEARN
# A SOULRAGE SKILL BY NORMAL MEANS, HE WILL FORGET IT AFTER THE NEXT FIGHT! SAME
# GOES FOR USING NORMAL SKILLS AS SOUL RAGE SKILLS! IF YOU WANT TO USE A SKILL
# AS A NORMAL AS WELL AS A SOU RAGE SKILL, JUST MAKE DUPLICATES.
#
#
# If you find any bugs, please report them here:
# http://www.chaosproject.co.nr/index.php?showtopic=54
# or send me an e-mail:
# boris_blizzard@yahoo.de
#
#==============================================================================
$SRS_rate = 5000 # SR bar fill rate
$sr_element = 17 # SR element
$bar_style = 1 # SR bar drawing style (0 or 1)
$RAGE_COLOR = Color.new(240, 0, 0, 255) # Color of the SR command (R, G, B, A)
$DRAW_BAR = true # set to "true" if you want a bar else set it to "false"
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
attr_reader :sr
alias setup_srs_later setup
def setup(actor_id)
setup_srs_later(actor_id)
@sr = 0
end
def sr=(sr)
@sr = sr
@sr = 1000 if @sr > 1000
@sr = 0 if @sr < 0
end
end
#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler
alias skill_can_use_srs_later? skill_can_use?
def skill_can_use?(skill_id)
if $data_skills[skill_id].element_set.include?($sr_element)
if self.is_a? (Game_Actor) and $data_skills[skill_id].sp_cost > self.sr/10
return false
else
return true
end
end
return skill_can_use_srs_later?(skill_id)
end
alias attack_effect_srs_later attack_effect
def attack_effect(attacker)
last_hp = self.hp
save = attack_effect_srs_later(attacker)
if self.damage.is_a?(Numeric) and self.damage > 0 and
self.is_a?(Game_Actor) and self.hp != 0
self.sr += self.damage * $SRS_rate / last_hp
end
if self.is_a?(Game_Actor) and self.dead?
self.sr = 0
end
return save
end
alias skill_effect_srs_later skill_effect
def skill_effect(user, skill)
last_hp = self.hp
save = skill_effect_srs_later(user, skill)
if self.damage.is_a?(Numeric) and self.damage > 0 and
self.is_a?(Game_Actor) and self.hp != 0
self.sr += self.damage * $SRS_rate / last_hp
end
if self.is_a?(Game_Actor) and self.dead?
self.sr = 0
end
return save
end
def elements_correct(element_set)
dummy_elements = [$sr_element]
elements = element_set.clone
if elements == []
return 100
end
multiplier = 0
size = 0
for i in elements
next if dummy_elements.include?(i)
multiplier += self.element_rate(i)
size += 1
end
if size == 0
return 100
end
return multiplier/size
end
end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
def gradient_bar(x, y, w, color1, color2, color3, rate)
rx = color3.red
gx = color3.green
bx = color3.blue
offset = 5
x += offset
y += 27
r = color1.red
g = color1.green
b = color1.blue
r_rate = color2.red - r
g_rate = color2.green - g
b_rate = color2.blue - b
for i in 0...(offset + 3)
fill_rect(x - i, y + i - 2, w + 3, 1, Color.new(0, 0, 0, 192))
end
for i in 0...(offset + 1)
fill_rect(x - i, y + i - 1, w + 1, 1, Color.new(255, 255, 255, 192))
end
for i in 0...offset
red = rx * (offset - 1 - i) / offset
green = gx * (offset - 1 - i) / offset
blue = bx * (offset - 1 - i) / offset
fill_rect(x - i + 1, y + i - 1, w, 1, Color.new(red, green, blue, 192))
end
for i in 0...(w * rate).to_i
for j in 0...offset
case $bar_style
when 0
red = r + r_rate * i / (w * rate)
green = g + g_rate * i / (w * rate)
blue = b + b_rate * i / (w * rate)
when 1
red = r + r_rate * j / offset
green = g + g_rate * j / offset
blue = b + b_rate * j / offset
end
set_pixel(x + i - j + 1, y + j - 1, Color.new(red, green, blue, 192))
end
end
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base < Window
def draw_actor_sr(actor, x, y, w = 148)
w -= 12
rate = actor.sr.to_f / 1000
color1 = Color.new(80, 0, 0, 192)
color2 = Color.new(240, 0, 0, 192)
color3 = Color.new(80, 0, 0, 192)
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
end
def draw_item_name2(item, x, y, color)
if item == nil
return
end
opacity = self.contents.font.color == normal_color ? 255 : 128
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = color
self.contents.draw_text(x + 28, y, 288, 32, item.name)
end
end
#==============================================================================
# Window_SoulRage
#==============================================================================
class Window_SoulRage < Window_Selectable
def initialize(actor)
super(0, 128, 640, 384)
x = 0
y = 0
@skill_id = 0
@skill1 = nil
@skill2 = nil
@skill3 = nil
@skill4 = nil
@skill5 = nil
@column_max = 1
@actor = actor
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def update_actor(actor)
@actor = actor
refresh
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
if @actor != nil
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = 5
if @item_max > 0
self.contents = Bitmap.new(width - 42, row_max * 42)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 24
for i in 0...5
draw_item(i)
end
end
end
end
def draw_item(index)
y = index * 42
case index
when 0
equip = $data_weapons[@actor.weapon_id]
database(@actor.weapon_id, true)
@skill_id1 = @skill_id
when 1
equip = $data_armors[@actor.armor1_id]
database(@actor.armor1_id, false)
@skill_id2 = @skill_id
when 2
equip = $data_armors[@actor.armor2_id]
database(@actor.armor2_id, false)
@skill_id3 = @skill_id
when 3
equip = $data_armors[@actor.armor3_id]
database(@actor.armor3_id, false)
@skill_id4 = @skill_id
when 4
equip = $data_armors[@actor.armor4_id]
database(@actor.armor4_id, false)
@skill_id5 = @skill_id
end
@skill = $data_skills[@skill_id]
if @skill_id != 0
@actor.learn_skill(@skill_id)
end
if @skill_id != 0
if @skill.sp_cost <= @actor.sr / 10
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
rect = Rect.new(x, y, self.width / @column_max - 42, 42)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x+300, y+8, bitmap, Rect.new(0, 0, 24, 24), opacity)
if @actor.skill_can_use?(@skill_id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x+300 + 28, y, 204, 42, @skill.name, 0)
self.contents.draw_text(x+300 + 232, y, 48, 42, @skill.sp_cost.to_s + "%", 2)
sp_cost = @skill.sp_cost
else
if @skill_id == 0
self.contents.font.color = disabled_color
self.contents.draw_text(x+300 + 28, y, 204, 42, "not available", 0)
end
end
if @actor.skill_can_use?(@skill_id)
if @skill_id == 0
color = disabled_color
else
color = normal_color
end
else
color = disabled_color
end
if @actor.equippable?(equip)
draw_item_name2(equip, x+4, y+4, color)
else
self.contents.font.color = disabled_color
self.contents.draw_text(x, y, 288, 42, "Nothing equipped")
end
end
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
def top_row
return self.oy / 42
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 42
end
def page_row_max
return (self.height - 42) / 42
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
self.top_row = row
end
if row > self.top_row + (self.page_row_max - 1)
self.top_row = row - (self.page_row_max - 1)
end
cursor_width = self.width / @column_max - 42
x = @index % @column_max * (cursor_width + 42)
y = @index / @column_max * 42 - self.oy
self.cursor_rect.set(x, y, cursor_width, 42)
end
def skill
case self.index
when 0
return $data_skills[@skill_id1]
when 1
return $data_skills[@skill_id2]
when 2
return $data_skills[@skill_id3]
when 3
return $data_skills[@skill_id4]
when 4
return $data_skills[@skill_id5]
end
end
#===============================================================================
#
# FIND_THE_DATABASE
#
# This is your equipment Soul Rage database. To add a new Soul Rage skill to a
# weapon is very simple. Add another "when"-branch in the script snipplet below
# (they have comments next to it). Configure it like this template:
#
# when WEAPON_ID
# @skill_id = SOULRAGE_SKILL_ID
#
# The same works for armors:
#
# when ARMOR_ID
# @skill_id = SOULRAGE_SKILL_ID
#
# The lines are commented below so you should have no problems with the script.
#
# To determine the percentage of Soul Rage consumed to use a skill, set the SP
# to the percentage. e.g. 33SP would mean 33% of the SoulRage bar. Also add the
# element attribute to your Soul Rage skills, that you have configured as the
# Soul Rage element. If you haven´t done so, read the instructions in the first
# comment at the beginning of this script.
#
#===============================================================================
def database(equip_id, weapon)
@skill_id = 0
if weapon == true
case equip_id
when 6 # WEAPON_ID
@skill_id = 10 # Soul Rage skill ID
when 10
@skill_id = 8
end
else
case equip_id
when 6 # ARMOR_ID
@skill_id = 1 # Soul Rage skill ID
when 18
@skill_id = 25
end
end
end
#===============================================================================
# END_OF_DATABASE
#===============================================================================
end
#==============================================================================
# Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
def refresh
self.contents.clear
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 24
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 160 + 4
draw_actor_sr(actor, actor_x, 74, 120) if $DRAW_BAR == true
draw_actor_sr_no_bar(actor, actor_x, 74, 120) if $DRAW_BAR == false
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 100, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 100)
end
end
end
end
#==============================================================================
# Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
def skill
return @data[self.index]
end
def refresh
for actor in $game_party.actors
unless actor == nil
for i in 0...actor.skills.size
unless @skill == nil
@skill = $data_skills[actor.skills[i]]
for j in 0..actor.skills.size
if @skill.element_set.include?($sr_element)
actor.forget_skill(j)
end
end
end
end
end
end
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil and not skill.element_set.include?($sr_element)
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 24
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
skill = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
sp_cost = skill.sp_cost
end
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# Window_Command
#==============================================================================
class Window_Command < Window_Selectable
attr_accessor :commands
alias initialize_srs_later initialize
def initialize(width, commands)
initialize_srs_later(width, commands)
@SRcommand = "Soul Rage"
end
def swap_commands
temp = @commands[1]
@commands[1] = @SRcommand
@SRcommand = temp
refresh
end
alias refresh_srs_later refresh
def refresh
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size = 18
if @commands[1] == "Soul Rage"
for j in 0...6
self.contents.clear
self.contents.font.color = $RAGE_COLOR
rect = Rect.new(164 - j * 32, 32 * index, self.contents.width - 8, 32)
self.contents.draw_text(rect, @commands[1])
self.contents.font.color = normal_color
for i in 0...@item_max
unless @commands[i] == "Soul Rage"
draw_item(i, normal_color)
end
end
Graphics.update
end
else
refresh_srs_later
if $scene.is_a?(Scene_Battle)
self.contents.font.size += 4
self.contents.draw_text(0, 31, width - 32, 32, "›› ", 2)
self.contents.font.size -= 4
end
end
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias main_srs_later main
def main
main_srs_later
if @rage_window != nil
@rage_window.dispose
end
end
alias update_phase3_srs_later update_phase3
def update_phase3
if @rage_window != nil and @rage_window.visible
@rage_window.update
update_phase3_rage_select
return
end
update_phase3_srs_later
end
alias update_phase3_enemy_select_srs_later update_phase3_enemy_select
def update_phase3_enemy_select
if Input.trigger?(Input::B)
end_rage_select_plus
end
update_phase3_enemy_select_srs_later
end
alias update_phase3_actor_select_srs_later update_phase3_actor_select
def update_phase3_actor_select
if Input.trigger?(Input::B)
end_rage_select_plus
end
update_phase3_actor_select_srs_later
end
alias phase3_next_actor_srs_later phase3_next_actor
def phase3_next_actor
if @rage_window != nil
end_rage_select
end
phase3_next_actor_srs_later
end
def update_phase3_rage_select
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @rage_window.visible == true
end_rage_select
end
return
end
if Input.trigger?(Input::C)
@skill = @rage_window.skill
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.skill_id = @skill.id
@rage_window.visible = false
if @skill.scope == 1
start_enemy_select
elsif @skill.scope == 3 or @skill.scope == 5
start_actor_select
else
phase3_next_actor
end
return
end
end
def start_rage_select
@rage_window = Window_SoulRage.new(@active_battler)
@rage_window.help_window = @help_window
@actor_command_window.active = false
@actor_command_window.visible = false
end
def end_rage_select
end_rage_select_plus
@actor_command_window.swap_commands
@rage_window.dispose
@rage_window = nil
@help_window.visible = false
end
def end_rage_select_plus
if @rage_window != nil
if @rage_window.visible
@actor_command_window.active = true
@actor_command_window.visible = true
@help_window.visible = false
else
@rage_window.active = true
@rage_window.visible = true
end
end
end
alias update_phase4_step2_srs_later update_phase4_step2
def update_phase4_step2
update_phase4_step2_srs_later
if @active_battler.current_action.kind == 3
make_rage_action_result
end
end
def make_rage_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@active_battler.sr -= @skill.sp_cost * 10
@status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
@common_event_id = @skill.common_event_id
set_target_battlers(@skill.scope)
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
alias update_phase3_basic_command_srs_later update_phase3_basic_command
def update_phase3_basic_command
if @actor_command_window.index == 1 and Input.press?(Input::RIGHT)
if @actor_command_window.commands[1] != "Soul Rage"
$game_system.se_play($data_system.decision_se)
@actor_command_window.swap_commands
end
if not Input.trigger?(Input::UP) and not Input.trigger?(Input::DOWN)
@actor_command_window.update
end
else
if @actor_command_window.commands[1] == "Soul Rage"
$game_system.se_play($data_system.cancel_se)
@actor_command_window.swap_commands
end
end
if @actor_command_window.commands[1] == "Soul Rage" and Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 3
start_rage_select
return
end
update_phase3_basic_command_srs_later
end
alias battle_end_srs_later battle_end
def battle_end(result)
battle_end_srs_later(result)
for actor in $game_party.actors
for i in 0...$data_skills.size
skill = $data_skills[i]
if skill != nil and skill.element_set.include?($sr_element)
actor.forget_skill(i)
end
end
end
end
end