01-28-2007, 01:00 PM
Prize Points System
Version 3.0
by Dark Ruby
Jan 28 2007
Version 3.0
by Dark Ruby
Jan 28 2007
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Introduction:
This script allows you to go to a 'Prize Shop' and purchase items based upon 'Prize Points'. This version has a Help window, and is extra-easy to use to non-scripters.
Script:
Code:
=begin
===================================
Points Prize System v3.0
by Rubymatt
===================================
Version History:
v3.0: Started from scratch
Only required to enter variable for points number once.
Added Help window
Scene doesn't automatically close after an item is bought.
Made extra-simple
v2.0: Variable number only required to be entered a few times.
Layout improved
v1.0: Original Version
===================================
=end
class Game_Points
attr_accessor :points_variable
attr_accessor :item1
attr_accessor :item1_price
attr_accessor :item2
attr_accessor :item2_price
attr_accessor :item3
attr_accessor :item3_price
attr_accessor :item4
attr_accessor :item4_price
attr_accessor :item5
attr_accessor :item5_price
attr_accessor :item6
attr_accessor :item6_price
attr_accessor :item7
attr_accessor :item7_price
def initialize
#Begin Editing
#SETTING THE ITEM
#To set a prize as a weapon, use $data_weapons[id]
#To set a prize as an item, use $data_items[id]
#To set a prize as armour, use $data_armors[id]
#SETTING THE PRICE
#Simply change @item1_price etc to however many points you see fit.
#Remember: The ID is its number in the database MINUS ONE.
@points_variable = $game_variables[1] #Define your Points Variable here.
@item1 = $data_items[1]
@item1_price = 100
@item2 = $data_items[7]
@item2_price = 250
@item3 = $data_items[12]
@item3_price = 500
@item4 = $data_items[17]
@item4_price = 1000
@item5 = $data_weapons[1]
@item5_price = 1500
@item6 = $data_armors[25]
@item6_price = 2000
@item7 = $data_weapons[32]
@item7_price = 5000
#End Editing
end
end
class Window_Points < Window_Base
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Points")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_points.points_variable.to_s, 2)
end
end
class Window_PointsNeeded < Window_Base
def initialize
$game_points = Game_Points.new
super(0, 0, 100, 256)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.draw_text(0, 0, 68, 32, $game_points.item1_price.to_s, 2)
self.contents.draw_text(0, 32, 68, 32, $game_points.item2_price.to_s, 2)
self.contents.draw_text(0, 64, 68, 32, $game_points.item3_price.to_s, 2)
self.contents.draw_text(0, 96, 68, 32, $game_points.item4_price.to_s, 2)
self.contents.draw_text(0, 128, 68, 32, $game_points.item5_price.to_s, 2)
self.contents.draw_text(0, 160, 68, 32, $game_points.item6_price.to_s, 2)
self.contents.draw_text(0, 192, 68, 32, $game_points.item7_price.to_s, 2)
end
end
class Scene_PrizeSelect
def check_points
if $game_points.points_variable < $game_points.item1_price
@command_window.disable_item(0)
end
if $game_points.points_variable < $game_points.item2_price
@command_window.disable_item(1)
end
if $game_points.points_variable < $game_points.item3_price
@command_window.disable_item(2)
end
if $game_points.points_variable < $game_points.item4_price
@command_window.disable_item(3)
end
if $game_points.points_variable < $game_points.item5_price
@command_window.disable_item(4)
end
if $game_points.points_variable < $game_points.item6_price
@command_window.disable_item(5)
end
if $game_points.points_variable < $game_points.item7_price
@command_window.disable_item(6)
end
end
def main
$game_points = Game_Points.new
@spriteset = Spriteset_Map.new
s1 = $game_points.item1.name
s2 = $game_points.item2.name
s3 = $game_points.item3.name
s4 = $game_points.item4.name
s5 = $game_points.item5.name
s6 = $game_points.item6.name
s7 = $game_points.item7.name
s8 = "Cancel"
@command_window = Window_Command.new(200, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.x = 170
@command_window.y = 160
@command_window.back_opacity = 180
@needed_window = Window_PointsNeeded.new
@needed_window.x = 370
@needed_window.y = 160
@needed_window.back_opacity = 180
@points_window = Window_Points.new
@points_window.x = 240
@points_window.y = 64
@points_window.back_opacity = 180
@help_window = Window_Help.new
@help_window.back_opacity = 180
check_points
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@needed_window.dispose
@points_window.dispose
@spriteset.dispose
@help_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
@spriteset.update
@command_window.update
@needed_window.update
@points_window.update
@help_window.update
check_points
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 $game_points.points_variable < $game_points.item1_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item1.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item1.id, 1)
else
$game_party.gain_item($game_points.item1.id, 1)
end
$game_points.points_variable -= $game_points.item1_price
@points_window.refresh
when 1
if $game_points.points_variable < $game_points.item2_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item2.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item2.id, 1)
else
$game_party.gain_item($game_points.item2.id, 1)
end
$game_points.points_variable -= $game_points.item2_price
@points_window.refresh
when 2
if $game_points.points_variable < $game_points.item3_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item3.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item3.id, 1)
else
$game_party.gain_item($game_points.item3.id, 1)
end
$game_points.points_variable -= $game_points.item3_price
@points_window.refresh
when 3
if $game_points.points_variable < $game_points.item4_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item4.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item4.id, 1)
else
$game_party.gain_item($game_points.item4.id, 1)
end
$game_points.points_variable -= $game_points.item4_price
@points_window.refresh
when 4
if $game_points.points_variable < $game_points.item5_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item5.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item5.id, 1)
else
$game_party.gain_item($game_points.item5.id, 1)
end
$game_points.points_variable -= $game_points.item5_price
@points_window.refresh
when 5
if $game_points.points_variable < $game_points.item6_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item6.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item6.id, 1)
else
$game_party.gain_item($game_points.item6.id, 1)
end
$game_points.points_variable -= $game_points.item6_price
@points_window.refresh
when 6
if $game_points.points_variable < $game_points.item7_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item7.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item7.id, 1)
else
$game_party.gain_item($game_points.item7.id, 1)
end
$game_points.points_variable -= $game_points.item7_price
@points_window.refresh
when 7
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
case @command_window.index
when 0
@help_window.set_text($game_points.item1.description, 0)
when 1
@help_window.set_text($game_points.item2.description, 0)
when 2
@help_window.set_text($game_points.item3.description, 0)
when 3
@help_window.set_text($game_points.item4.description, 0)
when 4
@help_window.set_text($game_points.item5.description, 0)
when 5
@help_window.set_text($game_points.item6.description, 0)
when 6
@help_window.set_text($game_points.item7.description, 0)
when 7
@help_window.set_text("Return to the Map.", 0)
end
end
end
[CENTER]Prize Points System
Version 3.0
Introduction:
This script allows you to go to a 'Prize Shop' and purchase items based upon 'Prize Points'. This version has a Help window, and is extra-easy to use to non-scripters.
Screenshot:
Screenie!
Script:
CODE
=begin
===================================
Points Prize System v3.0
by Rubymatt
===================================
Version History:
v3.0: Started from scratch
Only required to enter variable for points number once.
Added Help window
Scene doesn't automatically close after an item is bought.
Made extra-simple
v2.0: Variable number only required to be entered a few times.
Layout improved
v1.0: Original Version
===================================
=end
class Game_Points
attr_accessor :points_variable
attr_accessor :item1
attr_accessor :item1_price
attr_accessor :item2
attr_accessor :item2_price
attr_accessor :item3
attr_accessor :item3_price
attr_accessor :item4
attr_accessor :item4_price
attr_accessor :item5
attr_accessor :item5_price
attr_accessor :item6
attr_accessor :item6_price
attr_accessor :item7
attr_accessor :item7_price
def initialize
#Begin Editing
#SETTING THE ITEM
#To set a prize as a weapon, use $data_weapons[id]
#To set a prize as an item, use $data_items[id]
#To set a prize as armour, use $data_armors[id]
#SETTING THE PRICE
#Simply change @item1_price etc to however many points you see fit.
#Remember: The ID is its number in the database MINUS ONE.
@points_variable = $game_variables[1] #Define your Points Variable here.
@item1 = $data_items[1]
@item1_price = 100
@item2 = $data_items[7]
@item2_price = 250
@item3 = $data_items[12]
@item3_price = 500
@item4 = $data_items[17]
@item4_price = 1000
@item5 = $data_weapons[1]
@item5_price = 1500
@item6 = $data_armors[25]
@item6_price = 2000
@item7 = $data_weapons[32]
@item7_price = 5000
#End Editing
end
end
class Window_Points < Window_Base
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Points")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_points.points_variable.to_s, 2)
end
end
class Window_PointsNeeded < Window_Base
def initialize
$game_points = Game_Points.new
super(0, 0, 100, 256)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.draw_text(0, 0, 68, 32, $game_points.item1_price.to_s, 2)
self.contents.draw_text(0, 32, 68, 32, $game_points.item2_price.to_s, 2)
self.contents.draw_text(0, 64, 68, 32, $game_points.item3_price.to_s, 2)
self.contents.draw_text(0, 96, 68, 32, $game_points.item4_price.to_s, 2)
self.contents.draw_text(0, 128, 68, 32, $game_points.item5_price.to_s, 2)
self.contents.draw_text(0, 160, 68, 32, $game_points.item6_price.to_s, 2)
self.contents.draw_text(0, 192, 68, 32, $game_points.item7_price.to_s, 2)
end
end
class Scene_PrizeSelect
def check_points
if $game_points.points_variable < $game_points.item1_price
@command_window.disable_item(0)
end
if $game_points.points_variable < $game_points.item2_price
@command_window.disable_item(1)
end
if $game_points.points_variable < $game_points.item3_price
@command_window.disable_item(2)
end
if $game_points.points_variable < $game_points.item4_price
@command_window.disable_item(3)
end
if $game_points.points_variable < $game_points.item5_price
@command_window.disable_item(4)
end
if $game_points.points_variable < $game_points.item6_price
@command_window.disable_item(5)
end
if $game_points.points_variable < $game_points.item7_price
@command_window.disable_item(6)
end
end
def main
$game_points = Game_Points.new
@spriteset = Spriteset_Map.new
s1 = $game_points.item1.name
s2 = $game_points.item2.name
s3 = $game_points.item3.name
s4 = $game_points.item4.name
s5 = $game_points.item5.name
s6 = $game_points.item6.name
s7 = $game_points.item7.name
s8 = "Cancel"
@command_window = Window_Command.new(200, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.x = 170
@command_window.y = 160
@command_window.back_opacity = 180
@needed_window = Window_PointsNeeded.new
@needed_window.x = 370
@needed_window.y = 160
@needed_window.back_opacity = 180
@points_window = Window_Points.new
@points_window.x = 240
@points_window.y = 64
@points_window.back_opacity = 180
@help_window = Window_Help.new
@help_window.back_opacity = 180
check_points
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@needed_window.dispose
@points_window.dispose
@spriteset.dispose
@help_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
@spriteset.update
@command_window.update
@needed_window.update
@points_window.update
@help_window.update
check_points
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 $game_points.points_variable < $game_points.item1_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item1.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item1.id, 1)
else
$game_party.gain_item($game_points.item1.id, 1)
end
$game_points.points_variable -= $game_points.item1_price
@points_window.refresh
when 1
if $game_points.points_variable < $game_points.item2_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item2.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item2.id, 1)
else
$game_party.gain_item($game_points.item2.id, 1)
end
$game_points.points_variable -= $game_points.item2_price
@points_window.refresh
when 2
if $game_points.points_variable < $game_points.item3_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item3.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item3.id, 1)
else
$game_party.gain_item($game_points.item3.id, 1)
end
$game_points.points_variable -= $game_points.item3_price
@points_window.refresh
when 3
if $game_points.points_variable < $game_points.item4_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item4.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item4.id, 1)
else
$game_party.gain_item($game_points.item4.id, 1)
end
$game_points.points_variable -= $game_points.item4_price
@points_window.refresh
when 4
if $game_points.points_variable < $game_points.item5_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item5.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item5.id, 1)
else
$game_party.gain_item($game_points.item5.id, 1)
end
$game_points.points_variable -= $game_points.item5_price
@points_window.refresh
when 5
if $game_points.points_variable < $game_points.item6_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item6.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item6.id, 1)
else
$game_party.gain_item($game_points.item6.id, 1)
end
$game_points.points_variable -= $game_points.item6_price
@points_window.refresh
when 6
if $game_points.points_variable < $game_points.item7_price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.save_se)
if @item1.is_a? RPG::Weapon
$game_party.gain_weapon($game_points.item7.id, 1)
elsif @item1.is_a? RPG::Armor
$game_party.gain_armour($game_points.item7.id, 1)
else
$game_party.gain_item($game_points.item7.id, 1)
end
$game_points.points_variable -= $game_points.item7_price
@points_window.refresh
when 7
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
case @command_window.index
when 0
@help_window.set_text($game_points.item1.description, 0)
when 1
@help_window.set_text($game_points.item2.description, 0)
when 2
@help_window.set_text($game_points.item3.description, 0)
when 3
@help_window.set_text($game_points.item4.description, 0)
when 4
@help_window.set_text($game_points.item5.description, 0)
when 5
@help_window.set_text($game_points.item6.description, 0)
when 6
@help_window.set_text($game_points.item7.description, 0)
when 7
@help_window.set_text("Return to the Map.", 0)
end
end
end
Instructions:
- Insert the script above Main
- Go into Game_Points
- Read instructions and apply them there.
- Use the Change Variable Command for the variable number you put in Game_Points to change the number of points.
- There you have it! Script impliment complete!
Compatibility Issues:
None known.
Author's Notes:
This script is easy enough to place in your game and use, even for non-scripters. Have fun with this script.
There may be a future update, though I don't see what more can be put in.
AND DON'T FORGET TO GIVE CREDIT, KIDDIES!