I’m trying to make a game where you pick up objects to go faster and faster. I’ve been trying to make it so that every tiem you pick the object up, it adds to your Max Fly Speed, but I’m not entirely sure how to do this. I assume I have to store MaxFlySpeed somewhere and then make the code add, say, 500 to it every time I pick up an object. So far I’ve only been able to reference Max Fly Speed + 500, and all that does it change the default speed to 1500.
Try something like this. Drag the CharacterMovement component out of the list on the left (Under Character), Drag the output node into a blank spot of the blueprint, then have it call Get Max Fly Speed and Set Max Fly Speed. Have it triggered by the event youre using (I just used the 0 key command for the example)
This is set up in the Character class. If you want the powerup itself to be responsible for setting the character speed, you can do it there instead. You’ll have to cast the to your character class and grab it’s attributes like this -
Sorry, that doesn’t work. It may be that I have this whole thing set up wrong. I’m still trying to learn Blueprints and the documentation is extremely sparse.
Right-o. So I’ve followed your script exactly, with an added event to destroy the pickup – Imgur: The magic of the Internet. The game I’m working on is based on the 2D template, and the character is controlled with the mouse in the x and y axes – Imgur: The magic of the Internet. And just for posterity, this is a sample of the type of level design I’m trying to accomplish, although I may remove the obstacles. (The flaming spheres are the powerups) – Imgur: The magic of the Internet.
Nope, didn’t work either. The graph shows the data is going through and it is definitely casting to the character and setting the speed, but no matter what I do my character does not go faster.
Interestingly, similar code works in another game template to set walk speed, so it likely has to do with the way the player character is handled in my game, and because of that I believe I’m going to temporarily abandon this project to work on another one. Thanks for your help though! I learned something today.