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
1
Question by DRazvan · May 07, 2014 at 10:24 PM · c#androiddesigndesign-patterns

A simple quest system[solved]

For my game i am gonna need to create a rather small quest system. Let me explain how it will work.

I will have 3 or 4 NPC each implementing the following logic.

Quest Logic

To get into some more details about this logic. It's an educational game, my character is inside a house and each family member is considered a NPC. Each NPC's "quest line" will be independent, so you will simultaneously have 4 chores/quests active.

Let's say i go to NPCx and i accept chore 1. Chore 1 will be something like -> go clean your room. I move through the house and when i enter my room I will have a collision trigger and load another scene with a mini game to complete the chore.

Only when this chore is completed i will return to my main scene and go to NPCx again and then let's say i accept Quest1.

Quests will only load other scenes, they are also some mini-games but these form the educational part. So I loaded a different scene, play a small game, then when i finnish i go back to NPCx.

Only when Quest1 is completed he will give me chore2, repeat.

To start off I will probably have only 2 (Chore,Quest) pairs for each NPC.

This is how I thought of implementing it.

  1. Create a class Quest, with some common variables like quest_title,quest_description,quest_state,quest_number and some setters getters.

  2. I really want to avoid GUI System so I think i'm going to create a GUITexture for dialog window, place a TextMesh over it and 2 other GUITextures for Accept/Decline buttons.

  3. Setup some collision triggers near each NPC that will have a script which will create the current quest and will handle the quest dialog. Everytime OnEnterTrigger event is called I will create the corresponding Quest Dialog like : "This is the first quest description" Accept or NOT? Or if the quest is already active but not finnished : "Have you completed your chore?".

  4. After the Quest Dialog is made visible and activate its script Accept button will Load the new scene.

  5. Somehow (haven't thought this far) when the current mini game(quest) is finnished,change MainScene.GetNPCGameObject.GetScript.current_quest.setState("finnished");

Here is the idea for the triggers Script:

 Quest curr_quest;
     int current_quest_id;
     // Use this for initialization
     void Start () {
         current_quest_id = 1;
         curr_quest = new Quest ("Title1", "Descr1", "pending", 1);
     }
     
     void OnTriggerEnter () {
         switch (current_quest_id)
         {
         case 1:
             if(curr_quest.GetState() == "pending"){
                 //Make my GUITextures (background,button Accept,button Decline) visible
                 //Set my TextMesh text to current quest title and description and make it visible
                 //Activate script attached to Button GUITextures
             }
             else if(curr_quest.GetState() == "active"){
                 //Show GUI for active quest this time
             }
             else if(curr_quest.GetState() == "finnish"){
                 //Show GUI for finnish quest
                 curr_quest = new Quest("title2","descr2","pending",2);
                 current_quest_id++;
             }
             break;
         case 2:
             //repeat for q2
             break;
         case 3:
             //repeat for q3
             break;
         case 4:
             //repeat for q4
             break;
         default:
             break;
         }
     }

Or instead of a trigger collision event, a tap on the NPC itself.

Some things i omitted : Platform: Android, Language: C#

Please provide with some input and ideas, but keep in mind the following:

I am a beginner in Unity and C#.

Keep it simple, I'm not trying to create some big RPG game.

The idea behind this is that i thought most educational games are just a bunch of levels thrown together so I am trying to create an interactive game in which playing a bunch of games is a game.

Thank you.

quest_logic.jpg (63.7 kB)
Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

Looking for advice about changing levels. 1 Answer

An OS design issue: File types associated with their appropriate programs 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Best practice for adding specific attributes to an object but not all of them 2 Answers


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