[SOLVED]I have no Idea why this trigger isn't working :\
please check this trigger and tell me what's the problem if you can find it.
I put it in my map after making it in the jasscraft and the Powerful_Ignition trigger is disabled anytime I try to save the map :\
ofc the udg_aunit is defined in the globals like this:
EDIT: My problem was solved by Element of Water
thx again
please check this trigger and tell me what's the problem if you can find it.
I put it in my map after making it in the jasscraft and the Powerful_Ignition trigger is disabled anytime I try to save the map :\
JASS:
//===========================================================================
// Trigger: Attack Register
//===========================================================================
function Trig_Attack_Register_Conditions takes nothing returns boolean
if (( GetUnitAbilityLevel(GetAttacker(),'A003') > 0 ) and ( GetUnitAbilityLevel(GetAttacker(),'A003') < 3 ) and(IsUnitType(GetAttacker(),UNIT_TYPE_MECHANICAL)==false) and (IsUnitType(GetAttacker(),UNIT_TYPE_STRUCTURE)==false)and IsUnitInRange(GetTriggerUnit(),GetAttacker(),(50+100*I2R(GetUnitAbilityLevel(GetAttacker(),'A003'))))) then
return true
endif
return false
endfunction
function Trig_Attack_Register_Actions takes nothing returns nothing
set udg_aunit = GetTriggerUnit()
endfunction
function InitTrig_Attack_Register takes nothing returns nothing
set gg_trg_Attack_Register = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Attack_Register,EVENT_PLAYER_UNIT_ATTACKED)
call TriggerAddCondition(gg_trg_Attack_Register,Condition(function Trig_Attack_Register_Conditions))
call TriggerAddAction(gg_trg_Attack_Register,function Trig_Attack_Register_Actions)
endfunction
//===========================================================================
// Trigger: Powerful Ignition
//===========================================================================
function Powerful_Ignition_Effect takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t,"u")
local unit v = GetHandleUnit(t,"v")
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real a = GetUnitX(v)
local real b = GetUnitY(v)
local real r = Atan2(b-y,a-x)
local real lvl = I2R(GetUnitAbilityLevel(u,'A003'))
call SetUnitPosition(v,a+Sin(r)*(5+10*lvl),b+Cos(r)*(5+10*lvl))
set u = null
set v = null
endfunction
function Trig_Powerful_Ignition_Actions takes nothing returns nothing
local timer t = CreateTimer()
local effect se = AddSpecialEffectTarget("Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" ,GetTriggerUnit(),"origin")
call TimerStart(t,0.05,true,function Powerful_Ignition_Effect)
call SetHandleHandle(t,"u",GetEventDamageSource())
call SetHandleHandle(t,"v",GetTriggerUnit())
call TriggerSleepAction(0.55)
call PauseTimer(t)
call DestroyTimer(t)
call DestroyEffect(se)
set se = null
set t = null
endfunction
//===========================================================================
function InitTrig_Powerful_Ignition takes nothing returns nothing
set gg_trg_Powerful_Ignition = CreateTrigger()
call TriggerRegisterUnitEvent(gg_trg_Powerful_Ignition,udg_aunit,EVENT_UNIT_DAMAGED )
call TriggerAddAction( gg_trg_Powerful_Ignition, function Trig_Powerful_Ignition_Actions )
endfunction
//===========================================================================
function InitCustomTriggers takes nothing returns nothing
call InitTrig_Melee_Initialization()
call InitTrig_Powerful_Ignition()
call InitTrig_Attack_Register()
endfunction
//===========================================================================
JASS:
globals
//User-Defined
unit udg_aunit = null
// Generated
trigger gg_trg_Melee_Initialization = null
trigger gg_trg_Powerful_Ignition = null
trigger gg_trg_Attack_Register = null
endglobals
EDIT: My problem was solved by Element of Water
thx again
Last edited: