Ok I just converted this trigger
To Jass and set all the variables to locals
And now theres 49 compiled errors!
Also theres so many functions, thats laggy, anyway I can improve?
Code:
Blink StrikeBU
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Blink Strike [NEW]
Actions
Set CastingUnit = (Casting unit)
Set TempPoint = (Position of (Target unit of ability being cast))
Set BlinkStrikeTarget = (Target unit of ability being cast)
Unit - Move CastingUnit instantly to TempPoint2
Unit - Make CastingUnit face BlinkStrikeTarget over 0.00 seconds
Animation - Play CastingUnit's attack animation
Unit - Cause CastingUnit to damage BlinkStrikeTarget, dealing (175.00 + (150.00 x ((Real((Level of Blink Strike [NEW] for CastingUnit))) - 1.00))) damage of attack type Hero and damage type Normal
Custom script: call RemoveLocation(udg_TempPoint)
Set BlinkStrikeTarget = No unit
For each (Integer A) from 1 to ((Level of Blink Strike [NEW] for (Casting unit)) x 2), do (Actions)
Loop - Actions
Set TempPoint = (Position of CastingUnit)
Set TempGroup = (Units within 512.00 of TempPoint matching (((((Matching unit) is alive) Equal to True) and (((Matching unit) is in TempGroup2) Equal to False)) and (((Matching unit) belongs to an enemy of (Owner of CastingUnit)) Equal to True)))
Set BlinkStrikeTarget = (Random unit from TempGroup)
Set TempPoint2 = (Position of BlinkStrikeTarget)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
BlinkStrikeTarget Equal to No unit
Then - Actions
Custom script: exitwhen true
Else - Actions
Lightning - Create a Magic Leash lightning effect from source TempPoint to target TempPoint2
Unit - Move CastingUnit instantly to TempPoint2
Unit - Make CastingUnit face BlinkStrikeTarget over 0.00 seconds
Animation - Play CastingUnit's attack animation
Unit - Cause CastingUnit to damage BlinkStrikeTarget, dealing (150.00 + (200.00 x ((Real((Level of Blink Strike [NEW] for CastingUnit))) - 1.00))) damage of attack type Hero and damage type Normal
Wait 0.25 game-time seconds
Lightning - Destroy (Last created lightning effect)
Unit Group - Add BlinkStrikeTarget to TempGroup2
Set BlinkStrikeTarget = No unit
Custom script: call RemoveLocation(udg_TempPoint)
Custom script: call RemoveLocation(udg_TempPoint2)
Custom script: call DestroyGroup(udg_TempGroup)
Custom script: call DestroyGroup(udg_TempGroup2)
Custom script: set udg_TempPoint = null
Custom script: set udg_TempPoint2 = null
Custom script: set udg_TempGroup = null
Custom script: set udg_TempGroup2 = null
Code:
function Trig_Blink_Strike_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A085' ) ) then
return false
endif
return true
endfunction
function Trig_Blink_Strike_Func010Func002002003001001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Blink_Strike_Func010Func002002003001002 takes nothing returns boolean
return ( IsUnitInGroup(GetFilterUnit(), TempGroup2) == false )
endfunction
function Trig_Blink_Strike_Func010Func002002003001 takes nothing returns boolean
return GetBooleanAnd( Trig_Blink_Strike_Func010Func002002003001001(), Trig_Blink_Strike_Func010Func002002003001002() )
endfunction
function Trig_Blink_Strike_Func010Func002002003002 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(CastingUnit)) == true )
endfunction
function Trig_Blink_Strike_Func010Func002002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Blink_Strike_Func010Func002002003001(), Trig_Blink_Strike_Func010Func002002003002() )
endfunction
function Trig_Blink_Strike_Func010Func005C takes nothing returns boolean
if ( not ( BlinkStrikeTarget == null ) ) then
return false
endif
return true
endfunction
function Trig_Blink_Strike_Actions takes nothing returns nothing
set local unit CastingUnit = GetSpellAbilityUnit()
set local point TempPoint = GetUnitLoc(GetSpellTargetUnit())
set local unit BlinkStrikeTarget = GetSpellTargetUnit()
call SetUnitPositionLoc( CastingUnit, TempPoint2 )
call SetUnitFacingToFaceUnitTimed( CastingUnit, BlinkStrikeTarget, 0 )
call SetUnitAnimation( CastingUnit, "attack" )
call UnitDamageTargetBJ( CastingUnit, BlinkStrikeTarget, ( 175.00 + ( 150.00 * ( I2R(GetUnitAbilityLevelSwapped('A085', CastingUnit)) - 1 ) ) ), ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
call RemoveLocation(TempPoint)
set BlinkStrikeTarget = null
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = ( GetUnitAbilityLevelSwapped('A085', GetSpellAbilityUnit()) * 2 )
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set local point TempPoint = GetUnitLoc(CastingUnit)
set local group TempGroup = GetUnitsInRangeOfLocMatching(512, TempPoint, Condition(function Trig_Blink_Strike_Func010Func002002003))
set local unit BlinkStrikeTarget = GroupPickRandomUnit(TempGroup)
set local point TempPoint2 = GetUnitLoc(BlinkStrikeTarget)
if ( Trig_Blink_Strike_Func010Func005C() ) then
exitwhen true
else
call AddLightningLoc( "LEAS", TempPoint, TempPoint2 )
call SetUnitPositionLoc( CastingUnit, TempPoint2 )
call SetUnitFacingToFaceUnitTimed( CastingUnit, BlinkStrikeTarget, 0 )
call SetUnitAnimation( CastingUnit, "attack" )
call UnitDamageTargetBJ( CastingUnit, BlinkStrikeTarget, ( 150.00 + ( 200.00 * ( I2R(GetUnitAbilityLevelSwapped('A085', CastingUnit)) - 1 ) ) ), ATTACK_TYPE_HERO, DAMAGE_TYPE_NORMAL )
call PolledWait( 0.25 )
call DestroyLightningBJ( GetLastCreatedLightningBJ() )
call GroupAddUnitSimple( BlinkStrikeTarget, TempGroup2 )
set BlinkStrikeTarget = null
endif
call RemoveLocation(TempPoint)
call RemoveLocation(TempPoint2)
call DestroyGroup(TempGroup)
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DestroyGroup(udg_TempGroup2)
set TempPoint = null
set TempPoint2 = null
set TempGroup = null
set TempGroup2 = null
endfunction
//===========================================================================
function InitTrig_Blink_Strike takes nothing returns nothing
set gg_trg_Blink_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Blink_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Blink_Strike, Condition( function Trig_Blink_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Blink_Strike, function Trig_Blink_Strike_Actions )
endfunction
And now theres 49 compiled errors!
Also theres so many functions, thats laggy, anyway I can improve?