Custom Method

Alalia

Villager
Member
Joined
Dec 23, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
Basically my problem is I want to make a method that does something I can do normally without script calls. But it's extensive work to repeat it every single time I want to accomplish the same essential goal with a different event. The method would be creating a pop-up window once the player gets within a certain range, counting up to the number I input and then closing the window and turning on a self switch once it gets to that number. I can't seem to figure out where to put this method to allow me to call it in a script. I'm not sure what other info is needed to figure it out, so if you need more info, or if I'm just doing it completely wrong, say something. Thanks in advance!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,501
Reaction score
12,044
First Language
English
Primarily Uses
RMMV
If you can do it in a script call of an event, just put it into a common event, then call the common event from your event.  If it's the same for all of them, that'll work, right down to the self switches.
 

Alalia

Villager
Member
Joined
Dec 23, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
It wouldn't be the same for all of them. Window size would differ, time up would differ, the message would differ. The switch also differs sometimes. It would be extremely convenient if I could figure out how to get my method to work.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,776
First Language
German
Primarily Uses
RMMV
To be able to be executed, the method needs to be known to the game inteerpreter, not to the engine itself. That are different modules/classes.


You might look at other scripts for this - they often make referencing functions for the game interpreter that call the correct function in the engine itself (because the game interpreter itself also has limitations and some functions only work outside the interpreter).
 

Alalia

Villager
Member
Joined
Dec 23, 2015
Messages
18
Reaction score
1
First Language
English
Primarily Uses
I didn't really understand most of what you said ><. Is that a sign I should get someone who knows what they are doing to make it for me? >.>
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,776
First Language
German
Primarily Uses
RMMV
With modern programming, a function or method can be limited as to here it can be used - which means it is important where you place it in the program's structure.


Writing a function without declaring it to a class usually means that it can be used nowhere - that is what is happening to your method. You need to tell the engine the context where it is allowed to use and call that method from before it can be used.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Is i possible too make a weapon have a chance of using a skill?
Can the Eternal Dreamers finish off the final boss? We'll see!
Fekken kill me. I unknowingly swapped out two important events's codes and saved the game to test it. I'm just doing this for fun and the fun has now been replaced with excruciating torture.
Is this how game developers feel all the time?

EDIT:
WAIT HOLY S***
MY LAST POST ASKING FOR HELP ON AN EVENT ACTUALLY SAVED IT
OH MY GOD
Coffee + Silk Coconut Milk + Splenda Zero = Not ..... awful :/ .
I was making a cutscene where Hero's dad got killed by the dragon but when he lose its say game over and send you to the tittle screen. How can remove game over for that cutscene

Forum statistics

Threads
94,448
Messages
921,006
Members
124,268
Latest member
Harway
Top