Thursday, April 5, 2012

Key Items Tutorial

Tutorial for Key Items in RPG Maker VX ace

The new key items feature has opened the door for an infinite number of
possibilities. This allows your character to use items to interact with the
would outside of the status menu and battles. Want to actually USE a key
to open a door? May it a "key" item (sorry for the pun) and away you go!
The player will have to actually select the correct key from within
this menu, instead of simply having it in their inventory. One drawback of this
is that after hours of gameplay, you may begin to accumulate hundreds of key items.
One way to combat this is to make sure to create in your events a removal of the used
item from your inventory, unless it is an item that is used repeatedly. Another
option is to notice that you can set common items to never be useable, therefor
you can put ite'm like "Grandma's locket" as a common item and it will show grey in your menu,
but itf it's not a useable key item, it won't clog up your very small window for selecting
key items. Now that you are completely confused, I'm going to break down the key item
feature, and yes, I will have pictures :-p


Firstly, the following image shows you the Item page in your database

Within this database you can create your items as well as assign them to be
either common items or key items. You can also select if the item can be used
in battles only, in the field only, or never.

This next image is the Event screen, showing you where the option for the key item feature
can be found and implimented.



You need to create your key item first. Write down the item ID (or the number of the item)
Like so


Now, this next part is where I got stuck.
So you have an event where the first line in the Event box is something like
Select Key Item [0000:name]
the next thing you want to do is create a conditional branch, this will basically make it so that
if the player has the item you want them to have, it'll work, and if they dont, it wont.
this is what it should look like
@>Text,-,- dark, middle
         :          :You need a key
@>Select Key Item: [000:name]
@>Conditional Branch: Variable [0000:name] == ###
   @>(here is where you put whatever the action using the correct item will cause
   @> this will always be blank
 : Else
   @> This is where you put the consiquence for using the incorrect item
   @> this will always be blank
 : Branch End
@>
And below is an image of my tester, basically I put a chest with the key item in it
and a door with the event on it (set to same as character)
The door only opens if i have the key.



And there you have it, it's just that simple. If you have any questions or would like to
see another tutorial, you know where to find me. Tah!
Below is a video of how the even will play out.

8 comments:

  1. I get everything apart from what the ## is supposed to be? Looks like that 28 just came out of nowhere to me!! On mine I have it working so that the key item opens the door, however also exiting the key items interface without selecting anything will also activate it, as will choosing a key item with an ID/ variable above the selection, instead of just the one item. Do you have any ideas about what I'm doing wrong and what is the significance of the 28? Thank you!

    ReplyDelete
    Replies
    1. That 28 would be the item id in the database, just look at which number your key item is on the list in the item database and set the variable to that number in the conditional branch. In this case, the game is told that if you select item 28, the door will open.

      Delete
  2. I have a question: after the item is used, how do you get it to disappear from the inventory?

    ReplyDelete
  3. This was a great tutorial, thanks! I haven't added key items to my tutorial yet, so this was really helpful!

    @Audray, in the Conditional Branch when they choose the right item, just add in a change item line [key item] -1 and when they use the item, one will be subtracted from their current total. If they don't have any of the item, it will default to the "else" part of the branch.

    ReplyDelete
  4. This tutorial is very confusing. Number one, when I set my door to be opened as you have described, well...my door won't open. Yes, I made my script match yours, this is bogus.

    ReplyDelete
  5. When I use the correct item I get this error:
    "Script 'Window_KeyItem' line 45: NoMethodError occurred.
    undefined method `[]= ' for nil:NilClass

    ReplyDelete
  6. How do you do this with multiple items?

    ReplyDelete