|
- function Multi_Targets_Spell takes unit speller, integer spellId, unit target, integer dummyspellId, real radius, real delay returns nothing
- local group g = CreateGroup()
- local integer f = 0
- local integer fend
- local unit u
- local unit array tg
- local unit array sp
- local real ox = GetUnitX( speller )
- local real oy = GetUnitY( speller )
- local real tx = GetUnitX( target )
- local real ty = GetUnitY( target )
- local integer order = GetUnitCurrentOrder( speller )
- local player who = GetOwningPlayer( speller )
- local boolean isEnemy = IsUnitEnemy( target, who )
- call IssueTargetOrderById( speller, order, target)
- call GroupEnumUnitsInRange( g, tx, ty, radius, null )
- loop
- set u = FirstOfGroup( g )
- exitwhen u == null
- if ( IsUnitEnemy( u, who ) == isEnemy and u != target and GetUnitAbilityLevel( u, 'Aloc' ) <= 0 and GetUnitAbilityLevel( GetFilterUnit(), 'Bvul' ) <= 0 and GetUnitAbilityLevel( u, 'BHds' ) <= 0 and not( GetUnitState( u, UNIT_STATE_LIFE ) <= 0.0 )) then
- set tg[f] = u
- set sp[f] = CreateUnit( who, DummyU(), ox, oy, 0.0 )
- call UnitAddAbility( sp[f], dummyspellId )
- call SetUnitAbilityLevel( sp[f], dummyspellId, GetUnitAbilityLevel( speller, spellId ))
- call UnitApplyTimedLife( sp[f], 'BTLF', 10.00 )
- set f = f + 1
- endif
- call GroupRemoveUnit( g, u )
- endloop
- set fend = f
- if ( delay > 0.1 ) then
- call TriggerSleepAction( delay )
- endif
- set f = 1
- loop
- exitwhen f > fend
- if ( tg[f] != null ) then
- call IssueTargetOrderById( sp[f], order, tg[f] )
- set sp[f] = null
- set tg[f] = null
- endif
- set f = f + 1
- endloop
- call DestroyGroup( g )
- set g = null
- endfunction
复制代码
用法:
以群体风暴之锤为例子- Storm bolt
- Events
- Unit - A unit Begins casting an ability
- Conditions
- (Ability being cast) Equal to Storm Bolt
- Actions
- Custom script: call Multi_Targets_Spell(GetTriggerUnit(),GetSpellAbilityId(),GetSpellTargetUnit(),[color=#FF0000]'A00B'[/color],[color=#66FF00]300.0,0.25[/color] )
复制代码 其中红色是辅助技能的代码,绿色部分,300.0是影响范围,0.25是延迟(辅助单位必须本身没有延迟,函数中的延迟才能准确)。 |
|