Difference between revisions of "LUA:GetMostHated"

(Created page with "= LUA Functions: AddHate() = Adds hate to ''param2'' from ''param1'' ==== Syntax ==== AddHate(param1, param2, param3) ==== Parameters ==== ; Required - ''param1'' (Spawn), ''...")
 
 
Line 1: Line 1:
= LUA Functions: AddHate() =
+
= LUA Functions: GetMostHated() =
Adds hate to ''param2'' from ''param1''
+
Gets the spawn with the most hate in the given spawns hate list
  
  
 
==== Syntax ====
 
==== Syntax ====
AddHate(param1, param2, param3)
+
GetMostHated(param1)
  
  
 
==== Parameters ====
 
==== Parameters ====
; Required - ''param1'' (Spawn), ''param2'' (Spawn), ''param3'' (sint32)
+
; Required - ''param1'' (Spawn)
: ''param1'' is the spawn that is adding hate
+
: ''param1'' is the spawn who's hate list we want to look in
: ''param2'' is the spawn recieving the hate
 
: ''param3'' is the amount of hate to add
 
  
 
==== Usage ====
 
==== Usage ====
 
<pre>
 
<pre>
function cast(Caster, Target)
+
function hailed_busy(NPC, Spawn)
     -- Add 50 hate to the target
+
     local hated = GetMostHated(NPC)
     AddHate(Caster, Target, 50)
+
     if hated ~= nil then
 +
        Say(NPC, GetName(Hated) .. " I hate you the most")
 +
    end
 
end
 
end
 
</pre>
 
</pre>
  
This is a simple taunt spell that adds 50 hate to the target.
+
This will make the spawn say who is at the top of there hate list when hailed while in combat
 
 
== Notes ==
 
If this is called from a spell script then the target/targets will be determined by the spell data(encounter AE, true AE, single target, etc...), the param is still required though.
 

Latest revision as of 20:50, 28 August 2013

LUA Functions: GetMostHated()

Gets the spawn with the most hate in the given spawns hate list


Syntax

GetMostHated(param1)


Parameters

Required - param1 (Spawn)
param1 is the spawn who's hate list we want to look in

Usage

function hailed_busy(NPC, Spawn)
    local hated = GetMostHated(NPC)
    if hated ~= nil then
        Say(NPC, GetName(Hated) .. " I hate you the most")
    end
end

This will make the spawn say who is at the top of there hate list when hailed while in combat