I have a problem while making my own Action Battle System. The problem is i want the game to pop up the value of a variable, but i have no clue how i can do it. I don't want that the game to pause while displaying it want it to pop up parralell so not like a normal textbox. I hope theres a script or sth. that may help me.
Tanks to you
-Dyseyro
Is this for debugging purposes, or part of the battle system?
If its for debugging, and you simply want to take a look at the value of a variable for testing, I use this (http://forum.chaos-project.com/index.php/topic,7816.0.html).
If its part of the battle system, and is incorporated into the gameplay, you need to be way more specific on how it should look, where it is, and what you want to display.
Well, that isnt what i meant. I just want that a value of a variable pops up on the screen while the game goes on. Nothing special. I just want to show the player how much DMG he dealed. And I'm sorry for my bad english I'm german so my english isn't the best. I hope you understand what I mean. Like a window with a message if you use the event command "Show Text", but if i would do it with this event command the game would pause for at least a few seconds and it would destroy the gameflow.
class Popup
# Set the default size of the window. This is used when no size is defined.
DEFAULT_SIZE = [320, 64]
# Default number of frames the window displayes for when not defined.
DEFAULT_DURATION = 60
#-----------------------------------------------------------------------------
# * Display a Pop-up window
# text - The text to display in the window
# time - The number of frames to display window for
# width - Width of the window
# height - Height of the window
#-----------------------------------------------------------------------------
def self.show(text, time = nil, width = nil, height = nil)
width = (width == nil ? DEFAULT_SIZE[0] : width)
height = (height == nil ? DEFAULT_SIZE[1] : height)
x = (640 - width) / 2
y = (480 - height) / 2
@count = Graphics.frame_count + (time == nil ? DEFAULT_DURATION : time)
@window = Window_Base.new(x, y, width, height)
@window.contents = Bitmap.new(width - 32, height - 32)
@window.contents.draw_text(0, 0, width - 32, height - 32, text, 1)
Thread.new do
while Graphics.frame_count < @count; end
Popup.dispose_window
end
end
#-----------------------------------------------------------------------------
# * Dispose the window
#-----------------------------------------------------------------------------
def self.dispose_window
if @window != nil && !@window.disposed?
@window = @window.dispose
end
end
end
That should do it.
Use the following command:
Popup.show(TEXT, FRAME_COUNT, WIDTH, HEIGHT)
The only argument you actually need is the text. If the others are omitted, it uses the values that are defined as the defaults.
Ok I solved my problems so far with this. the only thing thats left is to make the window invisible so you only see the message that would be all. But thanks anyway.
You said you wanted a window. Either way, after the window is created, you can just add a line to set the windowskin to nil.