Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Window_Base Troubles

Sure. Here's the line . . .

"self.contents.draw_text(x, y, 120, 32, actor.name)"

And if for some reason this would help, here's the script. . .

class Window_Base < Window
# ------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
# ------------------------------------
def dispose
if self.contents != nil
self.contents.dispose
end
super
end
# ------------------------------------
def text_color(n)
case n
when 0
return Color.new(255, 255, 255, 255)
when 1
return Color.new(128, 128, 255, 255)
when 2
return Color.new(255, 128, 128, 255)
when 3
return Color.new(128, 255, 128, 255)
when 4
return Color.new(128, 255, 255, 255)
when 5
return Color.new(255, 128, 255, 255)
when 6
return Color.new(255, 255, 128, 255)
when 7
return Color.new(192, 192, 192, 255)
else
normal_color
end
end
# ------------------------------------
def normal_color
return Color.new(255, 255, 255, 255)
end
# ------------------------------------
def disabled_color
return Color.new(255, 255, 255, 128)
end
# ------------------------------------
def system_color
return Color.new(192, 224, 255, 255)
end
# ------------------------------------
def crisis_color
return Color.new(255, 255, 64, 255)
end
# ------------------------------------
def knockout_color
return Color.new(255, 64, 0)
end
# ------------------------------------
def update
super
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
end
# ------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
# ------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
# ------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, actor.class_name)
end
# ------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
# ------------------------------------
def make_battler_state_text(battler, width, need_normal)
brackets_width = self.contents.text_size("[]").width
text = ""
for i in battler.states
if $data_states.rating >= 1
if text == ""
text = $data_states.name
else
new_text = text + "/" + $data_states.name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
if text == ""
if need_normal
text = "[Normal]"
end
else
text = "[" + text + "]"
end
return text
end
# ------------------------------------
def draw_actor_state(actor, x, y, width = 112)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text)
end
# ------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 32, "E")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
end
# ------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
# ------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
# ------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
# ------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end
 
Here is the menu. . .
#========================================================================================
# Thanks: AcedentProne: for using facesets, and showing location window.
# Thanks: Firewords and Axe Man Deke
# Made by GaveUpTomorrow - May 4th, 2006
# Version 0.80
#========================================================================================
#========================================
#Game_Map
#========================================
class Game_Map
def name
$map_infos[@map_id]
end
end
#========================================
#Window_Title
#========================================
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#----------------------------------------------------------------
# Window_Base (New Functions)
#----------------------------------------------------------------
class Window_Base < Window
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
def draw_actor_face(actor, x, y)
face = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
def draw_actor_level2(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Level")
self.contents.font.color = normal_color
self.contents.draw_text(x + 26, y, 24, 32, actor.level.to_s, 2)
end
def draw_actor_hp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x - 15, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 33, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 45, y, 48, 32, actor.maxhp.to_s)
end
end
def draw_actor_sp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x - 15, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 33, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 45, y, 48, 32, actor.maxsp.to_s)
end
end
end
#==============================================================================
# Window_Location
#==============================================================================
class Window_Location < Window_Base
def initialize
super(475, 234, 160, 172)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 18
refresh
end
def refresh
cx = contents.text_size($game_map.name).width
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, 32, "Location:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 25, 140, 32, $game_map.name)
self.contents.font.color = system_color
self.contents.draw_text(0, 50 , 120, 32, "Number of Steps:")
self.contents.font.color = normal_color
self.contents.draw_text(4, 75, 120, 32, $game_party.steps.to_s, 2)
self.contents.draw_text(0, 100, 120, 32, "Shards:")
self.contents.draw_text(116, 100, 120, 32, $game_party.shards.to_s)
end
end
#==============================================================================
# Window_MenuStatus
#==============================================================================
class Window_MenuStatus2 < Window_Selectable
def initialize
super(170, 355, 300, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 18
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
w = i * 100 + 10
x = 64
y = i * (100)
actor = $game_party.actors[0]
x = 640*i
y = 0
draw_actor_face(actor, 0, 85)
draw_actor_level(actor, x + 85, y)
draw_actor_exp(actor, x + 85, y + 20)
draw_actor_hp(actor, x + 85, y + 40)
draw_actor_sp(actor, x + 85, y + 60)
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 100 - 4, self.width - 32, 96 + 4)
end
end
end
#==============================================================================
# Window_GameName
#==============================================================================
class Window_GameName < Window_Base
def initialize
super(475, 5, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 22
end
#-----------------------------------------------------------------------------
def refresh
#-----------------------------------------------------------------------------
# if $game_variables[0001] == 1
# self.contents.draw_text(0, 0, 120, 32, "Raining", 2)
# end
# if $game_variables[0001] == 2
# self.contents.draw_text(0, 0, 120, 32, "Snowing", 2)
# end
if $game_system.season_change >=9 and $game_system.season_change < 12
self.contents.draw_text(-35, 0, 120, 32, "Spring", 2)
elsif $game_system.season_change >=0 and $game_system.season_change < 3
self.contents.draw_text(-25, 0, 120, 32, "Summer", 2)
elsif $game_system.season_change >=3 and $game_system.season_change < 6
self.contents.draw_text(-45, 0, 120, 32, "Fall", 2)
elsif $game_system.season_change >=6 and $game_system.season_change < 9
self.contents.draw_text(-30, 0, 120, 32, "Winter", 2)
end
end
end
#==============================================================================
# Window_PlayTime2
#==============================================================================
class Window_PlayTime2 < Window_Base
def initialize
super(0, 0, 160, 172)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Play Time:")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
@total_sec = Graphics.frame_count / Graphics.frame_rate
@minute=$game_time.get_minute.floor
hour = $game_time.get_hour
pm_flag= hour >=12 ? true : false
hour= hour >= 12 ? hour-12 : hour
day=$game_time.get_day
month=$game_time.get_month
year=$game_time.get_year
if hour.floor==0
text=sprintf("%02d:%02d",12,@minute)
else
text=sprintf("%02d:%02d",hour,@minute)
end
if pm_flag
text += " PM"
else
text += " AM"
end
self.contents.font.color = system_color
self.contents.draw_text(4,64,140,32,"Date and Time:")
self.contents.font.color = normal_color
self.contents.draw_text(4,114,120, 32, text, 2)
text = sprintf("%02d-%02d-%02d", month, day, year)
self.contents.font.color=system_color
self.contents.draw_text(30,94,120,32,text)
end
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
if $game_time.get_minute.floor != @minute
refresh
end
end
end
#==============================================================================
# Window_Status2
#==============================================================================
class Window_Status2 < Window_Base
def initialize(actor)
super(170, 5, 300, 345)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 18
@actor = actor
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 178, 0)
draw_actor_state(@actor, 86, 0)
draw_actor_parameter(@actor, 4, 50, 0)
draw_actor_parameter(@actor, 4, 67, 1)
draw_actor_parameter(@actor, 4, 84, 2)
draw_actor_parameter(@actor, 4, 101, 3)
draw_actor_parameter(@actor, 4, 118, 4)
draw_actor_parameter(@actor, 4, 135, 5)
draw_actor_parameter(@actor, 4, 152, 6)
self.contents.font.color = system_color
self.contents.draw_text(4, 25, 80, 32, "Next Level:")
self.contents.font.color = normal_color
self.contents.draw_text(44, 25, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 182, 96, 32, "Equipment:")
self.contents.font.size = 13
draw_item_name($data_weapons[@actor.weapon_id], 4, 212 + 3)
draw_item_name($data_armors[@actor.armor2_id], 4, 247)
draw_item_name($data_armors[@actor.armor4_id], 4, 282 - 3)
draw_item_name($data_armors[@actor.armor1_id], 134 + 15, 212 + 3)
draw_item_name($data_armors[@actor.armor3_id], 134 + 15, 247)
end
end
#==============================================================================
# Window_Battler
#==============================================================================
class Window_Battler < Window_Base
def initialize
super(475, 5, 160, 225)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_actor_battler(actor, 60, 180)
end
end


And if this helps, Scene_Menu. . .
#-------------------------------------------------------------------------------------------------------------------------
# Scene_Menu
#-------------------------------------------------------------------------------------------------------------------------
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
def main
s1 = $data_system.words.item
s2 = "Abilities" #$data_system.words.skill
s3 = "Equipment" #$data_system.words.equip
s4 = "Status"
s5 = "Quests"
s6 = "Party"
s7 = "Save Game"
s8 = "End Game"
@back = Sprite.new
if $game_system.season_change >=9 and $game_system.season_change < 12
@back.bitmap = RPG::Cache.picture("spring")
elsif $game_system.season_change >=0 and $game_system.season_change < 3
@back.bitmap = RPG::Cache.picture("summer2")
elsif $game_system.season_change >=3 and $game_system.season_change < 6
@back.bitmap = RPG::Cache.picture("fall")
elsif $game_system.season_change >=6 and $game_system.season_change < 9
@back.bitmap = RPG::Cache.picture("winter")
end
@back.x = 0
@back.y = 0
@command_window = Window_Command.new(160, [s1, s2, s3, s5, s7, s8])
@command_window.index = @menu_index
@command_window.opacity = 175
@playtime_window = Window_PlayTime2.new
@playtime_window.opacity = 175
@gold_window = Window_Gold.new
@gold_window.opacity = 175
@status_window = Window_MenuStatus2.new
@status_window.opacity = 175
@actor = $game_party.actors[0]
@status2_window = Window_Status2.new(@actor)
@status2_window.opacity = 175
@location_window = Window_Location.new
@location_window.opacity = 175
@battler = Window_Battler.new
@battler.opacity = 175
@game_window = Window_GameName.new
@game_window.opacity = 175
@command_window.x = 5
@command_window.y = 5
@playtime_window.x = 5
@playtime_window.y = 234
@gold_window.x = 5
@gold_window.y = 411
@game_window.x = 475
@game_window.y = 411

if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end

if $game_system.save_disabled
@command_window.disable_item(4)
end
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@status_window.dispose
@gold_window.dispose
@playtime_window.dispose
@status2_window.dispose
@battler.dispose
@location_window.dispose
@game_window.dispose
end
#--------------------------------------------------------------------------
def update
@command_window.update
@status_window.update
@playtime_window.update
@gold_window.update
@game_window.refresh

if $game_system.season_holder < $game_system.season_change
if $game_time.get_minute == 0
if $game_time.get_day == 21
$game_system.season_change += 1
$scene = Scene_Menu.new(@command_window.index)

$game_system.season_holder = $game_system.season_change
end
end
end
if $game_time.get_day > 22 or $game_time.get_day < 21
$game_system.season_holder -= 1
end

if $game_system.season_change == 12
$game_system.season_change = 1
end

if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#---------------------------------------------------------------------------
def delay(seconds)
for i in 0...(seconds * 1)
sleep 0.01
Graphics.update
end
end
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(0)
@command_window.active = false
#@status_window.active = true
#@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(0)
#@command_window.active = false
#@status_window.active = true
#@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Quests.new
#@command_window.active = false
#@status_window.active = false
#@status_window.visible = false
#@status_window.index = 0
when 4
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
#@checker = 0
#@command_window.active = false
#@status_window.active = true
#@status_window.index = 0
when 6
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 7
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
when 4
$game_system.se_play($data_system.decision_se)
$scene = Scene_Quests.new(@status_window.index)
when 5
$game_system.se_play($data_system.decision_se)
if @checker == 0
@changer = $game_party.actors[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.actors[@where] = $game_party.actors[@status_window.index]
$game_party.actors[@status_window.index] = @changer
@checker = 0
@status_window.refresh
end
end
return
end
end
end
 
Try replacing this line in Scene_Menu
Code:
@status2_window = Window_Status2.new(@actor)

with this line:

Code:
@status2_window = Window_Status2.new($game_party.actors[@status_window.index])
 
I replaced it, but it still gives me this error.

"Script 'Window_Base' Line82: NoMethodError occurred.
Undefined method 'name' for nil:NilClass"

Wouldn't the change have to be made in 'Window_Base' ? But, I don't know ruby.
 
I still get the error, but before it blacks out and says the error " Nil " appears. Also, when I open my menu a huge box appears with all sorts of writing.

The code now looks like this. . .

(Lines 79 - 85 of Window_Base)
# ------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
p actor
self.contents.draw_text(x, y, 120, 32, actor.name)
end
# ------------------------------------
 
I get this error, when I try to start a battle. Here is a picture of the error. I hope this answers all the questions.

http://h1.ripway.com/ScourgeDragon/Error.bmp[/img]

Here is my Window_Base
class Window_Base < Window
# ------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
# ------------------------------------
def dispose
if self.contents != nil
self.contents.dispose
end
super
end
# ------------------------------------
def text_color(n)
case n
when 0
return Color.new(255, 255, 255, 255)
when 1
return Color.new(128, 128, 255, 255)
when 2
return Color.new(255, 128, 128, 255)
when 3
return Color.new(128, 255, 128, 255)
when 4
return Color.new(128, 255, 255, 255)
when 5
return Color.new(255, 128, 255, 255)
when 6
return Color.new(255, 255, 128, 255)
when 7
return Color.new(192, 192, 192, 255)
else
normal_color
end
end
# ------------------------------------
def normal_color
return Color.new(255, 255, 255, 255)
end
# ------------------------------------
def disabled_color
return Color.new(255, 255, 255, 128)
end
# ------------------------------------
def system_color
return Color.new(192, 224, 255, 255)
end
# ------------------------------------
def crisis_color
return Color.new(255, 255, 64, 255)
end
# ------------------------------------
def knockout_color
return Color.new(255, 64, 0)
end
# ------------------------------------
def update
super
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
end
# ------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
# ------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
# ------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, actor.class_name)
end
# ------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
# ------------------------------------
def make_battler_state_text(battler, width, need_normal)
brackets_width = self.contents.text_size("[]").width
text = ""
for i in battler.states
if $data_states.rating >= 1
if text == ""
text = $data_states.name
else
new_text = text + "/" + $data_states.name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
if text == ""
if need_normal
text = "[Normal]"
end
else
text = "[" + text + "]"
end
return text
end
# ------------------------------------
def draw_actor_state(actor, x, y, width = 112)
text = make_battler_state_text(actor, width, true)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text)
end
# ------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 24, 32, "E")
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2)
self.contents.draw_text(x + 108, y, 12, 32, "/", 1)
self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s)
end
# ------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
# ------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
# ------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
# ------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end


Here is line 82.
self.contents.draw_text(x, y, 120, 32, actor.name)
 
It happens, when I start a battle. But, not when I'm in a battle. I go up to an event npc, talk, then instead of the battle starting I get that error.

#==============================================================================
# â–  Window_BattleStatus
#------------------------------------------------------------------------------
#  バトル画面でパーティメンバーのステータスを表示するウィンドウです。
#==============================================================================

class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 320, 640, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Battle Status" window font
self.contents.font.size = $defaultfontsize
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# ● レベルアップフラグの設定
# actor_index : アクターインデックス
#--------------------------------------------------------------------------
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[1]
actor_x = i * 160 + 4
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "Level Up")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# メインフェーズのときは不透明度をやや下げる
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end
 
Well, I see a problem in your Window_BattleStatus. It probably won't fix your problem, but change this line:
Code:
actor = $game_party.actors[1]
to this:
Code:
actor = $game_party.actors[i]
It is in def refresh.
 
*Bump*

This is a weird error, but it doesn't involve battles anymore.:D

When I go to use an item(in this case a potion), I'm able to select a spot that doesn't have an actor in it. I can move the selection thing up, but if you accidentally press on the blank spot you get the error.

http://h1.ripway.com/ScourgeDragon/Selection.jpg[/img]
 
Okay, here you go.
========================================================================================
# Thanks: AcedentProne: for using facesets, and showing location window.
# Thanks: Firewords and Axe Man Deke
# Made by GaveUpTomorrow - May 4th, 2006
# Version 0.80
#========================================================================================
#========================================
#Game_Map
#========================================
class Game_Map
def name
$map_infos[@map_id]
end
end
#========================================
#Window_Title
#========================================
class Scene_Title
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
#----------------------------------------------------------------
# Window_Base (New Functions)
#----------------------------------------------------------------
class Window_Base < Window
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
def draw_actor_face(actor, x, y)
face = RPG::Cache.character("Faces/" + actor.character_name, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
def draw_actor_level2(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Level")
self.contents.font.color = normal_color
self.contents.draw_text(x + 26, y, 24, 32, actor.level.to_s, 2)
end
def draw_actor_hp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x - 15, y, 48, 32, actor.hp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 33, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 45, y, 48, 32, actor.maxhp.to_s)
end
end
def draw_actor_sp2(actor, x, y, width = 144)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x - 15, y, 48, 32, actor.sp.to_s, 2)
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 33, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 45, y, 48, 32, actor.maxsp.to_s)
end
end
end
#==============================================================================
# Window_Location
#==============================================================================
class Window_Location < Window_Base
def initialize
super(475, 234, 160, 172)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 18
refresh
end
def refresh
cx = contents.text_size($game_map.name).width
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 120, 32, "Location:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 25, 140, 32, $game_map.name)
self.contents.font.color = system_color
self.contents.draw_text(0, 50 , 120, 32, "Number of Steps:")
self.contents.font.color = normal_color
self.contents.draw_text(4, 75, 120, 32, $game_party.steps.to_s, 2)
self.contents.draw_text(0, 100, 120, 32, "Crystal Shards:")
self.contents.draw_text(116, 100, 120, 32, $game_party.shards.to_s)
end
end
#==============================================================================
# Window_MenuStatus
#==============================================================================
class Window_MenuStatus2 < Window_Selectable
def initialize
super(170, 355, 300, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 18
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
w = i * 100 + 10
x = 64
y = i * (100)
actor = $game_party.actors[0]
x = 640*i
y = 0
draw_actor_face(actor, 0, 85)
draw_actor_level(actor, x + 85, y)
draw_actor_exp(actor, x + 85, y + 20)
draw_actor_hp(actor, x + 85, y + 40)
draw_actor_sp(actor, x + 85, y + 60)
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 100 - 4, self.width - 32, 96 + 4)
end
end
end
#==============================================================================
# Window_GameName
#==============================================================================
class Window_GameName < Window_Base
def initialize
super(475, 5, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 22
end
#-----------------------------------------------------------------------------
def refresh
#-----------------------------------------------------------------------------
# if $game_variables[0001] == 1
# self.contents.draw_text(0, 0, 120, 32, "Raining", 2)
# end
# if $game_variables[0001] == 2
# self.contents.draw_text(0, 0, 120, 32, "Snowing", 2)
# end
if $game_system.season_change >=9 and $game_system.season_change < 12
self.contents.draw_text(-35, 0, 120, 32, "Spring", 2)
elsif $game_system.season_change >=0 and $game_system.season_change < 3
self.contents.draw_text(-25, 0, 120, 32, "Summer", 2)
elsif $game_system.season_change >=3 and $game_system.season_change < 6
self.contents.draw_text(-45, 0, 120, 32, "Fall", 2)
elsif $game_system.season_change >=6 and $game_system.season_change < 9
self.contents.draw_text(-30, 0, 120, 32, "Winter", 2)
end
end
end
#==============================================================================
# Window_PlayTime2
#==============================================================================
class Window_PlayTime2 < Window_Base
def initialize
super(0, 0, 160, 172)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Play Time:")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, text, 2)
@total_sec = Graphics.frame_count / Graphics.frame_rate
@minute=$game_time.get_minute.floor
hour = $game_time.get_hour
pm_flag= hour >=12 ? true : false
hour= hour >= 12 ? hour-12 : hour
day=$game_time.get_day
month=$game_time.get_month
year=$game_time.get_year
if hour.floor==0
text=sprintf("%02d:%02d",12,@minute)
else
text=sprintf("%02d:%02d",hour,@minute)
end
if pm_flag
text += " PM"
else
text += " AM"
end
self.contents.font.color = system_color
self.contents.draw_text(4,64,140,32,"Date and Time:")
self.contents.font.color = normal_color
self.contents.draw_text(4,114,120, 32, text, 2)
text = sprintf("%02d-%02d-%02d", month, day, year)
self.contents.font.color=system_color
self.contents.draw_text(30,94,120,32,text)
end
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
if $game_time.get_minute.floor != @minute
refresh
end
end
end
#==============================================================================
# Window_Status2
#==============================================================================
class Window_Status2 < Window_Base
def initialize(actor)
super(170, 5, 300, 345)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = 18
@actor = actor
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 178, 0)
draw_actor_state(@actor, 86, 0)
draw_actor_parameter(@actor, 4, 50, 0)
draw_actor_parameter(@actor, 4, 67, 1)
draw_actor_parameter(@actor, 4, 84, 2)
draw_actor_parameter(@actor, 4, 101, 3)
draw_actor_parameter(@actor, 4, 118, 4)
draw_actor_parameter(@actor, 4, 135, 5)
draw_actor_parameter(@actor, 4, 152, 6)
self.contents.font.color = system_color
self.contents.draw_text(4, 25, 80, 32, "To Next Level:")
self.contents.font.color = normal_color
self.contents.draw_text(44, 25, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 182, 96, 32, "Equipment:")
self.contents.font.size = 13
draw_item_name($data_weapons[@actor.weapon_id], 4, 212 + 3)
draw_item_name($data_armors[@actor.armor2_id], 4, 247)
draw_item_name($data_armors[@actor.armor4_id], 4, 282 - 3)
draw_item_name($data_armors[@actor.armor1_id], 134 + 15, 212 + 3)
draw_item_name($data_armors[@actor.armor3_id], 134 + 15, 247)
end
end
#==============================================================================
# Window_Battler
#==============================================================================
class Window_Battler < Window_Base
def initialize
super(475, 5, 160, 225)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
def refresh
self.contents.clear
actor = $game_party.actors[0]
draw_actor_battler(actor, 60, 180)
end
end


But, this menu script edits other scripts, so I'm gonna post Scene_Item too.

#==============================================================================
# Scene_Item
#==============================================================================
class Scene_Item
def main
s1 = $data_system.words.item
s2 = "Abilities" #$data_system.words.skill
s3 = "Equipment" #$data_system.words.equip
s6 = "Quests"
s7 = "Save Game"
s8 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s6, s7, s8])
@command_window.x = 5
@command_window.y = 5
@command_window.opacity = 175
@command_window.index = 0
@command_window.active = false
@back = Sprite.new
if $game_system.season_change >=9 and $game_system.season_change < 12
@back.bitmap = RPG::Cache.picture("spring")
elsif $game_system.season_change >=0 and $game_system.season_change < 3
@back.bitmap = RPG::Cache.picture("summer2")
elsif $game_system.season_change >=3 and $game_system.season_change < 6
@back.bitmap = RPG::Cache.picture("fall")
elsif $game_system.season_change >=6 and $game_system.season_change < 9
@back.bitmap = RPG::Cache.picture("winter")
end
@back.x = 0
@back.y = 0
@help_window = Window_Help2.new
@help_window.opacity = 175
@item_window = Window_Item.new
@item_window.help_window = @help_window
@item_window.x = 170
@item_window.y = 74
@item_window.height = 346 - 70
@item_window.opacity = 175
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
@playtime_window = Window_PlayTime2.new
@playtime_window.opacity = 175
@gold_window = Window_Gold.new
@gold_window.opacity = 175
@status_window = Window_MenuStatus2.new
@status_window.opacity = 175
@actor = $game_party.actors[0]
@location_window = Window_Location.new
@location_window.opacity = 175
@battler = Window_Battler.new
@battler.opacity = 175
@game_window = Window_GameName.new
@game_window.opacity = 175
@playtime_window.x = 5
@playtime_window.y = 234
@gold_window.x = 5
@gold_window.y = 411
@game_window.x = 475
@game_window.y = 411
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@item_window.dispose
@target_window.dispose
@gold_window.dispose
@playtime_window.dispose
@battler.dispose
@location_window.dispose
@game_window.dispose
@status_window.dispose
@command_window.dispose
@back.dispose
end
#--------------------------------------------------------------------------
def update
@help_window.update
@item_window.update
@target_window.update
@gold_window.update
@playtime_window.update
@game_window.refresh
$game_system.update

if $game_system.season_change >=9 and $game_system.season_change < 12
@back.bitmap = RPG::Cache.picture("spring")
elsif $game_system.season_change >=0 and $game_system.season_change < 3
@back.bitmap = RPG::Cache.picture("summer2")
elsif $game_system.season_change >=3 and $game_system.season_change < 6
@back.bitmap = RPG::Cache.picture("fall")
elsif $game_system.season_change >=6 and $game_system.season_change < 9
@back.bitmap = RPG::Cache.picture("winter")
end

if @item_window.active
update_item
return
end
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 1
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
unless $game_party.item_can_use?(@item.id)
@item_window.refresh
end
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
if Input.trigger?(Input::C)
if $game_party.item_number(@item.id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
if @target_window.index == -1
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
if used
$game_system.se_play(@item.menu_se)
if @item.consumable
$game_party.lose_item(@item.id, 1)
@item_window.draw_item(@item_window.index)
end
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
 
Sorry for the confusion, but what I exactly need is the Window_Target part of the script. :P
And please post your script between code tags. [noparse]
Code:
script goes here
[/noparse]
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top