*Advanced Question* Inventory doesn't show up in menu or battle!

Status
Not open for further replies.

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
This is a relatively difficult question and I've done a lot of custom scripting, so while I'd be incredibly grateful for a solution, even just a brainstorm of ideas or a point in the right direction would be appreciated.

For a while, I have noticed that when I do a Battle Test, and choose "Item", no items show up.  You can visit the Item Select screen in battle but nothing will show up and pressing the C button on the one blank space that's selectable will give you the buzzer SE.  Adding an item during battle via event seems to do nothing - visiting the Item Select screen in battle after doing so will still yield the same result.

This wasn't a big problem until recently - I would just create any battle I needed to test with items inside a test area map, and mark it as the Start Point.  Here, items would show up just fine.

However, today I was creating a new game mode ("Boss Rush") that simply warps you to a map from the Title Screen (after doing what I think is the necessary setup) where an Autorun event starts a battle, and in this new Game Mode I get the same problem where items don't show up.  I found some interesting extra things while playing around with this - when I make the event on this map simply give the player items (and then let them go to the menu screen before any battles), you still cannot see any items, and a special script that I have run to tell the player they gained items doesn't trigger.  Meanwhile, if I jump to this "battle map" from the test area map, instead of directly from the Title Screen, everything works fine.  I can see the items on the menu AND in battle just fine.

So my instinct is that either the Party, the Inventory, or some other Inventory-related mechanism is not being created correctly except via the New/Load game commands.  I searched around and changed different things for hours, with no effect.  I'll paste some of the relevant things I've changed in Scene_Title, DataManager, etc. below.  If you know the constructs and methods that are normally used to create the player's inventory, or if you have any ideas about other things I might try to get this to work properly, please share!  Thanks so much :)

The huge amount of custom scripting that's all tied together makes it impractical to try disabling scripts one by one.  However, I can say that in a completely clean project, Battle Tests work fine - you can see the player's inventory.

Here are what I think are the most relevant snippets from my custom scripting.  If you have specific classes or methods you want to see, let me know and I'll add them here.

Snippets from modifications to DataManager

module DataManager   #--------------------------------------------------------------------------  # * Set Up New Boss Rush  #--------------------------------------------------------------------------  def self.setup_new_bossrush    create_game_objects    $game_party.setup_starting_members    $game_map.setup(33)    $game_player.moveto(0, 0)    $game_player.refresh    Graphics.frame_count = 0  end endmodule DataManager   class << self   #--------------------------------------------------------------------------  # * Set Up Battle Test  #--------------------------------------------------------------------------  alias :setup_btest_with_globals :setup_battle_test  def setup_battle_test    load_global_data    setup_btest_with_globals  end   end# Note: load_global_data is a sensitive method, but shouldn't be# relevant to this problem. The Title screen uses it too# and that's where you launch a New Game from.end
Snippets from modifications to Scene_Title

class Scene_Title < Scene_Base
 
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  alias :start_with_globals :start
  def start
    DataManager.load_global_data
    start_with_globals
  end
 
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  alias :create_alternate_title_window :create_command_window
  def create_command_window
    create_alternate_title_window
    @command_window.set_handler:)arcade, method:)command_arcade))
    @command_window.set_handler:)bossrush, method:)command_bossrush))
    @command_window.set_handler:)options, method:)command_options))
  end
 
  #--------------------------------------------------------------------------
  # * Select Boss Rush Mode
  #--------------------------------------------------------------------------
  def command_bossrush
    
    reconcile_game_scores # This is irrelevant so ignore it.  I already tried removing it.  Didn't work.
    
    $mode = "Boss Rush"
   
    DataManager.setup_new_bossrush
    
# NOTE: The following is disabled but was once used instead of calling the setup_new_bossrush

#             method.  In both cases, I get the same problem: Items don't show up.

#~     $game_map.setup(33)
#~     $game_player.moveto(0, 0)
#~     $game_player.refresh
#~     Graphics.frame_count = 0
#~     
#~     fadeout_all
#~     Audio.bgm_stop
#~     $game_map.autoplay
#~     tone = Tone.new(0,0,0,0)
#~     $game_map.screen.start_tone_change(tone, 1)

    SceneManager.goto(Scene_Map) # This is ENABLED.
    
  end
 
  #--------------------------------------------------------------------------
  # * [New Game] Command - also sets the Mode to Adventure
  #--------------------------------------------------------------------------
  alias :command_new_game_with_mode :command_new_game
  def command_new_game
    $mode = "Adventure"
    command_new_game_with_mode
  end
 
  #--------------------------------------------------------------------------
  # * [Continue] Command - also sets the Mode to Adventure
  #--------------------------------------------------------------------------
  alias :command_continue_with_mode :command_continue
  def command_continue
    $mode = "Adventure"
    command_continue_with_mode
  end
 
end
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


Sounds like there's a problem in your Battle Items window. What script mods have you done there?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Sounds like there's a problem in your Battle Items window. What script mods have you done there?
Good question!

There are three mods to Window_BattleItem.  The first is a tiny change that I made so that all items appear enabled even when they're not (I have a few items in battle that are there simply to show you text and it looks weird to have them greyed out):

class Window_BattleItem < Window_ItemList #-------------------------------------------------------------------------- # * Include in Item List? #-------------------------------------------------------------------------- def include?(item) return item.is_a?(RPG::UsableItem) end endThe second is the standard series of changes made by "Battle Luna".  I'm not allowed to post this, right?

The last one is the standard "Disable Default Cursor" add-on that comes with Luna Engine.  I assume it's okay to post this since it's just two lines:

class Window_BattleItem < Window_ItemList   #--------------------------------------------------------------------------  # alias method: update_cursor  #--------------------------------------------------------------------------  alias battle_luna_ddc_update_cursor update_cursor  def update_cursor    setting[:cursor] ? battle_luna_ddc_update_cursor : cursor_rect.empty    ensure_cursor_visible  end endAnything suspicious here?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Comment out your version of include? and run it and see if the items appear.


Unless you're planning to show skills in this window, you may as well just change that to .is_a?(RPG::Item), but try the above first to see if going back to the default script fixes your problem.


Also look around to see if you've defined that include? method anywhere else - do a global search for class Window_BattleItem in case you've got several modifications split between different scripts.


Battle_Luna shouldn't change the behaviour of the .include? method - it's all about layout. Similarly, the last method you posted doesn't have anything to do with what items are actually displayed on the list.
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
Thanks for your help so far, Shaz!

I tried disabling my custom include? method - it didn't change anything.

Also did a global search for Window_BattleItem; I can confirm the standard (default) class has not been directly edited, and that the only place its include? method is modified is in my custom method.

The one thing that is making me think this is some kind of problem with DataManager or other game setup, is that I don't seem to even receive the item when I'm supposed to in the "Boss Rush" mode.  Doesn't appear on the menu screen under my items.

Weird one, right? :)

((Also, changed "UsableItem" to "Item".  You're right; that's a safer way to do it in case I make further mods to that window. or the UsableItem hierarchy.))

EDIT: Any chance this could be from a file corruption?  I've had to copy elements one-by-one into backup files on this project a few times due to the "Invalid File Format" corruption error that happened a few times when we got power outages.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
I'd say it's more to do with your additional scripts than a bug with data manager - seeing as you're the only one who's experienced it in the 3 years (?) since Ace has been released, and you're doing some weird stuff with your scripts.


If you try it in a brand new project with just your Window_BattleItem mods and no other script mods, does it work?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I'd say it's more to do with your additional scripts than a bug with data manager - seeing as you're the only one who's experienced it in the 3 years (?) since Ace has been released, and you're doing some weird stuff with your scripts.

If you try it in a brand new project with just your Window_BattleItem mods and no other script mods, does it work?
Kind of good to know I'm the only one who's seen this.  Moreso I was wondering whether *I* had done something wrong to DataManager as opposed to Window_BattleItem.

Just checked - yes, it does work properly in a new project.

One other thought/question related to figuring this out: the inventory construct (as in, the player having an inventory that can hold items) is created as soon as the party is created, as part of init_all_items, right?

I do alias the Game_Party initialize method, but in my mind this should be safe.  Let me know if you think otherwise:

#-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- alias :init_with_customs :initialize def initialize init_with_customs @util1 = [] @util2 = [] @clock = [false, 0, 0] endThanks!! :)
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
(keeping this separate from my last post for clarity)

Ah, I see what happened.

The items were never properly added to the inventory due to a bug in a very old modification that I made - one that aliases gain_item and only runs the old behavior if a switch is set ON (this switch is required for certain things but shouldn't be required for standard gain item behavior).  Essentially, the "gain item" event command would run, but it wouldn't actually add the item to the player's inventory.

In my standard new game mode, I ran a common event called "New Game Processing" at the beginning of the game that set this switch ON, but with the Boss Rush I never visited the map that would force it to run.

Additionally, it seems that the Battle Test Setup directly uses the gain_item method, which is why it was also affected by this bug in my scripting.

I am so sorry for wasting your time with this.  But thank you, sincerely, for talking through it with me - needing to answer your questions with certainty is what eventually led me to replicate the Game Start Processing event commands. :)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top