Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Joe99 · May 26, 2014 at 04:05 AM · gamerpg

Can I make a choice-driven game?

I'm planning on making a Mass Effect-esque game (a small version, at least) and I want to know how I can (if I can) make the player choose between two or three texts, and then something different happens, maybe one is an answer and another triggers a fight. I want to do it on my own so I can learn, so just say how to do it or write a few commands, not a script, please. I use javascript. Thanks!

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image robertbu · May 26, 2014 at 04:55 AM 1
Share

Right now you are at a design stage, so you question might be better asked on Unity Forums. There are three built-in ways to do text in Unity:

  • GUI: text can be put in a GUI.Button() or you can use a GUI.Label() and use Rect.Contains() to detect a click on the text.

  • GUIText: On$$anonymous$$ouseDown works with GUIText or you can GUIText.HitText() to detect a click by the mouse.

  • 3D Text/Text $$anonymous$$esh: you must put a collider (usually a box) on the text. Then you can use On$$anonymous$$ouseDown() or Raycasting() to detect a click on the text.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Kiwasi · May 26, 2014 at 04:30 AM

Yes

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by getyour411 · May 26, 2014 at 04:49 AM

 if(GUI.Button(...),choice1)) {
 // start fight
 }
 
 if(GUI.Button(...),choice2)) {
 // give witty answer
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Midnaut · May 26, 2014 at 06:21 AM

To answer the design part of the question,

you'll probably want to make some kind of conversation manager. For a mass effect style, you'll need to store camera positions, set up some animation controllers and work out some radial UI stuff.

To get the kind of code structure, for something simple, that doesn't require some kind of graph editor to map the conversation, i'm going to assume that each conversation will consist of a statement, or question, and you will have two choices, one will be the passive response the other the aggressive.

 var question;
 var choice1;
 var choice2;
 
 var talking = false;
 
 function StartConv()
 {
     talking = true;
 }
 
 function OnGUI()
 {
     if(talking)
     {
         GUI.label(Rect(10, 10, 200, 50), question);
 
         if (GUI.Button(Rect(10, 100, 200, 50), choice1))
         {
             AggressiveResult();
             talking = false;
         }
         if (GUI.Button(Rect(100, 160, 200, 50), choice2)) 
         {
             PassiveResult();
             talking = false;
         }
     }
 }
 function AggressiveResult() 
 {
     ...
 }
 function PassiveResult()
 {
     ...
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I need help fixing this code 1 Answer

Is there Another Alternative to Create your own game easily without Coding? 1 Answer

what is the best way to do this game? 2 Answers

Pathfinding for RPG games 2 Answers

WHY SAYS ME THAT IS AN ERROR? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges