[RGSS] [SCRIPTING] [RMXP] SIMPLE BESTIARY SCRIPT ADVICE
Posts
Pages:
1
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:
And this, if you need it, is my scene code.
Code:
Forgive the lack of organization. I'm still new to this and care more about learning the language. X'D
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
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
Pages:
1