ACETHEMAD'S PROFILE

Just a village madman! Nyahahaha!

OK. In all honesty, here to help out anybody with VX Ace questions. If anybody has a question about the engine (not scripting), I'll be glad to help!

Ciao!

Search

[RMXP] [RGSS] Battler Image not showing

So, then. I've run into another issue.

I've been working on my bestiary script, and then I realized something. The images of my enemy battlers are not changing whatsoever. It stays the first image no matter what I do.

Here's the script:

#==============================================================================

#
# My first RGSS Script. Hopefully, this works out well
#
# This is a standard bestiary script. It displays a list of enemies that
# you've encountered and their image and stats.
#
# Author: AceTheMad
#==============================================================================

class Window_Monster_Image < Window_Base
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize(enemy_window, x, y, width, height)
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
@enemy_window = enemy_window
@enemies = $data_enemies.compact
@selected_enemy = 0
refresh
end
#-----------------------------------------------------------------------------
# * Gets the battler
#-----------------------------------------------------------------------------
def get_battler
RPG::Cache.battler(@enemy.battler_name, @enemy.battler_hue)
end
#-----------------------------------------------------------------------------
# * Draws the bitmap
#-----------------------------------------------------------------------------
def draw_battler(enemy, x, y)
bmp = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
src_rect = Rect.new(0, 0, bmp.rect.width, bmp.rect.height)
self.contents.blt(x, y, bmp, src_rect, 150)
end
def update_cursor
if @selected_enemy >= 0
if Input.trigger?(Input::UP)
@selected_enemy -= 1
p "Up was pressed. Selected enemy is now" + @selected_enemy
end
if Input.trigger?(Input::DOWN)
@selected_enemy += 1
p "Down was pressed. Selected enemy is now" + @selected_enemy
end
else
@selected_enemy = 0
end
end
#-----------------------------------------------------------------------------
# * Refresh
#-----------------------------------------------------------------------------
def refresh
self.contents.clear
update_cursor
#p @enemy_window.item
draw_battler(@enemies[@selected_enemy],1,1)
end
end

class Monster_List < Window_Selectable
def initialize
super(0, 0, 220, 480)
@item_max = $data_enemies.compact.length
@commands = $data_enemies.compact
self.contents = Bitmap.new(width - 32, @item_max * 32)
@column_max = 1
refresh
self.index = 0
@selected_item = self.index
end

#-----------------------------------------------------------------------------
# * Item
#-----------------------------------------------------------------------------
def item
@commands && @selected_item >= 0 ? @commands[@selected_item] : nil
end

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = MBook::TEXT_SIZE
for i in 0...@item_max
draw_item(i)
end
end

#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
y = 4 + index * 32
self.contents.draw_text(0, y, 220, 32, $data_enemies.compact[index].name)
end
end


And here's the scene code.

#-------------------------------------------------------------------------------

# MonsterBook scene
#-------------------------------------------------------------------------------
class Monster_Book
#-----------------------------------------------------------------------------
# * Main Processing
#-----------------------------------------------------------------------------
def main
@list_window = Monster_List.new
@image_window = Window_Monster_Image.new(@list_window, 220, 0, 420, 320)
Graphics.transition

loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end

Graphics.freeze

@image_window.dispose
@list_window.dispose
end

def update
@image_window.update
@list_window.update

# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to Menu screen
$scene = Scene_Menu.new
return
end
end
end


In advance, thank you for your help.

AceTheMad

[RGSS] [SCRIPTING] [RMXP] Simple Bestiary Script Advice

So, then.

I was FINALLY dipping my fingers into the RGSS scripting world. Decided to start with a simple XP game. I'm working on a simple monster book.

I've...already ran into an issue.

I was working on a list of monsters to select from. At first, it looks fine. But then I scroll down.

I get this:



Basically, it's making the size of the list the exact amount of enemies I have in the game.

But, the text is only displaying the initial amount of enemies visible in the window.

Here's what I've got so far:

Code:

#==============================================================================
#
# My first RGSS Script. Hopefully, this works out well
#
# This is a standard bestiary script. It displays a list of enemies that
# you've encountered and their image and stats.
#
# Author: AceTheMad
#==============================================================================

class Window_Monster_Image < Window_Base
#-----------------------------------------------------------------------------
# * Object Initialization
#-----------------------------------------------------------------------------
def initialize
super(220, 0, 420, 240)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end

def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = MBook::TEXT_SIZE
self.contents.draw_text(30, 30, contents.text_size(MBook::TEXT).width, MBook::TEXT_SIZE + 12, MBook::TEXT)
end
end

class Monster_List < Window_Selectable
def initialize
super(0, 0, 220, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = $data_enemies.compact.length
@column_max = 1
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
y = 4 + index * 32
self.contents.draw_text(0, y, 220, 32, $data_enemies.compact[index].name)
end
end
And this, if you need it, is my scene code.

Code:
#-------------------------------------------------------------------------------
# MonsterBook scene
#-------------------------------------------------------------------------------
class Monster_Book
#-----------------------------------------------------------------------------
# * Main Processing
#-----------------------------------------------------------------------------
def main
@image_window = Window_Monster_Image.new
@list_window = Monster_List.new
Graphics.transition

loop do
Graphics.update

Input.update

update

if $scene != self
break
end
end

Graphics.freeze

@image_window.dispose
@list_window.dispose
end

def update
@image_window.update
@list_window.update
end

end

Forgive the lack of organization. I'm still new to this and care more about learning the language. X'D

What's up, guys?

Hey, guys! It is I...AceTheMad!

I've finally got the motivation to post here, so I am gonna go straight to the point! I'm a helpful madman across the street willing to help out anybody with VX Ace questions (that isn't scripting). I've got several years of experience with the engine and hope to get to know as many of you as I can!

Ciao, and see y'all later!

Nyahahaha!
Pages: 1