Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Shop Script

Status
Not open for further replies.
I know how to make the items appear in the Shop VIA Scripting. But How do I make a shop use all items without having to add every single item to the call script.
 

Aran

Member

I'm not sure how you add items to the shop, in the interpreter it looks like this line
Code:
  # Add goods list to new item
        $game_temp.shop_goods.push(@list[@index].parameters)

But perhaps if it wants id's, then simply loop through all the items in your database and where it asks for the id put the variable containing the id's in place of it. I'm not sure, but that may work...
 
Just do this in a call script (And I assume Item is all of the Items)

Code:
$game_temp.shop_goods = []
$data_items.each_index do |index|
  next if index == 0
  $game_temp.shop_goods << [index, 0]
end
$scene = Scene_Shop.new

But the data is really an array of arrays like this [id, type]
where id is the id of the item and type is 0: item 1: weapon 2:armor
 
Oops had the array setup the wrong way

Code:
$game_temp.shop_goods = []
$data_items.each_index do |index|
  next if index == 0
  $game_temp.shop_goods << [0, index]
end
$scene = Scene_Shop.new

its [type, id]
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top