How does RMMZ calculates Variables?

Thanks @Masked but I figured out how to do that with events, I was setting it wrong. See my edited post aboce. Thank you!
I see, but you could still have extracted the common logic (decrement and break) out of the conditionals, that's my point xd

You can check my previous response for the proof that having the same thing on the positive and negative clauses of a conditional is logically equivalent to just taking it out of the condition.

Also, an adjacent question to this topic. I've been using the same switch (hence its name being Global Critter Spawn) to disable all spawn events in the map, for every map that have spawns. It seems to work fine. the most spawners a map have is 5. Is this a problem?

Seems fine to me, probably won't be a problem unless you need to control the spawns separately.
I see, but you could still have extracted the common logic (decrement and break) out of the conditionals, that's my point xd

You can check my previous response for the proof that having the same thing on the positive and negative clauses of a conditional is logically equivalent to just taking it out of the condition.

well, I looked it but I have no idea how to interprete code, sorry.😅
well, I looked it but I have no idea how to interprete code, sorry.😅

The code is literally a transliterated event though? I just cut some unnecessary punctuation and verbosity. What exactly makes it harder to understand?

This is exactly the same thing, but "uglyfied" to look like an event:

Code:
<> Control Variables: #0002 N Events = Random 1..2
<> Loop
    <> Control Variables: #0001 Spawn Rarity = Random 0..100
    <> If Spawn Rarity >= 95
        <> Comment: Do the plugin thing
     : End
    <> Control Variables: #0002 N Events -= 1
    <> If N Events == 0
        <> Break Loop
     : End
: Repeat Above

Now compare this to what I wrote before and tell me it's easier to read:

Code:
set n_events = random 1..2

loop
  set spawn_rarity = random 0..100

  if spawn_rarity >= 95
    spawn(<ID>)
  end

  n_events -= 1

  if n_events == 0
    break loop
  end if
end loop

You people have some serious prejudice against code, smh.
@guking Erm, I do not have MZ and so is not an expert in MZ, but I set up something similar in MV for loot and it works fine. Since MV and MZ are similar in the eventing, I suspect it is the looping that is causing the trouble in your original event. Maybe try removing the loop?
technically is not a creature, it's flowers, but that's besides the point hehe.

It supposed to spawn as the player enter the map. The idea is every time the player enters the map the creatures are spawned in different areas with different chances.

I'd recommend using auto-event instead of parallel, that way the flowers will be generated before the map is displayed.
The code is literally a transliterated event though? I just cut some unnecessary punctuation and verbosity. What exactly makes it harder to understand?

This is exactly the same thing, but "uglyfied" to look like an event:

Code:
<> Control Variables: #0002 N Events = Random 1..2
<> Loop
    <> Control Variables: #0001 Spawn Rarity = Random 0..100
    <> If Spawn Rarity >= 95
        <> Comment: Do the plugin thing
     : End
    <> Control Variables: #0002 N Events -= 1
    <> If N Events == 0
        <> Break Loop
     : End
: Repeat Above

Now compare this to what I wrote before and tell me it's easier to read:

Code:
set n_events = random 1..2

loop
  set spawn_rarity = random 0..100

  if spawn_rarity >= 95
    spawn(<ID>)
  end

  n_events -= 1

  if n_events == 0
    break loop
  end if
end loop

You people have some serious prejudice against code, smh.

Hehe, not prejudice, I'm just dumb. I tried to learn how to code for XP once and was a nightmare. It never made sense for me. I tried to find some videos on youtube to learn js for MZ but the guy in the video started talking about a lot of stuff that didn't make sense for me or anything so I gave up. (also the audio was terrible and the accent was hard for me :/)

I can understand now that you put it in a "event way", but it's really hard for me. Not sure if it's because of adhd or whatever hehe. But thank you! I can't understand events as well, haha. I mean, I know how they work and etc, but I have to keep checking them time after time to see if I understood the process. That's why I had the looping problem at first. Sorry 😅 (usually I open the makers to make maps with the tileset, making a game is just consequence haha)

Well I think everyone has helped me already and I've figured out the problem as well, so I think it's okay to close this thread 🙂

Original thread: https://forums.rpgmakerweb.com/threads/how-does-rmmz-calculates-variables.132945/