Archive for July 2012

No Unequipping Weapons

By Fomar0153
Last Updated: 20 July 2012 (Version 1.0)
Download Link: http://pastebin.com/raw.php?i=H613ikbm

Sometimes it just doesn’t make sense for players to unequip their weapons or maybe it breaks your systems etc. Anyway this prevents players from unequipping their weapons.

5
  

Resource Staff Release June 2012

I’m a bit late reporting this. Whoops.

Any check it out at: http://forums.rpgmakerweb.com/index.php?/topic/1094-resource-staff-resources/

This time two scripts from me:

  • Disabled Icons + Command Menu Icons
  • More Selfswitches

If you need help with either script then feel free to comment.

9
  

Cobb Tocs Network

So I’ve finished the first part of a much larger project of mine, the Cobb Tocs Network.

While it’s still a week or two off before I start letting people use the scripts, I thought I’d mention it in advance. Also you are welcome to test the system as it currently is and give early feedback if you want.

9
  

Anatomy of Windows

So I’ve been meaning to do this for a while and today I finally got nudged into doing this so let’s jump right into the anatomy of windows!

Firstly there are a lot of windows in RPG Maker Ace by default and if you’re scripting at some point you’re going to need to make a window. Which can be quite daunting and also waste a lot of your time when you’re trying to get it right. First let’s have a look at all the windows, the arrows indicate inheritance.

As you can see all windows inherit from Window_Base and there are several windows that act as bases for the other windows. Let’s strip it down to just the windows that are inherited from:

That’s a bit easier on the eyes now isn’t it? Also in case you’re not sure what I mean by inheritance, I’ll explain it quickly. Inheritance is where one class inherits from another class which is to say that it effectively copies all of the original classes methods and variables. So we can literally do this:

class Window_Name < Window_Base

end

And our new window Window_Name has everything Window_Base has, pretty cool huh?

Ok so now we need to decide what window to inherit from, generally it is going to be one of four:

So our first question should be are you using the window to just display information or is the player going to be able to select something in the window? Well if you just want to display things then all you really need to do is look at the drawing methods in Window_Base. If you want to have the window selectable then you need to know a few more things and we’ll go through them. The easiest way I think would be to go through the methods you’ll use/edit most. So let’s start there.

Window_Base

line_height – this is by default 24, the hight of an icon and the default font size. Useful with fitting_height which calculate the minimum window height given a number of lines.

standard_padding – if you ever need to get closer to the edge of a window then decrease this also if the window itself is not visible (self.opacity = 0) then this padding is wasted. By default this is 12.

Now going into Window_Selectable assume that the above remains unchanged unless I mention it again.

Window_Selectable

col_max – the number of columns by default 1.

spacing – the space between the coloums. 32 by default.

item_max – 0 by default, you need to change that if you’re going to display anything. I’m going to advocate having an array that contains the data you need to draw your items and then you can make this something like @data.size

item_width – you are very unlikely to need to change this, in fact if you think you need to change this then you should probably be looking at standard_padding and spacing. This automatically calculates the width your item should have.

item_height -this is by default the same size as line_height, you should only need to change it  if you for example have have the battle hud in columns and not rows and need to make the cursor bigger. Or maybe you want to display more information about items and want each items to have another row of space to work with.

item_rect -this gets you a rect based on the item number this rect is also the one which the cursor uses. In general you should use item_rect_for_text

item_rect_for_text -Basically item_rect but  with four pixels cut off each side, basically stopping the cursor obscuring the first or last letters of anything you put.

Also in case you didn’t already know you need to write a draw_item method a standard one would get a rect from item_rect_for_text and then used it to position everything.

Window_Command

Right a few changes this time Window_Command uses @list to store the data for drawing (item_max is automatically done for you in Window_Command) and you should add them using add_command. Which accepts two to four parameters

name, symbol, enabled, ext

name is what’s displayed to the players, symbol is something like :identifier and enabled is whether or not they can click that option by default this is true and I don’t know what ext does I’ve never used it.

visible_line_number – how many rows before the command window scrolls.

make_command_list – this is where you should really be adding commands to the window, it’s called when the window is made and again everytime the command wndow is refreshed.

Window_HorzCommand

There’s no real difference for you between this and Window_Command except if you want this window to scroll. There is a bug with the default scripts and I don’t know if they fixed it yet. If when you make a scrolling HorzCommand window it scrolls but doesn’t work right add this code to your project:

class Window_HorzList < Window_HorzCommand
  #--------------------------------------------------------------------------
  # * Set Leading Digits - BUGFIX
  #--------------------------------------------------------------------------
  def top_col=(col)
    col = 0 if col < 0     col = item_max - (col_max - 1) if col > item_max - 1
    self.ox = col * (item_width + spacing)
  end
end
7