#Skill tree help

1 messages · Page 1 of 1 (latest)

forest hornet
#

so i have skills

Skills ={
            ["SkillPoint"] = 0;
                SkillCash =
            {
            SkillPoints = 1,
            Prereqs = {},
            Unlocked = false,
            },
            SkillCash2 =
            {
            SkillPoints = 3,
            Prereqs = { "SkillCash" },
            Unlocked = false,
            },
}

i need help with Prereqs, i tried do code by myself but i cant understand this part
i have function prereqsMeet that tried to check does prereqs upgraded
So it should do like that, trying to upgrade SkillCash2, prereqs = SkillCash, SkillCash["Unlocked" = true]
But idk how to do that

function prereqsMeet(player, Skill)
    local prereqs = Skill["Prereqs"]
    print(prereqs)
    for _, name in prereqs do
        if not table.find(Skill, Skill["Unlocked" == true]) then
            print("False")
            return false
        end
    end
    print("True")
    return true
end

there is my try, when there is no prereqs its working, but if it have 1 or more table.find(Skill, Skill["Unlocked" == true]) always be nil
(sorry for much text)

pearl holly
#

Yoo the issue is table.find(Skill, Skill["Unlocked"] == true) — that part is messed up 😅 you're basically asking it to find true inside the Skill table. try checking like this instead:

#

not Skill[name] or not Skill[name].Unlocked then
print("False")
return false
end

#

that should work better if Skill[name] is a table with an Unlocked bool 👍

#

Hope that helps.bruv rizz

forest hornet
#

im just use
if Skills[name].Unlocked == true then
print("True")
return true
end
and its worked

#

but if i do more then one prereqs it wont work i think