Projectile type problem

Hey people… can someone tell me why wont this work… I dont get it

First person Template

Duplicated the projectile blueprint, then changed the Character bluprint to point to my Projectile2 (no issue there)

Now I added 3 different particule effect to the my new projectile blue print and I want to change the shown component by pressing 1 or 2 or 3

I am trying to do this by only hidding or showing the particles by using the keys but it only show the default one and changing the particles that are already launched

how can I do this please someone

there is my blueprint

Thx for your help

Once the projectile is spawned, it’s no longer controlled by your pawn, and does not receive key input command from you.
you could however passing message to your projectiles so they can change things themselves.
For these topic search for blueprint communication.

Thx for your input but

It does the contrary of what you are saying… the particle do switch but only in the projectiles that are already been launch and I have to spam the number for the particles to switch to what I want

I just want to set the visible particle using 1 2 3 and keep it constant to that un toll I press another button

Still, I will look up the communication blueprint you are talking about
Thx again

Anyone else??

you mean all of the projectiles switch at the same time? that would be a bug for sure.
because only one level object at a time can get input event.

if you want set before you fire, try control your visibility with 3 bools and tick expose on spawn.
then you can use your pawn to set those 3 bools to decide what type of projectile to fire.

Are you sure about that 1 input oject at a time, Penguin? I haven’t tested it in UE4 yet, but I am pretty sure that serveral objects can get input form one controller unless you “consume” the input event in an object.

Anyways, to topic: You should just handle the input information in the object that spawns the projectiles and then pass the values via an init function after spawning them.
In the Projectile you then put the code you have in BeginPlay to the Init-function and you are done.
I usally write Init functions for my dynamically spawned Blueprints, so I can just init them after spawning with the given parameters.

So again:

  • Handle the input in the class that spawns the projectile
  • Spawn the projectile
  • pass the stored values via an init function to the spawned projectile
  • handle activating/deactivating of particles in the Init function

You are right PenguinTD. Only the last projectile I shoot change to what I want and it make sense. I get it now that pressing the key apply the visibility on the last actor and does not change the default value of it.

I will try your boolean solution and let you know how it goes.

Thx again

@DennyR, in OP’s case he use actual input keystroke events, so only whatever latest level object have input enabled are taking the input.
Of course you can control several objects from one controller, but that’s not the issues here.

For those interested, I finally managed to do it ( I had to stop trying to make visible and not visible a possible solution… which was stupid anyway since I couldnt change the value of the different elements without affecting all of them)

So instead, I created 3 Projectiles Blueprint… one for each effect (spark, Fire, Smoke)

Went into the MyCharacter blueprint and added a class variable pointer for each projectile blueprint

Then, I created an empty class variable that have spark as the default value but that can be set by input 1 2 3

Assign that class actor to the projectile SpawnActor

And Voila… really simple and quick way to spawn different type of projectile using 1 to 9

Thx both of you helping me see the light!! And I hope this can help others (other noobs like me who does this only for fun)

Here is my blueprint screenshot ( Extra: I added another thing I managed to do which complement the Projectile choice very well… It is a Firerate delay (to change from machinegun style to slow magnum .44 style… I called it Trigger delay)

d41acacd9774b9e5eee5ea8c346f6856834cda8b.jpeg

Me again… I cant believe the secret was all in promoting to variable

It suddently open tons of possibility… changing the sound, changing the weapon mesh, … everything seems so simple now. I added specific sound to each weapon just by promoting to variable ( Some of you experts and not so experts must be looking this post thinking “Wow… Welcome to blueprint 101”

Haha anyway… that made my day! Cheers

e42db050fb2032e751065206629eb0d2b0a366c6.jpeg

Pretty much every one learn this way if not have previous experience.
Also, it is possible to combine all 3 projectile into just one blueprint if particle visibility is some of the differences.

Cheers!