|
发表于 2008-7-11 20:05:28
|
显示全部楼层
我到是做了个。。冰冻闪电链。。。。
不知道...LZ要否
是J的。。分4个函数。。。。
本人懒到。。。不想法附件了。。直接发函数
[jass]
//===============闪电效果(淡化效果)======
//参数:1.闪电效果类型2.开始单位3.结束单位4.持续时间(精确度0.1秒)5.目标单位特效
function WS_Lightning_2 takes nothing returns nothing
local timer Timer = GetExpiredTimer()
local lightning Lightning = I2LGT(GetStoredInteger(udg_cache,I2S(H2I(Timer)),"Lightning"))
local unit Start_Unit = I2U(GetStoredInteger(udg_cache,I2S(H2I(Timer)),"Start_Unit"))
local unit End_Unit = I2U(GetStoredInteger(udg_cache,I2S(H2I(Timer)),"End_Unit"))
local real Time = GetStoredReal(udg_cache,I2S(H2I(Timer)),"Time")
local real Endtime = GetStoredReal(udg_cache,I2S(H2I(Timer)),"Endtime")+0.1
call StoreReal(udg_cache,I2S(H2I(Timer)),"Endtime",Endtime)
if(Endtime>Time)then
call DestroyLightning(Lightning)
call FlushStoredMission(udg_cache,I2S(H2I(Timer)))
call DestroyTimer(Timer)
else
if (GetUnitState(End_Unit,UNIT_STATE_LIFE)>0 and GetUnitState(Start_Unit,UNIT_STATE_LIFE)>0)then
call SetLightningColor(Lightning, 1, 1, 1, 1-Endtime/Time)
call MoveLightningEx(Lightning, true,GetUnitX(Start_Unit), GetUnitY(Start_Unit), GetUnitFlyHeight(Start_Unit)+60, GetUnitX(End_Unit),GetUnitY(End_Unit), GetUnitFlyHeight(End_Unit)+60 )
else
call SetLightningColor(Lightning, 1, 1, 1, 1-Endtime/Time)
endif
endif
set Lightning = null
set Timer = null
set Start_Unit = null
set End_Unit = null
endfunction
function WS_Lightning takes string Lightning_Type,unit Start_Unit,unit End_Unit,real Time,string Effect returns nothing
local timer Timer = CreateTimer()
local lightning Lightning = AddLightningEx(Lightning_Type,true, GetUnitX(Start_Unit), GetUnitY(Start_Unit), GetUnitFlyHeight(Start_Unit)+60, GetUnitX(End_Unit),GetUnitY(End_Unit),GetUnitFlyHeight(End_Unit)+60)
call DestroyEffect(AddSpecialEffectTarget( Effect,End_Unit,"chest") )
call StoreInteger(udg_cache,I2S(H2I(Timer)),"Lightning",H2I(Lightning))
call StoreInteger(udg_cache,I2S(H2I(Timer)),"Start_Unit",H2I(Start_Unit))
call StoreInteger(udg_cache,I2S(H2I(Timer)),"End_Unit",H2I(End_Unit))
call StoreReal(udg_cache,I2S(H2I(Timer)),"Time",Time)
call TimerStart(Timer,0.1,true,function WS_Lightning_2)
set Lightning = null
set Timer = null
endfunction
//=======================================
//================霜冻效果(BUFF效果)===============
//参数1.目标单位2.持续时间
function WS_Slow_2 takes nothing returns nothing
local timer Timer = GetExpiredTimer()
local unit Unit = I2U(GetStoredInteger(udg_cache,I2S(H2I(Timer)),"Unit"))
call UnitRemoveAbility(Unit,'B000')
call FlushStoredMission(udg_cache,I2S(H2I(Timer)))
call FlushStoredMission(udg_cache,I2S(H2I(Unit)))
set Timer = null
call DestroyTimer(Timer)
set Unit = null
endfunction
function WS_Slow takes unit Unit,real Time returns nothing
local timer Timer = I2TM(GetStoredInteger(udg_cache,I2S(H2I(Unit)),"Timer"))
local unit Auxiliary_Unit = CreateUnit(GetTriggerPlayer(), 'h000', GetUnitX(Unit), GetUnitY(Unit), 0)
if (H2I(Timer)==0) then
set Timer = CreateTimer()
call StoreInteger(udg_cache,I2S(H2I(Unit)),"Timer",H2I(Timer))
call UnitAddAbility(Auxiliary_Unit,'A000')
call IssueTargetOrderById(Auxiliary_Unit, 852226, Unit )
call StoreInteger(udg_cache,I2S(H2I(Timer)),"Unit",H2I(Unit))
call TimerStart(Timer,Time,false,function WS_Slow_2)
else
call DestroyTimer(Timer)
set Timer = CreateTimer()
call StoreInteger(udg_cache,I2S(H2I(Unit)),"Timer",H2I(Timer))
call UnitAddAbility(Auxiliary_Unit,'A000')
call IssueTargetOrderById(Auxiliary_Unit, 852226, Unit )
call StoreInteger(udg_cache,I2S(H2I(Timer)),"Unit",H2I(Unit))
call TimerStart(Timer,Time,false,function WS_Slow_2)
endif
set Timer = null
set Auxiliary_Unit = null
endfunction
//=======================================================
//==============选取范围内满足是敌人,不是建筑,是存活的单位========
//=====参数1.范围2.中心点3.过滤单位
function WS_GetUnitsInRangeOfLoc_2 takes nothing returns boolean
if (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false)then
if (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0)then
return true
endif
endif
return false
endfunction
function WS_GetUnitsInRangeOfLoc takes real radius,location whichLocation,group Unit,player Play returns unit
local group G= GetUnitsInRangeOfLocMatching(radius,whichLocation,Condition(function WS_GetUnitsInRangeOfLoc_2))
local integer Unit_2
call GroupRemoveGroup( Unit, G )
set Unit_2 = H2I(FirstOfGroup(G))
loop
exitwhen(IsUnitEnemy(I2U(Unit_2), Play) == true or CountUnitsInGroup(G)<=0)
call GroupRemoveUnit( G,I2U(Unit_2))
set Unit_2 = H2I(FirstOfGroup(G))
endloop
if (CountUnitsInGroup(G)<=0) then
call DestroyGroup(G)
return null
else
call DestroyGroup(G)
return I2U(Unit_2)
endif
endfunction
技能函数见下面的
function Trig_Ice_Lightning_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function Trig_Ice_Lightning_Actions takes nothing returns nothing
local unit Trigger_Unit = GetTriggerUnit()
local unit GetSpellTarget_Unit = GetSpellTargetUnit()
local group Group = CreateGroup()
local unit Unit
local integer i =0
call WS_Lightning("CLPB",Trigger_Unit,GetSpellTarget_Unit,0.7,"Abilities\\\\Weapons\\\\FrostWyrmMissile\\\\FrostWyrmMissile.mdl")
call WS_Slow(GetSpellTarget_Unit,3)
call UnitDamageTarget(Trigger_Unit,GetSpellTarget_Unit,100,true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call GroupAddUnit(Group,GetSpellTarget_Unit)
loop
exitwhen (i>=100)
set i=i+1
set Unit = WS_GetUnitsInRangeOfLoc(600,GetUnitLoc(GetSpellTarget_Unit),Group,Player(0))
if (H2I(Unit)!=0)then
call TriggerSleepAction( 0.00 )
call GroupAddUnit(Group,Unit)
call WS_Lightning("CLPB",GetSpellTarget_Unit,Unit,0.7,"Abilities\\\\Weapons\\\\FrostWyrmMissile\\\\FrostWyrmMissile.mdl")
call WS_Slow(Unit,3)
call UnitDamageTarget(Trigger_Unit,Unit,100,true,false,ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
set GetSpellTarget_Unit = Unit
else
call TriggerSleepAction( 0.00 )
endif
endloop
set Trigger_Unit = null
set GetSpellTarget_Unit = null
set Unit = null
set Group = null
call GroupClear( Group )
call DestroyGroup( Group )
endfunction
//===========================================================================
function InitTrig_Ice_Lightning takes nothing returns nothing
set gg_trg_Ice_Lightning = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ice_Lightning, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ice_Lightning, Condition( function Trig_Ice_Lightning_Conditions ) )
call TriggerAddAction( gg_trg_Ice_Lightning, function Trig_Ice_Lightning_Actions )
endfunction
[/jass]
OVER....自己都觉得长...
不过我是特意分开写的...
一些功能 之后的技能还能用.....
这个是缓存版...
我还有个数组版 |
|