Raocoin2.lua

Download here (v2.0.10)

The Raocoin2 library allows the creation of customisable currencies, which can be saved between plays. It also provides a built-in shop framework to allow these currencies to be used for various tasks.

Installation
Place the file raocoin2.lua and the folder named raocoin in either your level's custom graphics folder for use in a level, along with a lunadll.lua file, or in the same directory as your .wld file along with a lunaworld.lua file for use throughout an entire episode.

How to use
To enable the Raocoin2 library for a specific set of levels, add this line to lunaworld.lua:

Then, define a currency by registering either an NPC item to count, or a global memory address to reference. This example will count dragon coins, and display a UI element at the point (472, 66) (just under the score):

While this example will assign a reference to the existing HUD coin counter, allowing regular coins to be saved, loaded, and used as currency:

Each of these functions returns a Currency object, which can be used to create shops and store values between plays.

= Documentation =

Constants
These are static values that should be treated as read-only

Fields
These are variables you can access

Classes
These are internal classes that you can create and access using the API

Currency
''The Currency class stores and retains a value for the currencies that have been registered to the game. Currency objects are created using "registerCurrency" or "registerMemCurrency"''

Events
These are customisable events that can be used in lunadll.lua to run user-specified code

Item
''The Item class stores an object that can be bought by calling "buy". Item objects are specific to a single currency''

Functions
These are functions you will need to use the library

Events
These are customisable events that can be used in lunadll.lua to run user-specified code