Oh, Variable 5! (Moby's Text SE & Yanfly's Victory Aftermath!)

So I made the changes (I think), and tried this...

Spoiler
class Game_Actor < Game_Battler  attr_accessor :game_variables[5]

  

  alias zale_actor_init_587vgnmdi3 initialize

  def initialize(name)

    case actor.name

      when 'Eric'

        $game_variables[5] = 2

      when 'Ryoma'

        $game_variables[5] = 3

      when 'Ernest'

        $game_variables[5] = 2

      when 'Terence'

        $game_variables[5] = 2

      when 'Isabelle'

        $game_variables[5] = 4

      when 'Alice'

        $game_variables[5] = 4

      when 'Noah'

        $game_variables[5] = 3

      else

        $game_variables[5] = 7

    end

    zale_actor_init_587vgnmdi3(name)

  end

end
Now it will boot to title, but will crash as soon as "New" is selected.  It gives me the message...
"Script ‘Game_Actor’ line 52: TypeError occurred. No implicit conversion from nil to integer."

​When I open the scripts after that, it takes me to Line 52 of the Game_Actor script, the one under the Game Objects section.

Got to admit, I don't have an inkling as to the 'why' this time...
there are a few things that could cause those errors, mainly if something happens during initialisation.

I can think of another approach to solve the issue, but it's late here and I have a full day tomorrow.

I'll try to post a solution script tomorrow evening.

If someone else has more time before I can post it: I'm thinking of moving the fix to Yanfly's side and alias the set_victory_text function to include the case sequence there.
Take your time, man. You guys have done way more than I was expecting when I posted this. 

Also, I'm going to start testing these scripts in a new project with *only* the related scripts installed...in the off, off chance one of my other installed scripts is causing a would-be solution to fail...

Original thread: https://forums.rpgmakerweb.com/threads/oh-variable-5-mobys-text-se-yanflys-victory-aftermath.15427/