Sign In Register

How can we help you today?

Start a new topic

variables in virtual goods

 Hi,


I want to have an inventory system with random generated items and after some searching i think it needs to be done with virtual goods.


I want to give each player an Item, but this item is randomly generated (hp dmg values etc).


So how to do this?


//Setup in GameSparks

1. create virtual good "Item".

2. Add a property set with each attribute (hp, dmg, speed)


// givePlayerGift();


1. purchasing the virtual good

2. (?) changing the values of this specific good

1 person has this question
1 Comment

Hi Kelvin,


For this kind of system I'd recommend instead of using properties (which are meant more for distinguishing attributes based on specifics rather than random values) I would tie the awarding of a virtual good to the creating of a document in a runtime collection that would hold the attributes that are randomly generated. This way, when the good is awarded, you could write some cloud code to set these attributes as part of a document tied to both the player and the virtual good, insert this into a collection, then any time you need to reference this virtual good you would also pull this document to check it's player-specific attributes.


Does this make sense?


-Pádraig

Login to post a comment