on hit
The hit
script event is sent by the damage source to NPCs and props when the the entity is damaged. ^¶m1
will be set to the damage received by the entity while ^$param2
is set to the weapon type if the damage source is the player: spell
, bare
, dagger
, 1h
, 2h
, arrow
or (for NPC targets only before Arx Libertatis 1.3) summoned
if the damage is from a summoned entity. In this case, the event ^sender
will be the player
.
With Arx Libertatis 1.3 or newer, ^$param3
holds the spell ID or entity ID of the weapon or summoned entity used to inflict the damage and ^$param4
specifies the damage type flags as used in the dodamage
and damager
commands:
f | Fire |
m | Magical |
p | Poison |
l | Lightning |
c | Cold |
g | Gas |
e | Metal |
w | Wood |
s | Stone |
a | Acid |
o | Organic |
r | Drain life |
n | Drain mana |
n | Push |
Spell IDs are made up of the spell name followed by _
and then a unique instance number. Use the if isin
command to check for spell or damage types:
if
fireball isin ^$param3 { // Hit by a fireball }if
l isin ^$param4 { // Hit with lightning damage }