correct way to call a common event

ArronYagger

Villager
Member
Joined
Jan 9, 2016
Messages
23
Reaction score
1
First Language
English
Currently I have it so that when something happens say a switch is turned on or something like that I call a common event:


$gameTemp.reserveCommonEvent(eventId);




But if I try and do that again it wont get called again. I have to then try a third time to call it and then it gets called. So: 


first time: $gameTemp.reserveCommonEvent(eventId); - common event is called.
second time: $gameTemp.reserveCommonEvent(eventId); - common event is not called
third time: $gameTemp.reserveCommonEvent(eventId); - common event is called.


Is this not the correct way to call common events on the fly?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,430
Reaction score
7,711
First Language
German
Primarily Uses
RMMV
You better go back three steps, because I think you overcomplicate matters.


Why do you even want to call a common event by script? why not have it react directly to the switch, without using any scripting?


Accessing the game loop from script is not easy, and you'll need that if you want to program it to include something (that is why the function is named "RESERVEcommonevent" instead of calling it).


It is a lot easier to use the already existing functions of events to place something in the gameloop or have them react to something from it.


For example, if you want a common event to be processed on a switch, then make that common event a parallel process conditioned to that switch. If you want it to react only once, either disable the switch with the last command or use two switches (one for the event and one for whatever other info that needs to be stored).


If that isn't what you want, then please tell us exactly what you want to do instead of how you want it to do, and we tell you how to handle it correctly without going into complications like you try above.
 

ArronYagger

Villager
Member
Joined
Jan 9, 2016
Messages
23
Reaction score
1
First Language
English
While this helps it doesn't answer my main question: How do you call a common event via script, I assume this was the right way to do it.


All I need to know is "Use this code to call a common event" if its not that simple then I guess I can elaborate more on what I want to do. 
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,430
Reaction score
7,711
First Language
German
Primarily Uses
RMMV
It doesn't answer your question, because for most cases your question is wrong. That is what I'm trying to tell you - for most effects you should NOT call a common event from a script, and I wanted to know why you even try that to see if you don't better go a different way to achieve what you want.
 

ArronYagger

Villager
Member
Joined
Jan 9, 2016
Messages
23
Reaction score
1
First Language
English
I think ill keep looking since you didnt answer my question. Thanks though.


So this is the correct way, I was doing something weird in my event with switches. Once I removed the stupidity it works the way I need it too.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,848
First Language
English
That is the correct way to call a common event.


Common events do not run immediately when you reserve it.


The game by default only keeps one common event in reserve. If you reserve several common events, each request would simply overwrite the previous.


I wrote the common event queue to address this overwriting problem so that if you queued up 3 events, all 3 of them would be executed eventually.
 

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

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,454
Members
137,821
Latest member
Capterson
Top