RPG Sunrise
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.



 
AccueilRechercherDernières imagesS'enregistrerConnexion
Le Deal du moment : -15%
-15% Apple MacBook Air 13” 16Go RAM / 256Go SSD ...
Voir le deal
1299 €

 

 Mettre un jeu de roulette

Aller en bas 
AuteurMessage
Eldorn
Intendant
Intendant
Eldorn


Masculin Nombre de messages : 188
Age : 30
Emploi/loisirs : Making tiens!
Date d'inscription : 24/10/2007

Mettre un jeu de roulette Empty
MessageSujet: Mettre un jeu de roulette   Mettre un jeu de roulette Icon_minitimeMer 31 Oct - 16:18

Ce script vous permettra d'insérer une roulette dans votre jeu.
Nommez-le "Scene_Tablero"
Pour l'activer, créez un event, mettez l'éditeur de script et écrivez
$scene = Scene_Tablero.new


La 2ème partie du script et est dessous.
Attention, c'est un seul et même script!

Code:
#==============================================================================
#roulette by sayonara-p
#==============================================================================


class Window_Tablero < Window_Selectable
#==============================================================================
def initialize
super(256, 64, 144, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@item_max = 36
@column_max = 3
@filas_max = @item_max/@column_max
@commandos = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36"]
refresh
self.index = 0
end
#==============================================================================
def refresh
contador = 0
self.contents.clear
for j in 0..@filas_max
contador -=1
for i in 0..@column_max
contador +=1
draw_item(contador, i, j)
end
end
end
#==============================================================================
def draw_item(index, x, y)
if index==0 or index==2 or index==4 or index==6 or index==8 or index==11 or index==13 or index==15 or index==17 or index==18 or index==20 or index==22 or index==24 or index==26 or index==29 or index==31 or index==33 or index==35
self.contents.font.color = knockout_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x*41+9*x, y*33, 12, 32, @commandos[index].to_s,1)
end
#==============================================================================
end
#==============================================================================
#==============================================================================
#==============================================================================
#==============================================================================
#==============================================================================
#==============================================================================
class Scene_Tablero

def main
@currentbet = 0
@indice_apuesta = 0
@numero_escogido = 0
@rojo = false
@negro = false
@par = false
@impar = false
@falta = false
@pasa = false
# ------------------------------------------------------------------
s1 = "Jouer"
s2 = "Quitter"
# ------------------------------------------------------------------
t1 = "Pari"
t2 = " 5000"
t3 = " 2000"
t4 = " 1000"
t5 = " 500"
t6 = " 200"
t7 = " 100"
t8 = " 50"
t9 = " 20"
# ------------------------------------------------------------------
u1 = "Simple nombre"
u2 = "Rouge ou Noir"
u3 = "Pair ou impair"
u4 = "Petit ou Grand"
# ------------------------------------------------------------------
v1 = "Rouge"
v2 = "Noir"
# ------------------------------------------------------------------
w1 = "Pair"
w2 = "Impair"
# ------------------------------------------------------------------
x1 = "Petit"
x2 = "Grand"
# ------------------------------------------------------------------
@help_window = Window_Help.new
@help_window.opacity = 100
# ------------------------------------------------------------------
@opcion_window = Window_Command.new(256, [s1, s2])
@opcion_window.active = true
@opcion_window.width = 256
@opcion_window.height = 96
@opcion_window.y = 64
@opcion_window.opacity = 200
# ------------------------------------------------------------------
@tablero_window = Window_Tablero.new
@tablero_window.active = false
@tablero_window.index = -1
@tablero_window.opacity = 200
# ------------------------------------------------------------------
@apuesta_window = Window_Command.new(256, [t1, t2, t3, t4, t5, t6, t7, t8, t9])
@apuesta_window.width = 256
@apuesta_window.height = 480-64-96
@apuesta_window.y = 96 + 64
@apuesta_window.active = false
@apuesta_window.index = -1
@apuesta_window.opacity = 200
# ------------------------------------------------------------------
@dinero_window = Window_Gold.new
@dinero_window.width = 640-256-144
@dinero_window.x = 256 + 144 + 112
@dinero_window.y = 64
@dinero_window.opacity = 100
# ------------------------------------------------------------------
@tipo_window = Window_Command.new(640-256-144,[u1, u2, u3, u4])
@tipo_window.active = false
@tipo_window.index = -1
@tipo_window.width = 640-256-144
@tipo_window.x = 256 + 144
@tipo_window.y = 64 + 96
@tipo_window.opacity = 100
# ------------------------------------------------------------------
@color_window = Window_Command.new(640-256-144,[v1, v2])
@color_window.active = false
@color_window.index = -1
@color_window.width = 640-256-144
@color_window.x = 256 + 144
@color_window.y = 64 + 96 + 128 + 32
@color_window.opacity = 100
@color_window.visible = false
# ------------------------------------------------------------------
@par_window = Window_Command.new(640-256-144,[w1, w2])
@par_window.active = false
@par_window.index = -1
@par_window.width = 640-256-144
@par_window.x = 256 + 144
@par_window.y = 64 + 96 + 128 + 32
@par_window.opacity = 100
@par_window.visible = false
# ------------------------------------------------------------------
@falta_window = Window_Command.new(640-256-144,[x1, x2])
@falta_window.active = false
@falta_window.index = -1
@falta_window.width = 640-256-144
@falta_window.x = 256 + 144
@falta_window.y = 64 + 96 + 128 + 32
@falta_window.opacity = 100
@falta_window.visible = false
# ------------------------------------------------------------------
@back_window = Window_Base.new(0,0,640,480)
@back_window.opacity = 100
@back_window.z = 50
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@opcion_window.dispose
@tablero_window.dispose
@apuesta_window.dispose
@dinero_window.dispose
@tipo_window.dispose
@color_window.dispose
@par_window.dispose
@falta_window.dispose
@back_window.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
# ------------------------------------
def update
@opcion_window.update
@apuesta_window.update
@tablero_window.update
@tipo_window.update
@color_window.update


Dernière édition par le Mer 31 Oct - 16:20, édité 2 fois
Revenir en haut Aller en bas
Eldorn
Intendant
Intendant
Eldorn


Masculin Nombre de messages : 188
Age : 30
Emploi/loisirs : Making tiens!
Date d'inscription : 24/10/2007

Mettre un jeu de roulette Empty
MessageSujet: Re: Mettre un jeu de roulette   Mettre un jeu de roulette Icon_minitimeMer 31 Oct - 16:19

Code:
@par_window.update
@falta_window.update
if @opcion_window.active
@opcion_window.opacity = 200
@apuesta_window.opacity = 100
@tablero_window.opacity = 100
@tipo_window.opacity = 100
@color_window.opacity = 100
@par_window.opacity = 100
@falta_window.opacity = 100
update_opcion
return
end
if @apuesta_window.active
@opcion_window.opacity = 100
@apuesta_window.opacity = 200
@tablero_window.opacity = 100
@tipo_window.opacity = 100
@color_window.opacity = 100
@par_window.opacity = 100
@falta_window.opacity = 100
update_apuesta
return
end
if @tablero_window.active
@opcion_window.opacity = 100
@apuesta_window.opacity = 100
@tablero_window.opacity = 200
@tipo_window.opacity = 100
@color_window.opacity = 100
@par_window.opacity = 100
@falta_window.opacity = 100
update_tablero
return
end
if @tipo_window.active
@opcion_window.opacity = 100
@apuesta_window.opacity = 100
@tablero_window.opacity = 100
@tipo_window.opacity = 200
@color_window.opacity = 100
@par_window.opacity = 100
@falta_window.opacity = 100
update_tipo
return
end
if @color_window.active
@opcion_window.opacity = 100
@apuesta_window.opacity = 100
@tablero_window.opacity = 100
@tipo_window.opacity = 100
@color_window.opacity = 200
@par_window.opacity = 100
@falta_window.opacity = 100
update_color
return
end
if @par_window.active
@opcion_window.opacity = 100
@apuesta_window.opacity = 100
@tablero_window.opacity = 100
@tipo_window.opacity = 100
@color_window.opacity = 100
@par_window.opacity = 200
@falta_window.opacity = 100
update_par
return
end
if @falta_window.active
@opcion_window.opacity = 100
@apuesta_window.opacity = 100
@tablero_window.opacity = 100
@tipo_window.opacity = 100
@color_window.opacity = 100
@par_window.opacity = 100
@falta_window.opacity = 200
update_falta
return
end
end
# ------------------------------------
def update_opcion
case @opcion_window.index
when 0
@help_window.set_text("Jouer à la roulette.")
when 1
@help_window.set_text("Quitter la roulette.")
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
case @opcion_window.index
when 0
$game_system.se_play($data_system.decision_se)
@opcion_window.active = false
@opcion_window.index = -1
@apuesta_window.active = true
@apuesta_window.index = 0
when 1
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
return
end
end
# ------------------------------------
def update_apuesta
case @apuesta_window.index
when 0
@help_window.set_text("Poser un pari.")
when 1
@help_window.set_text("Augmenter le pari par 5000.")
when 2
@help_window.set_text("Augmenter le pari par 2000.")
when 3
@help_window.set_text("Augmenter le pari par 1000.")
when 4
@help_window.set_text("Augmenter le pari par 500.")
when 5
@help_window.set_text("Augmenter le pari par 200.")
when 6
@help_window.set_text("Augmenter le pari par 100.")
when 7
@help_window.set_text("Augmenter le pari par 50.")
when 8
@help_window.set_text("Augmenter le pari par 20.")
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@apuesta_window.active = false
@apuesta_window.index = -1
@opcion_window.active = true
@opcion_window.index = 0
return
end
if Input.trigger?(Input::C)
case @apuesta_window.index
when 0
@apuesta_window.active = false
@apuesta_window.index = -1
@tipo_window.active = true
@tipo_window.index = 0
return
when 1
@bet = 5000
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 2
@bet = 2000
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 3
@bet = 1000
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 4
@bet = 500
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 5
@bet = 200
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 6
@bet = 100
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 7
@bet = 50
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 8
@bet = 20
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 50000)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
end
return
end
end
# ------------------------------------
def update_tablero
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
check1
end
end
# ------------------------------------
def update_tipo
case @tipo_window.index
when 0
@help_window.set_text("Pari pour un simple nombre. Gain 1700%")
when 1
@help_window.set_text("Pari pour rouge ou noir. Gain 150%")
when 2
@help_window.set_text("Pari pour un nombre pair ou impair. Gain 150%")
when 3
@help_window.set_text("Pari pour un nombre petit (1-18), ou grand (19-36). Gain 150%")
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@tipo_window.active = false
@tipo_window.index = -1
@apuesta_window.active = true
@apuesta_window.index = 0
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @tipo_window.index
when 0
@indice_apuesta = 17
@tipo_window.active = false
@tipo_window.index = -1
@tablero_window.active = true
@tablero_window.index = 0
when 1
@indice_apuesta = 1.5
@tipo_window.active = false
@tipo_window.index = -1
@color_window.visible = true
@color_window.active = true
@color_window.index = 0
when 2
@indice_apuesta = 1.5
@tipo_window.active = false
@tipo_window.index = -1
@par_window.visible = true
@par_window.active = true
@par_window.index = 0
when 3
@indice_apuesta = 1.5
@tipo_window.active = false
@tipo_window.index = -1
@falta_window.visible = true
@falta_window.active = true
@falta_window.index = 0
end
end
end
# ------------------------------------
def update_color
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @color_window.index
when 0
@rojo = true
check2
when 1
@negro = true
check2
end
end
end
# ------------------------------------
def update_par
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @par_window.index
when 0
@par = true
check3
when 1
@impar = true
check3
end
end
end
# ------------------------------------
def update_falta
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @falta_window.index
when 0
@falta = true
check4
when 1
@pasa = true
check4
end
end
end
# ------------------------------------
def check1
@numero_escogido = @tablero_window.index + 1
@help_window.set_text("La roue de la roulette est en train de tourner!")
delay(1)
@aleatorio = rand(37)-1
@help_window.set_text("La roue montre " + " " + @aleatorio.to_s)
delay(1)
if @aleatorio == @numero_escogido
win
else
lose
end
end
# ------------------------------------
def check2
@help_window.set_text("La roue de la roulette est en train de tourner!")
delay(1)
@aleatorio = rand(37)-1
@help_window.set_text("La roue montre " + " " + @aleatorio.to_s)
delay(1)
if @aleatorio==1 or @aleatorio==3 or @aleatorio==5 or @aleatorio==7 or @aleatorio==9 or @aleatorio==12 or @aleatorio==14 or @aleatorio==16 or @aleatorio==18 or @aleatorio==19 or @aleatorio==21 or @aleatorio==23 or @aleatorio==25 or @aleatorio==27 or @aleatorio==30 or @aleatorio==32 or @aleatorio==34 or @aleatorio==36
if @rojo
win
else
lose
end
else
if @negro
win
else
lose
end
end
end
# ------------------------------------
def check3
@help_window.set_text("La roue de la roulette est en train de tourner!")
delay(1)
@aleatorio = rand(37)-1
@help_window.set_text("La roue montre " + " " + @aleatorio.to_s)
delay(1)
if @aleatorio==2 or @aleatorio==4 or @aleatorio==6 or @aleatorio==8 or @aleatorio==10 or @aleatorio==12 or @aleatorio==14 or @aleatorio==16 or @aleatorio==18 or @aleatorio==20 or @aleatorio==22 or @aleatorio==24 or @aleatorio==26 or @aleatorio==28 or @aleatorio==30 or @aleatorio==32 or @aleatorio==34 or @aleatorio==36
if @par
win
else
lose
end
else
if @impar
win
else
lose
end
end
end
# ------------------------------------
def check4
@help_window.set_text("La roue de la roulette est en train de tourner!")
delay(1)
@aleatorio = rand(37)-1
@help_window.set_text("La roue montre" + " " + @aleatorio.to_s)
delay(1)
if (@aleatorio <= 18) and (@aleatorio != 0)
if @falta
win
else
lose
end
elsif (@aleatorio >= 19) and (@aleatorio != 0)
if @pasa
win
else
lose
end
end
end
# ------------------------------------
def win
delay(1)
$game_system.me_play($game_system.battle_end_me)
$game_party.gain_gold(@currentbet*@indice_apuesta)
@help_window.set_text(" Tu as gagné!")
delay(3)
$scene = Scene_Tablero.new
end
# ------------------------------------
def lose
delay(1)
$game_system.me_play($data_system.gameover_me)
@help_window.set_text(" Tu as perdu!")
delay(3)
$scene = Scene_Tablero.new
end
# ------------------------------------
def delay(seconds)
for i in 0...(seconds * 10)
sleep 0.1
Graphics.update
end
end
# ------------------------------------
def bet
$game_party.lose_gold(@bet)
@currentbet += @bet
@dinero_window.refresh#(@currentbet)
end
# ------------------------------------
end
Revenir en haut Aller en bas
Eldorn
Intendant
Intendant
Eldorn


Masculin Nombre de messages : 188
Age : 30
Emploi/loisirs : Making tiens!
Date d'inscription : 24/10/2007

Mettre un jeu de roulette Empty
MessageSujet: Re: Mettre un jeu de roulette   Mettre un jeu de roulette Icon_minitimeSam 10 Nov - 7:08

Voila un screen :

Mettre un jeu de roulette Roulette
Revenir en haut Aller en bas
Contenu sponsorisé





Mettre un jeu de roulette Empty
MessageSujet: Re: Mettre un jeu de roulette   Mettre un jeu de roulette Icon_minitime

Revenir en haut Aller en bas
 
Mettre un jeu de roulette
Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Sunrise :: Alchimisterie :: Scripts :: Scripts Libres-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser