10-09-2014, 11:30 PM
Yes let's write an 80 line long event and use up a bunch of our 50 picture slots just so we can show the player they have 30,000 GP.
...That was just me being grumpy! The real reason you shouldn't do these sorts of things in events is because of the overhead of the Interpreter. Doing one or three things with parallel process events won't matter, you'll start lagging if you do very many more than that. Best leave the event system for actual game control stuff. Also you can reuse scripts easily! For example, here I turned the first script I ever wrote (a script that shows HP and MP in a cute little window) into one that can show variables. It took me longer to write this post than it did to edit this script.
and now all you have to do is get Scene_Map to draw your window! Just do it like how the @message_window is done. in Scene_Map:
Find:
Change to:
Find:
Change to:
Find:Change to:
You should study this script (and others, and the default ones) and learn how it works. And eventually you'll be able to code as well as me! Or at least make your own windows.
...That was just me being grumpy! The real reason you shouldn't do these sorts of things in events is because of the overhead of the Interpreter. Doing one or three things with parallel process events won't matter, you'll start lagging if you do very many more than that. Best leave the event system for actual game control stuff. Also you can reuse scripts easily! For example, here I turned the first script I ever wrote (a script that shows HP and MP in a cute little window) into one that can show variables. It took me longer to write this post than it did to edit this script.
Code:
#==============================================================================
# **
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_Variable < Window_Base
WHICH_VARIABLE = 1 #change this to your variable number.
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 420, 640, 60) #the sets the X, Y, Width, and Height.
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 200 #text (kinda transparent)
self.back_opacity = 175 #backgrond (pretty transparent)
#old value for checking if refresh needed
@old_value = 0
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_variable(0, 0)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
#do we need to update?
if $game_variables[WHICH_VARIABLE] != @old_value
refresh
end
end
#--------------------------------------------------------------------------
# * Draw Variable
#--------------------------------------------------------------------------
def draw_variable(x, y)
self.contents.draw_text(x, y-16, self.width, self.height,
$game_variables[WHICH_VARIABLE].to_s)
end
end
and now all you have to do is get Scene_Map to draw your window! Just do it like how the @message_window is done. in Scene_Map:
Find:
Code:
# Make message window
@message_window = Window_Message.new
Change to:
Code:
# Make message window
@message_window = Window_Message.new
#Our new Variable Window!
@variable_window = Window_Variable.new
Find:
Code:
# Dispose of message window
@message_window.dispose
Change to:
Code:
# Dispose of message window
@message_window.dispose
#We need to free our window from memory.
@variable_window.dispose
Find:
Code:
# Update message window
@message_window.update
Code:
# Update message window
@message_window.update
#This is called every frame so don't do anything crazy in updates
@variable_window.update
You should study this script (and others, and the default ones) and learn how it works. And eventually you'll be able to code as well as me! Or at least make your own windows.