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...")
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
= LUA Functions: IsFlanking() =
+
{{LUAFunction
Checks to see if the given spawn is flanking the target spawn
+
|Name = AddSpellTimer
 
+
|Description = Adds a timer to the spell that will call the given function
==== Syntax ====
+
|Param1 = int32
IsFlanking(param1, param2)
+
|Param1Desc = is the time in milliseconds
 
+
|Param2 = String
 
+
|Param2Desc = is the function to call when the time is up
==== Parameters ====
+
|OptionalParam1 = Spawn
; Required - ''param1'' (Spawn), ''param2'' (Spawn)
+
|OptionalParam1Desc = is the spawn to pass as the caster to the callback function
: ''param1'' is the spawn who will be checking the other
+
|OptionalParam2 = Spawn
: ''param2'' is the spawn we want to know if it is flanking
+
OptionalParam2Desc = is the spawn to pass as the target to the callback function
 
+
|Example =
 +
<pre>
 +
function proc(Caster, Target, Type)
 +
    AddControlEffect(Target, 4)
 +
    AddSpellTimer(1000, "RemoveStun")
 +
end
  
==== Usage ====
+
function RemoveStun(Caster, Target)
<pre>
+
     RemoveControlEffect(Target, 4)
function precast(Caster, Target)
 
     return IsFlanking(Target, Caster)
 
 
end
 
end
 
</pre>
 
</pre>
 
+
|ExampleDesc = This spell will stun the target on a proc and remove the stun after 1 second
Will check to see if the caster is flanking the target before casting
+
|Notes = If optional param1 and optional param2 are not given it will use the same caster and target used in the cast/tick/remove functions
 +
}}

Latest revision as of 12:09, 30 January 2021


LUA:AllFunctions - AddSpellTimer

Return to: LUA:AllFunctions | Tutorials | Portal | Forum | Project Manager | Bug Tracker


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

Syntax

AddSpellTimer(param1, param2, [opt param1], [opt param2])

Parameters

Required - param1 (int32), param2 (String)
param1 is the time in milliseconds
param2 is the function to call when the time is up
Optional - opt param1 (Spawn), opt param2 (Spawn

OptionalParam2Desc = is the spawn to pass as the target to the callback function)

opt param1 is the spawn to pass as the caster to the callback function
opt param2 Description not provided in the template...

Example

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 optional param1 and optional param2 are not given it will use the same caster and target used in the cast/tick/remove functions