Game Maker

Player Hit Entity

Triggers when a player damages a non-player entity.

This event fires when a player successfully damages any non-player entity (e.g., a Zombie, Cow, Armor Stand). This includes both melee and projectile attacks.

Action Values

  • Player: The player who dealt the damage.
  • Entity: The entity that was damaged.
  • Damage: A Number value representing the amount of damage dealt.

Event Configuration

  • Target Entity Type: Filter the event to only trigger when a specific type of entity is hit (e.g., only ZOMBIE).
  • Cancel Event: If true, the damage will be cancelled, and the entity will not get hurt.
  • Execution Mode: Control how often the event can trigger (e.g., Once Per Entity).

Use Cases

  • Creating a weapon that applies a special effect (like slow or poison) on hit.
  • Making certain entities immune to player damage.
  • Rewarding players for hitting a specific target in a minigame.

Example: A "Freezing Sword"

  1. Create Custom Item: Create a custom diamond sword named &bSword of Frost.
  2. Region: Select your main gameplay region.
  3. Event: Add a Player Hit Entity event.
  4. Actions:
    • Add a Conditional action.
    • Condition: Has Item -> check if the Player is holding the Sword of Frost.
    • If Actions:
      • Potion Effect: Target the Entity, apply SLOWNESS with an amplifier of 2 for 60 ticks (3 seconds).