Hello everyone. I have hit a wall with my app. To understand this better here is a little explanation. This is for my game app I’m creating. More specifically when the user ‘attacks’ an NPC. I have the math calculations working correctly to decide who wins in the fight (factoring in total levels and probability). When the user wins the fight, the game gives them a 50% chance of actually winning an
item or just money. This is done buy triggering a custom workflow after the initial workflow pressed when the user presses a button to attack.
-Step 1 in the workflow is to generate a random number between 1 and 2.
-Step 2 is to set the state of the group which holds the image of the item to which
item is won. This is done by the workflow set state. Custom state called item which is an item type (I know my naming sucks haha). The item that is set is a result of a search for items : random item. (I do plan on adding item rarity and chances of getting better items being lower for the future but for now this is my proof of concept).
-Step 3 the group from step 2 is shown on screen which reveals the image of the item they won. This all works.
-Step 4 is to assign this item to the user’s inventory. I have a data type called inventory which has 3 main fields (item, quantity and user). The workflow then creates a new inventory data type. User is obviously current user, quantity is 1 and the item is the group’s item from step 2. This is the part not working. It will show Item A as being won but then creates Item B in the inventory.
I know its hard to try to figure out without any access to the app but maybe someone can either think of a better way to achieve this or simplify this whole process? There are also conditions for the workflows incase the user already has this item but all my tests i do from clean slates and nothing works.