So you want people to wager who’s the better player, huh? Who got blessed by Lady Luck the most, eh? Well now you can!

Come one, come all to your own wagering game experience, you can have people bet based on kills, chance or whatever else you can think up.

Here are the new scripting nodes that make this happen:

Node Description Needed
SetPlayerWagerMultplier Sets the wager multiplier for a player. Must be called before calling SubmitPlayerWagers. Can be called multiple times on the same player, the last value set before calling SubmitPlayerWagers will be used. Required
SubmitPlayerWagers Submits the wagers for all players. Call this only once per game! Required
WagersResolved Called when we got the result for all the wagers. Required
GetPlayerWagerResult Gets a player’s wager result. Tells you if they won, how much the payout was, how much in total they wagered. Only call after WagersResolved has triggered. Optional

Let’s breakdown the flow of what you need to make it all work.

  1. Make a Custom Game with the Multiplier Wagering template

image.png

image.png

image.png

  1. Set a score to keep track of the wagering multiplier for each player. We will divide this later by 100 since scores are only integers. (100 → 1x bet, 150 → 1.5x bet, 2x → 2x bet, etc.). It is recommended you use a variable and make sure you set the variable name for the score and in your variable in the settings!

    image.png

    image.png

    image.png

  2. When ready to submit the wagers, make sure to set each player wager multiplier, then call submit Player Wagers. For this example we use the TimerEnded event of the Timer Plugin since we will control when the game ends. IMPORTANT: use a Float to divide the score for the correct multiplier. If you use an Integer it will truncate the result.

image.png

image.png

  1. Wait for the Wagers Resolved callback. This will be some downtime as the winnings are calculated, you can do whatever you want here as players wait to know if they won or lost the bets. You can use a Custom Event after Submit Player Wagers to stop player movements or throw some notification about their fate being decided
  2. Handle the wager results! In here doing a simple check for all the wagers and if we lost a wager, we are killing the player. Then we wait a couple seconds to end the game.

image.png

A full example where players just have 50 - 50 chance at winning or busting

image.png