AddHate(Spawn: Entity, Spawn: NPC, SInt32: Amount, Bool: SendPacket)
Pre-Requisite(s)
- None
Parameter(s)
Spawn: Entity - LUA Pointer for Player, NPC or Bot type only, this Spawn will be the “hated target”.
Spawn: NPC - LUA Pointer for NPC, it will add the Entity to it's hate list.
SInt32: Amount - Amount of Hate to Add or Subtract, if the Entity is already on the hate list and you subtract more than the total hate, it will reset to hate of 1.
Bool: SendPacket (OPTIONAL) - When used in a Spell Script, must be set to true for sending Threat Packet to Zone.
Return(s)
- None
Example(s)
function hailed(NPC, Spawn)
AddHate(Spawn, NPC, 10, 1) – Adds 10 hate to Spawn and engages NPC aggro. Additionally sends threat packet to clients.
end
– Taken from Spells/Commoner/BeslinsBoastfulPosture.lua
function cast(Caster, Target, MinVal, MaxVal, BonusAmt)
Level = GetLevel(Caster)
SpellLevel = 10
Mastery = SpellLevel + 10
StatBonus = GetStr(Caster) / 10
if Level < Mastery then
LvlBonus = Level - SpellLevel
else LvlBonus = Mastery - SpellLevel
end
HateBonus = LvlBonus * 2
MaxHate = MaxVal + HateBonus
MinHate = MinVal + HateBonus
AddHate(Caster, Target, math.random(MinHate, MaxHate),1)
AddSpellBonus(Target, 617, BonusAmt)
end
Result
Additional Notes