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.

Prize Points v2.0!

Yay, I've done it, with some help from Me(tm)!

Okies, here's my screenyweeny!
http://i35.photobucket.com/albums/d194/rubymatt/Prizepoints.jpg[/IMG]

Demo:
SAVEFILE:
http://www.savefile.com/files/1324425
MEGAUPLOAD:
[/FONT]
http://www.megaupload.com/?d=CQ28APUO

Scripty!:
New script above main blah de blah
Code:
#==================================
#Scene_Prize v1.0
#by Rubymatt
#==================================
#Insert in a new script above Main.
#HOW TO USE:
#in the Def Main section, edit the names of the items and points required.  
#Change the wording and prices of the things inside the "".
#-------------------------------------------------------------------
#in def update, the prize variations and variable number need changing to your game.
#Remove the # on lines 54-56 to make the final prize only obtainable once.
#-------------------------------------------------------------------
#VERSION HISTORY
#v2.0 (This ver)
#Variable now referred to as @points for easiness
#Prices now displayed in another window instead of random aligning
#Switch to prevent re-buying of the final item on the list
#------
#v1.0
#Sucky....
#==================================
class Scene_Prize
  def main
    @spriteset = Spriteset_Map.new
    @points = $game_variables[1] #Change the points variable here
    s1 = "Potion" #Edit your item names here.
    s2 = "Elixir"
    s3 = "Bronze Armour"
    s4 = "Ring of Strength"
    s5 = "Saint Robe"
    s6 = "Steel Sword"
    s7 = "Screw Thrust"
    s8 = "Cancel"
    @command_window = Window_Command.new(220, [s1, s2, s3, s4, s5, s6, s7, s8])
    @command_window.x = 100
    @command_window.y = 100
    @command_window.back_opacity = 200
    if @points < 100
      @command_window.disable_item(0)
    end
    if @points < 250
      @command_window.disable_item(1)
    end
    if @points < 500
      @command_window.disable_item(2)
    end
    if @points < 1000
      @command_window.disable_item(3)
    end
    if @points < 5000
      @command_window.disable_item(4)
    end
    if @points < 10000
      @command_window.disable_item(5)
    end
    if @points < 20000
      @command_window.disable_item(6)
    end
    #if $game_switches[50] == true
    #  @command_window.disable_item(6)    #Disables the best item
    #end
    @points_window = Window_Points.new
    @points_window.back_opacity = 200
    @points_window.x = 200
    @points_window.y = 4
    @needed_window = Window_PointsNeeded.new
    @needed_window.x = 320
    @needed_window.y = 100
    @needed_window.back_opacity = 200
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @spriteset.dispose
    @points_window.dispose
    @needed_window.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end 
  end #of def main
  def update
    @command_window.update
    @spriteset.update
    @points_window.update
    @needed_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::C)
      case @command_window.index
        when 0
          if @points < 100
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.shop_se)
          $game_party.gain_item(1, 1)
          @points -= 100
          $scene = Scene_Map.new
        when 1
          if @points < 250
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.shop_se)
          $game_party.gain_item(7, 1)
          @points -= 250
          $scene = Scene_Map.new
        when 2
          if @points < 500
            $game_system.se_play($data_system.buzzer_se)
           return
          end
          $game_system.se_play($data_system.shop_se)
          $game_party.gain_armor(13, 1)
          @points -= 500
          $scene = Scene_Map.new
        when 3
          if @points < 1000
            $game_system.se_play($data_system.buzzer_se)
           return
          end
          $game_system.se_play($data_system.shop_se)
          $game_party.gain_armor(25, 1)
          @points -= 1000
          $scene = Scene_Map.new
        when 4
            if @points < 5000
            $game_system.se_play($data_system.buzzer_se)
            return
          end
          $game_system.se_play($data_system.shop_se)
          $game_party.gain_armor(24, 1)
          @points -= 5000
          $scene = Scene_Map.new
        when 5
          if @points < 10000
            $game_system.se_play($data_system.buzzer_se)
          else
          $game_system.se_play($data_system.shop_se)
          $game_party.gain_weapon(3, 1)
          @points -= 10000
          $scene = Scene_Map.new
          end
        when 6
          if @points < 20000
            $game_system.se_play($data_system.buzzer_se)
            return
         end
          $game_system.se_play($data_system.shop_se)
          $game_party.actors[2].learn_skill(64)
          $game_switches[50] = true   #Remove the # if you want this to only be obtainable once.
          @points -= 20000
          $scene = Scene_Map.new
        when 7 #cancel
          $game_system.se_play($data_system.cancel_se)
          $scene = Scene_Map.new
        end
      end
    $game_variables[1] = @points.to_i
    end
  end# of class
class Window_Points < Window_Base
  def initialize
    super(0, 0, 200, 96)
      self.back_opacity = 255 
      self.contents = Bitmap.new(width - 32, height - 32)
      self.contents.font.name = "Arial"
      self.contents.font.size = 24
        refresh
      end
  def refresh
    self.contents.clear
    self.contents.font.color = Color.new(192, 224, 255)
    self.contents.draw_text(0, 0, 400, 32,  "Current Points:")
    self.contents.font.color = Color.new(255, 255, 255)
    self.contents.draw_text(4, 32, 160, 32,  $game_variables[1].to_s, 2) #This needs changing
  end
end
class Window_PointsNeeded < Window_Base
  def initialize
    super(0, 0, 140, 256)
      self.back_opacity = 255 
      self.contents = Bitmap.new(width - 32, height - 32)
      self.contents.font.name = "Arial"
      self.contents.font.size = 24
        refresh
      end
  def refresh
    self.contents.clear
    self.contents.font.color = Color.new(192, 224, 255)
    self.contents.draw_text(0, 0, 100, 32,  "100pts", 2) #First prize
    self.contents.draw_text(0, 0, 100, 96,  "250pts", 2) #Second prize
    self.contents.draw_text(0, 0, 100, 160,  "500pts", 2) #Third prize
    self.contents.draw_text(0, 0, 100, 224,  "1,000pts", 2) #Fourth prize
    self.contents.draw_text(0, 0, 100, 288,  "5,000pts", 2) #Fifth prize
    self.contents.draw_text(0, 0, 100, 352,  "10,000pts", 2) #Sixth prize
    #if $game_switches[50] == true
    #self.contents.draw_text(0, 0, 100, 416,  "Bought!", 2) #cannot buy twice
    #else
    self.contents.draw_text(0, 0, 100, 416,  "20,000pts", 2) #Final / Special Prize
  #end
end
end

Where the #s comment out lines to do with switches, remove the comment symbols and that will make the best prize only available once.

Updates soon... I have an idea for an update that I forgot to do, will re-upload asap!

Enjoy and givey credit! :D:D:D

EDIT: in the script, not yet in the demo, if you wish to make the last prize only available once, delete the # in front of full lines.

Now, if you have it, 'Bought' will appear next to it.
 
Well Nice update and repost

Some things you might want to improve

1) @points = $game_variables[1] #Change the points variable here
Try and use as few of the in game variables as possible, here you could have added a variable to the Game_Party class and then go on from there, so you wouldn't have to go back and set the variable to the points left.

2)
Code:
    s1 = "Potion" #Edit your item names here.
    s2 = "Elixir"
    s3 = "Bronze Armour"
    s4 = "Ring of Strength"
    s5 = "Saint Robe"
    s6 = "Steel Sword"
    s7 = "Screw Thrust"
    s8 = "Cancel"
    @command_window = Window_Command.new(220, [s1, s2, s3, s4, s5, s6, s7, s8])
    @command_window.x = 100
    @command_window.y = 100
    @command_window.back_opacity = 200
    if @points < 100
      @command_window.disable_item(0)
    end
    if @points < 250
      @command_window.disable_item(1)
    end
    if @points < 500
      @command_window.disable_item(2)
    end
    if @points < 1000
      @command_window.disable_item(3)
    end
    if @points < 5000
      @command_window.disable_item(4)
    end
    if @points < 10000
      @command_window.disable_item(5)
    end
    if @points < 20000
      @command_window.disable_item(6)
    end

you don't have to do this, but wouldn't be nicer if you could just send as parameters to this scene what stuff is available to win and their cost, and how many times you can buy it

If you need any further explanation or help I'm available by PM, I may just use this script (or an edited version) in my Monster Arena script (giving you credit for the system of course) since this feature has been requested by a few people.
 
Me(tm) you helped me with da @points at the bottom of scene_prize.
Trickster, thanks for the advice. I'll keep that in mind for V3.0
neo_rpgmaniak.... yyeeaaaahhhh........
Twin Matrix - Sure.
 

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