Difference between revisions of "LUA:AddSpellTimer"

(Created page with "= LUA Functions: IsFlanking() = Checks to see if the given spawn is flanking the target spawn ==== Syntax ==== IsFlanking(param1, param2) ==== Parameters ==== ; Required - ''p...")
 
Line 1: Line 1:
= LUA Functions: IsFlanking() =
+
= LUA Functions: AddSpellTimer() =
Checks to see if the given spawn is flanking the target spawn
+
Adds a timer to the spell that will call the given function
  
 
==== Syntax ====
 
==== Syntax ====
IsFlanking(param1, param2)
+
AddSpellTimer(param1, param2, [param3], [param4])
  
  
 
==== Parameters ====
 
==== Parameters ====
; Required - ''param1'' (Spawn), ''param2'' (Spawn)
+
; Required - ''param1'' (int32), ''param2'' (string)
 
: ''param1'' is the spawn who will be checking the other
 
: ''param1'' is the spawn who will be checking the other
 
: ''param2'' is the spawn we want to know if it is flanking
 
: ''param2'' is the spawn we want to know if it is flanking
 +
; Optional - ''param3'' (Spawn), ''param4'' (Spawn)
 +
: ''param3'' is the spawn to pass as the caster to the callback function
 +
: ''param4'' is the spawn to pass as the target to the callback function
  
  
 
==== Usage ====
 
==== Usage ====
 
<pre>
 
<pre>
function precast(Caster, Target)
+
function proc(Caster, Target, Type)
     return IsFlanking(Target, Caster)
+
     AddControlEffect(Target, 4)
 +
    AddSpellTimer(1000, "RemoveStun")
 +
end
 +
 
 +
function RemoveStun(Caster, Target)
 +
    RemoveControlEffect(Target, 4)
 
end
 
end
 
</pre>
 
</pre>
  
Will check to see if the caster is flanking the target before casting
+
This spell will stun the target on a proc and remove the stun after 1 second
 +
 
 +
== Notes ==
 +
If ''param3'' and ''param4'' are not given it will use the same caster and target used in the cast/tick/remove functions

Revision as of 14:59, 16 January 2014

LUA Functions: AddSpellTimer()

Adds a timer to the spell that will call the given function

Syntax

AddSpellTimer(param1, param2, [param3], [param4])


Parameters

Required - param1 (int32), param2 (string)
param1 is the spawn who will be checking the other
param2 is the spawn we want to know if it is flanking
Optional - param3 (Spawn), param4 (Spawn)
param3 is the spawn to pass as the caster to the callback function
param4 is the spawn to pass as the target to the callback function


Usage

function proc(Caster, Target, Type)
    AddControlEffect(Target, 4)
    AddSpellTimer(1000, "RemoveStun")
end

function RemoveStun(Caster, Target)
    RemoveControlEffect(Target, 4)
end

This spell will stun the target on a proc and remove the stun after 1 second

Notes

If param3 and param4 are not given it will use the same caster and target used in the cast/tick/remove functions