#Requirements for inclusions in a dictionary

1 messages · Page 1 of 1 (latest)

boreal hawk
#

I have a dictionary from a module script and called in a card system, and I want to add cards that will only show up if previous cards have been selected (ex. Attack 2 will only show up in the deck if you've gotten Attack 1)

twilit oxide
#

just check if player already has attack 1?

ionic gulch
# boreal hawk I have a dictionary from a module script and called in a card system, and I want...

Just like Life said, Check if your example Attack1 Is already chosen by the player via a table, or instance values.

Lets say

Card1 Got chosen, later on when choosing

First:
Just like i said in your previous post, you roll and check cards, within that you put it inside a new table or an instance value inside the player with the CardName on it.

Second:
Check if Card1 Exists already within the table or within the children of where its put at.

Third:
If failed, then re-roll again ^^

#

Actually

#

Change my mind, maybe this answer is a bit better irlcry

Track selected cards in a table. When generating the deck, only include cards whose prerequisites already exist in that table (e.g. only include Attack2 if Attack1 is present). Then pick randomly from that filtered list instead of re-rolling.

boreal hawk
boreal hawk
#

ill check my project rq and check if I can

#

ok I've found one way, right now I'm thinking to do smth like "for i,v in chosen do: [find every variable that has this name as a prerequisite] table.insert(cardPool, foundCard)"

#

would that make sense?

wispy sluice
#

just make a table that tracks the card that's there

#

like if u pick attack 1, just table.insert(urtable, "atk1") or something

#

so if u do if table.find(urtable, "atk1") then do atk2

#

btw always use table.find if u want to search super fast

#

don't manually find it with luau

#

so ur code isn't messy and it's faster jssayings

boreal hawk
#

didnt know dictionaries only worked on strings and tables with numbers, had to make a separate array table to work around what I needed to

wispy sluice
#

dictionary can work for any type

#

it's not an array

boreal hawk
#

idk man it wasnt working for me