Computer Science Canada Coordinate based RPG |
Author: | Supernal [ Fri Nov 02, 2007 4:34 pm ] |
Post subject: | Coordinate based RPG |
Greetings, everyone. This is my first post on this site. ![]() I was hoping I could acquire some help with a game I'm attempting to make. My problem right now is: I set my coordinate system up, and it's working fine. But my battle procedure runs via a randint event. It's basically: randint (b,1,100) Where "b" is my *b*attle procedure odds. So... : if b > 85 then Battle end if Now... I have the battle procedure running perfectly well... Except, when I am done the battle, it just re-loops, even after I've won/lost. And thats where my problem is. I need a way to terminate the procedure, and re-run the movement procedure. I'd appreciate any help/criticism. |
Author: | Degensquared [ Fri Nov 02, 2007 5:53 pm ] | ||
Post subject: | Re: Coordinate based RPG | ||
Well if you could post some more of your code it would be easier for us to get some perspective on the problem ![]() If you are using the loop statement to run through the battle, you might want to use an exit condition such as
This way when the fight is over, you can just simply exit the loop at that point, and bring you right to the end of the procedure. (or next part of the battle loop, awarding experience, loot, etc ![]() Also, just as a side tip, try to use Rand.Int, instead of randint. and also the syntax tags help a little ![]() [syntax="turing"] ![]() |
Author: | Supernal [ Fri Nov 02, 2007 7:07 pm ] |
Post subject: | RE:Coordinate based RPG |
Rand.Int is the snobs randint. ![]() I do hope I'm not stupid enough to have forgotten about exit. ![]() I'll post my source Monday. Thanks for replying relatively quickly. ![]() |
Author: | Mazer [ Fri Nov 02, 2007 8:57 pm ] |
Post subject: | Re: RE:Coordinate based RPG |
Supernal @ Fri Nov 02, 2007 7:07 pm wrote: Rand.Int is the snobs randint.
![]() It really isn't, if I haven't forgotten the details. randint is a procedure that takes a variable by reference to give you the random number. Rand.Int is a function and returns the random integer. |
Author: | Supernal [ Fri Nov 02, 2007 11:04 pm ] |
Post subject: | RE:Coordinate based RPG |
... You see, thats why I post here for help. Thanks, Mazer. ![]() I do believe I was a dumb ass, and forgot about "exit when *blahblah*"... So, pointless thread and such. Thank you, guys. |
Author: | Supernal [ Sat Nov 03, 2007 2:33 pm ] |
Post subject: | RE:Coordinate based RPG |
New question.. I have my Move procedure in a loop, how would I get the loop to exit when my battle procedure is called? (I'm not sure whether double posts are frowned upon, I'm sorry if so, but, this would most likely not be looked at for a while otherwise.) |
Author: | Mazer [ Sat Nov 03, 2007 5:53 pm ] |
Post subject: | RE:Coordinate based RPG |
Your move procedure is in a loop, or there's a loop in your move procedure? The latter is a bad idea. |
Author: | Supernal [ Sat Nov 03, 2007 7:33 pm ] |
Post subject: | RE:Coordinate based RPG |
There is a loop on my move procedure. |
Author: | Degensquared [ Sat Nov 03, 2007 7:37 pm ] | ||||
Post subject: | Re: Coordinate based RPG | ||||
Well it depends on how you have set up that move procedure, if you mean that you have it in a loop such as: Check if there is player input, if so then carry out some actions, and then draw the scene in a loop; you could simply call the battle procedure. By doing so, it would go through all of the code in the battle procedure and then go right back into the moving loop, with no deed to actually exit the loop. Example:
Another solution would be to put it in a nested loop, so you would have the move proc looping, and then when the exit condition is met, it would leave the loop, go to the next part (battle procedure), and then when that finished, go back to the top of the first loop, and re-enter the move proc. Example:
(Hope that answers your question ![]() |
Author: | Supernal [ Sat Nov 03, 2007 7:52 pm ] | ||||
Post subject: | Re: Coordinate based RPG | ||||
That is my move procedure.
And thats my battle procedure. (If you're wondering why I have "Choose an action." when there is only one option, I will add a "Run" option at some point.) Now, what I want to do is loop the "move" procedure until the randint value is > 75. Then, I want it to jump to the "Battle" procedure. After MHp < 1, I want it to continue back to the "move" procedure, over and over, so on and so forth. |
Author: | Supernal [ Tue Nov 06, 2007 8:14 pm ] |
Post subject: | RE:Coordinate based RPG |
I suppose no help applicable? |
Author: | HeavenAgain [ Tue Nov 06, 2007 8:32 pm ] | ||||
Post subject: | RE:Coordinate based RPG | ||||
for your main
and inside your battle procedure or w/e, add an
at the end ![]() |