Main Menu
  • Welcome to The RPG Maker Resource Kit.

Unknown Stack Error [VX]

Started by pacdiggity, May 10, 2011, 11:56:04 AM

0 Members and 1 Guest are viewing this topic.

pacdiggity

Urr... the PAC version, at least, of my Equipment Set's script causes a stack error when either a new game or continue scene is called after pressing F12, but not after the To Title command in the Game End section of the menu is used. The error is:
QuoteScript 'PAC Equipment Sets' line 264: SystemStackError occurred.

stack level too deep.
So, of course, we open up the editor to see why this is happening. The code around there is:

class Game_Actor < Game_Battler
#A whole bunch of other stuff...
  alias pacman_eq_bonus_maxhp maxhp
#Some more stuff...
  def maxhp
    default_val = pacman_eq_bonus_maxhp #LINE 264
    final_val = default_val
    n = 100
    if @bonus_set
    if !@bonus_set.empty?
      for j in 0...@bonus_set.size
      for i in 0...@bonus_set_pieces[j]
        if Set_Bonus[@bonus_set[j]][i] != nil
          if Set_Bonus[@bonus_set[j]][i][0] == 5
            n += Set_Bonus[@bonus_set[j]][i][1]
          end
        end
      end
    end
      final_val *= n
      final_val /= 100
    else
      final_val = default_val
    end
    end
    return final_val
  end
#More stuff...
end
Now, the stuff around that method is very, VERY similar to that method, e.g. the agi method is:
  def agi
    default_val = pacman_eq_bonus_agi
    final_val = default_val
    n = 100
    if !@bonus_set.empty?
      for j in 0...@bonus_set.size
      for i in 0...@bonus_set_pieces[j]
        if Set_Bonus[@bonus_set[j]][i] != nil
          if Set_Bonus[@bonus_set[j]][i][0] == 4
            n +=Set_Bonus[@bonus_set[j]][i][1]
          end
        end
      end
    end
    final_val *= n
      final_val /= 100
    else
      final_val = default_val
    end
    return final_val
  end

So I really have no idea what's causing the stack error in the maxhp method if the agi method is perfectly fine and error free. If nobody knows what's going on, is there a way to escape a stack error?
it's like a metaphor or something i don't know

modern algebra

#1
Maybe it's not error free. Maybe the maxhp method just crashes it first, but if it weren't there, the agi method would.

Anyway, for now you can just replace this:


  alias pacman_eq_bonus_atk atk
  alias pacman_eq_bonus_def def
  alias pacman_eq_bonus_spi spi
  alias pacman_eq_bonus_agi agi
  alias pacman_eq_bonus_maxhp maxhp
  alias pacman_eq_bonus_maxmp maxmp
  alias pacman_eq_bonus_cri cri
  alias pacman_eq_bonus_eva eva


with this:



  unless self.method_defined? (:pacman_eq_bonus_maxhp)
    alias pacman_eq_bonus_atk atk
    alias pacman_eq_bonus_def def
    alias pacman_eq_bonus_spi spi
    alias pacman_eq_bonus_agi agi
    alias pacman_eq_bonus_maxhp maxhp
    alias pacman_eq_bonus_maxmp maxmp
  end
  alias pacman_eq_bonus_cri cri
  alias pacman_eq_bonus_eva eva



Oh, and also, you might want to look into your PAC Skills. At line 435, you have return_scene but there is no such method in Scene_Battle. That will cause a NoMethodError. You probably meant for it to be end_skill_selection

pacdiggity

Thanks once again MA. It works fine now.
As for the skills script, it's quite heavily based off of Cozziekun's script, and admittedly I didn't look through the code that thoroughly. Thanks for picking up on that.
I still have no idea what caused the stack though.
it's like a metaphor or something i don't know