I wanted to create a new Window for one of the existing menus, so I added this to its Scene:
Please ignore the method "increase_attribute", it's dealt with for now. The thing is I created a class called Window_IncreaseAttr, it inherits Window_Command. This is its initialize method:
I declare @actor as the parameter "actor" in the initialize method, so I can use it in other methods. However, for some reason it isn't working properly.
The Window_IncreaseAttr method above is returning "undefined method "apoints" for Nil:nilclass" error. I have the @apoints variable defined in the setup method at Game_Actor. And the value of @actor is supposed to be $game_party.menu_actor defined in the aliased start method from the Scene I'm using ( which is Scene_Status ). Any1 got a lead?
Edit: I have used attr_accessor :apoints on Game_Actor. But I don't think the issue is related to this.
Edit: As I imagined and Shaz said, it's basically that @actor doesn't reference an actor. But I don't know why.
Ruby:
alias aearpgattr_start start
def start
aearpgattr_start
@attributegui = Window_IncreaseAttr.new(@actor)
@attributegui.set_handler(:str, method(:increase_attribute))
@attributegui.set_handler(:agi, method(:increase_attribute))
@attributegui.set_handler(:con, method(:increase_attribute))
@attributegui.set_handler(:int, method(:increase_attribute))
@attributegui.set_handler(:wis, method(:increase_attribute))
@attributegui.set_handler(:dex, method(:increase_attribute))
@attributegui.set_handler(:luk, method(:increase_attribute))
end
Please ignore the method "increase_attribute", it's dealt with for now. The thing is I created a class called Window_IncreaseAttr, it inherits Window_Command. This is its initialize method:
Ruby:
def initialize(actor)
super(0, 0)
@actor = actor
refresh
activate
end
I declare @actor as the parameter "actor" in the initialize method, so I can use it in other methods. However, for some reason it isn't working properly.
Ruby:
def increaseenabled?(symbol)
return false if @actor.apoints <= 0
return true
end
The Window_IncreaseAttr method above is returning "undefined method "apoints" for Nil:nilclass" error. I have the @apoints variable defined in the setup method at Game_Actor. And the value of @actor is supposed to be $game_party.menu_actor defined in the aliased start method from the Scene I'm using ( which is Scene_Status ). Any1 got a lead?
Edit: I have used attr_accessor :apoints on Game_Actor. But I don't think the issue is related to this.
Edit: As I imagined and Shaz said, it's basically that @actor doesn't reference an actor. But I don't know why.