|
楼主 |
发表于 2008-11-15 20:58:29
|
显示全部楼层
我也不明了.
[codes=jass]function Trig_A03X_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A03X'
endfunction
function Trig_A03X_Actionsb takes nothing returns nothing
local unit ua = udg_danwei[127]
local unit us
local timer t = GetExpiredTimer()
local real x = GetUnitX(ua)
local real y = GetUnitY(ua)
local real lx = GetStoredReal(GameCache(),I2S(H2I(t)),"X")
local real ly = GetStoredReal(GameCache(),I2S(H2I(t)),"Y")
local real move = SquareRoot((lx-x)*(lx-x)+(ly-y)*(ly-y))
local integer i = 1
if move <= 50 then
call KillUnit(ua)
endif
if (not(GetUnitState(ua,UNIT_STATE_LIFE) == 0)) then
call IssuePointOrderById(ua,851986,lx,ly)
loop
exitwhen i > 18
set us = CreateUnit(GetOwningPlayer(ua),'n00H',x,y,0.00)
call UnitApplyTimedLife(us,'BHwe',1)
call ShowUnit(ua,false)
call UnitAddAbility(us,'A024')
call IssuePointOrderById(us,852218,x+100*Cos(20*i*3.14159/180),y+100*Sin(20*i*3.14159/180))
set us = null
set i = i+1
endloop
else
loop
exitwhen i > 36
set us = CreateUnit(GetOwningPlayer(ua),'n00H',x,y,0.00)
call UnitApplyTimedLife(us,'BHwe',1)
call ShowUnit(ua,false)
call UnitAddAbility(us,'A024')
call IssuePointOrderById(us,852218,x+100*Cos(10*i*3.14159/180),y+100*Sin(10*i*3.14159/180))
set us = null
set i = i+1
endloop
set udg_danwei[127] = null
call PauseTimer(t)
call DestroyTimer(t)
call FlushStoredMission(GameCache(),I2S(H2I(t)))
endif
set ua = null
set t = null
endfunction
function Trig_A03X_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit ua = CreateUnit(GetOwningPlayer(u),'n00K',GetUnitX(u),GetUnitY(u),0.00)
local location l = GetSpellTargetLoc()
local timer t = CreateTimer()
local real lx = GetLocationX(l)
local real ly = GetLocationY(l)
local real ux = GetUnitX(u)
local real uy = GetUnitY(u)
call SetUnitAnimation(u,"spell")
call UnitApplyTimedLife(ua,'BHwe',4)
set udg_danwei[127] = ua
call IssuePointOrderById(ua,851986,lx,ly)
call StoreReal(GameCache(),I2S(H2I(t)),"X",lx)
call StoreReal(GameCache(),I2S(H2I(t)),"Y",ly)
call TimerStart(t,0.5,true,function Trig_A03X_Actionsb)
call RemoveLocation(l)
set u = null
set ua = null
set l = null
set t = null
endfunction
//===========================================================================
function InitTrig_A03X takes nothing returns nothing
set gg_trg_A03X = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_A03X, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_A03X, Condition( function Trig_A03X_Conditions ) )
call TriggerAddAction( gg_trg_A03X, function Trig_A03X_Actions )
endfunction[/codes]上面带了个全局set udg_danwei[127] = ua,我曾经试将ua放入缓存,但是保存地图时就报错了.
[codes=jass] call StoreInteger(GameCache(),I2S(H2I(t)),"TriggerUnit",H2I(ua))
//将上面这句代替set udg_danwei[127] = ua
//让后
local unit ua = I2U(GetStoredInteger(GameCache(),I2S(H2I(t)),"TriggerUnit"))
//将上面这句代替local unit ua = udg_danwei[127][/codes]这是CH巫妖的冰封球 |
|