VXAce Do i really need a script for this?

I want random area troop encounters to be replaced with events, and i dont know if there is already a tutorial for this or a script, but do i really need a script for this? please help!
What exactly do you want the replacement event to do?
If you want your random encounter system to relies on the number of steps and call events accordingly, you can do this fully by event with parallel process events without any script.

(I kind of took inspiration from this MV support thread)
You can have one parrallel processing event store the 'steps' value:
1750887417711.png

(sorry, my engine is in french)

Since the step counter is the number of steps since the beginning of the game, you might want to do some stuff like having a local counter to remember the last number of steps since the previous encounter or something like this.

Here is an example:
1750887996603.png


Translation:
Code:
wait 1 frame
v1 = step counter
v3 = v2
v3 += map_steps #a fixed value by you, in my picture above, 40
if v1 >= v3
  v2 = v1 #remember to update v2 to v1 whenever you've started a battle!
  call battle/ eventing battle #you can pick the fight you want, check for the current map area etc.
end
If you want your random encounter system to relies on the number of steps and call events accordingly, you can do this fully by event with parallel process events without any script.

(I kind of took inspiration from this MV support thread)
You can have one parrallel processing event store the 'steps' value:
View attachment 343639
(sorry, my engine is in french)

Since the step counter is the number of steps since the beginning of the game, you might want to do some stuff like having a local counter to remember the last number of steps since the previous encounter or something like this.

Here is an example:
View attachment 343640

Translation:
Code:
wait 1 frame
v1 = step counter
v3 = v2
v3 += map_steps #a fixed value by you, in my picture above, 40
if v1 >= v3
  v2 = v1 #remember to update v2 to v1 whenever you've started a battle!
  call battle/ eventing battle #you can pick the fight you want, check for the current map area etc.
end
Thanks! this helped! But where would the local counter event go? would it just be a parallel process?

Thanks! this helped! But where would the local counter event go? would it just be a parallel process?
Nevermind i figured it out. thanks! 🙂
I tried doing the same thing but with the tmp variable to equal to a random number from 5-7 but it doesn't seem to work.
Screenshot 2025-06-26 151656.png
bump, i still need help!
What do you mean by it does not seem to work? Is the event not triggering, is the random value not random? Please be more precise with your issue otherwise it is harder to provide meaningful help.

If your event is not triggering, check that your event in paralel process and its page conditions are met.

If it is the random value issue, then it is expected to trigger only with the lowest value. The reason why is that tmp gets a random value each frame (60 times per second), so with very high probability, your player won't have moved before tmp reaches the lowest possible value, in which case it will always trigger for this low value.

You need something a bit more advanced for this random value issue.

One way to fix this is to save the next step counter to reach when a battle is started or a map is loaded.
You can do it with 2 pages on your event:

Page 1 (automatic, no conditions):
Code:
v1 = step counter
v1 += map_counter #your constant or random value that must be reached to start a battle
swicth1 = true

Page 2 (parallel process, swicth1 is true):
Code:
wait 1 frame
v2 = step counter #v2 is a temporary value here
if v2 >= v1
  switch1 = false
  call battle/ eventing battle #you can pick the fight you want, check for the current map area etc.
end

switch1 here should be set to false whenever you change map if you want to avoid battling when loading a new map.
If it is the random value issue, then it is expected to trigger only with the lowest value. The reason why is that tmp gets a random value each frame (60 times per second), so with very high probability, your player won't have moved before tmp reaches the lowest possible value, in which case it will always trigger for this low value.
Thanks! This was the problem, it works now.

Original thread: https://forums.rpgmakerweb.com/threads/do-i-really-need-a-script-for-this.178534/