Page 1 of 1

Looping issue..with a card deck

Posted: Wed Jan 29, 2020 4:37 am
by DazaKiwi
I'm making a basic card deck gameplay not as traditional playing cards it will be a kin to having spell cards or magic the gathering and what not.

I've run into a snag with it and i kind of know what is happening but not why it is i will try and explain below.

The player has only 3 cards for a hand and when a card is played followed with the player drawing a new card a series of tasks with the use of a loop will match the RNG (1,8) number drawn (deck limit is 8 cards) and restrictions for the 3 task will check to see if the number hasn't been used before and matches an empty slot.

The task that runs 3 times and calls 3 tasks that is for finding an empty slot and the number hasn't been used before. What IS happening is the last number (last run of the loop) rolled gets supposedly picked as the task passes and outputs such. But in actual fact its the first loop that the rng number is actually added to the players hand.
Ive added some debug text in the tasks to help trouble shoot this.

I am hoping someone can tell me why... :anyone:

Re: Looping issue..with a card deck

Posted: Fri Feb 07, 2020 2:06 am
by DazaKiwi
After a bit of a break from this demo i came back to it with fresh eyes and got it working. I created a variabled called MatchFound and the other 3 tasks (Deal 3 cards at Start Part 1,2,3) now have MatchFound = 0 in its restrictions. Then i created a system task that is run after those 3 to check if there is an empty slot still and will restart the whole process again (this is for the very start of the demo to fill up the players hand with 3 cards). So now it is running as i originally intended it to. I may as well attach the new change for those who want a simple card system for non-playing card style game where some cards could be power-ups, resource gains, weapons etc.