Is there a way to keep boolexpr within the main function? Or at least pass on a data to that function?
I am asking because I want to move the unit target into the function that checks the condition. Or better, keep the everything in the main function so that i can use local variables to decide the conditions.
Because I don't want to use "IsUnitEnemy(GetFilterUnit(), Player(0)) == true " but I want to use, "IsUnitEnemy(GetFilterUnit(), GetOwnerofUnit(caster)) == true " or something of the sort. Below is my entire trigger. If that clarifies what I am trying to ask.
I am asking because I want to move the unit target into the function that checks the condition. Or better, keep the everything in the main function so that i can use local variables to decide the conditions.
Because I don't want to use "IsUnitEnemy(GetFilterUnit(), Player(0)) == true " but I want to use, "IsUnitEnemy(GetFilterUnit(), GetOwnerofUnit(caster)) == true " or something of the sort. Below is my entire trigger. If that clarifies what I am trying to ask.
JASS:
function Trig_Song_of_Chaos_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A07U' ) ) then
return false
endif
return true
endfunction
function Trig_Song_of_Chaos_Func001002001002003001 takes nothing returns boolean
return ( IsUnitAliveBJ(GetFilterUnit()) == true )
endfunction
function Trig_Song_of_Chaos_Func001002001002003002 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), Player(0)) == true )
endfunction
function Trig_Song_of_Chaos_Func001002001002003 takes nothing returns boolean
return GetBooleanAnd( Trig_Song_of_Chaos_Func001002001002003001(), Trig_Song_of_Chaos_Func001002001002003002() )
endfunction
function Trig_Song_of_Chaos_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target
local integer spelllevel = GetUnitAbilityLevel (caster, GetSpellAbilityId())
local location leak
local location leak2
local integer counter = 0
loop
exitwhen counter == 40
set leak = GetUnitLoc(caster)
set target = GroupPickRandomUnit(GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(500.00, leak, Condition(function Trig_Song_of_Chaos_Func001002001002003))))
call UnitDamageTargetBJ( caster, target, ( 30.00 * spelllevel ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
set leak2 = GetUnitLoc(target)
call AddSpecialEffectLocBJ( leak2, "Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl" )
call DestroyEffect(GetLastCreatedEffectBJ())
call RemoveLocation(leak)
call RemoveLocation(leak2)
set leak = null
set leak2 = null
call TriggerSleepAction(0.5)
set counter = counter + 1
endloop
set caster = null
set target = null
set leak = null
set leak2 = null
endfunction
//===========================================================================
function InitTrig_Song_of_Chaos takes nothing returns nothing
set gg_trg_Song_of_Chaos = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Song_of_Chaos, gg_unit_Hamg_0109, EVENT_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Song_of_Chaos, Condition( function Trig_Song_of_Chaos_Conditions ) )
call TriggerAddAction( gg_trg_Song_of_Chaos, function Trig_Song_of_Chaos_Actions )
endfunction
Last edited by a moderator: