3. Create a Currency Converter {{ currentPage ? currentPage.title : "" }}

If you want to have 3 different Currencies (Gold, Silver and Bronze) like the most RPG’s have, you need to be able to convert them depending on each Value.

For this we will do following example:

  • Bronze: If you have 1000 Bronze, it will be converted to 1 Silver.

  • Silver: If you have 1000 Silver, it will be converted to 1 Gold.

1. First of all open your Player BP and select the Currency Component.

Inside the Details Panel add two Items to the Currency Converter like following:

  • First Item - Convert 1000 Bronze to 1 Silver.

    • FromCurrency:

      • CurrencyType: Currency.Type.Bronze

      • Value: 1000

    • ToCurrency

      • CurrencyType: Currency.Type.Silver

      • Value: 1

  • Second Item: Convert 1000 Silver to 1 Gold.

    • FromCurrency:

      • CurrencyType: Currency.Type.Silver

      • Value: 1000

    • ToCurrency

      • CurrencyType: Currency.Type.Gold

      • Value: 1

Now following would happen if you call

  • AddAmount with Input Silver and Value 500:

    • If you have 1 Gold, 600 Silver, 300 Bronze

    • You would have 1000 Silver or more, so 1000 Silver will be converted to 1 Gold.

    • After you called AddAmount the new Value will be: 2 Gold, 100 Silver, 300 Bronze.

  • ReduceAmount with Input Silver and Value 500:

    • If you have 1 Gold, 200 Silver, 300 Bronze

    • You do not have enough Silver so 1 Gold will be converted to 1000 Silver.

    • After you called ReduceAmount the new Value will be: 0 Gold, 700 Silver, 300 Bronze.

{{{ content }}}