OSP Code QoL Flipping coins with tavernkeepers

Best answers
0
I had this in the Astorionar Adventure mod. It's a dialog with a tavernkeeper.
You can flip a coin with him and bet on either head or tail and select the amount
of money. It's random if you win or lose. To avoid becoming gambling-addicted
you can only do it every 6 hours (can easily be changed).
If you have unrealistic-saving-option it's an easy way to get unlimited money, but
that can be avoided by increasing the time and decreasing the bet-amounts.
Just as you like it...

Add the following lines in module_dialogs.py somewhere under other "tavernkeeper_talk".
Should work for both M&B and WB.

Code:
  [anyone|plyr,"tavernkeeper_talk", [
      (store_current_hours,":cur_hours"),
      (val_sub, ":cur_hours", 6),
      (gt, ":cur_hours", "$gamble_last_time"),
      ], "I'd like to flip a coin with you.", "tavernkeeper_coin",[]],

  [anyone,"tavernkeeper_coin", [
      ], "Alright. How much money do you want to lose?", "tavernkeeper_coin2",[]],

  [anyone|plyr,"tavernkeeper_coin2", [
      (store_troop_gold, ":gold", "trp_player"),
      (ge,":gold",50),
      ], "50 Denars.", "tavernkeeper_coin3",[
          (assign, reg6, 50),]],
  [anyone|plyr,"tavernkeeper_coin2", [
      (store_troop_gold, ":gold", "trp_player"),
      (ge,":gold",100),
      ], "100 Denars.", "tavernkeeper_coin3",[
          (assign, reg6, 100),]],
  [anyone|plyr,"tavernkeeper_coin2", [
      (store_troop_gold, ":gold", "trp_player"),
      (ge,":gold",200),
      ], "200 Denars.", "tavernkeeper_coin3",[
          (assign, reg6, 200),]],
  [anyone|plyr,"tavernkeeper_coin2", [
      (store_troop_gold, ":gold", "trp_player"),
      (ge,":gold",500),
      ], "500 Denars.", "tavernkeeper_coin3",[
          (assign, reg6, 500),]],
  [anyone|plyr,"tavernkeeper_coin2", [
      (store_troop_gold, ":gold", "trp_player"),
      (ge,":gold",1000),
      ], "1000 Denars.", "tavernkeeper_coin3",[
          (assign, reg6, 1000),]],
  [anyone|plyr,"tavernkeeper_coin2", [
      (store_troop_gold, ":gold", "trp_player"),
      (ge,":gold",2000),
      ], "20000 Denars.", "tavernkeeper_coin3",[
          (assign, reg6, 2000),]],
  [anyone|plyr,"tavernkeeper_coin2", [
      ], "I can't afford it.", "tavernkeeper_coinn",[]],

  [anyone,"tavernkeeper_coinn", [
      ], "Nevermind.", "tavernkeeper_talk",[]],

  [anyone,"tavernkeeper_coin3", [
      ], "Okay. Head or tail?", "tavernkeeper_coin4",[]],

  [anyone|plyr,"tavernkeeper_coin4", [
      ], "Head.", "tavernkeeper_coin5",[
          (str_store_string, s2, "@head"),
          (str_store_string, s3, "@tail"),]],
  [anyone|plyr,"tavernkeeper_coin4", [
      ], "Tail.", "tavernkeeper_coin5",[
          (str_store_string, s2, "@tail"),
          (str_store_string, s3, "@head"),]],

  [anyone,"tavernkeeper_coin5", [
      ], "Well, here we go... (He flips the coin.)", "tavernkeeper_coin6",[
        (store_random_in_range, "$rand2", 0, 2),]],

  [anyone,"tavernkeeper_coin6", [
       (eq,"$rand2",0),
      ], "Look, it's {s3}! Bad luck for you.", "tavernkeeper_coin6a",[]],
  [anyone,"tavernkeeper_coin6", [
       (eq,"$rand2",1),
      ], "Damn, it's {s2}... Here's your money.", "tavernkeeper_pretalk",[
          (troop_add_gold,"trp_player",reg6),
          (store_current_hours,":cur_hours"),
          (assign, "$gamble_last_time", ":cur_hours"),]],

  [anyone|plyr,"tavernkeeper_coin6a", [
      ], "Here are your {reg6} Denars.", "tavernkeeper_pretalk",[
       (troop_remove_gold,"trp_player",reg6),
       (store_current_hours,":cur_hours"),
       (assign, "$gamble_last_time", ":cur_hours"),]],
 

Specialist

Master Knight
WB
Best answers
0
Love this!
Now all those barbarian type players can gamble away a fortune in the Tavern.  :lol:
 

Specialist

Master Knight
WB
Best answers
0
Of course not! I'll give you credit where your credit is due. :smile:

Alot of your stuff is good quality as well. Like Age of Blades!  :mrgreen:
 

Ikaguia

Grandmaster Knight
WBWF&SNW
Best answers
0
WOW, that's so briliant and simple that I don't know how I haven't thought of that before... THANK YOU!!!
I'm gonna use this in my mod and I'm gonna give credits
 

Korgoth

Squire
WBWF&S
Best answers
0
Albertus please make some other gambling games in Taverns and maybe even in back alleys of streets lol
 

xPearse

Sergeant Knight
Best answers
0
Albertus Magnus said:
Nice to hear! Do you mind giving credit?  :smile:
Well obviously I am going to give credit so dont you worry, your name will be right on there with all the others. Thanks for releasing this to the public great job.