Forum rules - please read before posting.

Steam Achievements with AC

2»

Comments

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

    I've got this script as a Custom Action, I've got Steamworks.net 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 itch.io, 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?

    Thanks!

  • @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.

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.
Do NOT follow this link or you will be banned from the site!