Jump to content
New account registrations are disabed. This website is now an archive. Read more here.

Leon

Legend
  • Content Count

    1,713
  • Joined

  • Last visited

  • Days Won

    23

Everything posted by Leon

  1. so basically 10 windows for the options, and what kind of description in the middle? The middle is the only 'undetermined' thing. Just a phrase explaining what the selected option does, or is it more than that. I mean, this isn't too hard, i did soemthing like this before. (My Dark Tidings demo had soemthing similar to.) But, could you elaborate a little more on it? also, what is in the background, if anyhting? Further, do the bottom and top windows touch the edges of the window? Other than that, it isn't too difficult, just busy work. Biggest thing i see is I need the calculations of the windows. To get that, i need to know if the whole rig is centered in the Game window, and what is in the background. Further, if the rig should take up most of the window, or be to scale as you show.
  2. Ok, so I am trying to get back into my game-making groove, but need a script to do it. Just a simple way of changing something, such as equipments, items, skills, etc. A fairly simple menu system that would be a fun challenging thing. Any takers?
  3. Leon

    A request.

    I dont quite understand what you mean.
  4. All right, your moderator, Leon, is out of comission for a while. Ark, you can answer any questions that need answering. I am gone for a day or two.
  5. Just about everyone bailed on us, sadly. Then again, shouldnt really be a suprise, eh?
  6. Ark, you can make an entrance about the site or RmXP, most likely. So long as it is related to teh site.
  7. How do we add topics and such to the wiki?
  8. Well, i have an edit of the default battle system, and it is pretty cool, from what I hear.
  9. Can you post a couple screen-shots, please?
  10. Well, now i have to write a couple new scripts, including an idea for a battle system, other than the default and doesnt take too much artwork.
  11. Leon

    RPG Utopia

    You did get me and Marked. that is 2
  12. Agreed. It is good to see an honorable opponent.
  13. I agree. Shall the two of us not vote, to keep it even?
  14. Has anyone other than myself checked these out? They were both well done.
  15. For all of those who tested this, how was it? I am eager to know how it turned out.
  16. All right, welcome back to the Leon Scripting channel. Today, we will be discussing the programming of windows. There are 2 types of windows we will cover here, because the third is made using a scene. For now, sure, we can make a window, but remember, a window, and scene should always be preplanned before created. I have some small rules to windows that I follow, but it doesn't mean you have to. I just follow them because of how text is used. My own way of standardizing my windows. THe rules are very simple: A window's width AND a window's height must both be divisible by 32. Man, those rules are hard to follow... Another thing I would like to make clear is I follow how the old PKE version ran, back before I even knew there was a legal version. In the script 'Main', after begin, I put in two variables; one for the text font, the other for the text size. I do this because it is much easier for me to change them in an event or script this way, rather than remember the whole: Font.default_name B.S. There are some nice things about the Font object, but that is later. For windows, I use the variables same to PKE: $defaultfonttype = "Tahoma" $defaultfontsize = 24 THis is just for simplicity for me, though many think i use the 'illegal' version. With all of that out of the way, let's get started. We will start with Window_Base: Window_Base usually uses two basic methods in it's structure: def initialize def update Now, this may seem like little, but with them, we can do a whole lot more than just draw a window, we can also make it update. (obvious, right?) Now, to get started, we need to open our class, give it a name, use the superclass Window_Base, use the method initialize, and set up the parameters: class Window_Info < Window_Base #Line 1 def initialize #Line 2 super(0, 0, 640, 64) #Line 3 self.contents = Bitmap.new(width - 32, height - 32) #Line 4 self.contents.font.name = $defaultfonttype #Line 5 self.contents.font.size = $defaultfontsize #Line 6 end #Line 7 Lines: 1. Names the class, and shows by the '<' the superclass is Window_Base. 2. Calls the initialize method. 3. Calls the superclass, and defines the window as: (x, y, ox, oy) x = Location right of the upperleft corner. y = Location down from the upperleft corner. ox = How wide the window is. oy = How tall the window is. 4. self means this class, the contents is a new Bitmap (the window.), and the viewport of it is the width of the window - 32, and the height of the window - 32. We subtract 32 from each for the border of the window. (Note: The classes Bitmap and Viewport can be found in the help file.) 5. The window's font name is the variable I set in 'Main'. Not needed in the legal version, honestly. 6. The window's font size is the variable i set in 'Main'. Not needed in the legal version, honestly. 7. Ends the initialize method. If you notice, I didn't end the class. That is because we will add one more method to the window: Update. SO after that coding, put: def update(info_text) #Line 1 self.contents.clear #Line 2 self.contents.draw_text(0, 0, 618, 32, info_text, 1) #Line 3 end #Line 4 end #Line 5 Lines: Line 1: Calls the update method. It also shows any time the method 'update' is called for this class, it needs parentheses and a variable inside them. Line 2: Clears the window. Line 3: calls the 'draw_text' method of Window_Base. The breakdown is like this: (x, y, lx, ly, text, alignment) x = how far to the right the text is. y = How far down the text is. lx = The allowed space for the text. (Because the window cuts off 32 pixels early, we too the window's width and subtracted 32 for this. ly = How much height is allowed for the text. text = well, the text. alignment = The number to ID the alignment. If this doesn't exist, it is assumed to be 0. 0 = Left, 1 = Center, 2 = Right. Line 4:Ends the update method. Ends the class. Now, you see at line 1 where we have '(info_text)' after the method? This means if the update method of this class is called without that, we'll get an argument error. And, in line 3, when it draws the text, we have text as info_text. This means that info_text, which is a LOCAL VARIABLE, if you remember right, and since it is here, it NEEDS to be a string. A string is a line of text enclosed in quotes. With that, you have a window that can be updated in a scene. This is just an example of how you can use it. I mean, you can call in a whole item as a variable and draw every little detail of the item in the window, but this will be taught later, where we pick at the built in information. Right now, we are studying how to make windows, then a scene. Now, we went over the simplicity of Window_Base, we'll move on to Window_Selectable. This is a rather larger subject to cover, so I'll probably touch base with you really briefly on this in this section, nothing too spectacular, just a basic list of options. I will teach you the quick way to make a list of predefined options, but things such as a list of items we'll do later in Lesson 3. Right now, here we go on a simple 4 option list. The options won't pertain to anything, really, just four options as an example: class Window_Example < Window_Selectable def initialize super(0, 64, 192, 160) @options = ["Option 1", "Option 2", "Option 3", "Option 4"] #New Line 1 self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = $defaultfonttype self.contents.font.size = $defaultfontsize self.index = 0 #New Line 2 refresh #New Line 3 end Now, most of this you have seen before, but there are 2 new lines: New Line 1: This line is merely an array named '@options' that says that item 0 is option 1, item 1 is option 2, etc. Just remember to put these in quotes, and separate them by commas. New Line 2: This line is to set the index of the window. there are other lines similar to this one, and we'll cover those in the next section, which will tell about the common commands in Window_Base and such. New Line 3: This line calls up the method 'refresh'. Refresh is just the name of a method, it could be called trout and still work, but refresh describes it. On to the method of refresh. This is real simple example to do, for a short menu: def refresh self.contents.clear for i in 0...@options.size #New Line 1 x = 4 #New Line 2 y = i * 32 #New Line 3 self.contents.draw_text(x, y, 160, 32, @options[i]) #New Line 4 end #New Line 5 end end The new lines are described here: New Line 1: This includes a new keyword for you: for. For is a loop word. Then, i is the local variable that will resemble a number. The number is defined by the following piece, and it also says how much it loops: 0...@options.size. The way that works is 0 is the starting number, the number of dots tells whether or not to exclude the last number. 2 dots means to include the last number, 3 means to exclude it. Well, the size of the array is 4, but there is nothing in @options[4], because that is place number 5. So, we use 3 dots, so it loops like this: 0, 1, 2, 3. So, i will equal that each time, and when it equals 3, it will end the loop. New Line 2: The local variable x equals 4. We make it 4 to make room for the selecting rectangle. New Line 3: The local variable y equals the local variable i multiplied by 32. As you recall, i will equal 0, 1, 2, and 3. This means, y will equal, every time it loops, 0, 32, 64, then 96. New Line 4: This line is another draw text, but instead, we use variables for x and y. We use y because this means it will make each line drawn down one 'space', so that we have a list. A neat trick, no? New Line 5: Not really a new line, but we do have to end the 'for' statement. Just a quick review: a 'for' statement is set up like this: for i in x...y 2 dots to include the last number, 3 to exclude it. And x is the number we start at, y is the ending number. Doggone, that is alot of information to go over. In the next section, we'll cover the syntaxes we can use in a window. This list can actually be found as the names of the methods in Window_Base and Window_Selectable, but I would like to describe a little bit more how they work. Go ahead and review all of this, because it is alot of information. Also, you can try these if you want, just call them using call script by doing: Class_Name.new Of course, Class_Name would have to be the name of the windows we made. But, test them, and even change them around a bit. Learn a little. Just remember, you ahve to call the update method of the info window to show anything, so save that one for a scene. Read Section III
  17. Ok, so by now you have made your own class, which by definition can be considered a script that serves no real purpose. Now, we will explore how parent classes (superclasses) and child classes (sub classes) work, and the best way I can think of to do this is with Window, Window_Base, Window_Selectable, and Window_Command. Now, the objectives of this lesson are: Learn how superclasses and subclasses work. Learn how to use a superclass. Learn how to make a subclass. Be able to find the root of a variable (where it is defined.). Learn where to find needed information. (This sounds hard, but it is really quite easy once you learn how.) Build a series of windows and a scene by yourself. All of that may sound difficult, but in reality, it is basically taking what already exists in RGSS and adding to or modifying what can be found there. Also, you may be intimidated by building your own windows and scenes, but once you learn how to find the information you are looking for, it is all (relatively) smooth sailing from there. In fact, by the end of this lesson, I hope you can build your own basic CMS. Now, don't expect to be able to build anything like Diego's CMS over at the Creation Asylum just yet... He uses some unique techniques that require diving deeper into RmXP's scripts such as drawing rectangles and stuff. What we are doing here is the basics. Walk before you run type thing. But, you will be able to make a series of windows and use them as a new menu rather than the default menu. Ok, shall we get started? Before we actually build some windows and before I show you how, there are a few things I would like to cover. This includes the whole superclass and subclass thing. This would be a nice thing to know before we get started. We covered the basics of this in lesson 1, but a short review here can't hurt. Basically, superclasses and subclasses works on a hiarchy scale, and the best example, again, is with the Window commands: Window < Window_Base < Window_Selectable < Window_Command RGSS has Window built into the system, and you can actually find information on it in the help file. Next, Window_Base. It has the superclass of Window. TO find this information, pull up the Window_Base script in your scripts of a project. (New preferably so we dont destory a project.) The first coded line (non commented line) should read like this: class Window_Base < Window what this means is Window_Base has the superclass of Window. If you go to Window_Selectable, you will find it has the superclass of Window_Base, and Window_Command's superclass is Window_Selectable. How a superclass works is pretty simple: All commands availble to the superclass(es) is availible to the subclass of it. So Window_Selectable can use any method found in Window_Base and Window. This means Window_Command gets all methods from Window_Selectable, Window_Base AND Window. Pretty neat, right? You are probably thinking by now "Ok, so make all windows Window_Command, and skip the whole remembering which class will cover what i need." I hate to break it to you, but it isn't quite that simple. And for a few good reasons too: Window_Base won't lag up the system as much as Window_Command. Window_Command is only useful in scenes. Window_Selectable can have selectable objects, and Window_Base cant. So, in brief, with this, it is pretty easy to discover which windows to use for what it needs. For example: Window_Base is perfect for displaying information, and won't have a cursor, so even better for windows that have no options. Can be reused in different scenes. Window_Selectable is great for any window that will have options, and can easily be reused any number of times in different scenes. Window_Command is great for any menu that will instantly be active at the beginning of the scene, and will have some options disabled. Was intended for use with CMS systems, basically. They can NOT be reused. This isn't too hard to remember, right? Good. Now you know how the hierarchy of superclasses and subclasses work, and that methods can be called from a class's subclass. For example: Window_Selectable can use a method found in Window_Base. This really beats rewriting methods for each class. With superclass and subclass covered, we can move on to the structure of a window, and include the 'calling of variables' into methods. The calling of methods is both tricky, yet vital, and pretty neat. Well, onto Section II. Read Section II
  18. I purposely did that, but Try this one for yours: #=================================== # Leon's battle BGM Fix #---------------------------------------------------------------------- # Feature: # You can turn off the battle music for battles, and let the # bgm play through. It will only be interupted by the music # effect of battle, then the music fades back in. # # Instructions: # Place after Scene_Debug, but before Main # set SWITCH_TO_BYPASS equal to the switch that needs # to be on for this to work. So, if SWITCH_TO_BYPASS equalled 1, # and switch 1 is on, the BGM plays through battle. When switch # 1 is off, it will turn on the battle background music. #=================================== class Scene_Map alias leon_bgmfix_scenemap_callbattle call_battle SWITCH_TO_BYPASS = 8 def call_battle $game_temp.battle_calling = false $game_temp.menu_calling = false $game_temp.menu_beep = false $game_player.make_encounter_count $game_temp.map_bgm = $game_system.playing_bgm $game_system.se_play($data_system.battle_start_se) unless $game_switches[SWITCH_TO_BYPASS] == true $game_system.bgm_stop $game_system.bgm_play($game_system.battle_bgm) end $game_player.straighten $scene = Scene_Battle.new end end
  19. Leon

    Enrollment

    Sweet. I plan on adding another Lesson soon, as soon as your request is finished, Paine.
  20. Hey, KK, "You shouldn't give advice unless it is asked for.".
  21. I have hit 212 hours, unlocked every monster, stolen every item... gotten every ultimate item... the entire primer... It has been a couple years since I played it.
  22. *bump* I need this tested by many people, becuase no one person can find everything.
×
×
  • Create New...