|
楼主 |
发表于 2008-8-23 12:58:32
|
显示全部楼层
[jass]function GroupAC takes nothing returns nothing
local timer t = CreateTimer()
call StoreInteger( CacheValue(), HandleName(t), "UTG", ConvertHandleInt(GetTriggerUnit()) )
call StoreInteger( CacheValue(), HandleName(t), "UBOO", ConvertHandleInt(GetEnumUnit()) )
call StoreInteger( CacheValue(), HandleName(t), "INT", 0 )
call TimerStart( t, 0.03, true, function boo )
set t = null
endfunction
function Trig_NewTrigger_001_Actions takes nothing returns nothing
local group GG = CreateGroup()
local integer xunhuan = 0
local location p1
local location p2 = GetUnitLoc(GetTriggerUnit())
loop
exitwhen xunhuan > 44
set p1 = PolarProjectionBJ(p2, 5.00, ( ( I2R(xunhuan) + 1 ) * 8.00 ))
call CreateNUnitsAtLoc( 1, 'hfoo', GetOwningPlayer(GetTriggerUnit()), p1, ( ( 1 + I2R(xunhuan) ) * 8.00 ) )
set xunhuan = xunhuan + 1
call GroupAddUnitSimple( GetLastCreatedUnit(),GG)
endloop
call ForGroupBJ(GG, function GroupAC)
call GroupClear(GG)
call RemoveLocation(p1)
call RemoveLocation(p2)
set GG = null
set p1 = null
set p2 = null
endfunction
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function boo takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u1 = ConvertUnit( GetStoredInteger(CacheValue(), HandleName(t), "UTG") )
local unit u2 = ConvertUnit( GetStoredInteger(CacheValue(), HandleName(t), "UBOO"))
local integer cs = GetStoredInteger(CacheValue(), HandleName(t), "INT")
local real angle = 0
local real tempX = 0
local real tempY = 0
set angle = AngleBetweenUnits( u1, u2 )
set tempX = GetUnitX( u2 ) + 30 * Cos( (3.14159/180) * angle )
set tempY = GetUnitY( u2 ) + 30 * Sin( (3.14159/180) * angle )
call SetUnitX( u2, tempX )
call SetUnitY( u2, tempY )
set cs = cs +30
call StoreInteger( CacheValue(), HandleName(t), "INT", cs )
if(cs>700) then
call KillUnit(u2)
call FlushStoredMission( CacheValue(), HandleName(t) )
call DestroyTimer( t )
endif
set t = null
set u1 = null
set u2 = null
endfunction [/jass]
还好有保存,我测试的时候确实 单位组 的这种做法卡很多,,,,,,不知道是不是哪里写得不对~ |
|