找回密码
 点一下
查看: 1132|回复: 5

关于圆形移动

[复制链接]
发表于 2008-4-11 13:46:56 | 显示全部楼层 |阅读模式
function light_working takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit ua = GetHandleUnit(t,"Light_ua")
local integer lv = GetHandleInt(t,"Light_lv")
local real CenterLocX = GetHandleReal(t,"CenterLocX")
local real CenterLocY = GetHandleReal(t,"CenterLocY")
local integer i = 1

local real k1 = GetHandleReal(t,"k1")
local real k2 = GetHandleReal(t,"k2")

local unit array U_loop1
local unit array U_loop2

local real array U_loop1_LocX
local real array U_loop1_LocY
local real array U_loop2_LocX
local real array U_loop2_LocY

local real array U_loop1_tempLocX
local real array U_loop1_tempLocY
local real array U_loop2_tempLocX
local real array U_loop2_tempLocY

local group g = CreateGroup()
local boolexpr bol = Condition(function filterunits6)
if ( GetUnitAbilityLevel(ua, 'A01F') != 0 ) then

    set k1 = k1 + 1
    call SetHandleReal(t,"k1",k1)
    set k2 = k2 - 1
    call SetHandleReal(t,"k2",k2)

loop
exitwhen i >24
set U_loop1= GetHandleUnit(t,("U_loop1"+ I2S(i)) )
set U_loop2= GetHandleUnit(t,("U_loop2"+ I2S(i)) )

set U_loop1_LocX = GetUnitX(U_loop1)
set U_loop1_LocY = GetUnitY(U_loop1)

set U_loop1_tempLocX = CenterLocX + Cos(k1)*( 42.00 * i )
set U_loop1_tempLocY = CenterLocY + Sin(k1)*( 42.00 * i )
call SetUnitPosition(U_loop1,U_loop1_tempLocX,U_loop1_tempLocY)

set U_loop2_LocX = GetUnitX(U_loop2)
set U_loop2_LocY = GetUnitY(U_loop2)

set U_loop2_tempLocX = CenterLocX + Cos(k2)*( 42.00 * i )
set U_loop2_tempLocY = CenterLocY + Sin(k2)*( 42.00 * i )
call SetUnitPosition(U_loop2,U_loop2_tempLocX,U_loop2_tempLocY)

set i = i + 1
endloop
call GroupEnumUnitsInRange(g, GetUnitX(ua), GetUnitY(ua) , 1200, bol )
set udg_Num_Int = lv
call ForGroupBJ( g, function EmyAway )
else
call Light_over(ua)
call PauseTimer( t )
call DestroyTimer( t )
endif
call DestroyBoolExpr(bol)
call GroupClear( g )
call DestroyGroup(g)
set g = null
set bol = null
call DisplayTextToPlayer( Player(0), 0, 0, "k1="+R2S(k1) )
call DisplayTextToPlayer( Player(0), 0, 0, "k2="+R2S(k2) )
endfunction

function Trig_Light_start_Actions takes nothing returns nothing
local timer t = CreateTimer()
local timer t2 = CreateTimer()
local integer i= 1
local unit ua = GetTriggerUnit()

local real r_ua = GetUnitFacing(ua)
local integer lv = GetUnitAbilityLevel(ua, 'A006')
local location loc_ua = PolarProjectionBJ(GetUnitLoc(ua), 30.00, ( r_ua + 5.00 ))

local real CenterLocX = GetLocationX(loc_ua)
local real CenterLocY = GetLocationY(loc_ua)

local unit array U_loop1
local unit array U_loop2

local real array U_loop1_LocX
local real array U_loop1_LocY
local real array U_loop2_LocX
local real array U_loop2_LocY

local real array U_loop1_tempLocX
local real array U_loop1_tempLocY
local real array U_loop2_tempLocX
local real array U_loop2_tempLocY

local real k1
local real k2

set k1 = GetRandomReal(r_ua, ( r_ua + 25.00 ))
set k2 = GetRandomReal(( r_ua - 25.00 ), r_ua )


loop
exitwhen i > 24
set U_loop1_tempLocX = CenterLocX + Cos(k1)*( 42.00 * i )
set U_loop1_tempLocY = CenterLocY + Sin(k1)*( 42.00 * i )
set U_loop1 = CreateUnit(GetOwningPlayer(ua),'e003',U_loop1_tempLocX,U_loop1_tempLocY,0)

call SetUnitFlyHeight( U_loop1, ( 210.00 + ( i * 12.00 ) ), 1000000000.00 )
call SetUnitLookAt( U_loop1, "bone_head", ua, 0.00, 0.00, 0.00 )
call SetUnitScale( U_loop1, ( 0.21 * i ), ( 0.21 * i ), ( 0.21 * i ) )
call SetUnitVertexColor( U_loop1, 255, 255, 255, 90 )


set U_loop2_tempLocX = CenterLocX + Cos(k2)*( 42.00 * i )
set U_loop2_tempLocY = CenterLocY + Sin(k2)*( 42.00 * i )
set U_loop2 = CreateUnit(GetOwningPlayer(ua),'e003',U_loop2_tempLocX,U_loop2_tempLocY,0)

call SetUnitFlyHeight( U_loop2, ( 210.00 + ( i * 12.00 ) ), 1000000000.00 )
call SetUnitLookAt( U_loop2, "bone_head", ua, 0.00, 0.00, 0.00 )
call SetUnitScale( U_loop2, ( 0.21 * i ), ( 0.21 * i ), ( 0.21 * i ) )
call SetUnitVertexColor( U_loop2, 255, 255, 255, 90 )
set i = i + 1
endloop
// 传送单位
set i = 1
loop
exitwhen i >24
call SetHandleHandle(t,( "U_loop1"+ I2S(i)),U_loop1 )
call SetHandleHandle(t,( "U_loop2"+ I2S(i)),U_loop2 )
set i = i + 1
endloop
// 传送单位完毕

call UnitAddAbility( ua, 'A01F' )
call SetHandleHandle(t2,"Light_ua2",ua)
call TimerStart(t2,2.95,true,function light_set )

call SetHandleReal(t,"CenterLocX",CenterLocX)
call SetHandleReal(t,"CenterLocY",CenterLocY)
call SetHandleHandle(t,"Light_ua",ua)
call SetHandleInt(t,"Light_lv",lv)
call SetHandleReal(t,"k1",k1)
call SetHandleReal(t,"k2",k2)
call TimerStart(t,0.07,true,function light_working )
endfunction


没法看了
2道光搞成这样
以下为当前效果图和T版的技能
光芒之驱逐.w3x (25 KB, 下载次数: 3)
图.jpg
发表于 2008-4-11 14:24:53 | 显示全部楼层
算不算重复帖啊
回复

使用道具 举报

发表于 2008-4-11 14:45:09 | 显示全部楼层
虽然帖子很长~~可是你的问题在哪里呢?~~

你实际想要的效果又是什么呢?~~
回复

使用道具 举报

发表于 2008-4-11 16:10:45 | 显示全部楼层
1)不清楚 你的所有数组的下标  是本来就没有   还是复制的时候全丢失了
另外 既然用了缓存    数组就没必要了

2) 你没贴出 light_set 函数
图里出现了 两条以上的光芒       是不是因为没有设生命周期



猜测而已
回复

使用道具 举报

 楼主| 发表于 2008-4-12 15:20:00 | 显示全部楼层

SIN和COS没加BJ
按弧度算的
这就是问题。。。已经改好了。
回复

使用道具 举报

 楼主| 发表于 2008-4-12 15:30:16 | 显示全部楼层
引用第1楼msloveya于2008-04-11 14:24发表的  :
算不算重复帖啊
这个是自己写的,改动很大。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-7-21 10:50 , Processed in 0.086343 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表