My common event doesn't do what suppose to do

palom

Villager
Member
Joined
Aug 23, 2017
Messages
5
Reaction score
0
First Language
spanish
Primarily Uses
RMVXA
Hi, I'm trying to implement a "day/night" system so I checked how to do it, however I don't want it to trigger while I'm doing anything or talking with a NPC so I wanted to use the "steps" game data so everytime the character walks a new minute is added to the proper variable.

Well, this is the issue. I made a common event for this and when I was testing the event sadly it still worked as the basic Night/day system (I'm talking with a npc saying to me the actual time without moving and everytime I talk with him it's a different time). The weird thing is that if I apply that script to a map's event via parallel process the script works and the variable change just when I walk.

I'm using the spanish program so I'll add some green comments to the picture.
 

Attachments

  • COMMONEVENT.png
    COMMONEVENT.png
    106.4 KB · Views: 7

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,819
Reaction score
14,979
First Language
English
Primarily Uses
RMMV
If the variable is changing without you doing anything, then chances are you have a plugin that uses that variable by default, and you have not modified its parameters to use a different one (or have not named variables/switches used by plugins to ensure you don't use them for something else).
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,300
Reaction score
8,367
First Language
German
Primarily Uses
RMMV
I specifically note that you haven't named the switch that controls the common event either.
While technically a name is not needed, it is a very bad idea to use unnamed switches and variables.

Because the name is also the indicator that you have already used the switch/variable, and without a name you will never remember where and if you might have used that switch or variable already.

add to that the fact that a plugin using a variable will never name it automatically but that you have to do that manually when deciding how to configure the plugin, leaving out names becomes really bad.


Additionally, six frames wait might be a bit high depending on how you set speed for the player.
you only compare if the number of steps is different - if the speed is high enough and some other event commands cause lag, the player might be able to do two steps between the checks of the time event.
and it only counts steps - which means that if the player is idling time does not pass. This might be what you want, but I want to point it out in case you didn't want that - most time systems count waits instead.
 

palom

Villager
Member
Joined
Aug 23, 2017
Messages
5
Reaction score
0
First Language
spanish
Primarily Uses
RMVXA
The problem with a plugin using the variable is that if I use the same script as a regular map event (Adding the event to the map as a parallel process) that event work as it intended, so I'm not sure if that's the case. However if I trigger the common event (of course without the map event) the variable keep changing. So I can still do what i want but I'll need to add a copy of the parallel process in each map instead to just use the common event.


@Andar
About the name and frames.
I'll add a proper name to the variable later, I'm just still testing mechanics on debug maps for now. 3 frames would be enough then?
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,300
Reaction score
8,367
First Language
German
Primarily Uses
RMMV
However if I trigger the common event (of course without the map event) the variable keep changing.
that is exactly why we pointed out that you have to check all your plugins to see if one of them uses the same variable as your system.

Because variables NEVER change on their own.
They only change if they are commanded to be changed.
and if you didn't do that with this event, then either a different event does this or a plugin does this.

Both cases should be possible to be avoided by exact naming, because if you use a variable elsewhere and it is already named it will tell you to use a different variable.
but that only works if the naming is uphold from the beginning - since you already missed out on that, you now have to check every event on every map and every plugin to find where else you're using the same variable.
 

palom

Villager
Member
Joined
Aug 23, 2017
Messages
5
Reaction score
0
First Language
spanish
Primarily Uses
RMVXA
I found the bug (kinda), I tested turning off all the plugins but the "community_basic" one and the thing was still happening, i was thinking the only thing different between the map event and the common event was the switch.

The switch was on the 19º place, I changed it to the 2º slot and the timer variable is working as intended now. I'm not sure if that was really causing the conflict but it was solved somehow (although I still don't get why that switch was causing that...), I named the 15-20 switches as "no use" in order to avoid that problem.

All was tested on an empty map, what made the thing weirder.
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

PSA: please stop putting the word 'Eternal' in your game titles.
RMMZ: "Simple enough for a child!"
also RMMZ: "What, you're trying to make an RPG and you didn't know about Euler angles?"
I kinda spent the day having my own little gamejam and came up with this Catastrophe!

GZOq45s.png
Have Defeated Enemy Join Party as Actor, Show Passage Status, & MZ-Chan Art | RPG Maker News #107

My outfit at Metrocon. It was fun.

Forum statistics

Threads
113,625
Messages
1,076,286
Members
147,638
Latest member
Zachimera
Top