- Nov 16, 2015
- Reaction score
- Primarily Uses
Quick and Easy Steamworks Achievements Integration for RPG Maker VX Ace r7
This script allows you to use Steam achievements from your game. It needs no intermediary DLLs, only a recent version of the Steamworks DLL.
- Set/clear achievements
- Get/set player stats
- Supports average rate stats
- Get achievement state and unlocked time
- Enumerate achievements programmatically, get their display name and hidden status
- Reset all stats and achievements
- Check game ownership
- Check if a DLC is installed
- Updated script for Steamworks SDK 1.48.
- Relicense under MIT License
- Updated script for Steamworks SDK 1.43.
- Automatically retrieve stats on init.
- Added indicate_achievement_progress method.
- Updated script for Steamworks SDK 1.37.
- Fixed pointer return type on DLL imports.
- Added app is subscribed and DLC is installed methods.
- Added get methods, stats set methods.
- Tested in RPG Maker, fixed to make the script actually run.
- Initial version, written for Ruby 2.2.3.
How to Use
- Download a recent version of the Steamworks SDK (>= 1.37), and put its steam_api.dll into the root of your project folder.
- Add the script into the script editor.
- In the event or wherever else you want to set an achievement, add the following code:
steam = SteamUserStatsLite.instance steam.set_achievement 'YOUR_ACH_ID_HERE' steam.update
- If you want to set a stat, use this code:
steam = SteamUserStatsLite.instance steam.set_stat 'YOUR_STAT_ID_HERE', 100 steam.update
- The #set_achievement and #set_stat methods return true when the achievement/stat has been set succesfully. If it returns false, see the FAQ for more information.
Please see documentation on GitHub.
This demo was created by Miller Berto. Create a default RPG Maker project, and extract the contents of the ZIP file into the project folder. Please replace the SteamUserStatsLite script with the latest version.
The version to download depends on which version of the Steamworks SDK you want to use. Different versions of Steamworks SDK have different and sometimes incompatible ways of calling its functions, so you need the correct script to have it use the SDK correctly.
- Steamworks SDK v1.48 and above: r7
- Steamworks SDK v1.43 to v1.47: r6
- Steamworks SDK v1.37 to v1.42: r5
- Steamworks SDK v1.32 to v1.36: r3.2
Licensed under the MIT License, which means you can do anything with the script as long as you include the copyright notice.
Q: #set_achievement/#set_stat returns false. What's wrong?
A: It means either you haven't set up the achievement in the Steamworks partner site or you were playtesting through RPG Maker.
Because the playtesting game inherits the Steam context from RPG Maker, your achievements won't be found. If you launch your game directly, it should work. I recommend you add a steam_appid.txt file with your app ID during development so you can just launch the EXE and Steamworks will set the right context. If you have a steam_appid.txt file present, you can also launch RPG Maker by double clicking your project file, and the app ID would be set to yours so you can test achievements through playtesting from RPG Maker.
It could also be possible that Steamworks wasn't able to initialize. Check SteamUserStatsLite#initted? to see if Steamworks was initialized successfully.
Q: #set_stat is returning false, but I've already checked that Steamworks was initialized and the stat added and published on the Steamworks partner site. What do I do now?
A: #set_stat can take both Integers and Floats. Make sure when you're passing in the value, you have it converted to the type corresponding to what you set on the Steamworks partner site.
Q: I'm getting a RuntimeError telling me something about GetProcAddress.
A: You need to use at least Steamworks SDK 1.37 for this script to work. Download a newer version of the SDK.
Q: My game crashes when I try to call a Steamworks function. I'm using Steam DRM.
A: There is a compatibility problem with Steam DRM. So don't use it. Not as if it'll actually protect your game. It only gives you an illusion of safety, while in practice is practically useless for protection.
Q: I'm using r3.x, should I upgrade?
A: r4 is functionally the same as r3.2. If you do not need to use the latest Steamworks SDK, you do not need to (and probably should not) upgrade.
Credit and Thanks
- Created by cyanic
- Thanks to Miller Berto for letting me use his game as the testing grounds for this script.
I'm actually a complete RPG Maker noob. I wrote this yesterday on pure Ruby 2.2.3, and only got a copy of RPG Maker VX Ace this morning to test and fix problems.