[RMVX ACE] VARIABLE CHECK HELP
Posts
Pages:
1
Hello! ^_^
I'm trying to make a variable that, when a common event is used, will change to another number, but never to the same number. To try to attempt this, I had another variable store the first variable's number and, if they equal each other, should re-generate the number so that the variable won't ever come up with the same number that it had immediately before this.
This is how my common event looks, with variable #11 being the one that changes and #17 being there to try to keep #11 from being the variable it was last time.
I was hoping that I could get someone more knowledgable with eventing to tell me if this looks right (also because I haven't really used labels and I'm not sure I'm using them right either).
Thanks a ton ahead of time. ^_^
I'm trying to make a variable that, when a common event is used, will change to another number, but never to the same number. To try to attempt this, I had another variable store the first variable's number and, if they equal each other, should re-generate the number so that the variable won't ever come up with the same number that it had immediately before this.
This is how my common event looks, with variable #11 being the one that changes and #17 being there to try to keep #11 from being the variable it was last time.
I was hoping that I could get someone more knowledgable with eventing to tell me if this looks right (also because I haven't really used labels and I'm not sure I'm using them right either).
Thanks a ton ahead of time. ^_^
The event-commands that occur to me that you might want to look into is Loop and Break Loop. So, like, after you do the initial roll for #11, start a Loop, check to see if the two are equal, and if so, re-roll. Otherwise, Break Loop.
*Edit: I... think?
*Edit2: If you use the label method, my guess is that the label would be at the point where you re-roll #11, which is right after you make the two variables equal. As for the result of the "if #11 == #17" check, when that's true, it would be, simply, Jump to Label. Probably!
*Edit: I... think?
*Edit2: If you use the label method, my guess is that the label would be at the point where you re-roll #11, which is right after you make the two variables equal. As for the result of the "if #11 == #17" check, when that's true, it would be, simply, Jump to Label. Probably!
The roll for 17 should happen inside said loop. Sounds like you're thinking of:
I dunno what you're doing with the FirstRoll switch since it is never assigned a value in your snippet so I left it out. If it's meant for a literal first roll then set it to ON before the Loop and set it to OFF after the FirstRoll assignment.
e: for great code fixing bbcode engine shit idfk
e2: whoops yeah that's a mistake on my part. Fixed vvvv
Loop
Conditional Branch FirstRoll ON
Control Variable 17 = Random 1...17
Else
Control Variable 17 = Random 1...12
End Branch
Conditional Branch Variable 17 Does Not Equal Variable 11
Control Variable 11 = Variable 17
Break Loop
End Branch
Repeat Above
e: for great code fixing bbcode engine shit idfk
e2: whoops yeah that's a mistake on my part. Fixed vvvv
Thanks Marrend and GRS! :DDDD
One question on GRS's. Shouldn't the look break if Variable 17 doesn't == Variable 11, since I don't want them to be the same, or am I misunderstanding?
One question on GRS's. Shouldn't the look break if Variable 17 doesn't == Variable 11, since I don't want them to be the same, or am I misunderstanding?
This one should work:
in events (I think):
Which is *almost* the same as what GRS just said...
$game_variables[17] = $game_variables[11] $game_variables[11] = 1 + rand($game_switches[2] ? 17 : 12) while $game_variables[11] == $game_variables[17] $game_variables[11] = 1 + rand(17) end end
in events (I think):
Control Var 17 = Var 11
Condition: FirstRoll is ON
Control Var 11 = random 1...17
Else
Control Var 11 = random 1...12
End
LoopPoint <- label
Condition: Var 11 == Var 17
Control Var 11 = random 1...17
Jump To: LoopPoint
End
Which is *almost* the same as what GRS just said...
author=unity
Thanks Marrend and GRS! :DDDD
One question on GRS's. Shouldn't the look break if Variable 17 doesn't == Variable 11, since I don't want them to be the same, or am I misunderstanding?
Yeah, I was being dumb and fixed it. When they aren't equal then you want to escape your loop.
Pages:
1