[RMVX ACE] NEED HELP WITH VARIABLES FOR A MENU

Posts

Pages: 1
hey guys, so i am making a item menu using common events for my game, so far most of it is working out except for the adding and subtracting of numbers of the items.
now each item in this menu has 2 variables, one for the ones and one for the tens
(so i don't have to make 99 show picture conditional branches for each item) now subtracting and adding by 1 is working but i don't know how to add or sub more than that without adding a lot more conditional branches, so i was wondering if somebody cant help me with that.
here is what the common event looks like:

conditional branch (corn) in inventory, include equipment
call common event (icon check)
conditional branch: variable (corn ones) >9
control variables (corn tens) + 1
control variables (corn ones) = 0
branch end

conditional branch (corn) in inventory, include equipment
call common event (icon check)
conditional branch: variable (corn ones) <9
control variables (corn tens) - 1
control variables (corn ones) = 9
branch end

here what it currently looks like:

SunflowerGames
The most beautiful user on RMN!
13323

This would be easier if you didn't use a different variable for the ones and tens.
Or just made the maximum carry 9.
Marrend
Guardian of the Description Thread
21806
I was thinking something completely different. Like, altering the Window_ItemList class so that only the icon and number appear. It could probably use some tweaking to get it to where you want to look like, but, what I was looking at looked something like...

class Window_ItemList < Window_Selectable
  def col_max
    return 6
  end
  
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    draw_icon(item.icon_index, x, y, enabled)
    #change_color(normal_color, enabled)
    #draw_text(x + 24, y, width, line_height, item.name)
  end
end


...this.
@Kory_toombs i used 2 variables because i didn't want to do 100 show image conditional branches, and only having 9 maximum carry would be a huge pain for the player, after all it is a farm sim (like harvest moon fomt), and running back and forth from the storage would make the game (more)tedious

@Marrend does this script only show the the numbers and not make it interactive? (example just an image) would this be altered in the script editor? if so where exactly?
Marrend
Guardian of the Description Thread
21806
Well, I was going off the base-scripts, so that still assumes an item category window/processing. Not 100% sure how to deal with that yet. However, from the testing I've done, it displays the appropriate icon, a colon, then the quantity held. Like...




...so.

*Edit: This does not prevent the actual use of items, as far as I can tell. However, I am inclined to note that the position of the party-window that opens is on the right side of the screen when an item in an "even" column is selected, and on the right side of the screen for items in an "odd" column. This may have to do with the fact that the default column size for the item-screen is 2, rather than 6.
I don't know how to implement this, for all my menu (main menu,save menu,load menu etc)are all event/show picture base. i am not using the vanilla menu at all, so is there a way to use this?
Marrend
Guardian of the Description Thread
21806
Technically speaking, a script-call to SceneManager.call(Scene_Item) would bring up the default item-menu, and if you put the code I had for Window_ItemList into a new script-page under the "Materials" label, it will produce the window in my screenshot above. However, that might not be what you want to do.


I've been puzzling over it a bit longer, and I think I have a solution for you.

class Window_ItemList < Window_Selectable
  def spacing
    return 16
  end

  def col_max
    return 6
  end
    
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    draw_icon(item.icon_index, x, y, enabled)
  end
end

class Scene_Item < Scene_ItemBase
  def start
    super
    create_item_window
  end
  
  def create_item_window
    @item_window = Window_ItemList.new(32, 32, Graphics.width - 64, (12+24)*2)
    @item_window.category = :item
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:return_scene))
    @item_window.activate
    @item_window.select_last
  end
end

So, you'd still have to do a script-call to SceneManager.call(Scene_Item), and the position of the window might need to be tweaked to fit your game better. I'm kinda thinking the y value, in particular. That's the second value passed into Window_ItemList.new. However, should you use these values, it should look something like...




...that. Note that the scroll arrow is there because I have the same items as the last screenshot, and would have three lines of items. In your case, I don't think you need to worry about that.

*Edit: This image has been updated, so, if something looks off, you may need to hard refresh for it to display properly.
hey marrend with this script i was wondering if you can make the window invisible and just the number show up. is that possible? (sorry for taking such a long time to reply)
Marrend
Guardian of the Description Thread
21806
With...

class Window_ItemList < Window_Selectable
  def initialize(x, y, width, height)
    super
    self.opacity = 0
    self.back_opacity  = 0
    @category = :none
    @data = []
  end
  
  def spacing
    return 16
  end

  def col_max
    return 6
  end
  
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_number(rect, item)
    end
  end
  
  def draw_item_number(rect, item)
    draw_text(rect, sprintf("%2d", $game_party.item_number(item)), 2)
  end
end


...this code, numbers will appear on the screen, and nothing else. No windows, icons, or help window.





If you prefer the icons, it would be something more like...

class Window_ItemList < Window_Selectable
  def initialize(x, y, width, height)
    super
    self.opacity = 0
    self.back_opacity  = 0
    @category = :none
    @data = []
  end
  
  def spacing
    return 16
  end

  def col_max
    return 6
  end
  
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    draw_icon(item.icon_index, x, y, enabled)
  end
end


...that, instead.





For full disclosure, Scene_Item...

class Scene_Item < Scene_ItemBase
  def start
    super
    create_item_window
  end
  
  def create_item_window
    @item_window = Window_ItemList.new(32, 32, Graphics.width - 64, (12+24)*2)
    @item_window.category = :item
    @item_window.set_handler(:ok,     method(:on_item_ok))
    @item_window.set_handler(:cancel, method(:return_scene))
    @item_window.activate
    @item_window.select_last
  end
end


...which I'm pretty sure was posted before, was kept the same between the two options.
Pages: 1