The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on August 16, 2009, 10:42:13 PM

Title: Item & Skills Catalogue
Post by: modern algebra on August 16, 2009, 10:42:13 PM
Item & Skills Catalogue
Version: 1.0
Author: modern algebra
Date: August 16, 2009

Version History



Planned Future Versions

No real future versions, but possibly two mutually exclusive patches:

One where if you select an item it will bring up an ordering screen and allow you to purchase the item from the catalogue (with tax). The other would be for if you also have the Grid Inventory, and it would bring up a more detailed Information window (like the one in Grid Inventory).

Description


     This script allows you to create custom catalogues containing any of the items, weapons, armors, or skills that you have encountered. Wish to make a catalogue that will show every item you've ever encountered? That can be done. Want to make a catalogue that contains all paladin equipment and/or skills, whether encountered or not? That can be done too!

     Unlike other Item Logs, this script gives you the customizability to make different item logs that can show different things. Items, weapons, armors, and skills are auto-encountered (or not, if you wish), but you can also manually encounter items with a code. All of this means that there is a lot you can do with this script if you want to, but if all of that configuration seems a bit too complicated for you than that's OK too - the script will work plug & play too.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg21.imageshack.us%2Fimg21%2F4258%2Fcatalogueitemscreen.png&hash=fece8f44ff070ff76091a100baab82d5fa1b4328)

Instructions

Please see the header of the script, as well as the Editable Regions for instructions.

Script


The code is too long. Please see the attached text document (http://rmrk.net/index.php?action=dlattach;topic=34377.0;attach=17504). Note that this script requires the Catalogue Base (http://rmrk.net/index.php/topic,34376.0.html) script. Bitmap Addons (http://rmrk.net/index.php/topic,32286.0.html) is recommended.

Bug Fixes

Spoiler for Unequip to Nothing Bug:
A bug occurs whenever you try to unequip a weapon or armor and not replace it. To fix it, paste the following code into its own slot below the Item Catalogue but still above Main:

Code: [Select]
class Game_Party
  def gain_item (item, n, *args)
    unless item.nil?
      array = item_encounter_array (item)
      array.push (item.id) unless array.include? (item.id)
    end
    malgbra_basecatlogue_gnitem_7ff7 (item, n, *args) # Run Original Method
  end
end


Credit



Support


Please post in this topic at RMRK for support. Please do not PM me.

Known Compatibility Issues

This script requires the Catalogue Base (http://rmrk.net/index.php/topic,34376.0.html) script. Bitmap Addons (http://rmrk.net/index.php/topic,32286.0.html) is recommended.

Demo


See the Attached rar file (http://rmrk.net/index.php?action=dlattach;topic=34377.0;attach=17505).

Author's Notes


This was one of the first scripts I wrote for RMXP :) It didn't at all have the same function though :(


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Item & Skills Catalogue
Post by: SeMcDun on August 21, 2009, 09:26:43 PM
Hey man. Another nice script although I had a problem before my title screen came up. Says it's on line 183. System stack error. Stack level too deep. =/

Just thought I'd post incase it's a problem with the code rather than a clash with other scripts I have.

Note: I have the other catalogue script needed :)

Any help would be great.

Thanks :)
Title: Re: Item & Skills Catalogue
Post by: modern algebra on August 21, 2009, 09:50:26 PM
Does the demo work for you?

If so, it is probably a compatibility error. Come to think of it, it is likely an error with Monster Catalogue, as I made a silly mistake. I am updating that script to 1.0b now, so if you have it, try replacing it with the new version once I post it.
Title: Re: Item & Skills Catalogue
Post by: SeMcDun on August 23, 2009, 06:44:01 PM
Ah it's working now! I'm not sure why's it's started working though. Must have been compatability with other scripts seeing as I've been shifting them around.

I can't be sure which script/s were messing up the Item Catalogue.

Anyways, it's still good news I guess :P

And yeh the demo worked so I doubt there was a problem with the script, afterall it's a piece of your work haha always spot on.

Cheers again :)
Title: Re: Item & Skills Catalogue
Post by: modern algebra on August 23, 2009, 07:16:53 PM
Well, I make plenty of mistakes, so don't give me too much credit  :police:
Title: Re: Item & Skills Catalogue
Post by: SuperMega on August 31, 2009, 10:53:14 PM
Would it be possible to get the items and such that the player doesn't have display as question marks?
Title: Re: Item & Skills Catalogue
Post by: Destinynite1 on February 21, 2010, 03:51:02 AM
As soon as I get a game start, i get an error

Code: [Select]
alias malgbra_basecatlogue_gnitem_7ff7 gain_item
  def gain_item (item, n, *args)
    # If obtaining item, add it to encountered items
    array = item_encounter_array (item)
    array.push (item.id) unless array.include? (item.id) -----> [b]This is the line thats gives me the error[/b]
    malgbra_basecatlogue_gnitem_7ff7 (item, n, *args) # Run Original Method
  end

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg202.imageshack.us%2Fimg202%2F1216%2Ferrorjk.png&hash=88fec7044aee7fcd388ff28094377d3fa33f5f90)

How can I fix this? I tried many things and it doesn't seem to fix the problem
Title: Re: Item & Skills Catalogue
Post by: modern algebra on February 21, 2010, 04:38:07 AM
It's likely an incompatibility with some script that overwrites the initialize method of Game_Party. Try pasting the catalogue below all of the other custom scripts you have in the editor, but still above Main.
Title: Re: Item & Skills Catalogue
Post by: Destinynite1 on February 21, 2010, 09:47:38 PM
I always put new scripts below all my other ones. Maybe if I put it up top that might help. But thanks again Modern

EDIT2: Alright, i got it to work now. But none of my items are showing up. I even gave myself the items or equipped them and they don't appear.
Title: Re: Item & Skills Catalogue
Post by: modern algebra on February 21, 2010, 10:06:52 PM
Well, what did you do to get it to work? If you altered that line in any way, particularly if you skipped it if array is nil, then that would result in none of the items being considered encountered.

Could you upload your Scripts.rvdata for me? I can't do anymore until I see the scripts it is conflicting with.
Title: Re: Item & Skills Catalogue
Post by: Destinynite1 on February 22, 2010, 02:53:54 AM
Yeah, i'll send you a pm with link

EDIT: I'm using the Color Coded items script thats here. You gave me the link on RRR(atleast i think it was you XD)

EDIT2: I even copied the script exactly into a new project. I bet there's a conflicting script. Either one of Yan's or another custom one i have
Title: Re: Item & Skills Catalogue
Post by: modern algebra on February 22, 2010, 03:23:58 AM
Yeah, there's a sort of conflict. For some reason, I never anticipated that there might be a script which calls the gain_item method with a nil argument.

I think all you need to do to fix it is check if the array is defined, so put it back at the bottom (or at least below KGC_LimitBreak) and replace the line that gave you the error with this:

Code: [Select]
    array.push (item.id) if array && !array.include? (item.id)
Title: Re: Item & Skills Catalogue
Post by: Destinynite1 on February 22, 2010, 03:50:49 AM
Alright Modern. Thanks. I'll try that and let you know how it works

EDIT: Alright, now it shows the items. That part is fixed. Now, for some reason, when I go over any item with the color, it gives an error, this time coming from Window_Base on line 158. Here's the line:
Code: [Select]
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
Title: Re: Item & Skills Catalogue
Post by: modern algebra on February 22, 2010, 04:31:34 AM
I wasn't able to reproduce that error in your project, sorry. My bet is that you don't have element icons set up though - In the Item & Skills Catalogue, you need to set up this array:


  CI_ITEM_ELEMENT_ICONS = [132, 2, 4, 14, 16, 12, 138, 137, 104, 105, 106, 107,
                           109, 110, 111, 112]

So that there is an icon for every element. If you have x elements, you need x icon indices.
Title: Re: Item & Skills Catalogue
Post by: Destinynite1 on February 22, 2010, 04:46:17 AM
Looks like i have to go through my thousands of icons -.- Well, i'll get around to this and fix and see whats happens. Thanks for all the help modern

EDIT: By the way, how can I tell what icons goes to what?
Title: Re: Item & Skills Catalogue
Post by: modern algebra on February 22, 2010, 01:09:17 PM
It's in order, first in the array goes to the first element, second in the array goes to the second element, etc...

If you mean how do you know what index an icon in your Iconset is represented by, you can just count. First icon of the first row is 0 and it goes from left to right, then down a row, and so on. There are 16 icons in each row.

If you have a lot of icons, it would probably be worth using the Icon Preview script by woratana. You can find it in his Christmas Giftbox in the Script Database.
Title: Re: Item & Skills Catalogue
Post by: Destinynite1 on February 22, 2010, 05:14:02 PM
So the first number is Physical, then whatever, etc.. Alright.

EDIT2: I know why I kept getting that error. Mostly it was the icons. Now since i'm using KGC Equip Extension, anything thats from the standard 5 equipment slots, gives me the Window_base Error. How can I add more to the types of items?
Title: Re: Item & Skills Catalogue
Post by: modern algebra on February 22, 2010, 07:10:24 PM
Well, I have no guarantees, since I've never used that script. But this might work. I imagine it definitely won't work for whatever items have a kind = 6, so you might need to set up the extra equip script so that there is no first equipment type (and no items that have it)

Anyway, again this might not work, but if it doesn't I suggest you either remove the Item Catalogue or find another scripter to do it, as I am really busy with school and not willing to keep looking into it, sorry. Anyway, try doing this. Fo to the following line and add the icons you need to this as well (if you don't want icons for item type, then just give them 0s.

Code: [Select]
  CI_ITEM_KIND_ICONS = [144, 132, 52, 32, 42, 58, 133]

Once that is done, you need to go down somewhere around 610 and find this:

Code: [Select]
def draw_item_kind (kind, x, y)
    vocab = [Vocab.item, Vocab.weapon, Vocab.armor1, Vocab.armor2, Vocab.armor3, Vocab.armor4, Vocab.skill]
    text = vocab[kind]
    icon_index = ModernAlgebra::CI_ITEM_KIND_ICONS[kind]
    # Draw the kind of item
    draw_icon (icon_index, 8, 32)
    contents.font.color = Color.new (*ModernAlgebra::CI_ITEMTYPE_COLOUR)
    contents.draw_text (32, 32, 100, WLH, text)
  end

You should add the names for each type of item into here:

Code: [Select]

    vocab = [Vocab.item, Vocab.weapon, Vocab.armor1, Vocab.armor2, Vocab.armor3, Vocab.armor4, Vocab.skill]

You can split it into more than one line if you want, so like:

Code: [Select]
    vocab = [Vocab.item, Vocab.weapon, Vocab.armor1, Vocab.armor2,
      Vocab.armor3, Vocab.armor4, Vocab.skill]
Title: Re: Item & Skills Catalogue
Post by: Destinynite1 on February 22, 2010, 11:40:44 PM
Alright. Everything works perfect now. All my items appear, icons fixed, item names I'm still working on(getting a crash with that but thats ok, i'll fix it) but now, (maybe I have too many extra equips) but my "legs" slot crashes whenever I get an item that deals with legs. There's nothing for the item that would crash it, but maybe i'll figure it out when you get around to it. I'm sorry for bothering you tons on this script. And again thanks Modern. I appreciate it
Title: Re: Item & Skills Catalogue
Post by: modern algebra on February 22, 2010, 11:45:55 PM
If Legs are the first extra equipment type that you have set up, then:
I imagine it definitely won't work for whatever items have a kind = 6, so you might need to set up the extra equip script so that there is no first equipment type (and no items that have it)

So, in the setup for Extra Equips, try replacing "Legs" with  "" as the first element of the array and make sure no items are actually of that type. Put "Legs" as the last entry of the array and edit the corresponding items accordingly. That might work.
Title: Re: Item & Skills Catalogue
Post by: Kotone123 on July 21, 2011, 07:12:15 PM
Hey Algebra, I love your scripts a lot, it's just that I get some error messages sometimes, like this one:

Script "Skill Item Book" Line 338: No Method Error Occurred
Undefined Method 'include?' for nil:NilClass

I get it every time I equip and dequip weapons and armors even when I don't have the Weapon and Armor Catalogue in my Inventory. What do I do?
Title: Re: Item & Skills Catalogue
Post by: modern algebra on July 21, 2011, 07:15:51 PM
Hmm, that is a problem. To fix it, that method:

Code: [Select]
  alias malgbra_basecatlogue_gnitem_7ff7 gain_item
  def gain_item (item, n, *args)
    # If obtaining item, add it to encountered items
    array = item_encounter_array (item)
    array.push (item.id) unless array.include? (item.id)
    malgbra_basecatlogue_gnitem_7ff7 (item, n, *args) # Run Original Method
  end

should be changed to:

Code: [Select]
  alias malgbra_basecatlogue_gnitem_7ff7 gain_item
  def gain_item (item, n, *args)
    # If obtaining item, add it to encountered items
    unless item.nil?
      array = item_encounter_array (item)
      array.push (item.id) unless array.include? (item.id)
    end
    malgbra_basecatlogue_gnitem_7ff7 (item, n, *args) # Run Original Method
  end
Title: Re: Item & Skills Catalogue
Post by: Kotone123 on July 22, 2011, 04:25:18 AM
Thankyou programming genius ;)!
Title: Re: Item & Skills Catalogue
Post by: pacdiggity on July 22, 2011, 07:48:20 AM
Modern Algebra's checklist -
1. Make a fatal error. Check.
2. Be called a genius. Check.
3. Fall asleep on a bed of money. Pending.
Title: Re: Item & Skills Catalogue
Post by: Troile on January 05, 2012, 10:09:09 PM
I've noticed that when using this (and your monster catalog script) with your FSCMS script, when you back out of either, it leaves the menu altogether. Is there any way to fix this so you go back to the menu?
Title: Re: Item & Skills Catalogue
Post by: modern algebra on January 06, 2012, 12:15:17 AM
Add this into its own slot somewhere below the Catalogue_Base script:

Code: [Select]
class Scene_Catalogue
  def return_scene
    $scene = Scene_Menu.new
  end
end
Title: Re: Item & Skills Catalogue
Post by: Troile on January 06, 2012, 05:39:24 PM
Many thanks!
Title: Re: Item & Skills Catalogue
Post by: Infinate X on January 10, 2012, 02:45:29 AM
So.... Is this like a database?
Title: Re: Item & Skills Catalogue
Post by: evstellar on September 21, 2012, 12:38:47 AM
Hey Algebra, I know it might be a lot to ask in such short time, but could you add a patch to display the stats added in YEM: New Battle Stats? This would be greatly appreciated, thanks in advance!
Title: Re: Item & Skills Catalogue
Post by: modern algebra on September 21, 2012, 01:27:11 AM
Umm, try pasting the following into its own slot below the Item & Skills Catalogue script (untested):

Code: [Select]
#==============================================================================
# ** Window ItemCard
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - get_item_stats
#==============================================================================

class Window_ItemCard
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Get Item Stats
  #    item : the item to check
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias maisc_gtitmstats_3fr5 get_item_stats
  def get_item_stats(*args)
    item_stats, stat_names = maisc_gtitmstats_3fr5(*args)
    unless @object.is_a?(RPG::UsableItem)
      # Dex
      if $imported["DEX Stat"]
        item_stats.push (@object.dex)
        stat_names.push (YEM::STATS::DEX::VOCAB)
      end
      # Res
      if $imported["RES Stat"]
        item_stats.push (@object.res)
        stat_names.push (YEM::STATS::RES::VOCAB)
      end
    end
    return item_stats, stat_names
  end
end
Title: Re: Item & Skills Catalogue
Post by: Tetosan on September 27, 2012, 01:27:33 AM
Hey,
I ran into a problem and am not sure if this is a compability issue with other scripts or whatever.

I installed the script and decided to test it. Now whenever i hover over a certain skill in the Skill List i get this Error:
Quote
Script 'Window_Base' line 158: NoMethodError occured.

undefined method `' for nil:NilClass

It seems to only occur when i hover over this skill in the Skill Catalog, neither occures in the Skill tab of the menu or in a Fight ^^''

i do not use the Bitmap Addon as this gives me a menu when i open the Menu (suspect issue with another script)
Title: Re: Item & Skills Catalogue
Post by: modern algebra on September 27, 2012, 01:39:32 AM
Could you possibly recreate the error in a new project and upload it so I can take a look?
Title: Re: Item & Skills Catalogue
Post by: Tetosan on September 27, 2012, 02:12:05 AM
currently trying to reproduce the error in a new project.... seems to be a compability issue with another script tho as it works smoothly now... trying to identify scripts that could somehow inflict with it :/
Title: Re: Item & Skills Catalogue
Post by: modern algebra on September 27, 2012, 02:15:58 AM
Alright, well let me know :)
Title: Re: Item & Skills Catalogue
Post by: Tetosan on September 27, 2012, 03:02:32 AM
Currently i'm oblivious to what file exactly is causing this...

i thought it was something with the amouth of items i have as the exchange of the items.rvdata did not make the error pop up

however when i changed back to Verify that thesis the problem did not occur, then when exchanging everything -> error pops up again

However can say it's not a script issue tho. must be something in the data folders :/

EDIT: It seems to be a problem because the Script cannot call the skills element ^^'' as they're not Basis Elements :X

EDIT2:
For everyone out there with Custom added Elements
If you run into this problem too add more numbers to this line

Code: [Select]
CI_ITEM_ELEMENT_ICONS = [132, 2, 4, 14, 16, 12, 138, 137, 104, 105, 106, 107,
                           109, 110, 111, 112, 112, 122]
As you can see ^ has 3x 112 (as i have a total of 18 used elements (Added Twilight and Blood as an Element)

Thanks to modern algebra for the help tho if you didn't ask me to send you a new project where you can take a look at i'd never found out that it wasn't a compability error but my own stupidity for not carefully reading what the script said ^^''