Limiting sections of crafting menu

Discussion in 'RGSSx Script Support' started by Mawichan, Sep 11, 2018.

Thread Status:
Not open for further replies.
  1. Mawichan

    Mawichan Veteran Veteran

    Messages:
    55
    Likes Received:
    6
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Hello, I'm using Coloeocanth's Crafting System and Modern Algebra's custom Item Menu script.
    Fortunately, these two scripts are compatible.
    The problem is that all new item categories I created with the item menu script are included when I open the crafting scene, whereas I only want to see the armor and weapon sections when I open that scene.
    Is there something I can do to limit the categories shown in the crafting scene?
    Thank you in advance.
     
    #1
  2. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,817
    Likes Received:
    852
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    I believe I understand what you want, but can you make a quick mockup image to be clear?
    the solution should be a simple condition check, if I'm right.
     
    #2
  3. Mawichan

    Mawichan Veteran Veteran

    Messages:
    55
    Likes Received:
    6
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    This is more less what the layout of the crafting scene looks like
    [​IMG] [​IMG]
    This is more less what I want it to look like
    [​IMG] [​IMG]
    (Are these helpful?)

    For the sake making the inventory more orderly, I made separate categories for items that otherwise would have been crammed together in the same space. For example, I left melee weapons on the default "Weapons" category, while I made new ones for shields, bows, and tools for spell casting, even though they're all in the weapons section of the database.
    Same thing for armors, There's helmets, gloves, chestpieces, pants, and accesories, but only the chestpieces will be upgradable, so I don't need to feature the other armor sections.
    As for items, I left consumables on the default Item section, while I made new ones for crafting materials, items for buffing, items to use as projectiles and such. I don't need any of these to appear on the crafting menu.

    I hope I'm conveying this well enough, thank you for taking the time to look into this :)
     
    #3
  4. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,817
    Likes Received:
    852
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    line 131 of Modern Algebra's script.

    *it* should override Coloeoacanth's script, and is wired to self-adjust automatically.
    ¯\_(ツ)_/¯
     
    #4
  5. Mawichan

    Mawichan Veteran Veteran

    Messages:
    55
    Likes Received:
    6
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    I'm really sorry, but I don't understand what you mean.
    Line 131 of that script says "# To find out how to assign an item to one of the custom categories you create,"
    What should I do there?
     
    #5
  6. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,817
    Likes Received:
    852
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    read *the end of that sentence* on line 132?
     
    #6
  7. Mawichan

    Mawichan Veteran Veteran

    Messages:
    55
    Likes Received:
    6
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Well, I did before I asked, I looked at line 44 too. That's just the instructions to assign database items to the new categories in the inventory, which I long did already. How does assigning categories to items have anything to do with which sections appear on the crafting menu? I hope I'm not sounding rude.
     
    #7
  8. Sixth

    Sixth Veteran Veteran

    Messages:
    2,133
    Likes Received:
    801
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    You can't do this without a patch, because Modern Algebra's script overwrites the category selection window for all scenes which use it, and that craft scene happens to use it as well.

    You can try this snippet:
    Code:
    class Window_ItemCategory
    
      def make_command_list
        if SceneManager.scene.is_a?(Scene_CraftBase)
          # Setup the categories you want to show in the craft menus only here.
          # You can still only use the category symbols you have setup in
          # Modern Algebra's script.
          categories = [:item, :weapon, :armor]
        else
          categories = MA_CUSTOM_ITEM_MENU[:custom_categories]
        end
        vocab = MA_CUSTOM_ITEM_MENU[:category_vocab]
        categories.each {|category|
          text = vocab[category].is_a?(Symbol) ? eval(vocab[category].to_s) : vocab[category]
          add_command(text, category)
        }
      end
    
    end
    
    Put it right below Modern Algebra's script.
    Edit the categories array (the one below the comments), add whatever categories you want there.
    Of course, I didn't test this, so it's up to you to find out if it works or not. :p
     
    Last edited: Sep 12, 2018
    #8
  9. Mawichan

    Mawichan Veteran Veteran

    Messages:
    55
    Likes Received:
    6
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    I did figure I'd need a patch for it, though the previous answer threw me off a bit.
    Unfortunately, the patch you provided is not working.
    Thank you very much Sixth for looking into this either way :D
     
    #9
  10. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,817
    Likes Received:
    852
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    precisely what I was basing myself on!

    if Modern Algebra's script is run after Coloeocanth's, it'll take over that window, and take it's structure from the items themselves.
    your solution only restores the standard structure when using the crafting scene, which the OP wants to change, to begin with.
    so, better to build it around Modern Algebra's fix, and call it a day.

    I thought it was a sorting problem, but then realized MA's work takes care of it, moving it over to a set of note tags, that's why I pointed to the instructions.
    a work around could be to disguise the crafting categories as new, separate categories, but sporting the usual strings (WHICH, the plugin supports)
     
    Last edited: Sep 12, 2018
    #10
  11. Mawichan

    Mawichan Veteran Veteran

    Messages:
    55
    Likes Received:
    6
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Just gave a second look at Sixth's snippet. I now know why it didn't work.
    In the line:
    if SceneManager.scene_is?(Scene_CraftBase)
    The scene it should be asking for is Scene_Crafting.

    I changed that bit and works wonders now.
    Once again, thanks a lot to both of you for your time and patience :D
     
    #11
  12. Sixth

    Sixth Veteran Veteran

    Messages:
    2,133
    Likes Received:
    801
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    @Mawichan
    Yeah, I thought it will recognize the craft scenes if I only use their superclass in the check, but it seems that doesn't work with that scene_is? method.
    Changed the snippet, try it now.

    Edit:
    Ohh, ninja'd. :D
    That works too, yeah.
    If you need the same categories for the breakdown scene, you will have to add that to the check too.
    Or just use the edited snippet, it should work now for both scenes.

    @gstv87
    I honestly have no idea what are you trying to say.
    There is nothing that can be done with any of the script settings provided in any of these scripts to make 2 different category windows.
    My patch lets him setup a different group of categories for the crafting scenes, which is exactly what he wrote he wants, unless I misunderstood something.
     
    #12
  13. gstv87

    gstv87 Veteran Veteran

    Messages:
    1,817
    Likes Received:
    852
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    that's what I thought of, but using MA's own plugin: create new categories, but label them differently.
    MA's plugin should support that.
     
    #13
  14. Mawichan

    Mawichan Veteran Veteran

    Messages:
    55
    Likes Received:
    6
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    @Sixth
    Yes, the edited snippet works fine on both scenes! Before checking your reply I had used my workaround to make it work on the breakdown scene too, but I'll stick to your edited version instead since it's simpler. It's quite helpful.

    @gstv87 I don't think creating new categories regardless of labelling or item sorting would have helped. Either way the issue has been solved now, fortunately.
     
    #14
  15. mlogan

    mlogan Global Moderators Global Mod

    Messages:
    13,904
    Likes Received:
    7,682
    Location:
    Texas
    First Language:
    English
    Primarily Uses:
    RMMV

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #15
Thread Status:
Not open for further replies.

Share This Page