Help me make the poop bullet work!

Hi there!
I have a “bullet” Blueprint. When the bullet hits the only enemy, (BP_NPC02), it fires off a series of events. This works just fine in BP_NPC02.

What I want to do is create copies of BP_NPC02, (whic would be named named BP_NPC03, BP_NPC04 etc), and have those copies work in identiical fashion to BP_NPC02.

However when I duplicate BP_NPC02, the new BP_NPC03 while working in all other ways, does not fire off the series of events. And here, in the bullet BP, I think, is why:


So can anyone tell me how I might cast to ALL my NPC’s. Do I use an array or something?
Many thanks for reading my question :slight_smile:

1 Like

You just drag lots of copies of BP_NPC02 into the map.

Thanks for the reply ClockworkOcean!

I fully get what you’re saying. But say I want to have another enemy blueprint, for example BP_NPC03, which will have different mesh and properties, yet still have it execute the instructions that are currently casting EXCLUSIVELY to BP_NPC02 from INSIDE the Bullet BP.

Whenever I add a copy of BP_NPC02 to the map, it does not execute the instructions. Only the original BP_NPC02 executes those instructions, because in the bullet it is only casting to BP_NPC02!

1 Like

The second NPC_02 will be called something like NP_02_01 in the map. But they are both NP_02 class.

Have you set the event that’s starting this code to not consume input?

1 Like

For this you want to use parent/child classes. What I like to do in such scenarios is have a base_npc class, and from that I will create lots of child npc’s. Then, you can just cast to base npc and do the function, which will apply to all children.

image

You can do the events/functions that you want all of your npcs to have in the parent base npc class. Then the customized events can be done on children accordingly.

For example, lets say I want to set every npcs speed to a variable I’ve created called MaxSpeed & MinSpeed.
In the parent npc, I just do this:
image
And then when I want to change their speed, for example when they perceive a player, I just call this:

And each single child npc will have their speed set to MaxSpeed variable which I created. It’s important for you to understand, when you create a variable in a parent class, the child’s will have their copy in Class Defaults which you can play around with.

That’s how I would approach this! Best of luck.

3 Likes

isikdev! Amazing!
I created a childblueprint class of the NPC that worked, spawned it, and immediately I could see it perform exactly as intended.

You have opened up a whole new world to me. Thank you!!!
solved

2 Likes

You are very welcome! Enjoy haha. Childing stuff is amazing, and very useful at times.

2 Likes