-
Notifications
You must be signed in to change notification settings - Fork 12
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.
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.
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);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.
- Getting Started
- Setup Guide
- Your First Hero
- Event Handlers
- Damage
- Particles
- Warcraft Effects
- Props and Velocity
- Collisions and Triggers
- Ray tracing
- Advanced Geometry
- Sounds
- Custom Player Models
- Localization