Home > RGSS Script Reference > Game_Actors
Game_Actors
Inherits from: None
Description: This class exists merely to simplify queries to data from $game_actors
class Game_Actors
# ------------------------------------
def initialize
@data = []
end
# ------------------------------------
def [](actor_id)
if actor_id > 999 or $data_actors[actor_id] == nil
return nil
end
if @data[actor_id] == nil
@data[actor_id] = Game_Actor.new(actor_id)
end
return @data[actor_id]
end
end
|
Data: An array of Game_Actor objects.
Initalize
Arguments: None
Local Variables: None
How it Works: Sets the value of @data to an empy array.
[]
Arguments:
Actor_ID: The ID of the actor to check.
Local Variables: None
How it Works: An overload of the [] operator. This method first checks to see if the Actor_ID exists in the dataset entered into the editor. If it does, it then checks to see if a Game_Actor object exists for that actor. If it doesn't, it creates one and returns that object to the caller. If it does, the existing object is returned to the caller.
|
|