Help me understand how to get Lune's Unlimited Skill Tree script to work for VX Ace

Bear with me, as I have a lot of explaining to do. So, I have some of it working, namely the skill positions on the tree, but I can't seem to get the cursor to start on the tree selection buttons and move them without crashing the game. For the crash, I get an error that says "no implicit conversion from nil to integer" when I press the arrow keys to move. If I select enter on the starting location, it acts as if I have a skill selected, but I have no skills in that location. I want it to start being able to move between the skill trees, and then move between skills on the tree after selecting which tree you want to navigate.

Also, I don't understand what

'Left' => 4, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 1, # Skill below, 0 for none
'Up' => 1, # Skill above, 0 for none

means in relation to the script. I looked at the default version in a demo and tried to figure it out, but changing the numbers has no effect on the crashing. I think it might be talking about where other skills are in relation to the current selected skill on the tree, but the demo has numbers that make no sense with regards to where skills are located at in that tree.

For the skill, "Fire" it is the skill located on the top left of the tree. There are no skills to the left of it, three skills to the right, and 2 below it. But in the script, it shows

'Left' => 0, # Skill to the left, 0 for none
'Right' => 4, # Skill to the right, 0 for none
'Down' => 2, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none

for the numbers. I can't see how there are 8 skills to the left of the "Fire" skill, as there are clearly none. I might be interpreting this wrong, but the rest of the script doesn't give any further insights and neither does the forum post that the script was shown in.

The script in question: https://forums.rpgmakerweb.com/index.php?threads/lune-unlimited-skill-tree.25423/
'Scripts' is where people who have written completed scripts that they want to share with others can post them.

Moved to: RGSSx Script Support
Looking at the script, the numbers are pointing to the skill that is in that position.

For Fire
Code:
'Left' => 0, # Skill to the left, 0 for none
'Right' => 4, # Skill to the right, 0 for none
'Down' => 2, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
There is no skill above hence 0
Wind is to the right (skill #4)
Blaze is below (skill #2)
There is no skill to the left hence 0.
It's certainly not a very detailed setting explanation...

In the script settings, you see these lines:
Code:
Actor[8][6] = {
That's just an example.
The number 8 is the database ID of the actor. The settings will adjust the skill tree for that actor.
The number 6 is the ID or index of the skill on the skill tree. I underlined that part because that is important, they are NOT the database ID of the skills. These are the numbers you will use in those 'Left'/'Right'/'Up'/'Down' setting options.

For example, if you have a skill setting using the Actor[8][2] and Actor[8][3] setting "names", you can use the numbers 2 and 3 in those direction settings in any setting group made for Actor 8.
If you have 'Right' => 3, for the Actor[8][2] setting group, and 'Left' => 2, setup for the Actor[8][3] setting group, than if the cursor is on the first one of these (which got 2 for it's skill setting index), and if the player presses the RIGHT arrow key, the cursor will move to the second skill on the tree (which got 3 for it's skill setting index).
Now, if the player would press the RIGHT arrow key, nothing would happen, since we only set the 'Left' setting for this skill (well, assume now that we only did that and left the rest on 0 😛), and that will move back to the previous skill on the tree.

These direction settings are actually NOT connected in any way to the real positions of the skill icons on your skill tree. They will only setup the cursor movement on the skill tree, the position settings are setup with other setting options.

No idea if this made sense to you, but I hope it did. 😀
It's certainly not a very detailed setting explanation...

In the script settings, you see these lines:
Code:
Actor[8][6] = {
That's just an example.
The number 8 is the database ID of the actor. The settings will adjust the skill tree for that actor.
The number 6 is the ID or index of the skill on the skill tree. I underlined that part because that is important, they are NOT the database ID of the skills. These are the numbers you will use in those 'Left'/'Right'/'Up'/'Down' setting options.

For example, if you have a skill setting using the Actor[8][2] and Actor[8][3] setting "names", you can use the numbers 2 and 3 in those direction settings in any setting group made for Actor 8.
If you have 'Right' => 3, for the Actor[8][2] setting group, and 'Left' => 2, setup for the Actor[8][3] setting group, than if the cursor is on the first one of these (which got 2 for it's skill setting index), and if the player presses the RIGHT arrow key, the cursor will move to the second skill on the tree (which got 3 for it's skill setting index).
Now, if the player would press the RIGHT arrow key, nothing would happen, since we only set the 'Left' setting for this skill (well, assume now that we only did that and left the rest on 0 😛), and that will move back to the previous skill on the tree.

These direction settings are actually NOT connected in any way to the real positions of the skill icons on your skill tree. They will only setup the cursor movement on the skill tree, the position settings are setup with other setting options.

No idea if this made sense to you, but I hope it did. 😀
I think this makes sense. I changed the numbers to what they should be for my tree, but the game still crashes when I press the arrow keys. Here is my unfinished skill tree (layout is subject to change):
dtzPdC2.png

I should be able to switch between the two spell categories, and then select one and it goes the the first skill on the top left. Instead, it thinks that the cursor is already on the first skill on the top left. If I try to move to a different skill, the game crashes and gives me the same "no implicit conversion from nil to integer" error as before. The skills are numbered 1 to 15, starting from the top left and going down the column (1-5 in the left column, 6-10 in the middle column, etc). For skill 1, I have

'Left' => 0, # Skill to the left, 0 for none
'Right' => 6, # Skill to the right, 0 for none
'Down' => 2, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none

Skill 2:
'Left' => 0, # Skill to the left, 0 for none
'Right' => 7, # Skill to the right, 0 for none
'Down' => 3, # Skill below, 0 for none
'Up' => 1, # Skill above, 0 for none

And so on.
Also, when the crash happens, it references this section of code as to where the error happened, specifically line 786, which is first draw text line.
Code:
  def refresh(actor_id, skill)
    contents.clear
    contents.font.size = Font_Help
    contents.font.name = Font_Name unless Font_Name.empty?
    draw_text(0, 0, self.width, line_height, Actor[actor_id][skill]['Desc1'], 0)
    draw_text(0, line_height, self.width, line_height, Actor[actor_id][skill]['Desc2'], 0)
    draw_text(0, line_height*2, self.width, line_height, Actor[actor_id][skill]['Desc3'], 0)
    reset_font_settings
  end
end

EDIT: I think I know why it was crashing. After experimenting with the script, I HAVE to have a second skill tree made as well. If there is not a second skill tree yet, it messes with the script's functionality.
After playing with the script for a bit, I also found that the demo is not setup correctly.
In the section for each skill labeled
'Req_skills' => [51]
The skill entered in this is the skill number in the database, not the script.
The demo has the second tree not setup correctly.
EDIT: I think I know why it was crashing. After experimenting with the script, I HAVE to have a second skill tree made as well. If there is not a second skill tree yet, it messes with the script's functionality.

Are you getting any more crashes?
After playing with the script for a bit, I also found that the demo is not setup correctly.
In the section for each skill labeled
'Req_skills' => [51]
The skill entered in this is the skill number in the database, not the script.
The demo has the second tree not setup correctly.


Are you getting any more crashes?
So it uses the script skill number and not the skill database ID number?

It always crashes if there aren't any skills set for use in at least one other skill tree. I don't know why and can't really look in the script details, because I don't know how to interpret ruby. If I change the skill tree section for just one skill, from 'Tree' => 1, to 'Tree' => 2, there doesn't seem to be any crashing and I can navigate the skill tree normally. I wish I knew how to not have a second tree in there at the start, for testing purposes.
As explained by Sixth the directions...
left
right
are using the script skill numbers

But I found that the req_skills entry in the skill is the skill in the database.

To remove the second tree just remove the listing for it.
Code:
Actor[8][0] = {
# Images of the skill trees, put as many as wanted
# if you do not wish to have images, put '' on the name place
'Tree_Images' => ['fundo save', 'fundo save2'],
# Position of the cursors that change between the trees.
'Tree_Shift' => [[400, 50], [400, 80]],
}
Removing , 'fundo save2'
and , [400, 80]
should remove the second tree.

Inversely you can add a third by adding onto this.

More details
Spoiler: Script code
Code:
  #=========================================================================
  # Actor 8 => Skill 12 -> Attack Up                                 
  #=========================================================================
Actor[8][12] = {
'Skill_id' => 41, # Skill ID in the Database
'Maxlevel' => 7, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 20, # Necessary level to add points on the skill
'Level_Add' => 5, # Level Restriction for every point on the skill
'Tree' => 2, # The tree that this skill is on
'Left' => 10, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 13, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 300, # Icon Position in X
'Y' => 100, # Icon Position in Y
'Image' => 'Attack_Up', # Icon Image, for default icons put ''
'Req_skills' => [26, 28], # Needed skills to open this skill, any quantity
'Req_levels' => [10, 3], # Same as above, but with the levels of each skill
'Desc1' => 'Attack Up', # Description 1
'Desc2' => 'Requirements: Level 20 + 5x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 8 => Skill 13 -> Magic UP                                   
  #=========================================================================
Actor[8][13] = {
'Skill_id' => 120, # Skill ID in the Database
'Maxlevel' => 5, # Skill Maximum Level
'Multiply' => 40, # Effect Multiplier in %, 100 = 100%
'Level' => 25, # Necessary level to add points on the skill
'Level_Add' => 7, # Level Restriction for every point on the skill
'Tree' => 2, # The tree that this skill is on
'Left' => 11, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 0, # Skill below, 0 for none
'Up' => 12, # Skill above, 0 for none
'X' => 300, # Icon Position in X
'Y' => 240, # Icon Position in Y
'Image' => 'MagicUP', # Icon Image, for default icons put ''
'Req_skills' => [41], # Needed skills to open this skill, any quantity
'Req_levels' => [4], # Same as above, but with the levels of each skill
'Desc1' => 'Magic Up', # Description 1
'Desc2' => 'Requirements: Level 25 + 7x Skill Level', # Description 2
'Desc3' => '', # Description 3
}
Here you can see that listed skill in the script is #12 and #13.
#13 says that #12 is UP from it. from the demo that is.
and Req_skills is 41 like what #12 says it's skill_id is in the database.
That makes sense, but now I have a new problem. Putting skill points into any skill that requires a previous skill to have points in it crashes the game and gives me this error message "Argument Error occurred. Comparison of Fixnum with nil failed."

Here is an example: In this instance, Protection Against Magic requires at least a point in Blur Self. Blur Self has no requirements.
Code:
 #=========================================================================
  # Actor 1 => Skill 11 -> Blur Self                                
  #=========================================================================
Actor[1][11] = {
'Skill_id' => 95, # Skill ID in the Database
'Maxlevel' => 3, # Skill Maximum Level
'Multiply' => 60, # Effect Multiplier in %, 100 = 100%
'Level' => 1, # Necessary level to add points on the skill
'Level_Add' => 1, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 6, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 12, # Skill below, 0 for none
'Up' => 0, # Skill above, 0 for none
'X' => 545, # Icon Position in X
'Y' => 6, # Icon Position in Y
'Image' => '', # Icon Image, for default icons put ''
'Req_skills' => [], # Needed skills to open this skill, any quantity
'Req_levels' => [], # Same as above, but with the levels of each skill
'Desc1' => 'Blur Self', # Description 1
'Desc2' => 'Requires Level 1 + 1 per additional Level', # Description 2
'Desc3' => '', # Description 3
}
  #=========================================================================
  # Actor 1 => Skill 12 -> Protection Against Magic                              
  #=========================================================================
Actor[1][12] = {
'Skill_id' => 97, # Skill ID in the Database
'Maxlevel' => 3, # Skill Maximum Level
'Multiply' => 30, # Effect Multiplier in %, 100 = 100%
'Level' => 3, # Necessary level to add points on the skill
'Level_Add' => 1, # Level Restriction for every point on the skill
'Tree' => 1, # The tree that this skill is on
'Left' => 7, # Skill to the left, 0 for none
'Right' => 0, # Skill to the right, 0 for none
'Down' => 13, # Skill below, 0 for none
'Up' => 11, # Skill above, 0 for none
'X' => 545, # Icon Position in X
'Y' => 103, # Icon Position in Y
'Image' => '', # Icon Image, for default icons put ''
'Req_skills' => [95], # Needed skills to open this skill, any quantity
'Req_levels' => [], # Same as above, but with the levels of each skill
'Desc1' => 'Protection Against Magic', # Description 1
'Desc2' => 'Requires Level 3 + 1 per additional Level', # Description 2
'Desc3' => '', # Description 3
}
You forgot to setup the level requirement of the required skill.
Setup that in the 'Req_levels' option.
Each skill you setup in the 'Req_skills' option must have a level setup in the 'Req_levels' option.
You forgot to setup the level requirement of the required skill.
Setup that in the 'Req_levels' option.
Each skill you setup in the 'Req_skills' option must have a level setup in the 'Req_levels' option.
Thank you! Now it works. I don't know how I missed that.

Original thread: https://forums.rpgmakerweb.com/threads/help-me-understand-how-to-get-lunes-unlimited-skill-tree-script-to-work-for-vx-ace.95475/