Picking skills available

For my game, I want to have more spells available the more are bought. There are six different types of spells: fire,light,ground,ice,dark and sky. The way I want it to work is this: You start off with one type of your choice at the beginning of the game, and the first spell of that type. From there, you may buy the second spell of that type. Once you have bought that, you can buy either the third spell of that type, or the first spell from your main’s neighbours. Buying a neighbour gives you acces to that branch’s second spell, and buying that spell gives you access to the first spell of your neighbour’s neighbour. For example, fire is neighbours with sky and light. If I buy fire 2, I will be able to buy sky1 and/or light1. Having sky one, I can buy sky 2, and having sky 2 I can buy it’s neighbour, dark1.

If that hasn’t completely confused you, here’s my question: What would be the best way to program a system like this? Short of hard coding every possible solution, I tried using a 2 dimentional array to track whether or not I have an ability, and then used a nested loop to move through it, but it didn’t work (and it caused unforseen glitches unfortunately).

I’v only had a chance to read about part of what you wrote, but I get the general idea of what you want. Let me just check to make sure though, you want a skill tree right? Choose a skill which unlocks another skill within that tree.
I am working on a file right now to show you how and I will post it in a bit with an explanation on how everything is done. Supposed to be doing my work though, i’m in class. :hugegrin:

It’s ok, i think I furged out a solution :). I just re worked how I did my arrays.