I'm trying to convert an Ace script to MV, and have run into something I can't get my head around.
There's a method like this in the Game_Player class. The variable is not exposed (no attr_reader or attr_accessor) so the only way to access it is via the method, which I understood made it read-only:
Later there's a scene that appears to be modifying this data, but I don't see how it can, because it's accessing the method, not the underlying array:
What's going on with this line?
If @spare_members is not exposed, and spare_members is the method, not the array, how can this scene add stuff to the array? It's not storing the result in a variable for its own use.
Is it actually doing anything? It seems that something IS going on, because at some point a party member who is not in @spare_members does appear to be getting added to the array.
There's a method like this in the Game_Player class. The variable is not exposed (no attr_reader or attr_accessor) so the only way to access it is via the method, which I understood made it read-only:
Code:
class Game_Player < Game_Character
def spare_members
@spare_members = [] unless @spare_members
# do some stuff here to manipulate the contents
@spare_members
end
end
Code:
class Scene_PartySelection < Scene_Base
def start
$game_party.members.each{|m|
$game_player.spare_members << m unless
$game_player.spare_members.include?(m)
}
super
# other stuff here
end
end
What's going on with this line?
Code:
$game_player.spare_members << m
Is it actually doing anything? It seems that something IS going on, because at some point a party member who is not in @spare_members does appear to be getting added to the array.

