Jump to content

Multiple Choice Answers


Deactivated Member

Recommended Posts

Heya!

 

I'm trying to have multiple choice/answers/actions etc. in my callouts. So far I only have the usual "Press Y to Speak" and I'm trying to get more button responses into it. However if I try it like this (simplified):

 

if (Game.IsKeyDown(System.Windows.Forms.Keys.End)) 
{ 
	if (Game.IsKeyDown(System.Windows.Forms.Keys.Y)) 
	{
		Do-Thing-A
	}
	else if (Game.IsKeyDown(System.Windows.Forms.Keys.C)) 
	{
		Do-Thing-B
	}
}

The Game either doesn't respond to either buttonpresses or it justs ends itself.

 

Is there any otherway (and probably more efficient) to get this kind of system implemented?

Edited by RicardaHub
Link to comment
Share on other sites

  • 1 month later...

For my callouts I use game fibers and while loops for multiple choice dialogue. I can't tell if this is in the Process() or a gamefiber but for me my code usually looks something like this:

GameFiber.StartNew(delegate
            {
                Game.DisplayNotification("Press ~b~" + Settings.DialougeKey + "~w~ to speak.");
                while(true)
                {
                    GameFiber.Yield();
                    if(Game.IsKeyDown(Settings.DialougeKey1))
                    {
                        //do thing 1
                        option1 = true;
                        break;
                    }
                    else if(Game.IsKeyDown(Settings.DialougeKey2))
                    {
                        //do thing 2
                        option2 = true;
                        break;
                    }
                }
                if(option1) { Game.DisplaySubtitle("Response to option1"); }
                else if(option2) { Game.DisplaySubtitle("Response to option2"); }

            });

This is just a quick and dirty example but it demonstrates the general idea, and this could be adapted to work for decision making in a callout, not just dialogue. I hope this helps if you haven't already figured it out 😉

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...