Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player Hurt (to target) #3

Open
fnky opened this issue Feb 9, 2017 · 2 comments
Open

Player Hurt (to target) #3

fnky opened this issue Feb 9, 2017 · 2 comments

Comments

@fnky
Copy link
Collaborator

fnky commented Feb 9, 2017

Script types: All

Getting target type, damage dealt, damage type, etc.

See CBaseEntity::TakeDamage and CBaseEntity::TraceAttack

@Martin-H2
Copy link

Martin-H2 commented Jul 13, 2017

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, ...
}

@Martin-H2
Copy link

Martin-H2 commented Jul 13, 2017

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 );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants