|
发表于 2009-1-4 18:42:53
|
显示全部楼层
额........你要这么说我只好再做广告了(没办法,不知道其他什么地方有.....)
刚刚发的链模拟:
http://www.islga.org/bbs/read.php?tid=23243
一个就是 Test Trigger 2 下的:
[jass]
function Goushou_R_G_C takes nothing returns boolean
return ((IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE) > 0))
endfunction
function Goushou_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g
local group tempg
local unit u = I2U(GetStoredInteger(udg_GC,I2S(H2I(t)),"caster"))
local unit ua
local integer i = GetStoredInteger(udg_GC,I2S(H2I(t)),"counter") - 1
local real x = GetUnitX(u)
local real y = GetUnitY(u)
local real angle
call StoreInteger(udg_GC,I2S(H2I(t)),"counter",i)
if i != 0 then
set g = I2G(GetStoredInteger(udg_GC,I2S(H2I(t)),"group"))
set tempg = CreateGroup()
loop
set ua = FirstOfGroup(g)
exitwhen ua == null
set angle = Atan2(GetUnitY(ua)-y,GetUnitX(ua)-x)
if i - (i / 4) * 4 == 0 then
call DestroyEffect(AddSpecialEffect("Objects\\\\Spawnmodels\\\\Undead\\\\ImpaleTargetDust\\\\ImpaleTargetDust.mdl",GetUnitX(ua),GetUnitY(ua)))
endif
call SetUnitFacing(ua,GetUnitFacing(ua)+120)
call SetUnitX(ua,GetUnitX(ua)+15*Cos(angle))
call SetUnitY(ua,GetUnitY(ua)+15*Sin(angle))
call GroupRemoveUnit(g,ua)
call GroupAddUnit(tempg,ua)
endloop
loop
set ua = FirstOfGroup(tempg)
exitwhen ua == null
call GroupRemoveUnit(tempg,ua)
call GroupAddUnit(g,ua)
endloop
call DestroyGroup(tempg)
set tempg = null
else
call PauseTimer(t)
call DestroyGroup(g)
call FlushStoredMission(udg_GC,I2S(H2I(t)))
call DestroyTimer(t)
endif
set u = null
set t = null
set g = null
endfunction
function Trig_AEfk_Conditions takes nothing returns boolean
local timer t
local group g
if GetSpellAbilityId() == 'A004' then
set t = CreateTimer()
set g = CreateGroup()
call GroupEnumUnitsInRange(g,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),500,Condition(function Goushou_R_G_C))
call StoreInteger(udg_GC,I2S(H2I(t)),"caster",H2I(GetTriggerUnit()))
call StoreInteger(udg_GC,I2S(H2I(t)),"group",H2I(g))
call StoreInteger(udg_GC,I2S(H2I(t)),"counter",15)
call TimerStart(t,.04,true,function Goushou_Timer)
set t = null
set g = null
endif
return false
endfunction
[/jass]
注意看跟Group有关的语句。此为方法三。如果是方法二的话]就要在[jass]call GroupEnumUnitsInRange(g,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),500,Condition(function Goushou_R_G_C))[/jass]之前搞个全局变量把施法单位(或是说从哪一点为击退中心)的坐标记录(记得当初我用的是bj_meleeNearestMineToLoc还是其他什么的,总而言之是个看起来就满危险的全局bj变量.....)。然后把[jass] call SetUnitFacing(ua,GetUnitFacing(ua)+120)
call SetUnitX(ua,GetUnitX(ua)+15*Cos(angle))
call SetUnitY(ua,GetUnitY(ua)+15*Sin(angle))[/jass]之类的东西写到function Goushou_R_G_C下
额,由于例子没举好,看下面一个.......
[jass]
function Goushou_R_G_C takes nothing returns boolean
return ((IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))) and (GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE) > 0))
endfunction
function Goushou_R_G takes nothing returns nothing
local real LocX = GetUnitX(GetEnumUnit())
local real LocY = GetUnitY(GetEnumUnit())
local real angle = Atan2(GetUnitY(bj_lastCreatedUnit)-LocY,GetUnitX(bj_lastCreatedUnit)-LocX)
set LocX = LocX + 70 * Cos(angle)
set LocY = LocY + 70 * Sin(angle)
if (LocX > GetRectMinX(bj_mapInitialPlayableArea)) and (LocX < GetRectMaxX(bj_mapInitialPlayableArea)) and (LocY > GetRectMinY(bj_mapInitialPlayableArea)) and (LocY < GetRectMaxY(bj_mapInitialPlayableArea)) then
call SetUnitX(GetEnumUnit(),LocX)
call SetUnitY(GetEnumUnit(),LocY)
call DestroyEffect(AddSpecialEffect("Objects\\\\Spawnmodels\\\\Undead\\\\ImpaleTargetDust\\\\ImpaleTargetDust.mdl",LocX,LocY))
endif
endfunction
function Goushou_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local group g = I2G(GetStoredInteger(udg_GC,I2S(H2I(t)),"group"))
local unit u = I2U(GetStoredInteger(udg_GC,I2S(H2I(t)),"caster"))
local integer i = GetStoredInteger(udg_GC,I2S(H2I(t)),"counter") - 1
call StoreInteger(udg_GC,I2S(H2I(t)),"counter",i)
if i != 0 then
set bj_lastCreatedUnit = u
call ForGroup(g,function Goushou_R_G)
else
call PauseTimer(t)
call DestroyGroup(g)
call FlushStoredMission(udg_GC,I2S(H2I(t)))
call DestroyTimer(t)
endif
set u = null
set t = null
set g = null
endfunction
function Trig_AEfk_Actions takes nothing returns nothing
local timer t = CreateTimer()
local group g = CreateGroup()
call GroupEnumUnitsInRange(g,GetUnitX(GetTriggerUnit()),GetUnitY(GetTriggerUnit()),500,Condition(function Goushou_R_G_C))
call StoreInteger(udg_GC,I2S(H2I(t)),"caster",H2I(GetTriggerUnit()))
call StoreInteger(udg_GC,I2S(H2I(t)),"group",H2I(g))
call StoreInteger(udg_GC,I2S(H2I(t)),"counter",10)
call TimerStart(t,.05,true,function Goushou_Timer)
set t = null
set g = null
endfunction
[/jass]
在ForGroup之前用到了bj_lastCreatedUnit。
代码的效率问题就别吐我槽了,因为是以前写的........ |
|