- Joined
- May 9, 2010
- Messages
- 266
Hey guys!
I know, there are a lot of topics like this already, but i`ve read em and i still cant solve my problem.
I have a trigger that is disabled until a spell would be casted. This trigger should run another trigger (kinda loop).
So i have a next code:
It doesnt work because of local trigger. I cant understand why it doesnt work :C Could u help me ? =)
I know, there are a lot of topics like this already, but i`ve read em and i still cant solve my problem.
I have a trigger that is disabled until a spell would be casted. This trigger should run another trigger (kinda loop).
So i have a next code:
JASS:
scope RunScope initializer Init
function GroupCounter takes nothing returns nothing
set bj_groupCountUnits = bj_groupCountUnits + 1
endfunction
function IsGroupEmpty takes group g returns boolean
call ForGroup(g, function GroupCounter)
return bj_groupCountUnits==0
endfunction
function RunActions takes nothing returns nothing
set udg_TempPoint = GetUnitLoc(GetTriggerUnit())
set udg_TempPoint2 = GetSpellTargetLoc()
set udg_SS_RA = bj_RADTODEG * Atan2(GetLocationY(udg_TempPoint2) - GetLocationY(udg_TempPoint), GetLocationX(udg_TempPoint2) - GetLocationX(udg_TempPoint))
set udg_SS_Unit = CreateUnit(GetTriggerPlayer(),udg_SS_UnitType, GetLocationX(udg_TempPoint) + udg_SS_BasicOffset * Cos(udg_SS_RA * bj_DEGTORAD),GetLocationY(udg_TempPoint) + udg_SS_BasicOffset * Sin(udg_SS_RA * bj_DEGTORAD), udg_SS_RA)
// -
set udg_SS_HandleId0 = GetHandleId(udg_SS_Unit)
call SetUnitPathing( udg_SS_Unit, false )
// -
set udg_SS_SpeedFactor = ( udg_SS_SpeedFactor * udg_SS_Period )
set udg_SS_LiquidResistance = ( ( 6.00 * bj_PI ) * ( udg_SS_SlowLiquidFactor * udg_SS_Density ) )
// -
call SaveUnitHandleBJ( udg_SS_Unit, StringHashBJ("Unit"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_RA, StringHashBJ("Angle"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_DamageFactor, StringHashBJ("DF"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_SpeedFactor, StringHashBJ("SpeedFactor"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_Size, StringHashBJ("Size"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_Density, StringHashBJ("Density"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_SlowFactor, StringHashBJ("SlowF"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_EnergyFactor, StringHashBJ("EF"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( udg_SS_LiquidResistance, StringHashBJ("LR"), udg_SS_HandleId0, udg_SS_hash )
call SaveRealBJ( 1.00, StringHashBJ("SLFX"), udg_SS_HandleId0, udg_SS_hash )
// -
call SaveIntegerBJ( udg_SS_SpellTypeDetector, StringHashBJ("STD"), udg_SS_HandleId0, udg_SS_hash )
call SaveStringBJ( udg_SS_OnExlodeOrder, StringHashBJ("OnEO"), udg_SS_HandleId0, udg_SS_hash )
call SaveIntegerBJ(udg_SS_OnExplodeSpell, StringHashBJ("OnES"), udg_SS_HandleId0, udg_SS_hash )
// -
call SaveStringBJ( udg_SS_StrikeSFX, StringHashBJ("StrikeSFX"), udg_SS_HandleId0, udg_SS_hash )
// -
call SaveStringBJ( udg_SS_BounceSFX, StringHashBJ("WallBounceSFX"), udg_SS_HandleId0, udg_SS_hash )
// -
call SaveBooleanBJ( false, StringHashBJ("ISOBS"), udg_SS_HandleId0, udg_SS_hash )
// -
call SetUnitMoveSpeed( udg_SS_Unit, 0.00 )
call GroupAddUnit( udg_SS_group,udg_SS_Unit)
call UnitAddAbility( udg_SS_Unit,'Amrf' )
call UnitRemoveAbility( udg_SS_Unit,'Amrf' )
call SetUnitScale(udg_SS_Unit, udg_SS_Size * 0.01, udg_SS_Size * 0.01, udg_SS_Size * 0.01)
call SetUnitTimeScale( udg_SS_Unit, ( udg_SS_AnimationFactor * udg_SS_SpeedFactor*0.01 ) )
call SetUnitFlyHeight( udg_SS_Unit, ( udg_SS_Size / udg_SS_HeightFactor ), 100.00 )
call RemoveLocation(udg_TempPoint)
call RemoveLocation(udg_TempPoint2)
if ( IsGroupEmpty(udg_SS_group) == false ) then
call EnableTrigger( gg_trg_engin_periodic_loop )
endif
endfunction
//===========================================================================
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call DisableTrigger( t )
call TriggerAddAction( t, function RunActions )
endfunction
endscope
It doesnt work because of local trigger. I cant understand why it doesnt work :C Could u help me ? =)