|
发表于 2009-5-24 19:37:02
|
显示全部楼层
先从最后一个函数开始解释,前面跟后面相同的省略
[jass]function H2I takes handle h returns integer
return h
return 0
endfunction
function H2S takes handle h returns string
return I2S(H2I(h))
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
//Return Bug函数,不用说了
function jinengloop takes nothing returns nothing
local timer tt=GetExpiredTimer()
local real cx =GetStoredReal(udg_GC,H2S(tt),"cx")
local real cy=GetStoredReal(udg_GC,H2S(tt),"cy")
local real angle=GetStoredReal(udg_GC,H2S(tt),"angle")
local real x
local real y
local real z
local real dd=GetStoredReal(udg_GC,H2S(tt),"dd")//读取储存的信息
local unit array danwei
local real array x1
local real array y1
local real array z1
local real array z2
local integer i
set x=dd*Cos(angle)+cx
set y=dd*Sin(angle)+cy//取得一个新的坐标值,让每个单位都向前移动100,以下做跟jineng函数相同的事情
if dd<800 then
set dd=dd+50
call StoreReal(udg_GC,H2S(tt),"dd",dd)
call DestroyEffect( AddSpecialEffect("Abilities\\\\Spells\\\\Undead\\\\AnimateDead\\\\AnimateDeadTarget.mdl", x, y) )
set i=1
loop
exitwhen i>50
set x1=(x*i+cx*(50-i))/50
set y1=(y*i+cy*(50-i))/50
set z1=(60*(50-i))/50
set danwei=I2U(GetStoredInteger(udg_GC,H2S(tt),"danwei"+I2S(i)))
call SetUnitX(danwei,x1)
call SetUnitY(danwei,y1)
call SetUnitFlyHeight(danwei,z1,0)
set i=i+1
endloop
else
if dd<880 then
set dd=dd+4
call StoreReal(udg_GC,H2S(tt),"dd",dd)
set i=1
loop
exitwhen i>50
set z2=-(i-30)*(i-30)/2+450
set z1=(80*(50-i))/50
set i=i+1
endloop
set i=1
loop
exitwhen i>50
set z=(z1*(880-dd)+z2*(dd-800))/80
set danwei=I2U(GetStoredInteger(udg_GC,H2S(tt),"danwei"+I2S(i)))
call SetUnitFlyHeight(danwei,z,0)
set i=i+1
endloop
else
call DestroyTimer(tt)
call FlushStoredReal(udg_GC,H2S(tt),"anlge")
call FlushStoredReal(udg_GC,H2S(tt),"cx")
call FlushStoredReal(udg_GC,H2S(tt),"cy")
call FlushStoredReal(udg_GC,H2S(tt),"dd")
call FlushStoredInteger(udg_GC,H2S(tt),"int")
set i=1
loop
exitwhen i>50
set danwei=I2U(GetStoredInteger(udg_GC,H2S(tt),"danwei"+I2S(i)))
call SetUnitTimeScale(danwei,5)
call KillUnit(danwei)
call FlushStoredInteger(udg_GC,H2S(tt),"danwei"+I2S(i))
set i=i+1
endloop
endif
endif
//return
endfunction
//
function jineng takes nothing returns nothing
local unit u=GetTriggerUnit()
local timer tt=CreateTimer()
local real cx
local real cy
local real angle
local real x
local real y
local real dd=100
local unit array danwei
local real array x1
local real array y1
local real array z1
local integer i
set cx=GetUnitX(u)
set cy=GetUnitY(u)//坐标
set angle=GetUnitFacing(u)
set angle=angle*Atan(1)/45 //取得单位面向角度的弧度值
set x=dd*Cos(angle)+cx
set y=dd*Sin(angle)+cy//单位面向角度所在方向距离100的坐标
set i=1
loop
exitwhen i>50
set x1=(x*i+cx*(50-i))/50
set y1=(y*i+cy*(50-i))/50//这个是将(cx,cy)和(x,y)分成51份,去分点坐标
set z1=(60*(50-i))/50//抛物线高度...
set danwei=CreateUnit(GetOwningPlayer(u),'e003',x1,y1,angle)//在每个分点创建一个单位
call SetUnitFlyHeight(danwei,z1,0)//设置单位高度,让他们排成抛物线形状
call SetUnitTimeScale(danwei,0.01)//让单位几乎静止
call StoreInteger(udg_GC,H2S(tt),"danwei"+I2S(i),H2I(danwei))//GameCache储存单位
set i=i+1
endloop
call StoreReal(udg_GC,H2S(tt),"angle",angle)
call StoreReal(udg_GC,H2S(tt),"cx",cx)
call StoreReal(udg_GC,H2S(tt),"cy",cy)
call StoreReal(udg_GC,H2S(tt),"dd",dd)//储存信息
//
call TimerStart(tt,0.05,true,function jinengloop)//开启计时器,0.05秒周期做动作
set u=null
//return
endfunction[/jass]
修改了一下,这技能作者用了这么多的空行。。
在最后一个触发器中调用jineng()函数 |
|