I just wanted to learn how to inline triggers
. But I cant just get it to work, when I delete the BJs or turn them to natives, script errors occur.
This is just an converted text
.
I know how to turn the condition of an spell that is (ability being casted) but this is attacked unit.
This is just an converted text
JASS:
function Trig_AP_Start_Conditions takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetAttackedUnitBJ(), 'B000') == true ) ) then
return false
endif
return true
endfunction
function Trig_AP_Start_Func013002003 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_AP_Start_Func017Func002A takes nothing returns nothing
call UnitDamageTargetBJ( udg_AP_Caster, GetEnumUnit(), udg_AP_Damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_SONIC )
call AddSpecialEffectTargetUnitBJ( "overhead", GetEnumUnit(), "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endfunction
function Trig_AP_Start_Func017C takes nothing returns boolean
if ( not ( udg_AP_Chance <= 10 ) ) then
return false
endif
return true
endfunction
function Trig_AP_Start_Actions takes nothing returns nothing
// -----------------------------------------------------------------------------------------------------------------
// ----------------------------------------------- Variables --------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------
set udg_AP_Caster = GetAttackedUnitBJ()
// -----------------------------------------------------------------------------------------------------------------
set udg_AP_Loc[0] = GetUnitLoc(udg_AP_Caster)
// -----------------------------------------------------------------------------------------------------------------
set udg_AP_Damage = 150.00
set udg_AP_Aoe = 300.00
// -----------------------------------------------------------------------------------------------------------------
set udg_AP_Chance = GetRandomInt(0, 100)
// -----------------------------------------------------------------------------------------------------------------
set udg_AP_Group = GetUnitsInRangeOfLocMatching(udg_AP_Aoe, udg_AP_Loc[0], Condition(function Trig_AP_Start_Func013002003))
// -----------------------------------------------------------------------------------------------------------------
// ------------------------------------------------- Actions --------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------
if ( Trig_AP_Start_Func017C() ) then
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_AP_Loc[1] = PolarProjectionBJ(udg_AP_Loc[0], ( udg_AP_Aoe - ( udg_AP_Aoe / 10.00 ) ), ( 60.00 * I2R(GetForLoopIndexA()) ))
set udg_AP_Loc[2] = PolarProjectionBJ(udg_AP_Loc[0], 100.00, ( 60.00 * I2R(GetForLoopIndexA()) ))
call AddSpecialEffectLocBJ( udg_AP_Loc[1], "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
call AddSpecialEffectLocBJ( udg_AP_Loc[2], "Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
// -----------------------------------------------------------------------------------------------------------------
// --------------------------------------------Clearing Leaks----------------------------------------------
// -----------------------------------------------------------------------------------------------------------------
call RemoveLocation(udg_AP_Loc[1])
call RemoveLocation(udg_AP_Loc[2])
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call ForGroupBJ( udg_AP_Group, function Trig_AP_Start_Func017Func002A )
// -----------------------------------------------------------------------------------------------------------------
// --------------------------------------------Clearing Leaks----------------------------------------------
// -----------------------------------------------------------------------------------------------------------------
set udg_AP_Caster = null
// -----------------------------------------------------------------------------------------------------------------
call RemoveLocation(udg_AP_Loc[0])
// -----------------------------------------------------------------------------------------------------------------
call DestroyGroup(udg_AP_Group)
else
endif
endfunction
//===========================================================================
function InitTrig_AP_Start takes nothing returns nothing
set gg_trg_AP_Start = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_AP_Start, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_AP_Start, Condition( function Trig_AP_Start_Conditions ) )
call TriggerAddAction( gg_trg_AP_Start, function Trig_AP_Start_Actions )
endfunction
I know how to turn the condition of an spell that is (ability being casted) but this is attacked unit.