SingleUseGood

The SingleUseGood item is a consumable good item with a specific balance. More...

Import Statement: import VPlayPlugins.soomla 1.2
Inherits:

Item

Properties

Detailed Description

A SingleUseGood item is the most basic kind of a virtual good. It is a virtual item that a player can only use once before he has to purchase more of the same kind again. SingleUseGood items be purchased an unlimited number of times. These goods can normally be summed up and accumulated so that the user has a balance of them (e.g. 20 green balls). The balance of every virtual item is saved within an internal database and can be retrieved with balance property. Single use goods are commonly purchased with a virtual currency with the VirtualPurchase type.

A simple example for an additional one time usage weapon for Squaby looks like the following:

 Store {
   goods: [
     SingleUseGood {
       id: vacGood
       itemId: "vac_item_id"
       name: "Vacuum Cleaner"
       description: "All Squabies are sucked in by your mom's vacuum cleaner"
       purchaseType: VirtualPurchase { itemId: goldCurrency.itemId; amount: 50; }
     }
   ]
 }

Property Documentation

balance : int

A read-only property which holds the current balance of purchased items of this type in the inventory. You can use property binding to display the current amount of items available with the help of a Text item:

 Text {
   text: "Available Vacuum Cleaners: %1".arg(vacGood.balance)
 }

description : string

A meta field for giving the item a description to display to the user. This property is not used internally but you can use it to display a common description within your game wherever you need to.

Be sure to set this property if you're making use of Store::printStoreProductLists as this greatly simplifies the publishing process of your game.


itemId : string

The itemId is a unique identifier for this item within your virtual store. The property is mandatory.


name : string

A meta field for giving the item a name to display to the user. This property is not used internally but you can use it to display a common name within your game wherever you need to.

Be sure to set this property if you're making use of Store::printStoreProductLists as this greatly simplifies the publishing process of your game.


purchaseType : PurchaseType

The purchaseType property defines how the item can be purchased. Possible values are instances of StorePurchase or VirtualPurchase. If you use the virtual economy model shipped with the Store plugin the VirtualPurchase type is preferred.

This property is mandatory. For convenience, you can reuse the currency pack's itemId for the purchase type's itemId or productId like in the example below. Keep however in mind that on iOS productIds must be unique across all your games and therefore should be prefixed for StorePurchase purchase types (see StorePurchase::productId for more details).

 SingleUseGood {
   id: vacGood
   itemId: "vac_item_id"
   name: "Vacuum Cleaner"
   description: "All Squabies are sucked in by your mom's vacuum cleaner"
   purchaseType:  VirtualPurchase { itemId: goldCurrency.itemId; amount: 50; }
 }

Videos

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support