1.3 KiB
1.3 KiB
Function: DamageSpawn(attacker, victim, type, dmg_type, low_damage, high_damage, spell_name, crit_mod)
Description:
Damages the victim by the attacker. type represents damage packet types listed here https://github.com/emagi/eq2emu/blob/main/docs/data_types/damage_packet_types.md converted from hex to decimal.
Parameters:
attacker(Spawn) - Spawn object representingattacker.victim(Spawn) - Spawn object representingvictim.type(uint8) - Integer valuetype.dmg_type(uint8) - Integer valuedmg_type.low_damage(uint32) - Integer valuelow_damage.high_damage(uint32) - Integer valuehigh_damage.spell_name(string) - Stringspell_name.crit_mod(uint8) - Integer valuecrit_mod.
Returns: None.
Example:
-- From RegionScripts/exp04_dun_droga_nurga/naj_lavaregion_damage.lua
function TakeLavaDamage(Spawn)
local invul = IsInvulnerable(Spawn)
if invul == true then
return 0
end
local hp = GetHP(Spawn)
local level = GetLevel(Spawn)
local damageToTake = level * 25
-- if we don't have enough HP make them die to pain and suffering not self
if hp <= damageToTake then
KillSpawn(Spawn, null, 1)
else
DamageSpawn(Spawn, Spawn, 192, 3, damageToTake, damageToTake, "Lava Burn", 0, 0, 1, 1)
end
end