| Système
d'achat par point.
Auteur
: Rubymatt
Fonction
: Permet de faire un
système d'achat de point que le joueur récoltera
par des quêtes.
Image(s):
screen
Ressource(s)
: Aucune
Démo
: Aucune
Remarque
:
Testé et fonctionnel. Pour avoir plus de
produit, il faut complétez le script en recopiant
le même style de code que les autres produits.
Nombre
de scripts :
2
Installation
: Ouvrez
l'éditeur de script ( F11 ) et faites un nouveau
script au dessus de "Main", nommez le
"Scene_Prize"
et collez le code ci-dessous.
Utilisation
:
Grâce à la
commande d' évènement, faites "insérer un
script" et mettez :
$scene
= Scene_Prize.new
Cela
permet d'aller à la fenêtre des points.
Pour
obtenir des points, il faut faire une variable et
mettre la valeur que vous souhaitez (ça sera le
nombre de points). Attention ! il faut choisir
seulement la variable n°10. Pour changer de
variable, cherchez cette ligne :
$game_variables[10]
et remplacez
10
par le numéro que vous souhaitez
Pour changer
le nombre de point a obtenir pour un objet,
changer le nombre après $game_variables[10]
< ....
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 "".
#-------------------------------------------------------------------
#Under that are the lines:
# if $game_variables[10] < 100
#Change the [10] to the variable of the points
system.
#Change the 100 to the cost of the botom prize.
#-------------------------------------------------------------------
#in def update, the prize variations and variable
number need changing to your game.
#==================================
class Scene_Prize
def main
@spriteset = Spriteset_Map.new
s1 = "Potion: 100pts"
s2 = "Parchemin: 250pts"
s3 = "Carte: 500pts"
s4 = "Fruit: 1,000pts"
s5 = "Thunder Ring: 2,500pts"
s6 = "Armure en Mythril : 5,000pts"
s7 = "Basil's Screw Thrust: 10,000pts"
s8 = "Annuler"
@command_window = Window_Command.new(320, [s1, s2,
s3, s4, s5, s6, s7, s8])
@command_window.x = 140
@command_window.y = 100
@command_window.back_opacity = 200
if $game_variables[10] < 100
@command_window.disable_item(0)
end
if $game_variables[10] < 250
@command_window.disable_item(1)
end
if $game_variables[10] < 500
@command_window.disable_item(2)
end
if $game_variables[10] < 1000
@command_window.disable_item(3)
end
if $game_variables[10] < 2500
@command_window.disable_item(4)
end
if $game_variables[10] < 5000
@command_window.disable_item(5)
end
if $game_variables[10] < 10000
@command_window.disable_item(6)
end
@points_window = Window_Points.new
@points_window.back_opacity = 200
@points_window.x = 200
@points_window.y = 4
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
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
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_variables[10] < 100
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.gain_item(3, 1)
$game_variables[10] -= 100
$scene = Scene_Map.new
when 1
if $game_variables[10] < 250
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.gain_item(29, 1)
$game_variables[10] -= 250
$scene = Scene_Map.new
when 2
if $game_variables[10] < 500
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.gain_item(31, 1)
$game_variables[10] -= 500
$scene = Scene_Map.new
when 3
if $game_variables[10] < 1000
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.gain_item(32, 1)
$game_variables[10] -= 1000
$scene = Scene_Map.new
when 4
if $game_variables[10] < 2500
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.gain_armor(31, 1)
$game_variables[10] -= 2500
$scene = Scene_Map.new
when 5
if $game_variables[10] < 5000
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.gain_weapon(4, 1)
$game_variables[10] -= 5000
$scene = Scene_Map.new
when 6
if $game_variables[10] < 10000
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.actors[2].learn_skill(64)
$game_variables[10] -= 10000
$scene = Scene_Map.new
when 7
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
end
end# of class
Faites un
nouveau script au dessus de "Main",
nommez le "Window_BattleScore"
et collez le code ci-dessous.
#Window_BattleScore
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,
"Points actuels:")
self.contents.font.color = Color.new(255, 255,
255)
self.contents.draw_text(4, 32, 160, 32, $game_variables[10].to_s,
2)
end
def change_color(red, green, blue)
self.contents.font.color = Color.new(0, 255, 0)
end
end
|