设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 95|回复: 0

[转载发布] cyanic's Steam Achievements Integration

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58751
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68660

    灌水之王

    发表于 昨天 16:22 | 显示全部楼层 |阅读模式
    Quick and Easy Steamworks Achievements Integration for RPG Maker VX Ace r7
    by cyanic


    Introduction
    This script allows you to use Steam achievements from your game. It needs no intermediary DLLs, only a recent version of the Steamworks DLL.

    Features

    • 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

    Changelog
    Spoilerr7 (02/25/20)

    • Updated script for Steamworks SDK 1.48.
    • Relicense under MIT License

    r6 (02/25/20)

    • Updated script for Steamworks SDK 1.43.
    • Automatically retrieve stats on init.

    r5 (08/08/16)

    • Added indicate_achievement_progress method.

    r4 (06/16/16)

    • Updated script for Steamworks SDK 1.37.

    r3.2 (03/12/16)

    • Fixed pointer return type on DLL imports.

    r3.1 (11/15/15)

    • Added app is subscribed and DLC is installed methods.

    r3 (11/15/15)

    • Added get methods, stats set methods.

    r2 (11/15/15)

    • Tested in RPG Maker, fixed to make the script actually run.

    r1 (11/14/15)

    • 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:
                      Code:       
      1. steam = SteamUserStatsLite.instance
      2. steam.set_achievement 'YOUR_ACH_ID_HERE'
      3. steam.update
      复制代码

      Replace 'YOUR_ACH_ID_HERE' with the achievement's API name from the Steamworks partner site.
    • If you want to set a stat, use this code:
                      Code:       
      1. steam = SteamUserStatsLite.instance
      2. steam.set_stat 'YOUR_STAT_ID_HERE', 100
      3. steam.update
      复制代码

      Replace 'YOUR_STAT_ID_HERE' with the stat's API name from the Steamworks partner site.
    • 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.

    Demo
    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.

    Script
    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

    License
    Licensed under the MIT License, which means you can do anything with the script as long as you include the copyright notice.

    FAQ
    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

    Author's Notes
    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.


    本贴来自国际rpgmaker官方论坛作者:cyanic处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/cyanics-steam-achievements-integration.50640/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-4 17:32 , Processed in 0.139329 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表