Da
Ally
Nome Script: Sistema Premio
Versione: 1.0
Autore/i: Sky00Valentine
Informazioni:
Non so se avete presente il sistema nel gioco Need for Speed per la Playstation.
Dopo ogni gara vi mostrava delle carte le quali una volta scelte, vincevate o dei soldi, o delle parti di ricambio etc...
Questo script fa praticamente la stessa cosa.
Screenshots:
Istruzioni:
Istruzioni e demo all'interno dello script/demo.
Script:
#===========================================================================
#
# Sky Script Revolution : Reward Scene (SSR) (SSR/RS)
# Version 1.0
# August 03, 2011 Started
# August 08, 2011 Completed
#
#===========================================================================
#
# What is Sky Script Revolution (SSR)?
# It is a revamp of Sky's previous scripts.
# Is that all?
# No, that is only the beginning. Look for
# New Scripts as well. Also look forward to
# the reopenning of script request hall soon.
# What kind of scripts are you planning?
# I am starting to get into battle system
# scripting so look for edits.
# Are you supporting old scripts?
# Some scripts don't need revamping as they
# work beautifully, so I will update those
# scripts.
#
#===========================================================================
#
# Features :
# Version 1.0 - August 08, 2011
# - Card Reward Graphics
# - Choose from 4 possible rewards
# - Set up your own rewards.
#
#===========================================================================
#
# Credit
# Sky00Valentine :creator and editor
# New :requesting script
# Celianna :grahpics
#
#===========================================================================
#
# Terms of Use
# ------------
#
# Crediting Rpgmakervx.net is the only thing I ask.
# However feel free to credit Sky00Valentine if you
# see fit.
#
#===========================================================================
#
# Future improvement
# ------------------
#
# - Other Reward Graphics
# - Treasure Chests
#
#===========================================================================
#
# Instructions & Installation
# ---------------------------
# - place under materials
#
# - be sure to download the card_graphics found here and place them in pictures
# folder.
# http://www.mediafire.com/?6qhycyy6bv4s877
#
# - Setup the Module how you like.
#
# NEXT_SCENE is the next scene after the reward scene. Set to whatever.
#
# BACK_IMAGE is the background of the Scene. For the best results make
# your own or get one made for you.
#
# SHOW_TITLE if there is a background image the Choose Your Reward message
# will no longer show if this is set to false.
#
# MIN_VARIABLE set this to a free game variable that you can change through
# eventing.
#
# MAX_VARIABLE set this to a free game variable that you can change through
# eventing.
# Note that which ever game variables are MIN and MAX if REPETITION is set
# to false make sure they are 3 apart (6,9) otherwise you will be caught
# in an infinite loop. For a little safety I put in a breaker, that will
# inform you of your mistake.
# Note #2 the same problem can occur possibly if you fill REWARD HASH
# with the EXACT same reward multiple times. So make each reward unique
# will ya. Can also be fixed by setting REPETITION to true.
#
# BGM is the Background Music of the Scene. Jazz up this scene with some
# music.
#
# SOUND is a sound that will be played when you pick your reward. Feel the
# happiness of being rewarded ring in your ears.
#
# Repetition set this to false so that each reward is different from the
# others. Or you might find that you were going to get the same reward no
# matter which you picked. But if it is on it may increase your chance
# or decrease you chance from getting a great reward.
#
# TEXT well the three settings for this are pretty simple test it out.
#
# REWARDS well this is where you input each of your rewards. It is best
# explained below in the module please read carefully and everything should
# go smoothly.
#
# - Have fun with it.
#
#===========================================================================
$imported = {} if $imported == nil
$imported["SSRRewardScene"] = true
module Sky
module Reward
NEXT_SCENE = "Scene_Map.new" #Set to the Scene you want to go to when this one is exited.
BACK_IMAGE = "" #Background Image for this menu. Must be in the
#Pictures folder. Set to "" by default for a normal
#Menu look. Set it to background image name for custom
#Menu.
SHOW_TITLE = false #If set to false when BACK_IMAGE is being used
#the Choose Your Reward! Will not show up.
#this allows more customization.
MIN_VARIABLE = 1 #Game Variable for MIN setting, Set to Variable 1
MAX_VARIABLE = 2 #Game Variable for MAX setting, Set to Variable 2
#==========================================================
# Max setting allows Rewards in that range to be received.
# Down in the Rewards Hash you set rewards starting with 0 up to whatever
# If Min is set to 3 and Max is set to 6 only items 3 to 6 can be obtained
# when the Reward Scene is called.
#==========================================================
BGM = "" #BGM played when menu starts.
#BGM must be located in Audio/BGM folder
SOUND = "" #Sound played when selected reward is revealed.
#Sound must be located in Audio/ME folder
#Leave sounds empty and no sound will play.
REPETITION = true #Allows multiple of the same reward to appear at once
#So two or more hidden rewards can end up being the same.
TEXT = "Party Obtained " #When you get your reward this message will pop up.
TEXT_SIZE = 20 #The size of the message font. By default it is 20.
TEXT_FONT = "Calibri" #The font of the reward message. RPG Maker VX
#by default is Verdana.
REWARDS = {
# Set Icons as such.
#"Icons" => [icon_id(currency),icon_id(weapon),icon_id(armor),icon_id(items)]
# Set rewards as such, Types are Currency, Weapon, Armor, and Items.
# if Type is Currency value is amount of currency(Gold),
# if Type is anything else value is the id of that item.(number in database)
# reward_id => ["Type",value,amount]
# amount is how many of reward item. Unless the reward item is Currency.
"Icons" => [85,1,32,64], # Currency icon is icon 85, Weapon icon is icon 1
# Armor icon is icon 32, Item icon is icon 64
0 => ["Currency", 200], # Reward is 200 G
1 => ["Weapon", 1,2], # Reward is 2 Clubs
2 => ["Armor", 2,3], # Reward is 3 Scale Shields
3 => ["Item", 3,10], # Reward is 10 Full Potions
4 => ["Currency", 10000], # Reward is 10000 G
5 => ["Armor", 9, 1], # Reward is 1 Iron Helm
6 => ["Item", 3, 2], # Reward is 2 Full Potions
7 => ["Weapon",2,1], # Reward is 1 Long Sword
8 => ["Weapon",11,7], # Reward is 7 Wrapped Bows
9 => ["Item",1,99], # Reward is 99 Potions
}
end
#==========================================
#
# Do not edit anything below this point
# unless you have Ruby scripting knowledge.
# You have been warned.
#
#==========================================
end
class Scene_Reward < Scene_Base
include Sky #Allows Scene_Reward Class to automatically access Sky Module
include Reward #Allows Scene_Reward Class to automatically access Reward Module
#===========================================================================
#
# create_menu_background(alias)
# ----------------------
#
# if BACK_IMAGE is defined a custom background can be used
# instead of creating the normal menu background.
#
#===========================================================================
alias ssr_rs_background create_menu_background
def create_menu_background
if BACK_IMAGE == ""
ssr_rs_background
else
@back_image = Sprite.new
@back_image.bitmap = Cache.picture(BACK_IMAGE)
end
end
#===========================================================================
#
# start
# -----
#
# Does everything needed to startup the scene.
#
#===========================================================================
def start
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
Audio.BGM_play("Audio/BGM/" + BGM) if BGM != ""
create_menu_background
create_sprites
create_windows
draw_rewards
initialize_variables
randomize_rewards
end
#===========================================================================
#
# initialize
# ----------
#
# creates all local variables used in this scene.
#
#===========================================================================
def initialize_variables
@vert = 80.0
@draw_text = ""; @text = ""
@down = true; @show = false
@count = 0; @index = 1; @i = 0; @loop_break = 0; @choice = -1
@rewards = {}
end
#===========================================================================
#
# dispose
# -------
#
# disposes of all images created during this scene
# as well as stop sounds and move on to the next scene.
#
#===========================================================================
def dispose
@back_image.dispose unless @back_image == nil or @back_image.disposed?
@arrow.dispose
@item_1.dispose
@item_2.dispose
@item_3.dispose
@item_4.dispose
@title.dispose
@reward_window.dispose
@cards.dispose
Audio.me_stop
Audio.bgm_stop
$scene = eval(NEXT_SCENE)
end
#===========================================================================
#
# create_windows
# --------------
#
# creates and defines each window used in this scene.
#
#===========================================================================
def create_windows
@title = Window_Base.new(0,0,544,90)
@title.contents.font.size = 60
@title.contents.font.name = "Calibri"
@title.opacity = 0
@title.contents.draw_text(0,0,544,64,"Choose your Reward!",1)
@title.contents_opacity = 0 unless BACK_IMAGE == "" or SHOW_TITLE
@reward_window = Window_Base.new(0,260,544,176)
@reward_window.opacity = 0
@reward_window.contents.font.size = 20
@cards = Window_Base.new(0,134,544,142)
@cards.opacity = 0
@cards.contents.font.size = 12
@cards.contents.font.name = "Calibri"
end
#===========================================================================
#
# randomizize_rewards
# -------------------
#
# takes four random rewards from REWARDS Hash.
#
#===========================================================================
def randomize_rewards
while @rewards.size < 4 do
number = -1
while number < $game_variables[MIN_VARIABLE] do
call_exception if $game_variables[MIN_VARIABLE] > $game_variables[MAX_VARIABLE]
number = rand($game_variables[MAX_VARIABLE]+1)
end
@rewards[@rewards.size] = REWARDS[number] unless @rewards.has_value?(REWARDS[number]) and !REPETITION
@loop_break += 1
if @loop_break == 180
call_exception
end
end
end
#===========================================================================
#
# call_exception
# --------------
#
# breaks infinite loop and displays error message.
#
#===========================================================================
def call_exception
raise Exception.new("You were saved from an infinite loop error. Please set " +
"Min and Max Variables to a difference of 3 or more " +
"and make sure that you don't have multiples of the same" +
"reward. Refer to Sky and Reward Modules instructions.")
end
#===========================================================================
#
# draw_rewards
# -----------_
#
# sets up sprited images
#
#===========================================================================
def draw_rewards
@item_1.bitmap = Cache.picture("card_blue_1")
@item_2.bitmap = Cache.picture("card_red_1")
@item_3.bitmap = Cache.picture("card_green_1")
@item_4.bitmap = Cache.picture("card_yellow_1")
for i in 1..4
x = (i-1) * (90) + (36 * i)
eval("@item_" + i.to_s + ".x = #{x}")
eval("@item_" + i.to_s + ".y = 150")
end
@arrow.bitmap = Cache.picture("reward_arrow")
@arrow.y = 90
@arrow.x = 68
end
#===========================================================================
#
# create_sprites
# --------------
#
# creates five new sprites used for this scene.
#
#===========================================================================
def create_sprites
@item_1 = Sprite.new
@item_2 = Sprite.new
@item_3 = Sprite.new
@item_4 = Sprite.new
@arrow = Sprite.new
end
#===========================================================================
#
# spin(number)
# ------------
#
# animates the four reward sprites
# also reward is given to player here
#
# number: specifies which image to animate. 1 to 4
#
#===========================================================================
def spin(number)
color = number == 1 ? "blue" :
number == 2 ? "red" : number == 3 ? "green" : "yellow"
if @count == 20
eval("@item_" + number.to_s + '.bitmap = Cache.picture("card_'+ color +'_2")')
elsif @count == 13
eval("@item_" + number.to_s + '.bitmap = Cache.picture("card_'+ color +'_3")')
elsif @count == 6
eval("@item_" + number.to_s + '.bitmap = Cache.picture("card_'+ color +'_4")')
elsif @count == 0
eval("@item_" + number.to_s + '.bitmap = Cache.picture("card_'+ color +'_1")')
eval("@item_"+ number.to_s + ".opacity = 100")
draw_card(number)
elsif @count == -1
if number = @index
Audio.me_play("Audio/ME/" + SOUND) if SOUND != ""
$game_party.gain_gold(@rewards[@index-1][1]) if (@rewards[@index-1][0]).downcase == "currency"
$game_party.gain_item($data_weapons[@rewards[@index-1][1]],@rewards[@index-1][2]) if @rewards[@index-1][0].downcase == "weapon"
$game_party.gain_item($data_armors[@rewards[@index-1][1]],@rewards[@index-1][2]) if @rewards[@index-1][0].downcase == "armor"
$game_party.gain_item($data_items[@rewards[@index-1][1]],@rewards[@index-1][1],2) if @rewards[@index-1][0].downcase == "item"
rewarded_item = @rewards[@index-1][0].downcase == "currency" ? (@rewards[@index-1][1]).to_s + " #{Vocab.gold}" :
@rewards[@index-1][0].downcase == "weapon" ? @rewards[@index-1][2].to_s + " " + $data_weapons[@rewards[@index-1][1]].name.to_s :
@rewards[@index-1][0].downcase == "armor" ? @rewards[@index-1][2].to_s + " " + $data_armors[@rewards[@index-1][1]].name.to_s :
@rewards[@index-1][2].to_s + " " + $data_items[@rewards[@index-1][1]].name.to_s
rewarded_item += (@rewards[@index-1][2] == nil or @rewards[@index-1][2] == 1) ? "." : "s."
@text = TEXT + rewarded_item
end
end
end
#===========================================================================
#
# draw_card(number)
# -----------------
#
# reveals the reward hidden by each image.
#
# number: specifies which reward is being revealed. 1 to 4
#
#===========================================================================
def draw_card(number)
x = (number * 36)+(90*(number-1)) + 17
icon = @rewards[number-1][0].downcase == "currency" ? REWARDS["Icons"][0] :
@rewards[number-1][0].downcase == "weapon" ? REWARDS["Icons"][1] :
@rewards[number-1][0].downcase == "armor" ? REWARDS["Icons"][2] :
REWARDS["Icons"][3]
@cards.contents.draw_icon(icon,x,43)
rewarded_item = @rewards[number-1][0].downcase == "currency" ? (@rewards[number-1][1]).to_s + " #{Vocab.gold}" :
@rewards[number-1][0].downcase == "weapon" ? @rewards[number-1][2].to_s + " " + $data_weapons[@rewards[number-1][1]].name.to_s :
@rewards[number-1][0].downcase == "armor" ? @rewards[number-1][2].to_s + " " + $data_armors[@rewards[number-1][1]].name.to_s :
@rewards[number-1][2].to_s + " " + $data_items[@rewards[number-1][1]].name.to_s
rewarded_item += (@rewards[number-1][2] == nil or @rewards[number-1][2] == 1) ? "." : "s."
@cards.contents.draw_text(x - 17,67,66,16,rewarded_item,1)
end
#===========================================================================
#
# update_cursor
# -------------
#
# animates the cursor
#
#===========================================================================
def update_cursor
if @down
@vert += (11/16.0)
@down = false if @arrow.y == 100
else
@vert -= (11/16.0)
@down = true if @arrow.y == 90
end
@arrow.y = @vert.to_i
@arrow.x = ((@index - 1) * 90) + (36 * @index) + 32
end
#===========================================================================
#
# update
# ------
#
# updates each frame of the scene.
#
#===========================================================================
def update
@count -= 1 if @choice != -1 and @count > -3
update_cursor unless @count != 0 or @choice != -1
spin(@choice) unless @choice == -1 or @show
if @show and @count > -3
for i in 1..4
spin(i) unless @choice == i
end
end
if Input.trigger?( Input::C )
@count = 21 unless @count != 0 or @choice != -1
@choice = @index unless @choice != -1
if @draw_text == @text and @i > 0 and !@show
@show = true
@count = 21
elsif @show and @count == -3
dispose
end
Sound.play_decision unless SOUND != "" or @count != 21
elsif Input.trigger?( Input::B )
dispose if (@draw_text == @text and @i > 0)
elsif Input.trigger?( Input::RIGHT )
unless @count != 0
Sound.play_cursor
@index = @index < 4 ? (@index + 1) : 1
end
elsif Input.trigger?( Input::LEFT )
unless @count != 0
Sound.play_cursor
@index = @index > 1 ? (@index - 1) : 4
end
end
if @choice != -1
if @i % 2 == 0 and @draw_text != @text
@draw_text += @text[@i/2,1]
@reward_window.contents.clear
@reward_window.contents.draw_text(0,0,512,TEXT_SIZE+4,@draw_text)
end
@i += 1 unless @draw_text == @text
end
end
end
Demo:http://www.mediafire.com/?t2036i4ej6zwnp6