OnNPCDamage

From Onset Developer Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
OnNPCDamage

Type: Event
Context: Server
Introduced: v1.0

Description

Event thats called when a NPC is damaged.

Syntax

OnNPCDamage(npc, damagetype, amount)

Parameters

  • npc
    The NPC who is being damaged.
  • damagetype
    Type of damage applied.
  • amount
    Amount of damage applied.

Example

function OnNPCDamage(npc, damagetype, amount)
	local DamageName = {
		"Weapon",
		"Explosion",
		"Fire",
		"Fall",
		"Vehicle Collision"
	}

	print(npc.." took "..amount.." damage of type "..DamageName[damagetype])
end
AddEvent("OnNPCDamage", OnNPCDamage)

See also