I can’t find an example anywhere of exactly the right way to implement a Steam c++ command into an all BP project as a BP node. There’s broad documentation scattered about but nothing specific enough. Really the one I need to figure out the most is this:
bool BIsDlcInstalled( AppId_t appID );
Here’s the documentation with the command I’m trying to call:
Sorry you’ve had so much frustration. It’s a constant state for UE4 developers cuz there’s always something you don’t understand.
Anyway, the easiest thing to do is to use a C++ base class for the blueprint you need to call this Steam function from.
So your blueprint is derived from X (like AActor or APawn). You want to create a C++ class derived from that same class. Then you want to create a UFUNCTION() that is “BlueprintCallable” and call the Steam C++ functionality from there. On the other side, you want to reparent your blueprint to your C++ class. Now you can call your C++ function from your blueprint (you get a new node to use).
If you need the function to be called from multiple classes then you can put the UFUNCTION() in your GameMode. The static version of UFUNCTION)() can be called without requiring the GameMode object. Static functions don’t have to be in the GameMode but it’s where I put mine cuz it’s sort of global in a sense. Or maybe the GameMode is where you want to call it from, which works out just like if it was an AActor (i.e. same as the steps above)
Thank you so much for this. I had to walk away from it for a while to let things soak in and have made it most of the way. The game mode has been successfully re-parented to a c++ game mode class. I successfully created a blueprint node (blueprint pure text) using this guide:
I’m having trouble setting up the code to retrieve the Steam bool function result.
It always returns true because it says “return true;” in the function. We just did that as a first step. Now you need to use the Steam functions to detect if the DLC is there. If Steam says it’s there then return true. If Steam says it’s not there then return false.
It looks like you have to set up the Steam online subsystem in UE4 and then you can #include “isteamapps.h” to get access to BIsDlcInstalled(). AppID_t is just a uint32 so you can set up your blueprint node to take in a uint32 and give that to the BIsDlcInstalled() function. Get back the bool result and return it. Pretty straight forward. I think the hard part will be setting up Steam in the first place.
Thanks for your reply. Like I said before, already got Steam set up and working. It’s just this one c++ snip it that’s giving me trouble since the whole project is blueprints. I’ll try to dissect what you said to alter my code to do that.
It’s alright, I really appreciate the help. Considering using an alternative method for DLC since my c++ knowledge is so limited. Here’s some errors I’m getting and my latest attempt at the code. It still needs to be fixed so it doesn’t always return true. It’s also having trouble accessing the isteamapps.h and appID_t is undefined:
class MYGAME_API AGameMode_DLC : public AGameModeBase
UFUNCTION(BlueprintPure, meta = (DisplayName = "DLC 1", CompactNodeTitle = "DLC1", Category = Game))
static bool BIsDlcInstalled(appID_t appID);
That may not be the cleanest way but I can’t find anything saying how to do it (had to go through the engine source).
Then, change the parameter type “AppId_t” to “uint32” of the blueprint function in both the h and cpp files. That should get it to compile.
Then you need to get the interface to the steam subsystem. Once you have that, you should be able to call Steam’s BIsDlcInstalled() and return the result you get. I’m not sure how to get the interface yet. Hoping you know that part already.