[Tutorial] How to prevent damage
#7

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
That code just reverses the damage, and it doesn't work, look at this example:
Say the player that got hit has 30 HP.
The damage dealt was 40, killing the player.
Then the callback is called with your code which sets his health back to 30, but he's already dead because the callback is called after the damage is already done.
Time ago I had made an anti-tk system OnPlayerTakeDamage and happened just that! The player received a greater harm than his life and ended up dying.

So I used OnPlayerGiveDamage and it did not happen, the player did not die with a greater harm than life itself!
Of course I used conditional to check the team and still worked.

Verification of the callback seems to be much faster.
Reply


Messages In This Thread
How to prevent damage - by Manyula - 04.05.2016, 10:47
Re: How to prevent damage - by Wolfe - 04.05.2016, 11:54
Re: How to prevent damage - by CalvinC - 04.05.2016, 12:14
Re: How to prevent damage - by Wolfe - 04.05.2016, 12:17
Re: How to prevent damage - by F1N4L - 04.05.2016, 12:25
Re: How to prevent damage - by CalvinC - 04.05.2016, 12:33
Re: How to prevent damage - by F1N4L - 04.05.2016, 12:45
Re: How to prevent damage - by SyS - 04.05.2016, 14:45
Re: How to prevent damage - by Manyula - 04.05.2016, 16:19

Forum Jump:


Users browsing this thread: 1 Guest(s)