Author Topic: General RGSS/RGSS2/RGSS3 Help  (Read 135038 times)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #80 on: May 21, 2009, 03:11:41 AM »
How do we setup
Code: [Select]
$game_temp.shop_goods
I need to figure this out for a script for my game.

Offline legacyblade

  • Pretzel Man
  • Moderator
  • Chaos User
  • ***
  • Posts: 1838
  • LV: 84
  • Gender: Male
  • There is a fate worse than hell
    • View Profile
    • SpencerConrad.com
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #81 on: May 21, 2009, 05:10:57 AM »
long answer:

(click to show/hide)

short answer:

(click to show/hide)



Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5135
  • LV: 198
  • Gender: Female
  • Wants to write a compiler for fun
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #82 on: May 21, 2009, 05:24:19 AM »
$game_temp.shop_goods is an array that looks like this
Code: [Select]
[[x, y], [x, y], [x, y], [x, y]]
where x is the item type
Code: [Select]
case x
when 0
  item is a $data_items
when 1
  item is a $data_weapons
when 2
 item is a $data_armors
end
and y is the items ID
so...
Code: [Select]
[[0, 1], [1, 1], [2, 1]]would create a shop where you could buy a potion, bronze sword, and bronze shield in that order

hope this helps!

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #83 on: May 21, 2009, 05:44:51 AM »
$game_temp.shop_goods is an array that looks like this
Code: [Select]
[[x, y], [x, y], [x, y], [x, y]]
where x is the item type
Code: [Select]
case x
when 0
  item is a $data_items
when 1
  item is a $data_weapons
when 2
 item is a $data_armors
end
and y is the items ID
so...
Code: [Select]
[[0, 1], [1, 1], [2, 1]]would create a shop where you could buy a potion, bronze sword, and bronze shield in that order

hope this helps!



Thanks Rye *powers up*

And lb of course
$game_temp.shop_goods is going to equal something xD thanks anyways lb *powers up*

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5135
  • LV: 198
  • Gender: Female
  • Wants to write a compiler for fun
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #84 on: May 21, 2009, 05:53:23 AM »
yay I need power!
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline legacyblade

  • Pretzel Man
  • Moderator
  • Chaos User
  • ***
  • Posts: 1838
  • LV: 84
  • Gender: Male
  • There is a fate worse than hell
    • View Profile
    • SpencerConrad.com
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #85 on: May 21, 2009, 06:09:17 AM »
yay, power! And Game_Guy, that is how I find out what I need about certain data structures, print them when they're in use. It's how I figured out the move picture command in RGSS. I was just giving you my standard process.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #86 on: May 21, 2009, 06:57:41 AM »
short answer
(click to show/hide)




I was referring to the short answer. $game_temp.shop_goods = something of course it'll equal something xD

Offline legacyblade

  • Pretzel Man
  • Moderator
  • Chaos User
  • ***
  • Posts: 1838
  • LV: 84
  • Gender: Male
  • There is a fate worse than hell
    • View Profile
    • SpencerConrad.com
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #87 on: May 21, 2009, 07:42:07 AM »
oh, lol. My short answers are usually a sarcastic literal answer of the question :P

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #88 on: May 23, 2009, 04:06:29 AM »
Ok I want to be able to have each item have rarity stars. Now I have the icon but how would I go making this icon be display 1, 2, 3, 4, or 5 times on that item line?

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5135
  • LV: 198
  • Gender: Female
  • Wants to write a compiler for fun
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #89 on: May 23, 2009, 11:34:22 PM »
Code: [Select]
n.times do |i|
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #90 on: May 23, 2009, 11:51:18 PM »
so do I replace the i or the n with the number of times?

Offline Aqua

  • Lexima Warrior
  • *******
  • Posts: 2554
  • LV: 118
  • Gender: Female
  • Quack!
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #91 on: May 24, 2009, 12:04:17 AM »
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever


You could also do...
Code: [Select]
for i in item.rarity
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
This way you don't have to use conditions nor the n.
« Last Edit: May 24, 2009, 12:07:23 AM by Aqua »

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #92 on: May 24, 2009, 12:11:07 AM »
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever


You could also do...
Code: [Select]
for i in item.rarity
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
This way you don't have to use conditions nor the n.

I just replaced the n with item.rarity and it worked so there was no need to have branches.... thanks guys (lvs up aqua and ryex)

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5135
  • LV: 198
  • Gender: Female
  • Wants to write a compiler for fun
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #93 on: May 24, 2009, 02:10:30 AM »
where n = <number_of_times_to_draw_icon>
you can set n to 1, 2, 3, 4, or 5 with conditional branches or what ever


You could also do...
Code: [Select]
for i in item.rarity
  src_rect = Rect.new(0, 0, 24, 24)
  <bitmap_class_instance>.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
This way you don't have to use conditions nor the n.
You COULD  use a 'for i in' but you SHOULDN'T it's slow and  'n.times do |i| end' is much faster WcW taught me that
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #94 on: May 24, 2009, 02:48:29 AM »
Either way this question is resolved but could someone just explain how i would call a bitmap like the one ryex told me through the window.

I just want to know what everything in the line does.

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5135
  • LV: 198
  • Gender: Female
  • Wants to write a compiler for fun
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #95 on: May 24, 2009, 02:55:46 AM »
in a window
Code: [Select]
n.times do |i|
  src_rect = Rect.new(0, 0, 24, 24)
  self.contents.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
self.contents IS a Bitmap instance

but elsewhere
Code: [Select]
bitmap = Bitmap.new(width, height)
n.times do |i|
  src_rect = Rect.new(0, 0, 24, 24)
  bitmap.blt(<init_x_value> * i, y, RPG::Cache.icon(<icon_name>), src_rect)
end
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #96 on: May 24, 2009, 02:57:27 AM »
Ok that makes a bit more sense now what exactly does src_rect do/mean?

Just trying to learn as much as I can

Offline Ryex

  • Arctic Bird of Programming
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 5135
  • LV: 198
  • Gender: Female
  • Wants to write a compiler for fun
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #97 on: May 24, 2009, 03:11:14 AM »
src_rect is a compressed form of source_rectangle it is an instenct of the Rect class the Rect class simply stores a rectangle
so
Code: [Select]
src_rect = Rect.new(0, 0, 24, 24) creates a Rect instance with the dimensions 24 by 24 at the co-ordanets (0, 0)
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.

DropBox, the best free file syncing service there is.
(click to show/hide)

Offline fugibo

  • World Conqueror
  • Chaos User
  • ******
  • Posts: 1966
  • LV: 44
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #98 on: May 24, 2009, 03:25:32 AM »
You should probably just add the Rect.new parts inside the argument list, skip over storing then reloading the variable.

Offline G_G

  • Green Gmod Game_Guy AKA G4 AKA hyper-G AKA G-force
  • Global Moderator
  • Chaos Ultimate
  • ****
  • Posts: 6591
  • LV: 407
  • Gender: Male
    • View Profile
Re: General RGSS/RGSS2/RGSS3 Help
« Reply #99 on: May 24, 2009, 03:26:03 AM »
Thanks both of you *lv's both up*

Any bit of RGSS I can learn the better.