OnPlayerGiveDamage / TakeDamage
#1

Alright so I got a bit of an issue. I'm making a death system, you know the whole you die then appear on the ground "dieing" you accept death etc etc, but I want the user to still be able to take damage whilist on the ground, so my first thought was use an animation, as you still take damage while in one.. but for example "crack" you can just punch and get out of the animation, so then first thing comes to mind is to use TogglePlayerControllable, so I've done that and we all know you don't take damage when thats toggled, so I'm using OnPlayerGiveDamage to replicate the user taking damage, but I have to use SetPlayerHealth, so when the user dies I have to use OnPlayerDeath in the callback, But that is.. Buggy to say the least, when I use that, the person just chills there and eventually goes away.

Anyways, sorry for the wall of text.. my main question what are some ways to do this? and by this I mean have a player either be frozen on ground and still take damage, or how I can use OnPlayerGiveDamage properly and still have the kill be processed correctly through OnPlayerDeath.

Thanks,
PrawkC
Reply
#2

Set them to 1 health using OnPlayerGiveDamage instead of 0, so the OnPlayerDeath callback isn't called?
Reply
#3

I do a check if their health minus the damage is equal or less than 0 than it just calls OnPlayerDeath
Reply
#4

Your going about it all wrong, you need to create your own OnPlayerDeath() callback, then call it from OnPlayerGiveDamage / OnPlayerTakeDamage now there is a problem with this unless you set everyone to the same team there is a possibility that the shot will also sync on their screen resulting in double damage. There is a way around this by waiting 300ms to see if the player has taken any damage in that time if so then don't issue the GiveDamage if they're dead send a message to your OnPlayerDeath() of course this would be named something like OnPlayerDeathByPass() as your OnPlayerDeath() callback should just return 1. You will also need to mark the player as dead with some variable then check on each death with OnPlayerStateChange() just in case the death was not registered correctly which can happen, in which case you would call OnPlayerDeath().
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)