How can I SET a variable in a Blueprint Component?

I am trying to add to a variable (or change the value of a variable) that is located in a Blueprint Component.

Setting the variable
In this image I am in my “ObtainDash” blueprint and my “LootTable” blueprint component is a component of this “ObtainDash” blueprint. I am using said component to get the map variable (the loot table) and add a actor/float to the loot table variable.

Variable settings

How the variable is implemented/tested
I can test that the value is not being added to the variable as each time this actor is spawned it reads out it’s available drops.

1 Like

I’ve tried that and it does set the variable properly in my “ObtainDash” blueprint.

How can I check if they’re different instances? And if they are, how can I make it not different instances?

Thanks!

1 Like

Try adding a display to the cast failed and make sure it is not failing the cast. Also do a display on the First Person Character and make sure you are setting in character you are expecting. And then in the second graph where you are referencing do a display on the character again to make sure it is still the same character. If this is in the character BP and can use the self reference to get the BP Character instance name

2 Likes

Hi, I try to make a game using RPG rules … In order to hit an enemy, I use function with variables and result ToHit has to be > or = to EnemyArmorClass. Problem is I cannot connect EnemyArmorClass to TopdownCharacter … Someone can help ? Thanks

It’s my Enemy blueprint, it also contains the LootTable blueprint component.

It seems like maybe the node that is adding the value to the map (again, from within the ObtainDash BP) is only setting it for a single instance, which I assume would be the instance in the ObtainDash BP. Is there a way to set it so that ANY blueprint who has the LootTable blueprint component uses the new value?

idk what blueprint is the last image? if its the same obtaindash and youre getting loottable the same way then it should be the same, otherwise different, but idk how to make them the same (im a ue novice). i guess youd just have to find a way to share the data between the two blueprints

Thanks both of you … I will find out a solution !

FYI in case anybody finds this post in the future the solution I used was to just store the Blueprint Component I wanted to affect in the player character (game mode or level could work too) as it’s easy to cast to from anywhere. Once casted to you need to use the out actor to get the character, then out of that character you can get the Blueprint Component which you can then get/set from.

2 Likes