Hello Chris, im trying to create TDC style game using adventure creator. Im curious about DECK creation and randomizing draw deck solution. Im using containers for "battlefield fields" but i wanna hear your thoughts about this. Is it possible to create a game where i can "create" my own deck "Inventory1" and then when battle begins to store all my "Inventory" items to container named "Deck" and to draw cards one by one on random order and how would you approach stats of cards and actually attacking opponent ( i was using hotspot that is turned on/off if in certain container is certain card/item ). If you have any kind of suggestions i would like to hear it from you because im really close to create a good and fun game using AC.Thank you!
Comments
The v1.56 update of AC will include events that trigger when an item is moved to or from a Constainer, allowing custom code to be run at these times - that may be useful here.
AC already has the ability to assign properties to inventory items, however. They can be read, and items assigned to the player, through scripting. See the RuntimeInventory page of the scripting guide.
To add an item to the player's inventory, you just need it's ID number as given in the Inventory Manager:
AC.KickStarter.runtimeInventory.Add (2); // Add item ID = 2
Inventory properties can be created under the "Properties" tab of the Inventory Manager. One defined, your existing Inventory Items can then be given unique values for each of these properties. You can also limit properties to only apply to items that are listed under a specific category.
An inventory item's properties can be accessed by first getting the item's InvItem class instance:
InvItem myItem = AC.KickStarter.GetItem (2); // Get Item 2
Their property class, InvVar, can then be retrieved with:
InvVar myItemProperty = myItem.GetProperty (3); // Get Item 2's Property 3
The property's display value can then be retrieved, among other things:
myItemProperty.GetDisplayValue (0);