I’m trying to create a system similar to the coins in Mario, I can’t work out how to add coins that add different amounts to the players total, I can provide screenshots of my blueprint if that would help. I’m sure I’m missing something obvious but I can’t find a tutorial telling how to do it so I am asking the experts.
Please be kind this is my first genuine project I intend to finish.
TY all in advance.
Hey there @LuciferAluc4rd
Let’s say that you have a character with which you run around. Now, when you come close to a coin you want to pick it up or add some coins to your coins. For this I added a function AddCoins inside my character BP_Character:
Now I can call this function and just have to insert the CoinsAdd. But how to? I created a blueprint of type actor and use this as my coin, called BP_Coin. I added these components:
The static mesh will be the coin mesh, the Sphere is a collision sphere which will react to my character when he overlaps the coin. The RotatingMovement lets the coin rotate. Now, when I run over the coin this happens:
The BeginOverlap gets triggered. Then, from the other actor(BP_Character ran over the coin) I cast to BP_Character to have a reference. From this reference I can call AddCoins and add the CoinsToAdd or just enter any number. After that I destroy the actor because I picked up all the coins. In the picture above you saw the integer variable CoinsToAdd. When you set this as InstanceEditable you can edit this value when you place it in the level. You can also create Childs of this blueprints by right-clicking the BP_Coin and select CreateChildBlueprintClass. Like this:
They all will have these input fields:
The Coins-which are set to InstanceEditable- but also a material. This material can also be set by you to give them a different look. With this:
Have a look at it and play around with it.
Coins.zip (909.3 KB)
Maybe it’s about converting, see if this makes sense: