Download

Projectile Speed Change..

OK everybody here is the dilemma. I have Projectiles setup to where that they shoot at the target and you get points for every Projectile you catch.
And i had this Idea where after you reach a certain score amount the Projectiles will start shooting Faster and keep increasing in speed every time
you reach a certain score?

And i was wondering if there was simple setup to accomplish this or would some thing like this require a complex Blueprint setup?

Any Advice or input on this matter would as always be greatly Appreciated…

Inside the Projectile Blueprint, you can create a variable called “Projectile_Speed” and set it to Expose on Spawn, right on the variable details window.
That will make your Spawn node to show the “Projectile Speed” parameter for you to set. So, right after you do this, you can add inside your Projectile Blueprint, in the Begin Play, to set the projectile initial speed equals to the “Projectile Speed” variable.

To change the Projectile velocity you must get the ProjectileMovement component and set it’s “Initial_Speed” variable.

But how do you bind the Projectile Speed Variable to the Projectile Movement component Initial_Speed setting? I guess this was my Original question. I should’ve explained it better. I have it working, it just doesn’t change the setting’s Speed it only changes the numbers in the Variable. And the original speed never changes. Also when it reaches the Target Score to Speed up, it only fires once?

I would store the desired projectile speed in the savegame. Then from the actor which is the projectile to load the savegame data and set the speed via the BeginPlay node or construction script.

I’ve made it work here in this way:

First, go to your **character **blueprint and add those following variables:

  • Initial_Projectile_Speed_Multiplier;
  • Projectile_Gradual_Increment;

The first one will be used to multiply the projectile velocity, and the second is a constant increment value that will be used everytime you want to increase the multiplier.

Ok, now we have our own multiplier inside the character BP. This variable will be used to set the projectile speed when we spawn it by firing.

Now in **Projectile **blueprint, add this variable, mark as editable and expose on Spawn:

Inside the Projectile BP, on the BeginPlay Event, add this:

The “Projectile” variable is the Projectile Movement Component reference.

We are almost done, you just need now to adjust the value of the multiplier in Character Blueprint and set it when you spawn the projectile:

Follow this guide and tell me if it worked.

If you want to ADD a value to the velocity (not multiplying it), you need to change this inside the Projectile BP:

The Forward vector in this case is normalized to its relative forward direction, treat it like your velocity unit. Multiplying it will result in ‘x’ units of velocity, which you can add directly to your current velocity.
Again, tell me if it has worked for you.

Hey man sorry i took so long to get back to you, i had set this aside to work on other parts of my project. Those are done and now i am back to this. and now that i have had time to think about it. I was thinking instead of having it increase when the player hits a target Score. i wanna have just it increase in speed every time the projectile is spawned. so for example when you press play the first projectile will fire at 500 units then the second will fire at 1000 units the third at 1500 units and so… How would i be able to set the speed as it keeps increasing/

Sounds easy: make a counter and increase it after each projectile spawn. That counter will act as a multiplier, so everytime you spawn one projectile, multiply the initial projectile velocity with the counter and add +1 to the counter, following those steps I’ve posted above.

It can help me !!!
I also don’t recommend setting (Delay) after (Component activated). It will ruin everything.

FYI - Since ProjectileMovementComponent reads InitialSpeed in UProjectileMovementComponent::InitializeComponent, any changes you make to InitialSpeed must occur in the Construction script and NOT in BeginPlay. (BeginPlay is too late, as the component has already been initialized)

Just ran into this issue myself and figured I might as well update the thread…

1 Like