(MV/MZ) Discord Rich presence integration plugin

ODUE_discord

​
A plug-in for integrating your game with Discord Rich Presence (A.K.A Game SDK)





Please check the Github readme for an updated guide:
https://github.com/00due/Discord-RPC-for-RMMZ/

It's easier for me to just update one page for both MV and MZ than editing the two posts on RPG Maker forums.
Issues should be primarily submitted to Github too! It makes them easier for me to fix that way. If you don't have a Github account, then you can submit them here too.

Or use the video guide:




FEATURES:
- The only Discord RPC plugin for MV/MZ available currently
- Highly customizable
- Edit the details in-game

TODO:
- Allow replacing text temporarily while in battle

GUIDE:

Requirements:

You have to use nwjs 0.49.2 or higher for this to work!
If you don't know how to update nwjs, check this awesome guide!

Download:
https://github.com/00due/Discord-RPC-for-RMMZ/ (Yes, the link is the same for MV version)

After downloading, extract the `ODUE_discord_MV.js` file into `<your project's folder>/js/plugins`

Initial setup:

0.If you don't have Node.js installed, install it from https://nodejs.org/en/download

1.Open the folder of your game (where you have your game.rpgproject in) and open CMD or powershell there.

2.Run the command `npm install discord-rpc`
---If you're getting an error Command not found or something like that, make sure you have Node.js installed!---

3.Go to https://discord.com/developers/applications and create your application. Click 'New application' and give it your game's name.
After creating it, open the Rich Presence --> Art assets tab, and upload the large and small images.
---Recommendation: The large image is typically the logo of your game.---
---WARNING: The art assets have about 10-15 minutes delay until they become visible.---

4.Copy the Application ID from the 'General information' tab, and paste it into the 'Discord application ID on this plugin.

5.Fill the other plugin parameters with anything you want.
REQUIRED TO FILL:
Application ID, Large picture, Large picture text, Row 1


Plugin commands for MV:
Code:
rpc_replaceRow1 <text to replace with>
- Replaces row 1
Code:
rpc_replaceRow2 <text to replace with>
- Replaces row 2
Code:
rpc_saveRows
- Save both rows for later use
Code:
rpc_restore <row1 / row2>
– Restores a saved row
Code:
rpc_enable row2
- Enables the second row
Code:
rpc_disable row2
- Disables the second row



Examples:

Code:
// On battle start
rpc_saveRows
rpc_replaceRow1 Fighting a monster
rpc_disable row2


// On battle end
rpc_restore row1
rpc_enable row2


WARNING: After exporting for MV:​

Move the folder node_modules from www/ folder to the folder where the executable is. Otherwise it can't find the node module.


Terms of use:

1. You must give credit to ODUE
2. You can freely edit this plugin to your needs. However, you must still credit me.
3. This plugin is free for commercial and non-commercial projects.
4. This plugin is provided as is. I'm not responsible for anything you make with this plugin.
5. You can send feature requests to me on platforms such as Reddit (to u/SanttuPOIKA----).
However, I have no obligation to fulfill your requests.
I have a question : (I'm on RMMV)

- Does the rich presence display when you test the game without exporting it ?

Moreover, I did everything in order. All seems to be done, but for some reasons when I launch the exported game without forgetting to move node modules, nothing happens on Discord, it detects nothing at all
It should show up on playtest.

Can you show me your plugin parameters? I don't believe there are any issues with the status displaying on the current stable version of the plugin.
test.PNG

Here are my plugin parameters, note that the large image used is imported in the assets of the discord application, the name is correct as well as the application number
View attachment 278657
Here are my plugin parameters, note that the large image used is imported in the assets of the discord application, the name is correct as well as the application number
The only thing I can think that may break it is the ' symbol. Not sure if it's causing it, but it might be worth a shot to try to remove that and try if it works then.

However if not, can you send me a screenshot of the console when playtesting (F8)?
I removed every unconvenient symbol, it's still not working, here is the console extract :
I only have the length fail error.
test.PNG
I removed every unconvenient symbol, it's still not working, here is the console extract :
I only have the length fail error.
View attachment 278708
Do you get that error (in red) if you're not using this plugin?

What you can also try is disabling other plugins to check if there are any conflicts. If you do find one, I'll make sure to fix it as soon as possible.
Okay, I have feedbacks. My problem was that I forgot to update nw to 49.2. However, now that I did everything, when I test launch the game, the test windows appear briefly and then disappear. If I deactivate your plugin the problem disappear and the windows doesn't close itself. Do you any ideas to fix this ?
Okay, I have feedbacks. My problem was that I forgot to update nw to 49.2. However, now that I did everything, when I test launch the game, the test windows appear briefly and then disappear. If I deactivate your plugin the problem disappear and the windows doesn't close itself. Do you any ideas to fix this ?
Hmm, I haven't heard of anything like that before, nor I have any idea what's causing it. That's pretty difficult to debug from your end too.

Just to make sure, are you using Windows and you have Discord open when doing this?
(Even if not, the window shouldn't just close...)
Yeah I'm on windows and Discord is open. I'm sure it's coming from somewhere in the plugin or how the plugin works because without the plugin the play test starts as normal.
Yeah I'm on windows and Discord is open. I'm sure it's coming from somewhere in the plugin or how the plugin works because without the plugin the play test starts as normal.
I've updated it to make it run inside its own function, so that it shouldn't cause any issues with other plugins. Please try this: https://github.com/00due/Discord-RPC-for-RMMZ/archive/refs/heads/next.zip
(This is a beta branch, and thus the MZ version is broken. MV should work, though.)

If that doesn't fix it either, try this older version: https://github.com/00due/Discord-RP...25c709a15df50c4b657bf9f967/ODUE_discord_MV.js
Thank you for your time, i'll try it in a few hours when I come home and update you !
I tried it, none of the versions works. I think the problem is coming from my end. To clear things up when you updated nw did you put it to version 0.49.2 or higher ? Also did you update only the windows files for nw ?
I tried it, none of the versions works. I think the problem is coming from my end. To clear things up when you updated nw did you put it to version 0.49.2 or higher ? Also did you update only the windows files for nw ?

I'm personally using 0.64.1 (for now, planning to upgrade in the future) on MZ and it works fine. I've been in contact with other people using the older MV version that I linked to you that are using 0.49.2, and they've had no problems.

I'm using the Linux version of nw myself, but if you're on Windows, that's the only version you'll need.
I have a question @ODUE. Could you make like a video tutorial version on how to do this?
I have a question @ODUE. Could you make like a video tutorial version on how to do this?
Yeah I'll try to make one this week. I'm pretty busy so I'm not able to make it today.
I have a question @ODUE. Could you make like a video tutorial version on how to do this?
The video is now uploaded to this plugin page.

Original thread: https://forums.rpgmakerweb.com/threads/mv-mz-discord-rich-presence-integration-plugin.160185/