Hỏi vài vấn đề về jass/vjass

Dark_DragonKing

Mr & Ms Pac-Man
Tham gia ngày
23/7/08
Bài viết
217
Reaction score
0
Hiện nay do polledwait của blizzard có leak nên tui mún xài 1 polledwait mới, đó là =PolledWait2=. Mà không biết cái nào la tốt nhất. Bạn nào có thể chack gium cái được không.
function PolledWait2 takes real duration returns nothing
local real timeRemaining
local real st=TimerGetElapsed( bj_gameStartedTimer)
if st <= 0 then
set bj_gameStartedTimer = CreateTimer()
call TimerStart(bj_gameStartedTimer, 1000000, false, null)
endif
if (duration > 0) then
loop
set timeRemaining = duration - TimerGetElapsed( bj_gameStartedTimer) + st
exitwhen timeRemaining <= 0
if (timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD) then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
endif
endloop
endif
endfunction
đêy nữa
function Wait takes real duration returns nothing
local timer t
local real timeRemaining

if (duration > 0.00) then
set t = CreateTimer ()
call TimerStart (t,duration,false,null)
loop
set timeRemaining = TimerGetRemaining (t)
exitwhen timeRemaining <= 0.00

if (timeRemaining > 0.271828) then
call TriggerSleepAction (timeRemaining / 10.00)
else
call TriggerSleepAction (0.10)
endif
endloop
call PauseTimer (t)
call DestroyTimer (t)
endif
set t = null
endfunction

function PolledWait2 takes real duration returns nothing
local real timeRemaining
local real st = TimerGetElapsed(gametime)

if duration > 0. then
loop
set timeRemaining = duration - TimerGetElapsed(gametime) + st
exitwhen timeRemaining <= 0
if timeRemaining > 2.00 then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(0.0)
endif
endloop
endif
endfunction

Và ai có group system nào ngon co thể cho tui xin được không?
Vi khi pick unit ko phải la structure, hoăc là unit armor invul, magic immun, fly, unit dã chết thì mất khá nhiều thời gian.
Nếu có một library để call thi mới thực sự là nhanh
Thx trước nhìu:D
 
Về PolledWait thì dùng func thứ 1 ấy. 2 func kia, func thứ 2 thì cũng chỉ viết lại PolledWait của Blizzard thôi (thêm cái "set t = null" để tránh leak), func thứ 3 thì gần giống func thứ 1, chỉ dùng 1 timer, biến này là biến do mình tạo ra, func thứ 1 thì là biến có sẵn ( có sẵn vẫn "nhanh hơn" là tạo mới chứ :D )
-----
Còn về group system, ko hẳn là ko có, nhg chả hiểu sao system của Tom cho vào map khác thì bị lỗi gì đó :| (trong HAVOC thì hoạt động tốt, ko có vấn đề gì)

Thích thì Dragon cứ xem cái txt Tom gửi kèm đó. Cách dùng cũng ghi trong đó rồi, còn cách "implement" thì chắc phải tự biết chứ :))
 

Attachments

Thx, nhưng tui là magicz123 lần trước đã từng gặp ông roài mà:D, chư hem fai LonelyDragon đâu

Mà tiên thể cho hỏi cái dơn giản mà tìm mãi ko ra:

Làm thế nào đê mua dồ khi dủ 7 slot ma vẫn ghép lại được như trong DotA

Cho hình ảnh minh họa chụp WE thì càng tốt :x
 
magicz123, sao chả nhớ nhỉ :|

---

cái vụ inventory kia thì có trong map demo Tom gửi kèm ở dưới, cũng không khó lắm.
 

Attachments

Chết quên, khi nào mới nên DestroyTrigger nhỉ ??????, phải hỏi ngay mới được,

Hình như chỉ nên destroy map init chứ ko nên destroy mấy cái spell

Remove BJ thế này có cần thiết ko ??

function InitTrig_zxcv takes nothing returns nothing
local integer index = 0
local trigger y = CreateTrigger ()
loop
call TriggerRegisterPlayerUnitEvent (y,Player(index),EVENT_PLAYER_UNIT_SPELL_EFFECT,null)
set index = index + 1
exitwhen index == 16
endloop
call TriggerAddCondition(y,Condition(function ActiveConditions))
call TriggerAddAction(y,function Active)
call DestroyTrigger(y)
set y =null
endfunction
 
Back
Top