Komaqtion
You can change this now in User CP.
- Reaction score
- 469
But I want different periods, one for the duration of the effect, and one for how often one effect is created
scope SearingDash initializer init
globals
private constant integer ABIL_ID = 039;A000039;
private constant string EFFECT_1 = "Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl"
private constant real DURATION = 5 //How long the spell lasts
private constant real PERIOD = .1 //Time between 'ticks'
endglobals
//Polar bears are fluffy!
//effectDuration MUST be a whole number.
//effectDuration decides how many periods the effect lasts
//DO NOT CHANGE THIS TEXT MACRO! CHANGE THE ONE RIGHT AFTER private struct Data!!
//! textmacro effectInit takes effectDuration
effect array e[$effectDuration$]
integer eMax = $effectDuration$ - 1
//! endtextmacro
private struct Data
//CHANGE effectDuration HERE!
//Chance the number inside the quotes "X" DO NOT REMOVE ZE QUOTES!!!
//! runtextmacro effectInit("4")
integer i = 0
real x
real y
real speed
real time = 1
unit caster
timer t
static method create takes unit u returns Data
local Data d = Data.allocate()
set d.caster = u
set d.t = NewTimer()
set d.x = GetUnitX(u)
set d.y = GetUnitY(u)
set d.speed = GetUnitMoveSpeed(u)
return d
endmethod
method onDestroy takes nothing returns nothing
local integer i=0
loop //this is just in case :O
call DestroyEffect(.e<i>)
exitwhen i >= .eMax
set i=i+1
endloop
call SetUnitMoveSpeed(.caster, .speed)
call SetUnitPathing(.caster,true)
call SetUnitVertexColor(.caster,255,255,255,100)
endmethod
endstruct
private function Spell_Check takes nothing returns boolean
return GetSpellAbilityId() == ABIL_ID
endfunction
private function Periodic takes nothing returns boolean
local Data d = KT_GetData()
if d.time < DURATION - PERIOD then
set d.time = d.time + PERIOD
set d.x = GetUnitX(d.caster)
set d.y = GetUnitY(d.caster)
if d.i >= d.eMax then
set d.i = 0
endif
call DestroyEffect(d.e[d.i]) //I'm not sure if this will crash thread if there isn't an effect there
//if it does just add one in the initializer <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />
set d.e[d.i] = AddSpecialEffect(EFFECT_1,d.x,d.y)
set d.i = d.i+1
return false
else
call SetUnitMoveSpeed(d.caster, d.speed)
call SetUnitPathing(d.caster,true)
call SetUnitVertexColor(d.caster,255,255,255,100)
call d.destroy()
return true
endif
endfunction
private function Spell takes nothing returns nothing
local Data D = Data.create(GetTriggerUnit())
call SetUnitMoveSpeed(D.caster, 522)
call SetUnitPathing(D.caster,false)
call SetUnitVertexColor(D.caster,255,255,255,85)
call KT_Add(function Periodic, D, PERIOD)
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Spell_Check))
call TriggerAddAction(t, function Spell)
endfunction
endscope</i>
library TE requires KT
private struct SFX
effect sfx
method onDestroy takes nothing returns nothing
call DestroyEffect(.sfx)
endmethod
endstruct
private function Destroy takes nothing returns boolean
call SFX(KT_GetData()).destroy()
return true
endfunction
public function TimedEffect takes effect e, real duration returns nothing
local SFX d = SFX.create()
set d.sfx = e
call KT_Add(function Destroy,d,duration)
endfunction
endlibrary
scope SearingDash initializer init
globals
private constant integer ABIL_ID = 039;A000039;
private constant integer DUMMY_ID = 039;h000039;
private constant integer BUFF_ID = 039;BTLF039;
private constant string EFFECT_1 = "Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl"
private constant string ATTACH_POINT = "origin"
private constant real DURATION = 5 //How long the spell lasts
private constant real PERIOD = .03125 //Time between effects being created.
private constant real DAMAGE_PERIOD = 1 // How often the effects deal damage.
private constant real EFFECT_DURATION = 1.5 // How long the effects last.
private constant integer EFFECT_PERIODS = 48 // Here you have to do some calculation yourself.
// This constant should be EFFECT_DURATION * 32.
endglobals
globals
private group g = CreateGroup()
endglobals
private struct Data
unit array dummy[EFFECT_PERIODS]
integer i = 0
real x
real y
real speed
real time = 1
unit caster
player owner
timer t
static method create takes unit u returns Data
local Data d = Data.allocate()
set d.caster = u
set d.owner = GetOwningPlayer(d.caster)
set d.t = CreateTimer()
set d.x = GetUnitX(u)
set d.y = GetUnitY(u)
set d.speed = GetUnitMoveSpeed(u)
return d
endmethod
method onDestroy takes nothing returns nothing
call SetUnitMoveSpeed(.caster, .speed)
call SetUnitPathing(.caster,true)
call SetUnitVertexColor(.caster,255,255,255,100)
endmethod
endstruct
private function Spell_Check takes nothing returns boolean
return GetSpellAbilityId() == ABIL_ID
endfunction
private function Damage_Period takes nothing returns boolean
local Data d = KT_GetData()
if d.time < DURATION - PERIOD then
return false
else
return true
endif
endfunction
private function Periodic takes nothing returns boolean
local Data d = KT_GetData()
if d.time < DURATION - PERIOD then
set d.time = d.time + PERIOD
set d.x = GetUnitX(d.caster)
set d.y = GetUnitY(d.caster)
set d.dummy[d.i] = CreateUnit(d.owner, DUMMY_ID,d.x,d.y, bj_UNIT_FACING)
call UnitApplyTimedLife(d.dummy[d.i],BUFF_ID,EFFECT_DURATION)
call KT_Add( function Damage_Period, d, DAMAGE_PERIOD)
call TE_TimedEffect(AddSpecialEffect(EFFECT_1,GetUnitX( d.dummy[d.i]),GetUnitY( d.dummy[d.i])), EFFECT_DURATION)
set d.i = d.i+1
return false
else
call d.destroy()
return true
endif
endfunction
private function Spell takes nothing returns nothing
local Data D = Data.create(GetTriggerUnit())
call SetUnitMoveSpeed(D.caster, 522)
call SetUnitPathing(D.caster,false)
call SetUnitVertexColor(D.caster,255,255,255,85)
call KT_Add(function Periodic, D, PERIOD)
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Spell_Check))
call TriggerAddAction(t, function Spell)
endfunction
endscope
Effect Grouping Tool v1
by kingking
Effect Group type : egroup
Functions provided :
function CreateEGroup takes nothing returns egroup
function EGroupAddEffect takes egroup g, effect e returns nothing
function EGroupPickRandomEffect takes egroup g returns effect
function FirstOfEGroup takes egroup g returns effect
function CountEffectsInEGroup takes egroup g returns integer
function EGroupRemoveEffect takes egroup g, effect e returns nothing
function ForEGroup takes egroup g, code c returns nothing
function GetEnumEffect takes nothing returns effect
function EGroupClear takes egroup g returns nothing
function DestroyEGroup takes egroup g returns nothing
library EGroup
globals
private constant integer MAX_EFFECTS_IN_GROUP = 100
private effect EGroup_Effect = null
endglobals
//////////////////////////////////NO MORE TOUCHING//////////////////////////////////////////
struct egroup
effect array e [MAX_EFFECTS_IN_GROUP]
integer effectcount = 0
trigger callback = CreateTrigger()
method onDestroy takes nothing returns nothing
set .effectcount = 0
endmethod
endstruct
function CreateEGroup takes nothing returns egroup
return egroup.create()
endfunction
function EGroupAddEffect takes egroup g, effect e returns nothing
set egroup(g).effectcount = egroup(g).effectcount + 1
set egroup(g).e[egroup(g).effectcount] = e
endfunction
function EGroupPickRandomEffect takes egroup g returns effect
return egroup(g).e[GetRandomInt(1,egroup(g).effectcount)]
endfunction
function FirstOfEGroup takes egroup g returns effect
return egroup(g).e[1]
endfunction
function CountEffectsInEGroup takes egroup g returns integer
return egroup(g).effectcount
endfunction
function EGroupRemoveEffect takes egroup g, effect e returns nothing
local integer i = 1
local boolean b = false
loop
exitwhen i > egroup(g).effectcount or b == true
if egroup(g).e<i> == e then
set egroup(g).e<i> = egroup(g).e[egroup(g).effectcount]
set egroup(g).e[egroup(g).effectcount] = null
set egroup(g).effectcount = egroup(g).effectcount - 1
set b = true
endif
set i = i + 1
endloop
endfunction
function GetEnumEffect takes nothing returns effect
return EGroup_Effect
endfunction
function ForEGroup takes egroup g, code c returns nothing
local integer i = 1
local triggeraction ta = TriggerAddAction(egroup(g).callback,c)
loop
exitwhen i > egroup(g).effectcount
set EGroup_Effect = egroup(g).e<i>
call TriggerExecute(egroup(g).callback)
set i = i + 1
endloop
call TriggerRemoveAction(egroup(g).callback,ta)
set ta = null
endfunction
function EGroupClear takes egroup g returns nothing
loop
exitwhen egroup(g).effectcount == 0
set egroup(g).e[egroup(g).effectcount] = null
set egroup(g).effectcount = egroup(g).effectcount - 1
endloop
endfunction
function DestroyEGroup takes egroup g returns nothing
call egroup(g).destroy()
endfunction
endlibrary
</i></i></i>
scope SearingDash initializer init
globals
private constant integer ABIL_ID = 039;A000039; // The rawcode of the ability!
private constant string EFFECT_1 = "Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl"
private constant string ATTACH_POINT = "origin"
private constant real DURATION = 5 //How long the spell lasts
private constant real PERIOD = .03125 //Time between effects being created.
private constant real DAMAGE_PERIOD = 0.5 // How often the effects deal damage.
private constant real EFFECT_DURATION = 1.5 // How long the effects last.
private constant integer EFFECT_PERIODS = 48 // Here you have to do some calculation yourself.
// This constant should be EFFECT_DURATION * 32.
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL // Explains itself i think XD
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL // Same here <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />
private constant weapontype WEAPON_TYPE = WEAPON_TYPE_WHOKNOWS// And same here <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
private constant real DMG_FACTOR = 1. // An easy way of changing the damage!
endglobals
globals
private group g = CreateGroup()
private integer TempStruct
endglobals
private struct Data
real array ex[EFFECT_PERIODS]
real array ey[EFFECT_PERIODS]
integer i = 0
real speed
real time = 1
unit caster
player owner
timer t
integer lvl
static method create takes unit u returns Data
local Data d = Data.allocate()
set d.caster = u
set d.owner = GetOwningPlayer(d.caster)
set d.t = CreateTimer()
set d.speed = GetUnitMoveSpeed(u)
set d.lvl = GetUnitAbilityLevel(d.caster, ABIL_ID)
return d
endmethod
method onDestroy takes nothing returns nothing
call SetUnitMoveSpeed(.caster, .speed)
call SetUnitPathing(.caster,true)
call SetUnitVertexColor(.caster,255,255,255,100)
endmethod
endstruct
private function Damage takes nothing returns real
return I2R( Data(TempStruct).lvl) * DMG_FACTOR * 20.
endfunction
private function Filters takes nothing returns boolean
return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitEnemy(GetFilterUnit(), Data(TempStruct).owner) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false
endfunction
private function Spell_Check takes nothing returns boolean
return GetSpellAbilityId() == ABIL_ID
endfunction
private function Deal_Damage takes nothing returns nothing
call UnitDamageTarget(Data(TempStruct).caster, GetEnumUnit(), Damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
endfunction
private function Damage_Period takes nothing returns boolean
local Data d = KT_GetData()
local integer i
call BJDebugMsg(R2S(d.ex<i>))
call BJDebugMsg(R2S(d.ey<i>))
if d.time < DURATION - PERIOD then
loop
exitwhen i >= d.i
call GroupEnumUnitsInRange(g, d.ex[d.i], d.ey[d.i], 100, Filter (function Filters))
call ForGroup(g,function Deal_Damage)
set i = i + 1
endloop
return false
else
return true
endif
endfunction
private function Periodic takes nothing returns boolean
local Data d = KT_GetData()
if d.time < DURATION - PERIOD then
set d.time = d.time + PERIOD
set d.ex[d.i] = GetUnitX(d.caster)
set d.ey[d.i] = GetUnitY(d.caster)
call KT_Add( function Damage_Period, d, DAMAGE_PERIOD)
call TE_TimedEffect(AddSpecialEffect(EFFECT_1,d.ex[d.i],d.ey[d.i]), EFFECT_DURATION)
set d.i = d.i+1
return false
else
call d.destroy()
return true
endif
endfunction
private function Spell takes nothing returns nothing
local Data D = Data.create(GetTriggerUnit())
call SetUnitMoveSpeed(D.caster, 522)
call SetUnitPathing(D.caster,false)
call SetUnitVertexColor(D.caster,255,255,255,85)
set TempStruct = D
call KT_Add(function Periodic, D, PERIOD)
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition (function Spell_Check))
call TriggerAddAction(t, function Spell)
endfunction
endscope</i></i>
scope SearingDash initializer init
globals
private constant integer ABIL_ID = 039;A000039; // The rawcode of the ability!
private constant string EFFECT_1 = "Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl"
private constant string ATTACH_POINT = "origin"
private constant real DURATION = 5 //How long the spell lasts
private constant real PERIOD = .03125 //Time between effects being created.
private constant real DAMAGE_PERIOD = 0.5 // How often the effects deal damage.
private constant real EFFECT_DURATION = 1.5 // How long the effects last.
// This constant should be EFFECT_DURATION * 32.
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL // Explains itself i think XD
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL // Same here <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />
private constant weapontype WEAPON_TYPE = WEAPON_TYPE_WHOKNOWS// And same here <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
private constant real DMG_FACTOR = 1. // An easy way of changing the damage!
endglobals
globals
private group g = CreateGroup()
private integer TempStruct
endglobals
private struct Data
real speed
real time = 1
unit caster
player owner
integer lvl
static method create takes unit u returns Data
local Data d = Data.allocate()
set d.caster = u
set d.owner = GetOwningPlayer(d.caster)
set d.speed = GetUnitMoveSpeed(u)
set d.lvl = GetUnitAbilityLevel(d.caster, ABIL_ID)
return d
endmethod
method onDestroy takes nothing returns nothing
call SetUnitMoveSpeed(.caster, .speed)
call SetUnitPathing(.caster,true)
call SetUnitVertexColor(.caster,255,255,255,255)
endmethod
endstruct
private struct Dam
unit caster
player owner
real x
real y
integer lv
integer tick
endstruct
private function Damage takes nothing returns real
return I2R( Dam(TempStruct).lv) * DMG_FACTOR * 20.
endfunction
private function Filters takes nothing returns boolean
return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitEnemy(GetFilterUnit(), Dam(TempStruct).owner) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false
endfunction
private function Spell_Check takes nothing returns boolean
return GetSpellAbilityId() == ABIL_ID
endfunction
private function Deal_Damage takes nothing returns nothing
call UnitDamageTarget(Dam(TempStruct).caster, GetEnumUnit(), Damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
endfunction
private function Damage_Period takes nothing returns boolean
local Dam dd = KT_GetData()
if dd.tick > 0 then
set TempStruct = dd
call GroupEnumUnitsInRange(g, dd.x, dd.y, 100., Filter (function Filters))
call ForGroup(g,function Deal_Damage)
set dd.tick = dd.tick - 1
return false
else
call dd.destroy()
endif
return true
endfunction
private function Periodic takes nothing returns boolean
local Data d = KT_GetData()
local Dam dd
if d.time < DURATION - PERIOD then
set d.time = d.time + PERIOD
set dd = Dam.create()
set dd.caster = d.caster
set dd.owner = d.owner
set dd.x = GetUnitX(d.caster)
set dd.y = GetUnitY(d.caster)
set dd.lv = d.lvl
set dd.tick = R2I(EFFECT_DURATION / DAMAGE_PERIOD)
call KT_Add(function Damage_Period, dd, DAMAGE_PERIOD)
call TE_TimedEffect(AddSpecialEffect(EFFECT_1,dd.x,dd.y), EFFECT_DURATION)
return false
else
call d.destroy()
return true
endif
endfunction
private function Spell takes nothing returns nothing
local Data D = Data.create(GetTriggerUnit())
call SetUnitMoveSpeed(D.caster, 522)
call SetUnitPathing(D.caster,false)
call SetUnitVertexColor(D.caster,255,255,255,85)
call KT_Add(function Periodic, D, PERIOD)
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition (function Spell_Check))
call TriggerAddAction(t, function Spell)
endfunction
endscope
scope SearingDash initializer init
globals
private constant integer ABIL_ID = 039;A000039; // The rawcode of the ability!
private constant integer ATTACK_ID = 039;Aatk039; // The rawcode of the "Attack" ability!
private constant string EFFECT_1 = "Environment\\SmallBuildingFire\\SmallBuildingFire2.mdl"
private constant string ATTACH_POINT = "origin"
private constant real DURATION = 5 //How long the spell lasts
private constant real PERIOD = .03125 //Time between effects being created.
private constant real DAMAGE_PERIOD = 0.5 // How often the effects deal damage.
private constant real EFFECT_DURATION = 1.5 // How long the effects last.
// This constant should be EFFECT_DURATION * 32.
private constant attacktype ATTACK_TYPE = ATTACK_TYPE_NORMAL // Explains itself i think XD
private constant damagetype DAMAGE_TYPE = DAMAGE_TYPE_NORMAL // Same here <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />
private constant weapontype WEAPON_TYPE = WEAPON_TYPE_WHOKNOWS// And same here <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" />
private constant real DMG_FACTOR = 1. // An easy way of changing the damage!
private constant real RNG_FACTOR = 1. // An easy way of changing the damage range!
private constant integer TRANSPARENCY = 85 // In %, how transparent the caster becomes!
endglobals
globals
private group g = CreateGroup()
private integer TempStruct
endglobals
private struct Data
real speed
real time = 1
unit caster
player owner
integer lvl
boolean on
static method create takes unit u returns Data
local Data d = Data.allocate()
set d.caster = u
set d.owner = GetOwningPlayer(d.caster)
set d.speed = GetUnitMoveSpeed(u)
set d.lvl = GetUnitAbilityLevel(d.caster, ABIL_ID)
return d
endmethod
method onDestroy takes nothing returns nothing
call SetUnitMoveSpeed(.caster, .speed)
call SetUnitPathing(.caster,true)
call SetUnitVertexColor(.caster,255,255,255,255)
call UnitAddAbility(.caster, ATTACK_ID)
set .on = false
endmethod
endstruct
private struct Dam
unit caster
player owner
real x
real y
integer lv
integer tick
endstruct
private function Damage takes nothing returns real
return I2R( Dam(TempStruct).lv) * DMG_FACTOR * 20.
endfunction
private function Range takes nothing returns real
return I2R( Dam(TempStruct).lv) * RNG_FACTOR * 50. + 50.
endfunction
private function Filters takes nothing returns boolean
return GetWidgetLife(GetFilterUnit()) > 0.405 and IsUnitEnemy(GetFilterUnit(), Dam(TempStruct).owner) and IsUnitType(GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false
endfunction
private function Spell_Check takes nothing returns boolean
return GetSpellAbilityId() == ABIL_ID
endfunction
private function Is_On takes nothing returns boolean
return Data(TempStruct).on
endfunction
private function Deal_Damage takes nothing returns nothing
call UnitDamageTarget(Dam(TempStruct).caster, GetEnumUnit(), Damage, true, false, ATTACK_TYPE, DAMAGE_TYPE, WEAPON_TYPE)
endfunction
private function Damage_Period takes nothing returns boolean
local Dam dd = KT_GetData()
if dd.tick > 0 then
set TempStruct = dd
call GroupEnumUnitsInRange(g, dd.x, dd.y, Range, Filter (function Filters))
call ForGroup(g,function Deal_Damage)
set dd.tick = dd.tick - 1
return false
else
call dd.destroy()
endif
return true
endfunction
private function Periodic takes nothing returns boolean
local Data d = KT_GetData()
local Dam dd
if d.time < DURATION - PERIOD then
set d.time = d.time + PERIOD
set dd = Dam.create()
set dd.caster = d.caster
set dd.owner = d.owner
set dd.x = GetUnitX(d.caster)
set dd.y = GetUnitY(d.caster)
set dd.lv = d.lvl
set dd.tick = R2I(EFFECT_DURATION / DAMAGE_PERIOD)
call KT_Add(function Damage_Period, dd, DAMAGE_PERIOD)
call TE_TimedEffect(AddSpecialEffect(EFFECT_1,dd.x,dd.y), EFFECT_DURATION)
return false
else
call d.destroy()
return true
endif
endfunction
private function Move takes nothing returns nothing
local Data d
local real x1 = GetOrderPointX()
local real y1 = GetOrderPointY()
local real x2 = GetUnitX(d.caster)
local real y2 = GetUnitY(d.caster)
local real angle = bj_RADTODEG * Atan2(y1 - y1, x1 - x2)
local real newx = x2 + 5 * Cos(angle * bj_DEGTORAD)
local real newy = y2 + 5 * Sin(angle * bj_DEGTORAD)
call SetUnitX(d.caster, newx)
call SetUnitY(d.caster, newy)
endfunction
private function Spell takes nothing returns nothing
local Data D = Data.create(GetTriggerUnit())
set D.on = true
call SetUnitPathing(D.caster,false)
call SetUnitVertexColor(D.caster,255,255,255,Abs 255 * (TRANSPARENCY / 100))
call UnitRemoveAbility( D.caster, ATTACK_ID)
call KT_Add(function Periodic, D, PERIOD)
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition (function Spell_Check))
call TriggerAddAction(t, function Spell)
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerAddCondition(t, Condition(function Is_On))
call TriggerAddAction(t, function Move)
endfunction
endscope
call SetUnitVertexColor(D.caster,255,255,255,Abs 255 * (TRANSPARENCY / 100))