[RM2K3] LEVEL-BASED ENEMY ENCOUNTERS?
Posts
Pages:
1
So enemies in my game have level values attached to them, and I've been tinkering for days on end with a Parallel Process event to get the encounters to work.
At first, I started out with a ridiculously complex one, which first counted your steps and paired them with a randomly selected number between 10 and 50 (so you'll always take 10 steps at least before another battle), then when the numbers matched up it determined your level and threw things over to another common event. This event found your level and threw things to YET another smattering of common events based on your level. These events randomly selected between 5 different encounters, and when you won the battle it threw things over to another common event, which gave you randomized loot.
Yeah, so it worked off and on for some reason (I later determined that I was only using one variable for walking, the same one bound to the Key Input Processing, which explains why sometimes taking a single step would start an encounter, since keys 1-4 are bound to the arrow keys... whoops). I found a barebones tutorial on "predictable encounters," and threw my randomized twist on it, and it still wouldn't work. Now, I'm desperate for results, so I've followed the tutorial to the letter and it still doesn't work! No encounters or anything!
Any help is greatly appreciated! I've found holes in plenty of my other events, but I can't seem to find an issue here.
At first, I started out with a ridiculously complex one, which first counted your steps and paired them with a randomly selected number between 10 and 50 (so you'll always take 10 steps at least before another battle), then when the numbers matched up it determined your level and threw things over to another common event. This event found your level and threw things to YET another smattering of common events based on your level. These events randomly selected between 5 different encounters, and when you won the battle it threw things over to another common event, which gave you randomized loot.
Yeah, so it worked off and on for some reason (I later determined that I was only using one variable for walking, the same one bound to the Key Input Processing, which explains why sometimes taking a single step would start an encounter, since keys 1-4 are bound to the arrow keys... whoops). I found a barebones tutorial on "predictable encounters," and threw my randomized twist on it, and it still wouldn't work. Now, I'm desperate for results, so I've followed the tutorial to the letter and it still doesn't work! No encounters or anything!
<>Loop
<>Key Input Proc: [0105:Step_Counter]
<>Branch if Var [0105:Step_Counter] is 0 Greater
<>Variable Oper: [0110:Steps] +, 1
<>Branch if Var [0110:Steps] is 5 or more
<>Enemy Encounter: [i](Details don't really matter here)[/i]
<>
: End
<>
: End
<>Variable Oper: [0110:Steps] Set, 0
<>Variable Oper: [0105:Step_Counter] Set, 0
<>
: End Loop
<>
Any help is greatly appreciated! I've found holes in plenty of my other events, but I can't seem to find an issue here.
BUMP.
I've actually hit a development wall. If I can't figure this thing out, I'll have to rework the entire encounter aspect.
I've actually hit a development wall. If I can't figure this thing out, I'll have to rework the entire encounter aspect.
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
Part of your problem is that you're using Key Input Processing wrong. Actually you probably shouldn't be using it at all, but definitely not like this. You're increasing the step counter any time the player pushes a key, not just when they move. This means that if the player holds down the left arrow key, the step counter will increase something like sixty times per second, as the event keeps looping.
You're also setting the Steps variable back to 0 inside the loop, which means that it can never go higher than 1. The way it works right now, it's checking to see if the player pushes a key, if so it increases Steps by 1, and then it resets Steps to 0 before it checks again. Lolz.
What you should actually be doing is using variables to track the hero's X and Y coordinates. Something like this.
In other words, you keep two sets of variables for the hero's X and Y coordinates. One set of variables you set equal to the hero's current position every time the loop. The second set stores the last known place the hero was. If the two sets of variables aren't the same, then we know the hero moved, so you increase the step counter by 1 and then update the second set of variables.
You're also setting the Steps variable back to 0 inside the loop, which means that it can never go higher than 1. The way it works right now, it's checking to see if the player pushes a key, if so it increases Steps by 1, and then it resets Steps to 0 before it checks again. Lolz.
What you should actually be doing is using variables to track the hero's X and Y coordinates. Something like this.
<>Loop
<>Variable Oper: [0151:Hero X] Hero's X-Coordinate
<>Variable Oper: [0152:Hero Y] Hero's Y-Coordinate
<>Branch if Var [0151:Hero X] is Var [0153:Old Hero X] Not Equal
<>Variable Oper: [0110:Steps] +, 1
<>Variable Oper: [0153:Old Hero X] Hero's X-Coordinate
<>
: End
<>Branch if Var [0152:Hero Y] is Var [0154:Old Hero Y] Not Equal
<>Variable Oper: [0110:Steps] +, 1
<>Variable Oper: [0154:Old Hero Y] Hero's Y-Coordinate
<>
: End
<>Branch if Var [0110:Steps] is 5 or more
<>Variable Oper: [0110:Steps] Set, 0
<>Enemy Encounter: [i](Details don't really matter here)[/i]
<>
: End
: End Loop
<>
In other words, you keep two sets of variables for the hero's X and Y coordinates. One set of variables you set equal to the hero's current position every time the loop. The second set stores the last known place the hero was. If the two sets of variables aren't the same, then we know the hero moved, so you increase the step counter by 1 and then update the second set of variables.
Hey, thanks for the help! It works perfectly now, but I'm noticing some major lag using it. Moving around the map is extremely choppy and events with continuous animation are choppy as well. Any way to fix that, or is that just a result of the loop?
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
Put a 0.0 second wait just before the end of the loop, it should solve that.
Why would you put a loop inside a parallel process?
There should be a wait time in every parallel process. No exceptions. Events that need to constantly have up-to-date information, like checking player coordinates, should be a wait of 0.0, 2-3 0.0's, or a 0.1 at most. Things that don't need to be constantly checked, like if you killed all the enemies in the room, should be 0.5 or higher.
There should be a wait time in every parallel process. No exceptions. Events that need to constantly have up-to-date information, like checking player coordinates, should be a wait of 0.0, 2-3 0.0's, or a 0.1 at most. Things that don't need to be constantly checked, like if you killed all the enemies in the room, should be 0.5 or higher.
Pages:
1














