- Joined
- Sep 29, 2006
- Messages
- 447
Okay so I'm trying to make an ability called Optical Flare that stuns units in an area for 2 seconds and makes the screen white for the owner of those units for 2 seconds. The screen will then fade back in depending on the ability of the level. Right now my trigger doesn't work, and I know that GetLocalPlayer() can desync people so I need to know how to get this to work without desyncing everyone. Here's the trigger:
JASS:
function Trig_optical_flare_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A016'
endfunction
function is_organic takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_MECHANICAL) == false )
endfunction
function Fade takes nothing returns nothing
if GetLocalPlayer() == GetOwningPlayer(GetEnumUnit()) then
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 0.50, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
call TriggerSleepAction( 2.00 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, ( 2.00 + I2R(GetUnitAbilityLevelSwapped('A016', GetTriggerUnit())) ), "ReplaceableTextures\\CameraMasks\\White_mask.blp", 0, 0, 0, 0 )
endif
endfunction
function Trig_optical_flare_Actions takes nothing returns nothing
local location TempPoint = GetSpellTargetLoc()
local unit TempUnit
local unit caster = GetTriggerUnit()
local group TempGroup
set TempUnit = CreateUnitAtLoc( GetOwningPlayer(caster), 'h005', TempPoint, 270.00 )
call UnitAddAbility( TempUnit, 'A017' )
call UnitApplyTimedLife( TempUnit, 'BTLF', 1.00 )
call IssueImmediateOrder( TempUnit, "stomp" )
set TempGroup = GetUnitsInRangeOfLocMatching(200.00, TempPoint, Condition(function is_organic))
call ForGroup( TempGroup, function Fade )
call RemoveLocation(TempPoint)
call DestroyGroup(TempGroup)
set TempUnit = null
set caster = null
endfunction
//===========================================================================
function InitTrig_optical_flare takes nothing returns nothing
set gg_trg_optical_flare = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_optical_flare, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition( gg_trg_optical_flare, Condition( function Trig_optical_flare_Conditions ) )
call TriggerAddAction( gg_trg_optical_flare, function Trig_optical_flare_Actions )
endfunction