[RGSS3] Random Encounter Events

Hi,
This is a neat script that lets you CANCEL RANDOM ENCOUNTERS!
The script can be obtained from Himeworks: Random Encounter Events
It says that it can be done with a message from a common event with the variable in the script being the same as the ID of the common event. As much as I could learn from the comments, you need to use the script call in the common event's condition:
$game_troop.troop.id == 1

Forgive my noobiness, but after I set the Variable in the script to 1, I set up a common event in a new project with the common event conditional being the script call. I playtested and yet nothing happens when I encounter a slime as a random encounter battle. What am I doing wrong? And how can I get to set up the choice of engaging the random encounter OR fleeing it, as seen in the video on the Himeworks page?
common event conditional being the script call.
It's a little wrong.
The variable, first of all needs to have a value. The number in the VARIABLE in the script is just the variable you are using. You then need to use the command control variables to set the value of the actual variable. In your case set to 1. You could have put 59 in the script and set it to 32. CE 32 would be called.
Then the script will call common event 1.
By default the value of variables are 0.
Then in the logic of your common event is where you can decide how to cancel.
Which for your common event will never happen as you are saying if the troop is troop 1, then do battle.
There is no choice to not battle troop 1.
What you also have is if the troop is not troop 1, then cancel battle.
Should be more like this if you want to have a choice.
1585086279979.png
Should be more like this if you want to have a choice.
View attachment 137742
I did everything as in the screenshot, yet the random encounter slime in my new project still ignore the common event.

I am using the same unmodified Hime script copy-pasted into the script editor of my new project.
i.e. in the script:
Ruby:
  module Random_Encounter_Events
    
    # The number stored in this variable is the ID of the common event that
    # will run when you encounter an enemy.
    Variable = 1
  end

Yet I don't think the Hime script is properly calling this Common Event ID: 001 for Troop ID 001: Slime*2 in a random encounter. And I don't know how to get it to work.

There is simply no pre-battle message being displayed when a random encounter with Troop ID 001: Slime*2 occurs on the overworld during playtesting.

Please help!
Create an event on the starting map, an Autorun, that sets Game Variable ID 1 to a value of 1. This is telling the script that you want to use CommonEvent ID 1. That is what Roninator was telling you to do.

Though the screenshot he provided is a bit misleading since it sets Game Variable 1 again. Use a different variable ID instead.
Could I get a couple of screenshots about how its done? Both concerning the event on the map and the Common Event because I'm just running into Game Interpreter errors at this point in my new project.
did everything as in the screenshot
1585143410438.png

1585143605205.png
1585143547721.png
1585143490596.png

the screenshot he provided is a bit misleading
Oops.
It Works!

But does this mean that to cancel each kind of Troop's random encounter I have to set up a separate common event for each Troop? Or can I have multiple troops, each with their own unique pre-battle message, within a single common event?

I think I'll need more space for Common Events that do other things than only using them all for evading Random Encounter Troops throughout the game...

Let's say I'd like to have:
Troop ID: 001 Slime*2
Troop ID: 002 Bat*2
Troop ID: 003 Hornet*2 all in a single common event and to be able to cancel each Troop's random encounter.

How would I do it?
Screenshots please.
How would I do it?
Mostly up to you. That's what Hime was referring to when saying "the opportunity to run some extra logic "

It will be all about conditional branches and how you structure them.
You can put the choice box inside the conditional branch or at the end. Maybe something else. Totally up to you.
1585169779420.png

Original thread: https://forums.rpgmakerweb.com/threads/rgss3-random-encounter-events.119412/