Main Menu
  • Welcome to The RPG Maker Resource Kit.

[XP] Need Help with Loops

Started by theneonheart, November 21, 2012, 06:29:52 AM

0 Members and 1 Guest are viewing this topic.

theneonheart

I am trying to make a character able to choose their class through a dialogue with an NPC, but I want them to be able to look at each one of the four choices, and say "Yes, this is the one", OR "Let me look at the others" and then go back to the four choices. But I don't know how to do this with the basic dialogue system and doing it the long way is a big mess. Any advice on how to get this going? I'm using XP if that matters.
And if you stare for long enough into the abyss... you just might stare it down.

My Games: ExXception Draft
My Awesome Homepage The Neon Heart.com Host to My Writing / Music / Reviews / and More

Mangomight

Have you ever heard of loops? They work better than nothing for these kind of situations :)
To be simple I could demonstrate with variables, which would even work with the problem you're having;



@>Loop
  @>Show Choices: choice1, choice2, choice3, choice4
  When[choice1]
     @>Control Variables: [0001:testVariable] = 1
     @>
  When[choice2]
     @>Control Variables: [0001:testVariable] = 2
     @> 
     # and so on until 'branch end'.... 
     Branch End
  @>Text
     @> Sure this is the one?
     @>Show Choices: Yes, No
     When[Yes]
     @>Break Loop   # When 'Yes', breaks the loop..
     @>
     When[No]
     @>      # When 'No', continues the loop..
     Branch End
  @>
  Repeat above
  # Now that the variable is set, you can do whatever you want.
@>Text:
  # Say you picked choice2, then...
  @ You've chosen \V[1]               #=> You've Chosen 2
@>
         


Hopes that's pretty self explanatory, you just need to set up a couple of Conditional brances afterwards to make it completely what you wanted it to be, but I guess you'll figure that one out yourself. ;)

theneonheart

Hey, thanks for the help. It seems to be working. Sorry it took me a while to get back to you. I appreciate the help!
And if you stare for long enough into the abyss... you just might stare it down.

My Games: ExXception Draft
My Awesome Homepage The Neon Heart.com Host to My Writing / Music / Reviews / and More

theneonheart

OK, so now that I am working with loops, I have a discussion set up with an npc (this is a difference conversation than above). There are 3 choice options after an initial 'what's up' text. then when you pick one of the 3 choices, you discuss with more text. But I have it looped so you go back to the 3 choices at the end of each discussion. However, I have no way to exit the conversation yet. I want to add a conditional branch where you can just press escape and leave the conversation, or I suppose I might be able to add a fourth choice that exits out (just thought of that, I'm going to try that out), but it seems like I should figure out how to exit this with the escape button. I know there is a conditional branch for button pressed, but escape is not one of the options in the menu and I don't know how to make it show up there. Does anybody know how I can work this out? I'd appreciate the help.
Thanks.
And if you stare for long enough into the abyss... you just might stare it down.

My Games: ExXception Draft
My Awesome Homepage The Neon Heart.com Host to My Writing / Music / Reviews / and More

Tsunokiette

I don't remember how the interpreter in XP deals with loops, but it's probably best to avoid using one unless absolutely necessary. It might prevent other events from functioning at the same time.

Another option is to use labels. Labels are like bookmarks. You place one, then later you can use the jump to label command to jump back up or down to the specified label.

Example:

"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

drakenkanon

I disagree with Tsunokiette, loops are great for things like the event mentioned here, simply repeating parts.

On topic: I suggest adding an option like goodbye, nevermind, or whatever you want your character to say in quitting, and just putting a break loop there. In rpg maker VX when you show choices you get the option of selecting a certain option when the player cancels. I don't remember if this was the case with XP, if so: choose the goodbye/nevermind/whatever option.

I hope this helps

Kind regards,
Drakenkanon

Tsunokiette

Like I said - I don't remember how it works in XP, but if a loop will cause other events to stop functioning in the mean-time, then maybe that's not the best solution. Loops are helpful when used properly and especially if they can run concurrently.  I just don't remember if they do.
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They're bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I'm the only one, I'm the only one."

drakenkanon

I never had any problems with them when I used XP, but that might have been a coincidence. But I doubt they should cause much trouble, simply not being able to work during a NPC conversation sounds like a minor problem.

Kind regards,
Drakenkanon

iciecoy