Skip to content

Interface:Creature Events

Stefan A. Brannfjell edited this page Dec 19, 2017 · 2 revisions

These events run whenever something happens to a creature and/or player.

Available events:

onAdvance()
onDeath()
onExtendedOpcode()
onHealthChange()
onKill()
onLogin()
onLogout()
onManaChange()
onModalWindow()
onPrepareDeath()
onTextEdit()
onThink()


onAdvance()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onDeath()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onExtendedOpcode()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onHealthChange()

Description: This event runs each time a (registered) creatures health changes.
Parameters:

  • creature - Creature userdata of the victim
  • attacker - Creature userdata of the attacker, can be nil
  • primaryDamage - First part of the damage (always a positive value)
  • primaryType - First damage type
  • secondaryDamage - Second part of the damage (always a positive value)
  • secondaryType - Second damage type
  • origin - What were you hit by? A spell? Melee?
Accepted return values: 2 or more values must be returned otherwise the event will be cancelled.
return 5, COMBAT_FIREDAMAGE, 5, COMBAT_PHYSICALDAMAGE

Example:

function onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType)
	if not attacker then
		return 5, COMBAT_FIREDAMAGE, 0, COMBAT_NONE
	end
	return primaryDamage, primaryType, -secondaryDamage, secondaryType
end

Added in version: 1.0


onKill()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onLogin()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onLogout()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onManaChange()

Description: This event runs each time a (registered) creatures mana changes.
Parameters:

  • creature - Creature userdata of the victim
  • attacker - Creature userdata of the attacker, can be nil
  • manaChange - How much mana you have gained or lost (always a positive value)
Accepted return values: 1 value must be returned otherwise the event will be cancelled.
return 5

Example:

function onManaChange(creature, attacker, manaChange)
	if not attacker then
		return 0
	end
	return manaChange
end

Added in version: 1.0


onModalWindow()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onPrepareDeath()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onTextEdit()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0


onThink()

Description: N/A
Parameters: N/A
Accepted return values: N/A
Example:

N/A  

Added in version: 1.0