Troubles with the Yanfly Skill Shop Script

Okay, so to preface: I've been messing around with the script for my game a lot. Mostly I've just been adjusting the UI. Other than major design changes and window placement, the biggest modification that I can really think of that I've made to the primary script is that I made it so that only actors in the Battle Party can be accessed through the menu (reserve party members are accessed through the Ace Party System). I did this by changing every instance of "$game_party.members" to "$game_party.battle_members" in the script

So, I'm trying to implement the Yanfly Skill Shop. I've had to make a few changes to it, here and there, mostly to compensate for the changes I had already made to the UI. I also changed it so that it uses a variable instead of gold for payment, which I'm pretty sure is working.

The problem I'm getting is that when I select a skill to purchase I get an error message when it should be going to the part where I choose who gets the skill. The exact error message I get reads:

"Script 'Skill Shop' line 532: NoMethodError occurred.

undefined method '[]' for nil:NilClass"

And this is where line 532 is located

#-------------------------------------------------------------------------- # enable? #--------------------------------------------------------------------------def enable?(index)skill_id = @data[index] #line 532skill = $data_skills[skill_id]return $game_variables[43] >= skill.buyskill_AP_costendNow, I don't think I'm having this problem because I changed the gold cost to a variable cost. If the variable is at 0 or below the skills are unselectable, and if the variable is at the right cost, the skill is selectable for purchase. So I think it has something else to do with a different change I made to the main script. Can anybody help me out?
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


It would help if you included a link to the script, or if you've made extensive mods, paste your version into pastebin and give us a link.


It's saying @data is not defined.


What I'd do in this situation is find out where @data is initialized (maybe to [] or where elements are added to it) and see what calls that/those methods. Then see what calls the enable? method. Any chance enable? is being called first?


Any chance you've modified other scripts so that the enable? method here is being aliased, and called prior to whatever is setting up @data?


Without the full script, it's really just guesswork.


Something that might help is putting some console output as the first command in each of those methods, then running the game with the console turned on. That will tell you exactly which method in which class is being run, so you can see the order.
Okay, yeah, sorry. Here's the original yanfly script, and here's the version of it I've been modifying.

Honestly, though, I'm not entirely sure I see where the problem is coming from. I don't recall messing with the data manager or doing anything that might interfere with the data index.
Well, I... sort of fixed it. I just ripped out the part of the code that was giving me trouble. So it doesn't quite work like it should, yet, but at least it's not crashing and it is functional. This can go ahead and be marked as solved.

Original thread: https://forums.rpgmakerweb.com/threads/troubles-with-the-yanfly-skill-shop-script.39882/