- Joined
- Jan 13, 2019
- Messages
- 27
- Reaction score
- 5
- First Language
- English
- Primarily Uses
- RMVXA
This should (and hopefully) be the last Shop Steal problem I have.
So as you might know, I'm a amateur at coding, but I can still figure things out (RUBY can make so many more problems)
The problem is that when buying stuff, the items are free when the window opens.
The script only adds code, so I don't know what happened. Here's the bit of code that I think might be the problem (it's basically a modified copy of Window_ShopBuy)
I'm just looking for ways to fix the problem, not necessarily asking for someone to find out for me; I still want to improve, and possibly say that I made this script.
If more is needed, I will supply it.
So as you might know, I'm a amateur at coding, but I can still figure things out (RUBY can make so many more problems)
The problem is that when buying stuff, the items are free when the window opens.
The script only adds code, so I don't know what happened. Here's the bit of code that I think might be the problem (it's basically a modified copy of Window_ShopBuy)
Code:
#==============================================================================
# ** Window_ShopSteal
#------------------------------------------------------------------------------
# This window displays a list of steal goods on the shop screen.
#==============================================================================
class Window_ShopSteal < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :status_window # Status window
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, height, shop_goods)
super(x, y, window_width, height)
@shop_goods = shop_goods
@money = 0
refresh
select(0)
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 304
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
@data[index]
end
#--------------------------------------------------------------------------
# * Set Party Gold
#--------------------------------------------------------------------------
def money=(money)
@money = money
refresh
end
#--------------------------------------------------------------------------
# * Get Price of Item
#--------------------------------------------------------------------------
def price(item)
@price[item]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# * Create Item List
#--------------------------------------------------------------------------
def make_item_list
@data = []
@price = {}
@shop_goods.each do |goods|
case goods[0]
when 0; item = $data_items[goods[1]]
when 1; item = $data_weapons[goods[1]]
when 2; item = $data_armors[goods[1]]
end
if item
@data.push(item)
@price[item] = goods[2] == 0 ? item.price : goods[3]
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = item_rect(index)
draw_item_name(item, rect.x, rect.y)
rect.width -= 4
draw_text(rect, price(item), 2)
end
#--------------------------------------------------------------------------
# * Set Status Window
#--------------------------------------------------------------------------
def status_window=(status_window)
@status_window = status_window
call_update_help
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item) if @help_window
@status_window.item = item if @status_window
end
end
If more is needed, I will supply it.

