- InvitéInvité
[résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Sam 24 Mai 2008 - 15:17
Bonjour, bonjour !!!!!!
Alors voilà. Ce script permet de faire un jeu de Cartes ... le "Black-Jack" ...
Je l'ai testé et marche sans problème .
Ce Script n'est Compatible que pour XP !!
Moi, j'ai eu du mal à comprendre le but du jeu ...Mais bon . Se n'est pas ça que je voulais vous dire ...
Allez à l'Editeur de Scripts .
Créez un nouveau script au dessus de "Main" .(Clic droit/ Nouveau Script)
Nommez-le maintenant " Black Jack " (sans les guillemets !)
Et enfin , collez le script à la première ligne de votre nouveau script ...
Et voilà !
Pour avoir la fenêtre où il y a le jeu de carte, faites un nouvel évènement et allez dans "Insérer un script" dans les commandes d'évènement et mettez y ceci:
$scene = Scene_Blackjack.new
Auteur: Lanlan
Image(s):
Source: http://rpgcreative.net/Site/RPG%20Maker/pages/Script/script%20jeu%20de%20carte.html
Alors voilà. Ce script permet de faire un jeu de Cartes ... le "Black-Jack" ...
Je l'ai testé et marche sans problème .
Ce Script n'est Compatible que pour XP !!
Moi, j'ai eu du mal à comprendre le but du jeu ...Mais bon . Se n'est pas ça que je voulais vous dire ...
Allez à l'Editeur de Scripts .
Créez un nouveau script au dessus de "Main" .(Clic droit/ Nouveau Script)
Nommez-le maintenant " Black Jack " (sans les guillemets !)
Et enfin , collez le script à la première ligne de votre nouveau script ...
Et voilà !
- Spoiler:
- =begin
-----------------------------------------------------------------
:A scrîpt brought to you by LanLanGames,
:www.LanLanGames.tk, its horrendousgusting
:made by lanlan
:special thanks to those who helped at the
:rmxp.net RGSS support thread
:and to the guy who envented blackjack
-----------------------------------------------------------------
=end
class Scene_Blackjack
def main
@help_window = Window_Help.new
@table_window = Window_Table.new
@bet_window = Window_Bet.new
@bet_window.index = 0
@money_window = Window_Money.new
@hitstay_window = Window_HitStay.new
@hitstay_window.active = false
@cards = []
@graphic = []
@card_used = 0
variable_init
shuffle2
val_graphic
shuffle
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@table_window.dispose
@bet_window.dispose
@money_window.dispose
@hitstay_window.dispose
end
def update
@table_window.update
@bet_window.update
@help_window.update
@money_window.update
@hitstay_window.update
if @bet_window.active
update_bet
return
end
if @hitstay_window.active
update_hitstay
return
end
end
def update_bet
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@bet_window.index = 5
return
end
if Input.trigger?(Input::C)
case @bet_window.index
when 0
@bet = 25
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 1
@bet = 50
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 2
@bet = 100
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 3
@bet = 500
if ($game_party.gold >= @bet) and ((@currentbet+@bet) <= 500)
$game_system.se_play($data_system.decision_se)
bet
else
$game_system.se_play($data_system.buzzer_se)
return
end
when 4
$game_system.se_play($data_system.decision_se)
start_blackjack
when 5
$game_system.se_play($data_system.cancel_se)
$game_party.gain_gold(@currentbet)
$scene = Scene_Map.new
end
end
end
def update_hitstay
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@hitstay_window.index = 1
return
end
if Input.trigger?(Input::C)
case @hitstay_window.index
when 0
hit
when 1
stay
end
end
end
def bet
$game_party.lose_gold(@bet)
@currentbet += @bet
@money_window.refresh(@currentbet)
end
def start_blackjack
@bet_window.active = false
@m_hand1 = @cards[@card_used]
@graphic1 = @graphic[@card_used]
check_cards
@card_used +=1
@m_hand2 = @cards[@card_used]
@graphic2 = @graphic[@card_used]
check_cards
@card_used +=1
@d_hand1 = @cards[@card_used]
@d_graphic1 = @graphic[@card_used]
check_cards
@card_used +=1
@d_hand2 = @cards[@card_used]
@d_graphic2 = @graphic[@card_used]
@m_total = @m_hand1+@m_hand2
@d_total = @d_hand1+@d_hand2
if @m_hand1 == 1
@m_ace =1
@m_hand1=@m_hand1+10
@m_total=@m_hand1 + @m_hand2
end
if @m_hand2 == 1
if @m_hand1 != 11
@m_ace = 1
@m_hand2 = @m_hand2+10
@m_total = @m_hand1+@m_hand2
else
@m_hand2 = 1
@m_total = @m_hand1+@m_hand2
end
end
if @d_hand1 == 1
@d_ace =1
@d_hand1=@d_hand1+10
@d_total=@d_hand1 + @d_hand2
end
if @d_hand2 == 1
if @d_hand1 != 11
@d_ace = 1
@d_hand2 = @d_hand2+10
@d_total = @d_hand1+@d_hand2
else
@d_card2 = 1
@d_total = @d_hand1+@d_hand2
end
end
draw_cards
check_win
end
def shuffle
j = 51
k = 0
temp = 0
temp2 = 0
while (j>=0)
k = rand(j)
temp = @cards[j]
temp2 = @graphic[j]
@cards[j] = @cards[k]
@graphic[j] = @graphic[k]
@cards[k] = temp
@graphic[k] = temp2
j-=1
end
end
def shuffle2
@cards = [1,2,3,4,5,6,7,8,9,10,10,10,10,
1,2,3,4,5,6,7,8,9,10,10,10,10,
1,2,3,4,5,6,7,8,9,10,10,10,10,
1,2,3,4,5,6,7,8,9,10,10,10,10,
0,0]
end
def val_graphic
for i in 0...53
@graphic[i] = i
end
end
def check_cards
if @card_used == 52
shuffle
@card_used = 0
end
end
def draw_cards
@table_window.refresh(@m_hand1,@graphic1,
@m_hand2,@graphic2,
@m_hand3,@graphic3,
@m_hand4,@graphic4,
@m_hand5,@graphic5,
@d_hand1,52,
@d_hand2,@d_graphic2,
@d_hand3,@d_graphic3,
@d_hand4,@d_graphic4,
@d_hand5,@d_graphic5,
@m_total)
end
def draw_real_cards
@table_window.refresh(@m_hand1,@graphic1,
@m_hand2,@graphic2,
@m_hand3,@graphic3,
@m_hand4,@graphic4,
@m_hand5,@graphic5,
@d_hand1,@d_graphic1,
@d_hand2,@d_graphic2,
@d_hand3,@d_graphic3,
@d_hand4,@d_graphic4,
@d_hand5,@d_graphic5,
@m_total)
end
def variable_init
@bet = 0
@currentbet = 0
@dummy_gold = 0
@m_hand1 = 0
@graphic1 = 53
@m_hand2 = 0
@graphic2 = 53
@m_hand3 = 0
@graphic3 = 53
@m_hand4 = 0
@graphic4 = 53
@m_hand5 = 0
@graphic5 = 53
@d_hand1 = 0
@d_graphic1 = 53
@d_hand2 = 0
@d_graphic2 = 53
@d_hand3 = 0
@d_graphic3 = 53
@d_hand4 = 0
@d_graphic4 = 53
@d_hand5 = 0
@d_graphic5 = 53
@m_ace = 0
@d_ace = 0
@test = 0
end
def hit
check_cards
@card_used +=1
if @m_hand3 == 0
@m_hand3 = @cards[@card_used]
@graphic3 = @graphic[@card_used]
elsif @m_hand4 == 0 and @m_hand3 != 0
@m_hand4 = @cards[@card_used]
@graphic4 = @graphic[@card_used]
elsif @m_hand5 == 0 and @m_hand4 != 0
@m_hand5 = @cards[@card_used]
@graphic5 = @graphic[@card_used]
end
if @cards[@card_used] == 1
if @m_total <=10
@m_ace = 1
@m_total += 11
else
@m_total += 1
end
else
@m_total += @cards[@card_used]
end
check_win2
end
def stay
while (@d_total<=@m_total)
check_cards
@card_used +=1
if @d_hand3 == 0
@d_hand3 = @cards[@card_used]
@d_graphic3 = @graphic[@card_used]
elsif @d_hand4 == 0 and @m_hand3 != 0
@d_hand4 = @cards[@card_used]
@d_graphic4 = @graphic[@card_used]
elsif @d_hand5 == 0 and @m_hand4 != 0
@d_hand5 = @cards[@card_used]
@d_graphic5 = @graphic[@card_used]
end
if @cards[@card_used] == 1
if @d_total <=10
@d_ace = 1
@d_total += 11
else
@d_total += 1
end
else
@d_total += @cards[@card_used]
end
end
check_win3
end
def check_win
if @test == 0
if @m_total == 21 and @d_total != 21
draw_real_cards
win
elsif @m_total != 21 and @d_total == 21
draw_real_cards
lose
elsif @m_total == 21 and @d_total == 21
draw_real_cards
tie
else
@test = 1
@hitstay_window.active = true
end
end
end
def check_win2
if @m_total >= 22 and @m_ace == 1
@m_total -= 10
@m_ace = 0
draw_cards
elsif @m_total >= 22
draw_real_cards
lose
elsif @m_total == 21
draw_real_cards
win
elsif @m_total <=20
draw_cards
@hitstay_window.active = true
end
end
def check_win3
if @d_total >= 22 and @d_ace == 1
@d_total -= 10
@d_ace = 0
draw_real_cards
elsif @d_total >= 22
draw_real_cards
win
elsif @d_total == 21
draw_real_cards
lose
elsif @d_total > @m_total and @d_total <= 20
draw_real_cards
lose
elsif @d_total == @m_total
draw_real_cards
tie
elsif @d_total < @m_total
draw_real_cards
win
end
end
def win
$game_party.gain_gold(@currentbet*2)
@help_window.set_text("Win!")
delay(3)
$scene = Scene_Map.new
end
def lose
@help_window.set_text("Lose!")
delay(3)
$scene = Scene_Map.new
end
def tie
$game_party.gain_gold(@currentbet)
@help_window.set_text("Tie!")
delay(3)
$scene = Scene_Map.new
end
def delay(seconds)
for i in 0...(seconds * 10)
sleep 0.1
Graphics.update
end
end
end
class Window_Table < Window_Base
def initialize
super(0, 64, 512, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
end
#--------------------------------------------------------------------------
def refresh(hand1 = 0, graphic1 = 53,
hand2 = 0, graphic2 = 53,
hand3 = 0, graphic3 = 53,
hand4 = 0, graphic4 = 53,
hand5 = 0, graphic5 = 53,
d_hand1 = 0, d_graphic1 = 53,
d_hand2 = 0, d_graphic2 = 53,
d_hand3 = 0, d_graphic3 = 53,
d_hand4 = 0, d_graphic4 = 53,
d_hand5 = 0, d_graphic5 = 53,
total = 0)
@hand1 = hand1
@hand2 = hand2
@hand3 = hand3
@hand4 = hand4
@hand5 = hand5
@d_hand1 = d_hand1
@d_hand2 = d_hand2
@d_hand3 = d_hand3
@d_hand4 = d_hand4
@d_hand5 = d_hand5
@graphic1 = graphic1
@graphic2 = graphic2
@graphic3 = graphic3
@graphic4 = graphic4
@graphic5 = graphic5
@d_graphic1 = d_graphic1
@d_graphic2 = d_graphic2
@d_graphic3 = d_graphic3
@d_graphic4 = d_graphic4
@d_graphic5 = d_graphic5
@total = total
self.contents.clear
self.contents.draw_text(32, 320, 128, 32, "Your Hand: " + @total.to_s)
graphic
end
def graphic
x = 0
y = 0
@frame_width = 71
@frame_height = 96
if @graphic1 !=nil
@xpos1 = @graphic1*@frame_width
else
@xpos1 = 52
end
if @graphic2 !=nil
@xpos2 = @graphic2*@frame_width
else
@xpos2 = 52
end
if @graphic3 !=nil
@xpos3 = @graphic3*@frame_width
else
@xpos3 = 52
end
if @graphic4 !=nil
@xpos4 = @graphic4*@frame_width
else
@xpos4 = 52
end
if @graphic5 !=nil
@xpos5 = @graphic5*@frame_width
else
@xpos5 = 52
end
if @d_graphic1 !=nil
@xposd1 = @d_graphic1*@frame_width
else
@xposd1 = 52
end
if @graphic2 !=nil
@xposd2 = @d_graphic2*@frame_width
else
@xposd2 = 52
end
if @d_graphic3 !=nil
@xposd3 = @d_graphic3*@frame_width
else
@xposd3 = 52
end
if @graphic4 !=nil
@xposd4 = @d_graphic4*@frame_width
else
@xposd4 = 52
end
if @d_graphic5 !=nil
@xposd5 = @d_graphic5*@frame_width
else
@xposd5 = 52
end
bitmap = RPG::Cache.picture("cards")
src_rect_hand1 = Rect.new(@xpos1, 0, @frame_width, @frame_height)
src_rect_hand2 = Rect.new(@xpos2, 0, @frame_width, @frame_height)
src_rect_hand3 = Rect.new(@xpos3, 0, @frame_width, @frame_height)
src_rect_hand4 = Rect.new(@xpos4, 0, @frame_width, @frame_height)
src_rect_hand5 = Rect.new(@xpos5, 0, @frame_width, @frame_height)
src_rect_d_hand1 = Rect.new(@xposd1, 0, @frame_width, @frame_height)
src_rect_d_hand2 = Rect.new(@xposd2, 0, @frame_width, @frame_height)
src_rect_d_hand3 = Rect.new(@xposd3, 0, @frame_width, @frame_height)
src_rect_d_hand4 = Rect.new(@xposd4, 0, @frame_width, @frame_height)
src_rect_d_hand5 = Rect.new(@xposd5, 0, @frame_width, @frame_height)
self.contents.blt(0,192,bitmap,src_rect_hand1)
self.contents.blt(96,192,bitmap,src_rect_hand2)
self.contents.blt(96*2,192,bitmap,src_rect_hand3)
self.contents.blt(96*3,192,bitmap,src_rect_hand4)
self.contents.blt(96*4,192,bitmap,src_rect_hand5)
self.contents.blt(0,0,bitmap,src_rect_d_hand1)
self.contents.blt(96,0,bitmap,src_rect_d_hand2)
self.contents.blt(96*2,0,bitmap,src_rect_d_hand3)
self.contents.blt(96*3,0,bitmap,src_rect_d_hand4)
self.contents.blt(96*4,0,bitmap,src_rect_d_hand5)
end
end
class Window_Bet < Window_Selectable
# ------------------------------------
def initialize
super(512, 64, 128, 224)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@column_max = 1
refresh
self.index = 0
end
# ------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@item_max = 6
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
# ------------------------------------
def draw_item(index)
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
case index
when 0
self.contents.draw_text(x , y, 128, 32, "25", 0)
when 1
self.contents.draw_text(x , y, 128, 32, "50", 0)
when 2
self.contents.draw_text(x , y, 128, 32, "100", 0)
when 3
self.contents.draw_text(x , y, 128, 32, "500", 0)
when 4
self.contents.draw_text(x , y, 128, 32, "Done", 0)
when 5
self.contents.draw_text(x , y, 128, 32, "Quit", 0)
end
end
# ------------------------------------
def update_help
@help_window.set_text("" )
end
end
class Window_Money < Window_Base
# ------------------------------------
def initialize
super(512, 288, 128, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
@bet = 0
refresh(@bet)
end
# ------------------------------------
def refresh(bet)
@bet = bet
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 96, 32, $game_party.gold.to_s,2)
self.contents.draw_text(0, 32, 96, 32, @bet.to_s, 2)
end
end
class Window_HitStay < Window_Selectable
# ------------------------------------
def initialize
super(512, 384, 128, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name =$fontface
self.contents.font.size = $fontsize
@column_max = 1
refresh
self.index = 0
end
# ------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
@item_max = 2
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
# ------------------------------------
def draw_item(index)
x = 4
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
case index
when 0
self.contents.draw_text(x , y, 128, 32, "Hit", 0)
when 1
self.contents.draw_text(x , y, 128, 32, "Stay", 0)
end
end
# ------------------------------------
def update_help
@help_window.set_text("" )
end
end
Pour avoir la fenêtre où il y a le jeu de carte, faites un nouvel évènement et allez dans "Insérer un script" dans les commandes d'évènement et mettez y ceci:
$scene = Scene_Blackjack.new
Auteur: Lanlan
Image(s):
Source: http://rpgcreative.net/Site/RPG%20Maker/pages/Script/script%20jeu%20de%20carte.html
- NaasmarMembre
- Nombre de messages : 185
Age : 28
Distinction : aucune
Date d'inscription : 15/03/2008
Re: [résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Sam 24 Mai 2008 - 16:24
C'est pas ici qu'il faut poster !
- InvitéInvité
Re: [résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Sam 24 Mai 2008 - 16:59
Ah mince !
Désolé ... Bah je la met où alors ?!
Dans les Scripts ?
Edit Death' : Déplacé.
Désolé ... Bah je la met où alors ?!
Dans les Scripts ?
Edit Death' : Déplacé.
- KorndorStaffeux retraité
- Nombre de messages : 4959
Age : 110
Localisation : Erem Vehyx
Distinction : Champion de boxe et au lit ! :O [Wax]
Être Mythique [Mister]
Papi Korndor qui a l'ostéoporose [Skillo]
Soldat Ikéa [Coco']
Un bonhomme, un vrai ! [Neresis]
Vieillard acariâtre [Didier Gustin]
Date d'inscription : 16/12/2007
Re: [résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Dim 25 Mai 2008 - 16:32
Ben, en fait, pas là non plus, Tous nos scripts sont du RGSS2, et ce que tu nous poste là est du RGSS ^^'
Bon, ça passe pour cette fois, mais n'hésite pas à plutôt poster cela sur le forum de berka
Bon, ça passe pour cette fois, mais n'hésite pas à plutôt poster cela sur le forum de berka
- InvitéInvité
Re: [résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Dim 25 Mai 2008 - 16:34
Ah ouiii !C'est vrai ! J'avais oublié le Fofo de berka ...
Désolé .
bon bah merci tretian de m'avoir dis ou le mettre ...
Désolé .
bon bah merci tretian de m'avoir dis ou le mettre ...
- KorndorStaffeux retraité
- Nombre de messages : 4959
Age : 110
Localisation : Erem Vehyx
Distinction : Champion de boxe et au lit ! :O [Wax]
Être Mythique [Mister]
Papi Korndor qui a l'ostéoporose [Skillo]
Soldat Ikéa [Coco']
Un bonhomme, un vrai ! [Neresis]
Vieillard acariâtre [Didier Gustin]
Date d'inscription : 16/12/2007
Re: [résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Dim 25 Mai 2008 - 16:47
De rien, c'est vraiment pas grand chose ^^
Sujet clos, donc!
Sujet clos, donc!
- Tom1695Membre
- Nombre de messages : 57
Age : 28
Localisation : Tarn
Distinction : aucune
Date d'inscription : 07/04/2008
Re: [résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Dim 8 Juin 2008 - 9:37
Une question: on pourrait pas le convertir pour VX ???
- InvitéInvité
Re: [résolu]Le Black Jack (jeu de carte) pour XP seulement !!!!!!
Dim 8 Juin 2008 - 16:04
Alors là, je ne sais pas du tout !
Je l'ai trouvé sur un site mais je ne leur ai jamais demandé s'ils pouvaient faire la même chose (enfin convertir ..) pour le VX ...
A moins que quelqu'un se dévoue pour le mettre sur le VX ...
Enfin, il faut demander cela plutôt aux Scripteurs ....
Je l'ai trouvé sur un site mais je ne leur ai jamais demandé s'ils pouvaient faire la même chose (enfin convertir ..) pour le VX ...
A moins que quelqu'un se dévoue pour le mettre sur le VX ...
Enfin, il faut demander cela plutôt aux Scripteurs ....
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum
|
|