Random Encounter Indicator (from the Ar Tonelico series)

I've always found random encounters needlessly annoying, especially when I'm either underleveled or trying to solve a puzzle. There's nothing more frustrating than keeping track of where I am in a puzzle, only to have a difficult encounter pop up. It's a needless annoyance, but there's this game that presents a decent compromise in my opinion. 


945487de2f.jpg



Ah, Ar Tonelico. Will my love-hate relationship with you ever end? Er, sorry, another topic for another time.


Behold, the Random Encounter Bar™! Let me explain how it functions.


In the Ar Tonelico series, encounters aren't really random. Meaning, there's a fixed number of steps you can take before you encounter an enemy. As you continue taking steps, the blue bar shown in the picture slowly turns from blue to red. Once it turns fully red, you will encounter an enemy.


That isn't all, though. For every enemy you successfully defeat, a portion of the bar disappears. The process is repeated until the bar is completely empty, where you will no longer encounter enemies. The bar resets whenever you exit the map or exit your game (i.e. if you save & load back in, the bar will be full again).


I personally believe this is a brilliant approach to the issues that a random encounter system presents. It's technically not even random, since encounters only happen when you take x amount of steps, and the pain doesn't last forever. While playing the Ar Tonelico games, I always found myself grinding out encounters until the bar depleted, then focused on puzzles/map objectives (pressing switches, collecting logs, etc).


My request, then, is this: Would it be possible to have a plugin of this style created for RPG Maker MV? It wouldn't even have to be a bar. Perhaps, for example, two icons at the bottom right of the screen that'd have the step counter and the number of encounters left, idk. 


I know it's possible to have on-map encounters or an option to just turn them off from a menu, Kappa, but I'm only asking this out of ignorance of the program. I don't know if it'd be simpler to strategically place map encounters on every single dungeon or implement something like this either via events or plugins. 


Thank you for taking the time to hear me out.
The random encounters in the RM series work smiliar - the engine rolls a random number based on the average on the encounter table, and that is the number of steps you have to take before the next encounter.


However, you'll need a plugin to display that number graphically as it is currently only internal.


I've moved this thread to Plugin Request. Please be sure to post your threads in the correct forum next time. Thank you.
The random encounters in the RM series work smiliar - the engine rolls a random number based on the average on the encounter table, and that is the number of steps you have to take before the next encounter.


However, you'll need a plugin to display that number graphically as it is currently only internal.



I see; so it won't be possible without JavaScript. Unfortunate for me, at least. Hopefully a plugin creator will devote time towards this, as I'm sure people could benefit from it or at least find it different from default encounters. 

I've moved this thread to Plugin Request. Please be sure to post your threads in the correct forum next time. Thank you.



Ah, sorry about that. Still new to the site & not sure where to put things. I only posted it where I did because I wasn't sure if something like this was possible without a plugin and was just asking how it could be done. Still, my bad. I'll edit my post to make it more of a request than a question.
Let's see. You can use my Limited Random Battles plugin to limit the number of random battles on the map.


You can use Orange Hud to display values. One of the addons can add a gauge to the hud, too.


$gamePlayer._encounterCount


is the variable storing the encounter count. When the encounter count reaches 0 a random battle occurs.


If you want to get the number of random battles left on a map, you can use


DreamX.LimitedRandomBattles.GetRandomBattlesRemaining()


from my plugin.
Ooh, this sounds really promising. I'll toy around with them and get back to you if I'm successful or run into an issue. 
bcfe7c49e9.jpg



Bats have invaded my home. If I move around too much, they'll know I'm here and attack me.


Alright, after an hour of fidgeting & fumbling around, I've got something to work with. I'll make it pretty later, but just knowing it works excites me. For anyone wanting an in-depth guide, here's how I did it. 


Edit: Made it pretty. 


41b97dc2a0.png


Spoiler
The gauge indicates how many steps until you encounter an enemy. When it depletes, you get a battle.


The number, of course, is the number of encounters you have left until you stop facing enemies. 


The gauge is thanks to the OrangeHud plugin with the gauge add-on. The number is displayed via the line add-on, and is just grabbing the number of encounters left from DreamX's plugin.


9e247d1c31.png



(Note, if you want the bar to refresh upon re-entering the map, use a normal switch instead of a self switch and just turn the switch off whenever you exit the map.) 


Create a parallel event on the map(s) you want the hud to be on. On the first page, set a variable to equal the number of encounters you want on the map and put the <random_battle_variable:x> notetag from DreamX's plugin into the notebox on the map you want your encounters to be on. 


(Note that x is the variable id to grab the number of encounters from, not the number of encounters itself)


I put this on a separate page because you only need to grab this number once. DreamX's plugin will automatically decrease this number per encounter for you. If you have it on the same page where the other variables are being checked, it'll just reset it to the number specified after the battle instead of having it go down. 


cf85e70dfd.png



... Of course, I only realized this after I created the common event. 


Either way, have page 2 be a Parallel event as well. As for the values we need to grab here, 


1665d06c8b.png



They're just the script calls posted above by DreamX, shown how they'd appear in an event.


Variable 4 is just to give the Orange Hud Gauge a max value so it will drain properly. Just set it to something you don't think your map's encounter rate will exceed. This can be changed map to map if this page weren't in a common event, but I don't intend on changing my encounter rates for different maps. 


The switch is just to tell the Orange Hud plugin to show or hide the display depending on if you're on a map with encounters or not. 


e073ca1bfd.png



Onto plugin placement and editing, oh joy. They seem to be fine anywhere if they don't conflict with any other hud/random encounter plugins. I have them under several of Yanfly's plugins and it seems to be doing fine so far. Just be sure to have the OrangeHud addons below the main plugin of course.


f4fa1ce781.png



For the gauge, just set the values to these parameters as the variable IDs to the corresponding numbers we grabbed (and have SwitchId be the switch you want to use to toggle the hud) 


ac589b807c.png



Same deal for the encounters left variable under OrangeHudLine. 


Again, you can make it pretty however you want within the confines of the OrangeHud plugin (repositioning it, making it a different color, give it a window, etc). This is just how I got it to work.



Thank you very much for these gems, @DreamX  (for making the limited encounter plugin and pointing me to OrangeHud) 


You've got another follower, and I'll see if any of your other plugins will be useful for my project. 
[IMG]http://puu.sh/pPEFI/bcfe7c49e9.jpg[/IMG]


Bats have invaded my home. If I move around too much, they'll know I'm here and attack me.


Alright, after an hour of fidgeting & fumbling around, I've got something to work with. I'll make it pretty later, but just knowing it works excites me. For anyone wanting an in-depth guide, here's how I did it. 

Spoiler
The gauge indicates how many steps until you encounter an enemy. When it depletes, you get a battle.


The number, of course, is the number of encounters you have left until you stop facing enemies. 


The gauge is thanks to the OrangeHud plugin with the gauge add-on. The number is displayed via the line add-on, and is just grabbing the number of encounters left from DreamX's plugin.


[IMG]http://puu.sh/pPEWs/9e247d1c31.png[/IMG]


Create a parallel event on the map(s) you want the hud to be on. On the first page, set a variable to equal the number of encounters you want on the map and put the <random_battle_variable:x> notetag from DreamX's plugin into the notebox on the map you want your encounters to be on. 


(Note that x is the variable id to grab the number of encounters from, not the number of encounters itself)


I put this on a separate page because you only need to grab this number once. DreamX's plugin will automatically decrease this number per encounter for you. If you have it on the same page where the other variables are being checked, it'll just reset it to the number specified after the battle instead of having it go down. 


[IMG]http://puu.sh/pPFip/cf85e70dfd.png[/IMG]


... Of course, I only realized this after I created the common event. 


Either way, have page 2 be a Parallel event as well. As for the values we need to grab here, 


[IMG]http://puu.sh/pPFq4/1665d06c8b.png[/IMG]


They're just the script calls posted above by DreamX, shown how they'd appear in an event.


Variable 4 is just to give the Orange Hud Gauge a max value so it will drain properly. Just set it to something you don't think your map's encounter rate will exceed. This can be changed map to map if this page weren't in a common event, but I don't intend on changing my encounter rates for different maps. 


The switch is just to tell the Orange Hud plugin to show or hide the display depending on if you're on a map with encounters or not. 


[IMG]http://puu.sh/pPFGu/e073ca1bfd.png[/IMG]


Onto plugin placement and editing, oh joy. They seem to be fine anywhere if they don't conflict with any other hud/random encounter plugins. I have them under several of Yanfly's plugins and it seems to be doing fine so far. Just be sure to have the OrangeHud addons below the main plugin of course.


[IMG]http://puu.sh/pPFOm/f4fa1ce781.png[/IMG]


For the gauge, just set the values to these parameters as the variable IDs to the corresponding numbers we grabbed (and have SwitchId be the switch you want to use to toggle the hud) 


[IMG]http://puu.sh/pPFYZ/ac589b807c.png[/IMG]


Same deal for the encounters left variable under OrangeHudLine. 


Again, you can make it pretty however you want within the confines of the OrangeHud plugin (repositioning it, making it a different color, give it a window, etc). This is just how I got it to work.



Thank you very much for these gems, @DreamX  (for making the limited encounter plugin and pointing me to OrangeHud) 


You've got another follower, and I'll see if any of your other plugins will be useful for my project. 

Nice. It's worth noting that you can use the script parameters in Hudell's hud plugins to bypass the need to use parallel events.
It's worth noting that you can use the script parameters in Hudell's hud plugins to bypass the need to use parallel events.



Is that so? How would I go about that? After rereading the parameters, it only seems like it'd avoid the need to grab the two script calls from the event. I'd still need to grab the number of encounters and the max value for the gauge from somewhere, and I don't know how to do that outside of a parallel event (especially since I'd like to be able to set the number of encounters on each map) 


I also realized a flaw in my design. The bar doesn't refresh if you exit & re-enter the map, so instead of a self-switch I dedicated another switch switch to the process. Turn it on on page 1 to go to page 2, and have it turn off whenever you leave the map.


This probably seems like I'm bodging things together to anyone with more experience than I have, but I'm all ears for anything that'd make my life easier. 

Original thread: https://forums.rpgmakerweb.com/threads/random-encounter-indicator-from-the-ar-tonelico-series.64717/