Player Hurt (to target)
Script types: All
Getting target type, damage dealt, damage type, etc.
yes, my VOTE ! i really think we need more events to keep coding alive and stuff
HookReturnCode onPlayerHurt (CEntityDamageEvent@ ede) { ede.GetVictim(); // in this case, always a Player ede.GetDamageType(); // fire, poison, crush, etc ... ede.GetDamage(); // int ede.SetDamage(int); // <<-- THIS can change the outcome or even negate the event ede.GetAttacker() // entity (or null if falldamage etc was the cause) ede.GetCause() // new Enum: WORLD, TRIGGER, PLAYER, NPC, SCRIPT, ... }
NOW you can do nice stuff like server side difficulty, on TOP of map difficulty balance, without interfering:
float difficulty = 0.5f; // easy float difficulty = 1.0f; // normal float difficulty = 2.0f; // hard
HookReturnCode onPlayerHurt (CEntityDamageEvent@ ede) { if ( ede.GetCause() == DamageCause.NPC ) ede.SetDamage( ede.GetDamage() * difficulty ); }