[Scripting Demo] Coin Payout Triggers

This guide shows how to set up and track coin payouts so that in case a payout fails, no ingame currency is deducted from the player. Not using these triggers will result in players spending their resource without receiving any Modd Coins every time a payout fails.

Most important rule for script payouts: Never deduct the ingame currency before the payout was confirmed as successful!


Game
Sandbox for copying scripts

This demo is set up so you can transfer the scripts to your game. Simply create a player variable named CoinPayoutAmount, then copy the coin folder from World Scripts.

Setup Instructions
  1. create a variable for Player named CoinPayoutAmount (number), copy the coin folder from this game to your game (found in World Scripts).
    image
    image

  2. set up your Daily coin transfer limit in the Monetization tab (can only be done from ingame editor).

  3. create a currency that can be converted to modd coins. In this example, I am using a unit attribute Blob Coins which can be obtained by simply pressing Space.

  4. before running the transaction attempt script, you need to set the value of the player variable CoinPayoutAmount to the amount of coins you want to pay out. In our example, this is done in the Homie script pay out Blobs as Modd Coin. You can have different scripts that set different payout amounts.

  5. A successful payout triggers the World Script transaction confirmed. In this script, deduct the ingame currency from the player. The demo uses blob coin, but you can set up if conditionals to check for payout types that deduct different resources as well.

3 Likes