Okay I think I know how to ask this question now.
So I load up my Custom_Class
class Custom_Class
and I'm referencing nothing, it's just my own class.
How from there would I be able to run something when the map loads?
So
class My_Class
def initialize
#initialize stuff
end
def onMapLoad
#Do stuff
end
end
or do I actually have to reference something.
Whenever I try to make a custom class initialize never runs unless on an event I make a SceneManager.call("")
You would need to find the appropriate method in Game_Map and put in a call to your class from there. It depends what your custom class is all about and what you want to do with it when the map loads. Is it a scene? Is it something you want to be created/updated by the map?
If you only give ambiguous information, you can only receive an ambiguous response.
Iam no scripter, but maybe if you somehow know the current MAP ID than you could make:
Pseudocode:
If map_id not equals $game_variables[1] (this means a map will get loaded)
do your stuff
than control $game_variables[1] = map_id (Now the code isnt executed until the map id changes and therfor a new map
is getting loaded this frame or in the next frames.
Hope this somehow helps.
The initialize function is called when an instance of the class is created.
So $game_myclass = Game_MyClass.new <-- calls function initialize once set up.
I have a feeling that what you SAY you want to happen is not really what you want to happen.
You don't run a class. You instantiate a class once, not repeatedly (so you don't want to run that every time a map loads). You run a method within a class.
What I see above is something I'd expect to see instantiated when the player is instantiated, and then updated on each frame update, none of which has anything to do with loading maps. I also find it strange that you want to create a class for this, and not just add it to the Game_Player class (if it's for the player) or the Game_Event class (if it's for NPCs).
Perhaps you should explain what you're trying to achieve, and then we can help you out better. It may be that the approach you're planning to use is entirely wrong for your requirements.