|
发表于 2008-11-16 17:37:53
|
显示全部楼层
100%没排泄........
原来做了一个,但是没处理好地形高度问题,主要是因为弄出那么多点再GetLocationZ再设置高度有点麻烦,嘛、做成技能倒是不错。
[jass]
function Laser_Remove takes nothing returns nothing
local unit u = bj_lastCreatedUnit
call TriggerSleepAction(0)
call KillUnit(u)
call TriggerSleepAction(1)
call RemoveUnit(u)
set u = null
endfunction
function Laser takes real LocX1,real LocY1,real LocZ1,real LocX2,real LocY2,real LocZ2,integer EffectID,string Effect returns nothing
local integer i = 0
local integer imax = R2I(SquareRoot((LocX1-LocX2) * (LocX1-LocX2) + (LocY1-LocY2) * (LocY1-LocY2))/30) + 188
local real angle = (180.0/3.14159)*Atan2(LocY2-LocY1,LocX2-LocX1)
local real MapMinX = GetRectMinX(bj_mapInitialPlayableArea)
local real MapMaxX = GetRectMaxX(bj_mapInitialPlayableArea)
local real MapMinY = GetRectMinY(bj_mapInitialPlayableArea)
local real MapMaxY = GetRectMaxY(bj_mapInitialPlayableArea)
local real height = 0
local real x = 0
local real y = 0
local real z = 0
local unit u = null
if (LocZ1!=0) or (LocZ2!=0) then
set height = (LocZ1 - LocZ2)/(imax-188)
loop
set i = i + 1
exitwhen (i > imax) or ((LocZ1-height*I2R(i)) < 0) or (x > MapMaxX) or (x < MapMinX) or (y > MapMaxY) or (y < MapMinY)
set x = LocX1 + I2R(30*i) * Cos(angle*(3.14159/180))
set y = LocY1 + I2R(30*i) * Sin(angle*(3.14159/180))
set u = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),EffectID,x,y,angle)
call SetUnitFlyHeight(u,(LocZ1-height*I2R(i)),0)
set bj_lastCreatedUnit = u
call ExecuteFunc("Laser_Remove")
endloop
else
loop
set i = i + 1
exitwhen i > imax
set x = LocX1 + I2R(30*i) * Cos(angle*(3.14159/180))
set y = LocY1 + I2R(30*i) * Sin(angle*(3.14159/180))
call DestroyEffect(AddSpecialEffect(Effect,x,y))
endloop
endif
set u = null
endfunction
[/jass] |
|