|
[codes=jass]function H2I takes handle h returns integer
return h
return 0
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function I2TD takes integer i returns timerdialog
return i
return null
endfunction
function GameCache takes nothing returns gamecache
if udg_GC == null then
call FlushGameCache(InitGameCache("map.w3v"))
set udg_GC = InitGameCache("map.w3v")
endif
return udg_GC
endfunction
function tiaojian takes nothing returns nothing
if (not(IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == true )) then
return false
endif
return true
endfunction
function jishiqi takes nothing returns nothing
local unit u =I2U(GetStoredInteger(GC(),I2S(H2I(GetExpiredTimer())),"TriggerUnit"))
local timerdialog td = I2TD(GetStoredInteger(GC),I2S(H2I(GetExpiredTimer())),"TimerDialog"))
call ReviveHeroLoc(u,GetRectCenter(GetPlayableMapRect()), false )
call DestroyTimerDialog(td)
call FlushStoredMission(GC(), I2S(H2I(GetExpiredTimer())))
set u = null
set td = null
endfunction
function fh takes nothing returns nothing
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
local timerdialog td = CreateTimerDialog(t)
call TimerDialogSetTitle(td, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "复活时间:" )
call StoreInteger(GC(),I2S(H2I(t)),"TriggerUnit",H2I(GetTriggerUnit()))
call StoreInteger(GC(),I2S(H2I(t)),"TimerDialog",H2I(td))
call TimerStart(t,180,false,function jishiqi)
call TimerDialogDisplay(td,display)
set u = null
set t = null
set td = null
endfunction
//===========================================================================
function InitTrig_rh takes nothing returns nothing
local trigger tri = Createtrigger()
call TriggerRegisterAnyUnitEventBJ(tri,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(Condition(tri,function tiaojian))
call TriggerAddAction(tri,function fh)
set tri = null
endfunction[/codes]
//①我不懂,希望指出我的错误,更希望能说明.
//②我把return bug 那段东西放进 '自定义代码' 里,这样就不用每个触发都打上return bug ,不知这样对不对. |
|