Posts: 448
Threads: 18
Joined: Sep 2015
I'm looking for a way to sort the items in the shop window individually like it was in RM2k and not by ID.
Maybe a simple scriptcall would be enough, but at this point I'm not sure how to do it.
Posts: 4,592
Threads: 536
Joined: Dec 2009
It would require a custom script because all items or weapons or armors are hashes that store ID's and amounts, not items per se. Even if you separate every potion or bronze sword, they will be identical, you may pick any of them or the next one that it would not matter at all. Before anybody offers a solution, you would need to specify how you pretend to use it and where you need it, i.e. a bag menu, a shop menu, etc.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Posts: 448
Threads: 18
Joined: Sep 2015
01-16-2018, 11:40 PM
(This post was last modified: 01-16-2018, 11:40 PM by Mel.)
Just the normal shop window but with a custom order instead of sorted by ID.
Maybe you know the Call Shop command from RPG Maker 2000. There the items in the shop windows were sorted by the order how you put it into the command windows in the editor.
So you could have it like this:
[1] Bronze Sword
[5] Bronze Spear
[9] Bronze Axe
[2] Iron Sword
[6] Iron Spear
[10] Iron Axe
Without rearranging the whole database.
Posts: 71
Threads: 10
Joined: Jun 2015
Try this. Not sure if this is what you are looking for but trying replacing refresh method in Shop Buy with this.
Code: def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if item != nil
@data.push(item)
end
end
# Sort by Name
@data.sort! { |a,b| a.name <=> b.name }
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
Posts: 448
Threads: 18
Joined: Sep 2015
That helps alot.
Thank you!
At least as long as the alphabetical order does the trick.^^
Posts: 71
Threads: 10
Joined: Jun 2015
(01-17-2018, 12:55 AM)Melana Wrote: That helps alot.
Thank you!
At least as long as the alphabetical order does the trick.^^
if not, change .name to the attribute you need. You can sort by name, occasion, price, etc. As long as it is shared by items, weapons, and armor. Otherwise you have to edit a little more to specify when to apply the sorting and what to sort by.
Posts: 448
Threads: 18
Joined: Sep 2015
01-17-2018, 01:35 AM
(This post was last modified: 01-17-2018, 01:36 AM by Mel.)
Yes, that works fine.
The only complicated thing is to have a complete uncommon order without a specific sorting.
Like adding weapon[67],weapon[64] and weapon[70], and then weapon[5], weapon[8] and weapon[2] just because you want them in that specific order without a reason.
Might be very unlikely though.
Posts: 71
Threads: 10
Joined: Jun 2015
(01-17-2018, 01:35 AM)Melana Wrote: Yes, that works fine.
The only complicated thing is to have a complete uncommon order without a specific sorting.
Like adding weapon[67],weapon[64] and weapon[70], and then weapon[5], weapon[8] and weapon[2] just because you want them in that specific order without a reason.
Might be very unlikely though.
Im not sure why it changes the natural order of the array in the first place other than it is creating a new one that is referencing the original $game_temp.shop_goods but not directly using it.
Maybe someone a little more experienced than I would know.
Posts: 4,592
Threads: 536
Joined: Dec 2009
I don't recall quite clearly, but I thought the event command window tries to order them once you close the add goods subwindow, or was it during the addition of new goods? If there's no order implied by the maker itself, it should be showed the way they were added. If that's not the case, then it's obvious you'd need to check the corresponding Interpreter command that handles the shop option, there you may find if there is a sort method at some point. Keep in mind it stores info like this: [[0,1],[1,2],[2,4]]
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Posts: 448
Threads: 18
Joined: Sep 2015
Yes the event command sorts them already in the editor by ID.
If you put in the Iron Sword first and then the Bronze Sword, the Bronze Sword will stay on top.
|