|
发表于 2012-11-27 14:32:59
|
显示全部楼层
本帖最后由 lfglvstory 于 2012-11-27 14:35 编辑
如下几行代码就可以实现了,但是要有一个等级为100的命令光环技能。仅提供此种方法参考。对于level == 0的情况就没处理了,无大碍。- // 如下代码copy到地图全局代码块中,在初始化地图时调用SetBossAtt就行了
- function SetBossAtt_TimerActions takes nothing returns nothing
- local unit boss = gg_unit_N003_0001 // 请将此处的boss值修改为对应地图中BOSS的全局变量值
- local integer attAbilityId = 'ACac' // 对应你的强击光环技能的ID值,在物体编辑器下的技能栏按下ctr+d键可以查看
- local integer level = 100 - GetUnitStatePercent(udg_boss,UNIT_STATE_LIFE,UNIT_STATE_MAX_LIFE)
- if GetUnitAbilityLevel(boss,attAbilityId) <= 0 then
- call UnitAddAbility(boss,attAbilityId)
- endif
- call SetUnitAbilityLevel(udg_boss,attAbilityId,level)
- set boss = null
- if GetUnitState(boss, UNIT_STATE_LIFE) <= 0 then
- call PauseTimer(GetExpiredTimer())
- call DestroyTimer(GetExpiredTimer())
- endif
- endfunction
- function SetBossAtt takes nothing returns nothing
- local timer t = CreateTimer()
- call TimerStart(t,0.035,TRUE,function SetBossAtt_TimerActions)
- endfunction
复制代码 |
|