How to make Achievements?

Announcements, support questions, and discussion for the Dialogue System.
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

How to make Achievements?

Post by HaiiroMukuro »

Hello, It's me again. :D
Can Dialogue System can trigger achievements?
For example, The character suppose to wake up early for him to go to school.
The achievement entitled as "Too Lazy for First Day."
The player will pick from this choices.
Image
If the player picks the "fix the bed." No achievement.
If the player picks the "Come on! It's too early, lets take a nap for five minutes."
The achievement will trigger and shows "Achievement Unlocked: "Too Lazy for First Day.""
I want also to attach an Image for the achievement to make the player appreciate it.
Have a good day! :)
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to make Achievements?

Post by Tony Li »

Hello again,

Here's one way to do it:

1. In your dialogue database, add a new Boolean variable named "Achievement_TooLazy".

2. Create a UI Image named "Achievement_Image_TooLazy".

3. On the line "Come on! It's too early..." set the Script and Sequence fields to:
  • Sequence:

    Code: Select all

    SetActive(Achievement_Image_TooLazy);
    required SetActive(Achievement_Image_TooLazy,false)@2
  • Script:

    Code: Select all

    Variable["Achievement_TooLazy"] = true;
    ShowAlert("Achievement Unlocked: Too Lazy for First Day")
The variable will remember whether the player has earned the achievement or not.

In the example above, the image appears for 2 seconds, and then it disappears.

If you want the image to always be onscreen, even after loading saved games, change the steps to these:

3. On the line "Come on! It's too early..." set the Script and Sequence fields to:
  • Sequence:

    Code: Select all

    SetActive(Achievement_Image_TooLazy)
  • Script:

    Code: Select all

    Variable["Achievement_TooLazy"] = true;
    ShowAlert("Achievement Unlocked: Too Lazy for First Day")
4. Add a Persistent Active Data component to the Dialogue Manager. Assign Achievement_Image_TooLazy as the Target. Add a Condition > Lua Conditions element:

Code: Select all

Variable["Achievement_TooLazy"] == true
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: How to make Achievements?

Post by HaiiroMukuro »

Thanks! :D
I have a question.
On the main menu, there is an achievement button. If the player clicks the achievement button, it will show the achievements earned. It is also possible to show the achievements earned on a panel? Currently, I have a panel for achievements. Still I don't know how to show the achievements on the panel.
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to make Achievements?

Post by Tony Li »

Hi,

Continue to use Dialogue System variables to remember what achievements the player has earned.

Add OnPersistentActiveData components to the panel, one for each achievement image. Set the Trigger to OnEnable. Assign an achievement image to each component's Target. Set the Condition > Lua Condition to check the achievement's Dialogue System variable.
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: How to make Achievements?

Post by HaiiroMukuro »

Am I doing right?
Image
The achievement earned must show on this panel, but the achievement is not showing.
Image
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to make Achievements?

Post by Tony Li »

It looks like it's almost there. I'll send you an example later today.

DId you assign an image to Achievement_Image_TooLazy?
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: How to make Achievements?

Post by HaiiroMukuro »

Thanks a lot! :D
Yes, I put the Achievement_Too_Lazy under the game object named "Achievements."
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to make Achievements?

Post by Tony Li »

Is a valid image file assigned to Achievement_Too_Lazy?
HaiiroMukuro
Posts: 80
Joined: Sun Jul 17, 2016 3:38 pm

Re: How to make Achievements?

Post by HaiiroMukuro »

I put a blank image inside the panel and on the game object, yes its a valid image.
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to make Achievements?

Post by Tony Li »

Okay, thanks. I should have an opportunity in a couple hours to put together an example for you.
Post Reply