Killing the AI HELP

Hello,

I am in a serious stub here I can not figure out how to kill the AI I know how to make the AI kill the player but I have no idea how to get the Player to Kill the AI I tried multiple things with little success.

Does anyone know how to do this as Easy as possible or just know how regardless of difficulty? I tried to do this for months and I just cant do it.

This is the only thing holding my game back and as long as I get this to work I’m stuck in Development Hell.

Please help I’m in need of it.

  • Ernesto

Depends on your Gameplay.

Just some quick example.
lets say you fire with a gun at your enemy.

on your player
you do a line trace, if it hits you use “apply damage” with X Damage you your enemy.

on the enemy, you use the event “on damage” where you could take the applied damage and subtract it from a health variable and check if the health is 0 or lower than 0 and if its true you call “destroy actor”

I see now what I did wrong it turns out that the entire time I was not using LineTraceForObjects and I was using LineTraceByChannel which was the fatal mistake.

So the goal is for the character to get close to the enemy with a Forward vector by around 120 and to press the X button to pull off the attack and kill the enemy, I followed what you told me and i saw the Object Types and remember something about that involving Pawns and this ended up working just fine.

I’m amazed how easy this was despite the pain i went to get it to work in the past. Thanks man this was great help!