Giving each MultiGate projectile its own sound/emitter at destruction

Hi,

Currently I toggle the projectile by pressing R. (Note: the Current Projectile is defined as a variable):

283783-crr.png

So I can toggle them

But they all have the same explosion emitter with this setup

I suspect to change something in the last picture, but don’t know what.
Let’s say I want a Fireworks projectile. I toggle to it, destroy it, has fireworks emitter.
I want an EMP projectile. I toggle to it, destroy it, has a blue EMP explosion and radial force.

Any input appreciated!

assuming that your taking advantage of inheritance you could create a function in the base projectile and have children that inherit from the base. this function will handle all the needed script for the destruction of each projectile.

ok so first in your projectile base which i called bomb in the below pictures . here you create a custom event and do your destruction script. you mentioned emitters so thats what i went with. to handle the different emitters needed you would promote that pin to a variable, this will allow you to set the variable to different things in the children but run the same script. so fo the fireworks you set the variable to fireworks and it will inherit the script from its parent, then you would set the variable in emp to the needed emitter for that one.

In your character now you just need to have a script to handle calling the function in all of the projectiles. its pretty simple. from your input event you would get all actors of class (here i used the projectile type like you did). then you run a for each loop, and for each actor you call the destroy self event contained in the actor.

Hey thanks for your recent answer(s), I will try them out soon and mark it properly, as I dozed off and fell asleep.

Hello again,
I’m gonna try this now. Not sure if there is a base projectile with child logic; each projectile has its own BP and is simply set after the MultiGate to toggle since every projectile needs its own characteristics!

even with using a base class each projectile can be unique. think of a class like any category which can have sub categories. for example the base class could be human, then the child classes characteristics can be different from one another (race, hair color, gender, age, etc), but the base attributes remain the same (overall shape, genome, breath air). for your case you could make a base projectile class that has no attributes or defining characteristics, then the children that inherit would only have one common attribute and thats that they inherit from the same class. then each child projectile type can have its own functionality entirely if needed. though i would still put certain things in the base class as shown in the post above.

basically you want to have anything that will be common to all the projectiles in the base class likely including: mesh, projectile movement component, common custom events (even if the script is different).

Thanks Thompson.

Would I do this right?:

  1. I’d take a FirstPersonProjectile as the base projectile. This is the “bomb” (?). I will put your blueprint into it
  2. I’d create the parent class for it. Where do I do that?
  3. I’d assign your Blueprints to FPP and FPC.
  4. I’d create the child projectiles. Here’s where I can’t keep up… where do I define them as children?
  5. I assign the Destroy characteristics to each projectile which is the easy part, emitters and sounds.