Could a variable used in multiple events be added up automatically (without triggering all the events)?

Or do I need a manual count...?
Answering you question as it is stated: yes.
Event 1: set variable 1 as 1
Event 2: set variable 1 add 1
Variable 1 now equals 2.
(Without triggering events).. im unsure as to what you mean, but in order for the variable to be set or changed, an event must run the function.

If this isn't enough explanation, please provide more detail as to what you wish to accomplish(including any applicable screenshots).
I got a var that increases 1 every so often... at some point I'm going to have an event that checks if all those 1s reach some number, but I need to know if I need to count them myself beforehand or if I can just do some quick sum, but I can't go through the entire game and trigger all the events to do that, of course... it would be easier to just keep a manual count if that was the alternative.
If all of your events have multiple pages conditioned by the variable increasing, then increasing the variable will impact ALL of the events.

Once again, you are providing way too little information for people to really help you.

What does the variable represent? Why are you counting them yourself beforehand? Give more information - context.
No events other than one in the future will check for this var, so it increasing will have no impact for most of the game... context explained in the previous post.
You haven't explained why you think you have to do a manual count at any time or a quick sum prior to that one event that checks how high it is.

If the events all +1 to the variable, you should be able to do a conditional branch at any time to see what the variable is.

If you only have one event that uses that variable as a condition (either in the page conditions or a conditional branch) then +1 to the variable at any earlier point in the game will have no effect at all.
Where in a conditional branch? (I hope this doesn't depend on triggering them and showing the result in a text message...) I want this count to be able to trigger that later event... it's easy to know if a var should be 3 for another event to happen, but not quite if it ends up being 137...
Explain what is happening in the game - from the player's viewpoint. Why are they interacting with all these events? Are they collecting something? Doing something? What is the event that needs to check what is in this variable?

Until you actually explain WHAT you are trying to accomplish, we are only guessing, which means you could end up with a very wrong answer. Once again - nobody is going to steal your ideas. No need to be so secretive about it. All of your threads seem to go on way longer than they need to because nobody can quite understand what you are trying to achieve. If you just say "the player has to ... in order to ..." then we'll know exactly what you need and you'll get a very quick solution.

I will be shutting my computer off in another 10 minutes or so, so can't spend time going back and forth repeatedly asking for more information.
Not sure how that would help, but it's to do a treasure chest count, at any rate. Nothing to do with 'ideas', I simply thought leaving it abstract would still work, as whether it's a chest or a door count doesn't matter to the engine...
So you will have treasure chests scattered throughout the game, and at some point there is an event (NPC, doorway, etc) that will only let you progress if you have opened at least 3 of them?

In that case, on your event (NPC, doorway, etc) you can do one of two things:

1. have one event page that has no conditions and is what will happen if you interact with the event but haven't opened 3 chests, and another higher-numbered event page that has a page condition (above the sprite box) that says Variable >= 3, with the commands that will be run if you have opened 3 chests. If there are no commands - you just don't want that thing to be there anymore, leave the second page with no sprite and Below Characters as the priority. The player won't have to interact with it at all.

2. have one event page that has no conditions, and in the event commands do a Conditional Branch for Variable >= 3. You can check the Else box. Then you will be able to make the event do one thing if the player hasn't yet interacted with 3 chests, and another thing if they have. If they have, you might then turn on a self switch that activates the next page, which may have a sprite and commands (this is what will happen if you interact with this event again after first "unlocking" it), or it may be blank and Below Characters.

The first method will be automatic, the second method will require you to interact with the "blocking" event before it lets you through. See how providing more information about this event as well, would let me tell you exactly which of the above methods to use? Since you haven't, I have to either assume you mean one or the other and just give you that method, which may not end up being what you want, or I have to go to all the trouble of telling you ALL the methods I can think of.


If you use >= 3 (which you have to choose in the Conditional Branch command, but is the default/only option for the page condition) will cause those commands to happen if your variable is 3 or any higher number.
if im understanding this right you are planning to use this variable as either:
a conditional trigger (if variable >= X do ...)
or just a % of completion tracker (variable / X = % of treasure found)

but the problem is that you have no clue what to set X as because you havent been keeping track how many events raise this variable +1. correct? (should always keep track of these things)
so now you hoping for a script call or something that can tell you how many times this variable was referenced through the entire game, because you dont want to do a 100% playthrough of the game so far just to see this number?

(no clue if this call even exists (i doubt it exists in the way this scenario would be hoping for) im just trying to help shaz get the context that he needs.)
Yeah, Tiamat, that is what I mean... I only mentioned '3' earlier to indicate that a low number is easy to calculate... I actually just started this variable, so I can keep doing a manual count if there's no better alternative, but this is why I thought of asking...
Oh - is that it? You've been adding events that +1 to this variable but haven't been keeping count of them as you go, and you just want to figure out how many you have? I wish that had been made more clear from the beginning!

If you used Control Variables, you should be able to use the 'search' tool which will show you all the events that change that variable. Then just count them, excluding the one that checks how high it is, if you've already created it.

But if you've only just started using it, it would be better to keep a manual count.
Well, at least I can verify my count, but it would still have been useful if something automated existed... and I don't know how I could have explained it better, as I thought I did in multiple ways...
I thought you were talking about how to make an event check how many other events that +1 the player had interacted with. To me, it didn't come across as "I've made all these events but I didn't keep count of them and now I need to know how many I made".

The Search tool in the toolbar will show you all the events that use that variable, but I don't think it gives a total, so you'd still have to add it up.

I did something similar in a dungeon in my game, where something different happened if the player left depending on whether they'd left some enemies on one floor, killed all enemies on that floor, or killed all enemies on both floors. It was hard to track and I had to do it manually. If your events are all over the place, perhaps just keep a list in a text document of the map id/name and the event id.

I made a Cross Reference tool for Ace which I ported to MV, so you could see if that works in MZ. But I don't think it'll give anything more than the search tool would.
For a related issue that no one has tackled so far, do you happen to know about https://forums.rpgmakerweb.com/inde...earch-for-where-music-sprites-are-used.141994 ?
Please don't use one thread to ask people to view your other thread.

That one was posted a while ago, so it's totally fine for you to bump it to try and get some more attention (you can bump after 72 hours).

If you have your answer to this thread now, is it okay to close?
Links to related topics could be useful for others, though... and sure, I guess...
Thread closed

The topic you linked to is not related to this one though 😉

Original thread: https://forums.rpgmakerweb.com/threads/could-a-variable-used-in-multiple-events-be-added-up-automatically-without-triggering-all-the-events.142219/