Name | Type | is_array | initial_value |
//TESH.scrollpos=10
//TESH.alwaysfold=0
function Trig_SnakeWaveSingle_Conditions takes nothing returns boolean
if ( GetSpellAbilityId() == 'A001' ) then
return true
endif
return false
endfunction
function Trig_SnakeWaveSingle_Actions takes nothing returns nothing
local unit a = GetSpellAbilityUnit()
local real r = GetUnitFacing(a) // caster angle facing
local real x = GetUnitX(a)
local real y = GetUnitY(a) // caster possition
local real x1 = 0
local real y1 = 0 //the possition of new unit
local real d = 75 // distance
local real r2 = r // angle for polar projection
local integer k = 0 // number of times
local unit L //the unit that is goint to be created
loop
call TriggerSleepAction(0.0001) // the price for MUI... Its not slower than you think!
set x1 = x + d*Cos(r2 * bj_DEGTORAD) //calculates the possition of new unit(PolarProjection)
set y1 = y + d*Sin(r2 * bj_DEGTORAD)
set L = CreateUnit(GetOwningPlayer(a),'e000',x1,y1,bj_UNIT_FACING)//unit creation
call UnitApplyTimedLife(L,'BTLF',1.15)//duration
set x = x1
set y = y1 // saves and stores prevous coordiantes
set k = k +1 // number of times , also used in the angle calculation
set r2 = r + 40*Cos(45-12*k) // the key for making it curve , special formula made from scratch
exitwhen (k==40)
endloop
endfunction
//===========================================================================
function InitTrig_SnakeWaveSingle takes nothing returns nothing
set gg_trg_SnakeWaveSingle = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_SnakeWaveSingle, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_SnakeWaveSingle, Condition( function Trig_SnakeWaveSingle_Conditions ) )
call TriggerAddAction( gg_trg_SnakeWaveSingle, function Trig_SnakeWaveSingle_Actions )
endfunction
//TESH.scrollpos=25
//TESH.alwaysfold=0
function Trig_DNAWave_Conditions takes nothing returns boolean
if ( GetSpellAbilityId() == 'A002' ) then
return true
endif
return false
endfunction
function Trig_DNAWave_Actions takes nothing returns nothing
local unit a = GetSpellAbilityUnit()
local real r = GetUnitFacing(a) //angle that will be used
local real x = GetUnitX(a)
local real y = GetUnitY(a) //caster location
local real xP = x
local real yP = y //storage for prevous unit pos 2nd type
local real x1 = 0
local real y1 = 0 //the possition of new unit 1st
local real x2 = 0
local real y2 = 0 // the possition of new unit 2nd
local real d = 75 //distance between units , increasing this will make it longer
local real r2 = r // angle for polar projection 1st unit
local real r3 = r // the constant angle used for r4 ,USELESS.
local real r4 = r // angle for polar projection for the 2nd unit
local integer n = 12 //increasing this will change the shape of elipse
local integer k = 0 // the number of times
local unit L // units
local unit L2 // units at the other side
loop
call TriggerSleepAction(0.0001) // the price for MUI ...
set x1 = x + d*Cos(r2 * bj_DEGTORAD) //calculates the possition of new unit 1st
set y1 = y + d*Sin(r2 * bj_DEGTORAD)
set x2 = xP + d*Cos(r4 * bj_DEGTORAD)//calculates the possition of new unit 2nd
set y2 = yP + d*Sin(r4 * bj_DEGTORAD)
set L = CreateUnit(GetOwningPlayer(a),'e000',x1,y1,bj_UNIT_FACING)//unit creation
call UnitApplyTimedLife(L,'BTLF',1.15) //unit duration
set L2 = CreateUnit(GetOwningPlayer(a),'e000',x2,y2,bj_UNIT_FACING)//2nd unit creation
call UnitApplyTimedLife(L2,'BTLF',1.15)
set x = x1 // saves and stores the prevous possition to be used to calculate new
set y = y1
set xP = x2 //saves and stores.... for 2nd unit
set yP = y2
set k = k +1 // number of times counter
set r2 = r + 40*Cos(45+n*k) // the key to making curve,
set r4 = r3 +40*Cos(180+n*k) // why 180? yes i want to know that too,but works
exitwhen (k==40)
endloop
endfunction
//===========================================================================
function InitTrig_DNAWave takes nothing returns nothing
set gg_trg_DNAWave = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_DNAWave, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_DNAWave, Condition( function Trig_DNAWave_Conditions ) )
call TriggerAddAction( gg_trg_DNAWave, function Trig_DNAWave_Actions )
endfunction