OSP Code QoL Blackjack Poker For M&B1.0 (Dec 11, 2008)

Users who are viewing this thread

This may be obvious to most people, but I'll mention it anyway, since I'd didn't think about doing it at first.  It is very easy to modify the code to add the ability to play Blackjack with all your troops, npc's, lords, etc.  An example of my code is below, but its modified slightly so don't cut-n-paste it exactly or they will call the game Pazaak in your mod.  :wink:  I also made it so that when you play with a npc/lord/knight your relationship changes.  Here's a picture of me playing with Darth Vader.  :smile:



example from module_dialogs.py

######################################
# GENERIC MEMBER CHAT
######################################

  [anyone,"member_chat", [], "Your orders {sir/madam}?", "regular_member_talk",[]],
  [anyone|plyr,"regular_member_talk", [], "Tell me about yourself", "view_regular_char_requested",[]],
  #SW - new functionality for BLACKJACK MOD when talking to troops
  [anyone|plyr,"regular_member_talk",[],"Do you want to play Pazaak?", "regular_member_blackjack_1",[]],
  [anyone,"regular_member_blackjack_1",[],"Sure. Are you ready to play or should I review the rules?", "regular_member_blackjack_2",[]],
  [anyone|plyr,"regular_member_blackjack_2",[],"Start playing.", "regular_member_blackjack_3",[]],
  [anyone,"regular_member_blackjack_3",
  [
    (store_troop_gold,reg1,"trp_player"),
    (ge,reg1,1),
      ],
  "Ok.^^You will have to click 'Done' to close the Party window before the game can begin.", "close_window",[
    (assign, "$black_jack",1),
    (assign, reg50, 0),
    (start_presentation, "prsnt_blackjack"),
    ]],
  [anyone,"regular_member_blackjack_3",[],
  "You don't have enough money.", "regular_member_blackjack_1",[]],
  [anyone|plyr,"regular_member_blackjack_2",[],"Discuss the rules.", "regular_member_blackjack_4",[]],
  [anyone,"regular_member_blackjack_4",[],"Pazaak is played with the same rules as Blackjack. The player closest to 21, without going over, wins.", "regular_member_blackjack_1",[]],
  [anyone|plyr,"regular_member_blackjack_2",[],"Never mind.", "member_chat",[]],
  # end of blackjack mod

  [anyone,"view_regular_char_requested", [], "Aye {sir/madam}. Let me tell you all there is to know about me.", "do_regular_member_view_char",[[change_screen_view_character]]],
  [anyone,"do_regular_member_view_char", [], "Anything else?", "regular_member_talk",[]],
  [anyone|plyr,"regular_member_talk", [], "Nothing. Keep moving.", "close_window",[]],

######################################
# GENERIC PARTY ENCOUNTER
######################################


example from module_presentations.py

              (display_message, "@You have a higher hand value. You win!", 0x88ffff),
              (val_mul, reg51, 2),
              (call_script, "script_troop_add_gold", "trp_player", reg51),
              #(play_sound, "snd_game_win"),
#SW - added script_change_player_relation_with_troop to blackjack mod (win = -1, lose = +1, draw = 0)
(call_script, "script_change_player_relation_with_troop", "$g_talk_troop", -1),
 

EDIT: does anybody know if its possible to rotate the players a little bit so they are somewhat looking at each other?
 
Sorkenlol said:
Wow, awesome. Does it come with a blackjack tutorial? I have no idea how to play blackjack.
Blackjack is sometimes called 21 because the point is to get your cards to total as close to 21 as possible without going over.  Face cards (kings, queens, and jacks) count as 10, aces can count as either 1 or 11 as the player chooses.  One card is dealt to each player facedown (so only he/she can see it), a second one face up.  A hit means you request another faceup card from the dealer, to stay means you want no further cards.  Once all players have stayed, the facedown cards are revealed and the player closest to 21 without going over wins the pot (the total of all players' bets).  Typically the house/dealer will stay on 17 or better as that's statistically the break-even point.
In HokieBTs first picture, the player has gotten the ideal hand of an ace and a 10, where the dealer has busted by going over 21.  In his second one Lord Vader has won even with a crappy hand as the player has busted.
 
Looks cool. Would be fun to be able to have a game of high stakes no limit hold em as well at some of the taverns in order to easily increase your money. Hey, the opponents might even be better than most human players anyway :mrgreen:
 
oolonglgx said:
:grin: Hey everyone, I've made a 21K minor game(Blackjack Poker) in M&B
It's a patch for native 1.0, just unzip all files to the folder of native to activate it.

patch and source download link (Dec 11, 2008 update):
https://www.mbrepository.com/file.php?cid=8&id=1001
Search "#plus" in module_dialogs.py, module_mission_templates.py,  module_scripts.py, module_meshes.py and module_presentations.py can be able to find the new source code.
 
Thanks Alixyang and SantasHelper to upload :wink: 


Dec 11, 2008. There is a mistake to be corrected:
open the module_presentations.py and search"(gt, reg54, reg53),":
  ......
  (gt,reg55,21),
  (try_begin),
      (le,reg55,21),
      (gt,reg54,reg53),
      (assign,":win",1),
  ......
The second reg55 must be changed to reg53(banker's points), that is:
  ......
  (gt,reg55,21),#player's points(A=11) more than 21
  (try_begin),
      (le,reg53,21),#banker's points(A=11) less than or equal to 21
      (gt,reg54,reg53),#player's points(A=1) more than banker's points(A=11)
      (assign,":win",1),#player win
  ......
 
At first, thanks the all-mighty Max.Pain
icon_biggrin.gif
, who helped me translate this from chinese to english.

Main feature:


The game's rule is based on the classic rule of Blackjack, player can Hit, Stand and Double down, but no splitting or insurance. Speak to any travern holder to play.

Attention: Do not bring up game menus with hotkey such as Q or C, or you might not be able to see some cards or buttons and cannot continue after you return. If you still see "talk to Traven holder" after the game has begun, just move your character a little with WASD and it will disappear.

Screenshots in the game:
baf8ff50c817b6bd07bd9d70513d1052.jpg


7b574d9c49c46ab61944050a41c2cc03.jpg


052ffe515dcb0e4d7eea7e145d86f765.jpg


5dca5a8d0be7f9cb9f10411243e56005.jpg


a0415b26a46fc8fe7bf3fbf9fa9f98ba.jpg



:lol: One set of poker with M&B character patterns on it, replace the blackjack_poker.dds in Textures folder of the patch to use it.

May all-mighty Armagan forgive me for using his photo :mrgreen:

download link:
http://www.yousendit.com/download/TTZueEVSSU9KV01LSkE9PQ


OMFG...DOUBLE INTERVENTION TIME, M&B INTERVENTION AND GAMBLING INTERVENTION...W00T !! TWICE THE INTERVENTION TWICE THE AFTERMATH SEX !! :razz: :mrgreen:
 
X-Warrior-X - there's really no need to quote the entire first post, in my opinion it just clutters up the forum, etc.

Anyway, Gohda created some new pazaak cards for the star wars mod, does anybody know where in the code I can modify it to spread the cards out a bit so they don't overlap?



EDIT:  nevermind, I found three occurrences of
Code:
(val_add,":x_p",60),
and switched it to
Code:
(val_add,":x_p",90),
and it worked well for these new cards.
 
Has anybody had a problem with the math being wrong?  I Lost the following hand, but I should have Won ?  I'm wondering if its a bug in the native code, or if I messed it up somehow with a few very minor changes I made (graphics, text, spacing of the cards, etc)



EDIT:  Warcat92 posted the following in my mod's forum:

Warcat92 said:
I think the problem with the 1/11 card is that whenever it's the player's first card it only has a value of 1. It works fine everywhere else for me.
 
SantasHelper said:
HokieBT said:
Has anybody had a problem with the math being wrong?  I Lost the following hand, but I should have Won ?  I'm wondering if its a bug in the native code, or if I messed it up somehow with a few very minor changes I made (graphics, text, spacing of the cards, etc)

EDIT:  Warcat92 posted the following in my mod's forum:

Warcat92 said:
I think the problem with the 1/11 card is that whenever it's the player's first card it only has a value of 1. It works fine everywhere else for me.

what's the 4th card ? I got 19+ ?, so I can't really tell if you lost or won
(I'm talkig about that yellow card, no idea what it is)

it's an ace, can be worth 1 or 11, whatever suits you best
 
Both hands equal 21 so tie goes to the dealer.  Blackjack trumps 21, though.  Or at least it should, I haven't played with this mod yet.
 
Back
Top Bottom