My enemy doesn't die in new map

I have two maps in my project. The first one is the actual game (it’s just the basic level). The second map is a test level for my projectiles, fx etc.

Recently I was testing one of my guns against one of my AI enemies in the testing map. I was able to destroy my actor just fine. However, once I dropped that actor into my main map for the actual game, he won’t die. He isn’t taking any damage. It only works in the test map. Why might that happen?

Did you set up your gamemode in the new map you created?

what does the script look like that causes your enemy to actually die? and how are you implementing appling and taking damage? also where are the scripts (this is probable the important part)?

Above are the scripts inside the gun component.

Here is the event graph for the AI damage

So the only 2 areas are projectiles within the gun blueprint, and damage within the AI blueprint. There is nothing in the level blueprints so it’s not specific to just one level, it’s localized to just AI actor and the Gun actor. So it should work between maps/levels.

Yes I verified that my custom game mode is correct and consistent across both levels.

your blueprint is in my opinion overly complex and has many redundancies. also i dont see anything in particular here that would cause things to work in one level or the other unless you have different classes or collision settings in one of the levels.

now as for some of the issues here, first the way your handling damage isnt optimal you should leverage some of the functionality built into the engine by using the apply damage and event any damage nodes. using these two will make it super easy to handle damage. also on that note you should have the apply damage scripting in the object or character that will be applying the damage so in your case you could have it in the projectile as seen in picture 2 below. for the receiving damage you can use the event any damage which is called anytime the actor takes damage and the script that follows it is alot like what you already have. this system makes things easier because it has built in communication between the damage dealer and the damage receiver so no casting or getting references needed (unless you want to of course), it also eliminates the need for the on tick script that you have (it wasnt a useful script anyways since you already check health when its decremented). a last note on the damage and health aspect, you should use your events more consistently as in the case with handling the characters death. on overlap you were calling destroy actor but on tick you called a death event, i would pick one and stick with it so its easier to change and modify later (go with the event imo).

i see that you were using a line trace to create a explosion at impact, for this i would again implement this on the projectile which simplifies things. its simpler this way since you already know the location to spawn at (the projectiles location) and you will have the perfect timing (on hit).

pic1 character
pic2 proj

I removed all of the redundant blueprints. It’s cleaner yes, but it still does not address the issue of why the actor dies in one level, but doesn’t in the other.

I am starting to think it is a collision issue. In the testing map, I can shoot enemies from very close all the way up to about 1000 meters. But as soon as I play the game, it only kills enemies at point blank range, almost right in front of the barrel of the gun. I can no longer shoot enemies at a distance.

Basically I’m shooting enemy aircraft from a stationary position with a mounted machinegun (turret style).

do you get any overlap results? try putting a print string just before and after your cast on the overlap event (im assuming your codes the same). this will show if theres an overlap event which there should be since you say that you can damage at point blank range. is there an other actors that could be interfering with the shots like a blocking volume of something in the way? could you post your project file so we could test it ourselves?

I have a solution now. I tried searching for some sort of obstacle but it didn’t work. I stripped the scene down to the minimum and it’s the same. So I duplicated the testing map just to try and start over, and that did not work either. Finally I just made my testing map the default and official game map, and everything works. There is something weird about this particular map that allows me to hit any of my targets. It couldn’t be duplicated or copied, so I literally just dropped all my assets into it. This leads me to believe there is something hidden in this map that is allowing me to do it.

So for now, everything is ok. I’ll still look into why, but it’s all good for the time being. Now that I can shoot my AI, now I have to make them fly. Right now everything is stationary, but it’s good for target practice :slight_smile:

Thanks for the advice on cleanup though, I’m sure that would have made things a lot worse down the road if I hadn’t fixed that.

WIP: WIP_Squadron on Vimeo