|
楼主 |
发表于 2008-7-2 10:17:06
|
显示全部楼层
Time_func 中 udg_count不要清零 独立的计时器,多个不冲突啊= =
For_func 中 udg_count=udg_count+1 去掉 这个无所谓了,看自己爱好
For_func 少写了一个GroupRemoveUnit写了一个
写了一个群体心灵控制了为了不冲突
udg_u udg_count udg_g 都是用来 传递的,一般都使用局部。
[jass]
function Trig_Skill_C2_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A00J'
endfunction
function Skill_C2_g3_func takes nothing returns nothing
local unit u = GetFilterUnit()
if IsUnitType(u,UNIT_TYPE_GIANT)==false and IsUnitType(u,UNIT_TYPE_STRUCTURE)==false and IsUnitType(u,UNIT_TYPE_MECHANICAL)==false and IsUnitType(u,UNIT_TYPE_ANCIENT)==false and IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE)==false and GetUnitState(u,UNIT_STATE_LIFE)>0.01 and IsUnitEnemy(u,GetOwningPlayer(udg_u))==true then
set udg_e = AddSpecialEffectTarget("Abilities\\\\Spells\\\\Undead\\\\DeathandDecay\\\\DeathandDecayDamage.mdl",u,"chest")
set udg_time = 2
call ExecuteFunc("ESD")
call UnitDamageTarget(udg_u,u,udg_damage,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
endif
set u = null
endfunction
function Skill_C2_g2_func takes nothing returns nothing
local unit u = GetEnumUnit()
local integer ih
local real x
local real y
local group g
set udg_count=udg_count+1
if GetUnitAbilityLevel(u,'B002')<=0 then
call GroupRemoveUnit(udg_g,u)
set ih = h2i(u)
if GetUnitState(u,UNIT_STATE_LIFE)>0.01 then
call SetUnitOwner(u,i2pr(GetStoredInteger(udg_gc,I2S(ih),"HeiAnZhuanHuan_Pra")),true)
else
set x = GetUnitX(u)
set y = GetUnitY(u)
call DestroyEffect(AddSpecialEffect("Objects\\\\Spawnmodels\\\\Undead\\\\UndeadDissipate\\\\UndeadDissipate.mdl",x,y))
set udg_u = CreateUnit(i2pr(GetStoredInteger(udg_gc,I2S(ih),"HeiAnZhuanHuan_Prb")),'e000',x,y,0)
set g = CreateGroup()
call GroupEnumUnitsInRange(g,x,y,150,Condition(function Skill_C2_g3_func))
call DestroyGroup(g)
call UnitApplyTimedLife(udg_u,'BHwe',0.50)
endif
call FlushStoredInteger(udg_gc,I2S(ih),"HeiAnZhuanHuan_Pra")
call FlushStoredInteger(udg_gc,I2S(ih),"HeiAnZhuanHuan_Prb")
endif
set u = null
set g = null
endfunction
function Skill_C2_t_func takes nothing returns nothing
local integer ih = h2i(GetExpiredTimer())
local group g = i2g(GetStoredInteger(udg_gc,I2S(ih),"g"))
set udg_damage = GetStoredReal(udg_gc,I2S(ih),"damage")
set udg_count=0
set udg_g = g
call ForGroup(g,function Skill_C2_g2_func)
call DisplayTimedTextToPlayer(Player(0),0,0,0.75,I2S(udg_count))
if udg_count<=0 then
call DestroyGroup(g)
call PauseTimer(i2t(ih))
call FlushStoredMission(udg_gc,I2S(ih))
call DestroyTimer(i2t(ih))
endif
set g = null
endfunction
function Skill_C2_g1_func takes nothing returns nothing
local unit u = GetFilterUnit()
local integer ih = h2i(u)
if IsUnitType(u,UNIT_TYPE_GIANT)==false and IsUnitType(u,UNIT_TYPE_STRUCTURE)==false and IsUnitType(u,UNIT_TYPE_MECHANICAL)==false and IsUnitType(u,UNIT_TYPE_ANCIENT)==false and IsUnitType(u,UNIT_TYPE_MAGIC_IMMUNE)==false and GetUnitState(u,UNIT_STATE_LIFE)>0.01 and GetStoredInteger(udg_gc,I2S(ih),"HeiAnZhuanHuan_Pra")<=0 and IsUnitEnemy(u,GetOwningPlayer(udg_u))==true then
set udg_e = AddSpecialEffectTarget("Abilities\\\\Spells\\\\Items\\\\AIil\\\\AIilTarget.mdl",u,"origin")
set udg_time = 2
call ExecuteFunc("ESD")
call SetUnitX(udg_u,GetUnitX(u))
call SetUnitY(udg_u,GetUnitY(u))
call IssueTargetOrderById(udg_u,852560,u)
call StoreInteger(udg_gc,I2S(ih),"HeiAnZhuanHuan_Pra",h2i(GetOwningPlayer(u)))
call StoreInteger(udg_gc,I2S(ih),"HeiAnZhuanHuan_Prb",h2i(GetOwningPlayer(udg_u)))
call SetUnitOwner(u,GetOwningPlayer(udg_u),true)
set udg_count = udg_count+1
call GroupAddUnit(udg_g,u)
else
call GroupRemoveUnit(udg_g,u)
endif
set u = null
endfunction
function Trig_Skill_C2_Actions takes nothing returns nothing
local unit ua = GetTriggerUnit()
local location p = GetSpellTargetLoc()
local unit ub = CreateUnitAtLoc(GetOwningPlayer(ua),'e000',p,0)
local group g = CreateGroup()
local timer t = CreateTimer()
local integer ih = h2i(t)
call UnitAddAbility(ub,'A00K')
call SetUnitAbilityLevel(ub,'A00K',GetUnitAbilityLevel(ua,'A00J'))
set udg_u = ub
set udg_count=0
set udg_g = g
call GroupEnumUnitsInRange(g,GetLocationX(p),GetLocationY(p),150,Condition(function Skill_C2_g1_func))
if udg_count>0 then
call StoreInteger(udg_gc,I2S(ih),"g",h2i(g))
call StoreReal(udg_gc,I2S(ih),"damage",GetUnitAbilityLevel(ua,'A00J')*50)
call TimerStart(t,0.25,true,function Skill_C2_t_func)
else
call DestroyGroup(g)
call DestroyTimer(t)
endif
call UnitApplyTimedLife(ub,'BHwe',0.50)
call RemoveLocation(p)
set ua = null
set ub = null
set g = null
set p = null
set t = null
endfunction
//===========================================================================
function InitTrig_Skill_C2 takes nothing returns nothing
set gg_trg_Skill_C2 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Skill_C2, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Skill_C2, Condition( function Trig_Skill_C2_Conditions ) )
call TriggerAddAction( gg_trg_Skill_C2, function Trig_Skill_C2_Actions )
endfunction
[/jass] |
|