Skip to content
Wngui edited this page Feb 17, 2025 · 1 revision

Bonus Damage

Bonus damage can be applied during EventPlayerHurtOther events by calling the extension method directly on the event:

private void PlayerHurtOther(EventPlayerHurtOther @event)
{
    var bonusDamage = 10;
    @event.AddBonusDamage(bonusDamage);
}

You can also specify additional parameters such as armor damage and a custom killfeed icon.
Unlike TakeDamage(), bonus damage preserves kill effects like jump shots, wall penetration, and more, making it a more dynamic option.

Take Damage

You can directly apply damage to any player from anywhere in your code using an extension method available on every player controller:

private void SomeMethod(CCSPlayerController victim)
{
    var damage = 5;
    victim.TakeDamage(damage, Player);
}
  • victim – The player receiving damage.
  • Player – A hidden property in your class that refers to your own player controller.

Additional parameters, such as a custom killfeed icon, are also available.

Explosions 💥

Who doesn’t love a good explosion? The mod provides an easy way to spawn on-demand explosions:

var explosionPosition = victim.PlayerPawn.Value.AbsOrigin.Clone().Add(z: 5);
var radius = 500;
var damage = 200;
var attacker = Player
Warcraft.SpawnExplosion(explosionPosition, radius, damage, attacker);

Ignore Damage

If you're creating a block or evasion ability, you can prevent incoming damage using the IgnoreDamage() extension method on EventPlayerHurt:

private void PlayerHurt(EventPlayerHurt @event)
{
    @event.IgnoreDamage();
}

This will completely block the incoming damage for your hero. You can also specify a set amount of damage to block instead.

Clone this wiki locally