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:
I’ve been banging my head on my desk for over a week now trying to figure this out. My extremely limited c++ knowledge isn’t making it any easier either.
The Steam overlay is set up and working fine (after altering the defaultengine.ini) along with achievements and leaderboards (through blueprint nodes).
This one explains it a little bit but I’m still missing something.
Any help on this is greatly appreciated, thank you.
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.
Oh interesting. If you just do Pure it’s essentially a Get function and shows up like a variable. Didn’t know that. But if you want to pass in parameters, add the Callable one.
So it works with the ftext however I’m having trouble getting it to work with a bool. Something’s off since it’s failing to build. The code is in the second half of my since updated post. Thanks!
Note: I replaced AppId_t with int to get it to compile. I assume you need to include a header to get that typedef defined. It may not be usable in a blueprint function though.
I don’t see it in the UE4 source. What’s that about?
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:
.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "isteamapps.h"
#include "GameMode_DLC.generated.h"
/**
*
*/
UCLASS()
class MYGAME_API AGameMode_DLC : public AGameModeBase
{
GENERATED_BODY()
UFUNCTION(BlueprintPure, meta = (DisplayName = "DLC 1", CompactNodeTitle = "DLC1", Category = Game))
static bool BIsDlcInstalled(appID_t appID);
};
Just remember this is the blind leading the blind. I’ve never used Steam so I’m flying by Google. That video I linked probably has good info. That said, here we go:
First, you need to remove #include "isteamapps.h" and add these includes:
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.