Forum rules - please read before posting.

Steam Achievements with AC



  • Resurrection again, and I probably won't be the last.

    I've got this script as a Custom Action, I've got installed and working with my game, but Acheivements don't seem to be unlocking. I am currently running from the Editor, but I understand that should work too.

    Here is an Acheivement in Steamworks:

    I've tried typing both "1/0" and "chancer_00" in the Custom Action box, but neither do a thing.

    Also, where on steam can I view if I have unlocked any acheivements for my unreleased game?

    And is there anything else I need to do on the Steamworks side to make this active?

    Massive thanks.

  • Latest is, that entering in "Chancer..." does work, but only after build is loaded into steam. That's good enough for me.

  • edited September 2019

    ...and for anyone who wants to have an Lock function. Duplicate the Unlock Script, change any instances of "Unlock" to "Lock", including the file name. Then replace SteamUserStats.SetAchievement(AchievementID); with SteamUserStats.ClearAchievement(AchievementID);

    You can now make a new actionlist with this new Lock script as your Custom Action and link this actionlist to an Active Input. I'm using F5.

    Just type in whichever Steam ACH you wish to unlock, run the game and press F5.

    Also, everything is now working for me in the Editor too, must have needed some catchup time :)

  • Where I fall down is when i want to check if an achievement has been unlocked yet, so I can get the sfx to only play on the first time its triggered. Otherwise the sfx will play on following playthroughs, even if the steam achievement does not get take again.

  • You can use:

    bool unlockTest = false;
    SteamUserStats.GetAchievement(ID, out unlockTest);

    unlockTest will be true or false depending on if it's been achieved or not.

  • Ah cool. I got pretty close to that, but wasn't quite there.

    Then I guess I can follow that with an if statement to check the status of unlockTest, before the SetAchievement part?

    Also, how would I arrange a line to get unlockTest result to display in the console?

    Thanks for your help.

  • edited September 2019

    Yeah, I have it in a function:
    bool TestSteamAchievment(string ID)
    bool unlockTest = false;
    SteamUserStats.GetAchievement(ID, out unlockTest);
    return unlockTest;

    So I can just test like so:

    if (TestSteamAchievment("MY_ACHIEVEMENT"))

    And something like this might work, but it's off the top of my head, before the return:
    Debug.Log(string.Format("{0}, {1}", ID, unlockTest));

  • Very useful thank you

  • Hey all - the latest release of my game has steam achievements all working properly, however, I want to push a new release to, so I'm going to need to disable Steamworks.NET on those particular builds. Can someone give me an example of how to do this? I was able to at least disable the main gameobjects that initialize Steamworks on game load but anytime I reach a point where I trigger an achievement, the game attempts to connect to Steam. I see that you can decouple the code using preprocessors (DISABLESTEAMWORKS) but I don't really understand preprocessors and how to make them work in this way. I'm using the code that @Alverik kindly wrote up to trigger an achievement via an action, so I'm guessing I'd have to modify that code somehow?

    Any pointers?


  • @themightyzq Within the action lists that grant achievements, you could check the platform and proceed accordingly. For example: if it's Steam then run the Steam code, if it's on itch then turn on a custom menu, etc.

  • @witheredCrow - Yeah, I had thought about doing a global variable and doing it per achievement via actionlists but was hoping for a system level thing that would do an auto-check on load so I wouldn't have to touch the content data. I'm going to do a test with preprocessors this weekend and see what I come up with.

  • Hey guys, any way to do this for GOG as well? I'm not a coder and this guide has been super helpful for getting Steam achievements working. But has anyone figured out a method for GOG achievements?

  • I'm getting fatal console errors trying to use this script (using Unity 2019.4.21f1 and AC v1.65.2)

    ActionUnlockAchievement.cs(21,34): error CS0115: 'ActionUnlockAchievement.Category': no suitable method found to override

    ActionUnlockAchievement.cs(22,26): error CS0115: 'ActionUnlockAchievement.Title': no suitable method found to override

    ActionUnlockAchievement.cs(23,26): error CS0115: 'ActionUnlockAchievement.Description': no suitable method found to override

    I think this has to do with custom actions being scripted differently since 1.65.2, but when I updated AC to 1.75.5 a lot of stuff broke.

    I restored from a back-up (containing AC v1.65.2)

    Can you help me getting this script to work with v 1.65.2?

  • edited July 2022

    I was able to get this script from throwing errors by removing "override" (ie override public ActionCategory...) for those 3 lines of code. However it's not appearing in the Actions Manager properly. Any help would be appreciated. Thanks!

  • The Actions system was re-written in v1.73 - this page covers the changes.

    It looks like Alverik's post on the first page of this thread features the Action code in its original, pre-1.73 state.

  • Thanks for that link. I have several games and each with various versions of AC. It’s good to have this information for updating my custom actions.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.