# Achievement Unlocks

**URL:** <https://forum.choiceofgames.com/t/achievement-unlocks/134603>\
**Category:** ChoiceScript Help\
**Created:** [March 27, 2023, 5:22pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603 "2023-03-27T17:22:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kazuma\_Itsuchi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kazuma_itsuchi/32/192366_2.png) [@Kazuma\_Itsuchi](https://forum.choiceofgames.com/u/Kazuma_Itsuchi)\
**Post date:** [March 27, 2023, 5:22pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/1 "2023-03-27T17:22:31Z")

</div>

I know I’m making a LOT of posts with these specific tags, however, I have a lot of plans for this series. I need to know if there is a way to reference achievements. I have a code system implemented that allows the player to start the game with different circumstances(Genomes unlocked at the start, Better starting equipment, abilities they would not otherwise have etc.) I want these codes to be given to the player in the codes menu at the start of the game based on the number of achievements they have unlocked. is there a way to do this?

---

<div class="post-metadata">

**Author:** ![quartz](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/quartz/32/174435_2.png) [@quartz](https://forum.choiceofgames.com/u/quartz)\
**Post date:** [March 27, 2023, 5:30pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/2 "2023-03-27T17:30:33Z")

</div>

There is no built in mechanism, but it’s easy to make. All you have to do is create a counter variable and increment it every time the player unlocks an achievement.

If you have scenes that repeat that might accidentaly increment the counter after the player already has the achievement, you can use the \*check\_achievements command to prevent unwanted side effects.

> **[Achievement](https://choicescriptdev.fandom.com/wiki/Achievement)**
>
>     The \*achievement command is used to define one or more Achievements able to be awarded to a player for noteworthy feats or accomplishments within the game - solving puzzles or mysteries; overcoming or otherwise surviving especially...

---

<div class="post-metadata">

**Author:** ![Kazuma\_Itsuchi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kazuma_itsuchi/32/192366_2.png) [@Kazuma\_Itsuchi](https://forum.choiceofgames.com/u/Kazuma_Itsuchi)\
**Post date:** [March 27, 2023, 5:33pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/3 "2023-03-27T17:33:21Z")

</div>

On top of this, Is there a way to use \*check\_achievements inside of an if statement for this? One code in particular I want to unlock once the player gets all of the endings.

---

<div class="post-metadata">

**Author:** ![quartz](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/quartz/32/174435_2.png) [@quartz](https://forum.choiceofgames.com/u/quartz)\
**Post date:** [March 27, 2023, 5:35pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/4 "2023-03-27T17:35:21Z")

</div>

Haven’t tried it personaly, but based on the documentation, I think you should put the if statement inside check\_achievements. I might be wrong. Best way to find out is to test it with a simple scene.

---

<div class="post-metadata">

**Author:** ![Kazuma\_Itsuchi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kazuma_itsuchi/32/192366_2.png) [@Kazuma\_Itsuchi](https://forum.choiceofgames.com/u/Kazuma_Itsuchi)\
**Post date:** [March 27, 2023, 5:36pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/5 "2023-03-27T17:36:30Z")

</div>

Alright, Thanks for the help. I’ll message back here later on whether or not it works.

---

<div class="post-metadata">

**Author:** ![Kazuma\_Itsuchi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kazuma_itsuchi/32/192366_2.png) [@Kazuma\_Itsuchi](https://forum.choiceofgames.com/u/Kazuma_Itsuchi)\
**Post date:** [March 27, 2023, 5:52pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/6 "2023-03-27T17:52:52Z")

</div>

It works. If you use \*check\_achievements before an \*if statement, you can set up the statement based on the achievement status. I set up this choice and it works perfectly.

```plaintext
*label codes
What code do you want to use?
*check_achievements
*choice
  *if (choice_achieved_fae) and not(fae)
    #Enable Fae Genome
      *set fae true
      *goto codes
  *elseif (choice_achieved_fae) and (fae)
    #Disable Fae Genome
      *set fae false
      *goto codes

```

---

<div class="post-metadata">

**Author:** ![Nahim\_Kerman](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/nahim_kerman/32/62734_2.png) [@Nahim\_Kerman](https://forum.choiceofgames.com/u/Nahim_Kerman)\
**Post date:** [March 31, 2023, 4:52pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/7 "2023-03-31T16:52:56Z")

</div>

Wow. I wasn’t aware ChoiceScript let you do that!?!

Thanks buddy!

---

<div class="post-metadata">

**Author:** ![Kazuma\_Itsuchi](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/kazuma_itsuchi/32/192366_2.png) [@Kazuma\_Itsuchi](https://forum.choiceofgames.com/u/Kazuma_Itsuchi)\
**Post date:** [March 31, 2023, 5:53pm UTC](https://forum.choiceofgames.com/t/achievement-unlocks/134603/8 "2023-03-31T17:53:27Z")

</div>

No problem! Was just testing a theory.
