Right now my blueprint is like this
But it doesnt work well cuz if i am inside of enemy after 1.5 seconds it just pushes me out instantly and it looks bad, how can i fix this?
Right now my blueprint is like this
One thing you could do is setup a custom collision channel for damage/attacks. That way you can maintain physical collision but have control over when/how often damage is distributed
thats not what i am trying to achieve, what i want is prevent the player to get multiple hits in a few seconds and dying instantly
Instead of working with the collisions (turning them on or off) add an IsInvulnerable bool and once you are hit set it to true. Start a timer that once it ends turn off IsInvulnerable.
Add a check for IsInvulnerable before administering damage. If the character is in it’s invulnerable state then do not do the damage if not then apply the damage as needed. (triggering the state and restarting the timer)
That would work but i also want my enemies to go past inside of my character after they hit it, making a platformer game so enemies dont have much ai, they just move and attack if the player too close to them, after they attack if there is no player they move on, that was the first thing that i want and the reason why i made it this way. So sorry for not telling this first.
Then perhaps switch the pawn reaction channel to overlap and use that in place of block. You can switch it back to block once the invulnerability phase is over and you are no longer overlapping the enemy.
I was actually trying something like that, if delay is over and also not overlapping but i failed to do “when overlap is ended” part, there is on overlap end events but failed to do so.
Are you using an event hit or overlap to trigger the damage? Using event hit will trigger multiple events so long as their touching, event begin overlap will trigger one, until they no longer overlap then overlap again. Can you post blueprints of all the functionality involved in what’s going on?
What’s I think is happening is on collision event, your turning off collision, after the delay when it turns back on, if they’re still overlapped or hit itstriggering another event. I think using custom collision channels and begin overlap events would get you the result your looking for
My enemies blueprint is like this
Also the collision on the enemies are not always active, they are only active when attacking so a few frame only