Hỏi về triger

con_ga_tre

Youtube Master Race
Tham gia ngày
23/12/08
Bài viết
12
Reaction score
0
Mấy pác cho tui hỏi 1 tí.
tui đang lám 1map war3
về triger thì biết sơ sơ.
tui làm triger thì đúng nhưng sao khi play map nó vẫn ko hoạt động đúng theo triger mình tạo.
Sao kì vậy ta????
 
Nói thế thì thì tốt nhất hỏi chúa :-s Phải nói spell ra sao , và bạn post cái trigger của bạn thì mới biết đường mà nhắc chứ.
 
ko phải spell

Mã:
Unit Group - Pick every unit in AIgroup and do (Actions)
    Loop - Actions
        Set i = (Player number of (Owner of (Picked unit)))
        Set mauitnhat = 999999.00
        Set heromauitnhat = No unit
        Unit Group - Pick every unit in (Units in (Region centered at (Position of AI[i]) with size (1600.00, 1200.00))) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Picked unit) belongs to an enemy of (Owner of AI[i])) Equal to True
                        ((Picked unit) is in HeroGroup) Equal to True
                        ((Picked unit) is alive) Equal to True
                        (Life of (Picked unit)) Less than or equal to mauitnhat
                    Then - Actions
                        Set mauitnhat = (Life of (Picked unit))
                        Set heromauitnhat = (Picked unit)
                    Else - Actions
                        Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Percentage life of AI[i]) Greater than or equal to 36.00
                (Percentage life of heromauitnhat) Less than or equal to 34.00
                heromauitnhat Not equal to No unit
            Then - Actions
                Set herotancong[i] = True
                Wait 0.20 seconds
                Unit - Order AI[i] to Attack heromauitnhat
            Else - Actions
                Do nothing

ý tui thế này:
mỗi 2s kiểm tra xung quanh con Hero AI[i[ để tìm ra 1 con enemy hero ít máu nhất để mà đập nó
khi test thì con hero của tui còn 100HP, con AI thì 600/8HP mà nó cứ trơ trơ, ko thèm nhào vô đạp con hero tui.
tui thấy hình như cái triger có khi mình làm đúng mà nó vẫn ko chạy đúng. nhiều trườnghợp như vậy trong nhiều map.
 
đúng là phải hỏi chúa thôi
bạn nói ko đâu đuôi gì cả ai mà giúp gì bạn đc
event của bạn đâu ?
 
Xài pick unit này bạn à :
Unit Group - Pick every unit in (Units within 512.00 of (Center of (Playable map area)) matching (((Triggering unit) is A structure) Equal to True)) and do (Actions)
Loop - Actions
 
matching (((Matching unit))) chứ, làm trigger unit dễ...nhầm lắm :D
 
cái condition là dễ nhầm lắm
hồi đó tui làm trigger cho hero biến hình đó
để condition là (picked unit)is a hero equal to true
phải là (triggering unit)is a hero equal to true mới đúng :D mò hết 10p mới ra :D
 
oái, như vậy là khi pick các unit trong vùng xung quanh hero đó thì cái điều kiện trong Loop phải là Triggering Unit chứ ko được Pick Unit ả

Còn câu hỏi thứ 2:
Lúc trước làm 1 cái map có AI thế này: khi 1 hero của computer vào cái vòng tròn, nếu nó # DemonHunter và chưa có ngọc sét thì give cho nó 1 ngọc sét. Cái trigger đó hoạt động tốt nên tui ko đụng gì tới nó nữa
Sau đó tui edit map thêm, làm 1 số trigger khác, đảm bảo ko ảnh hưởng điều kiện, event gì tới cái trigger trên kia cả. Thế mà khi test map, con hero nào của máy (chưa có ngọc sét) chui vô cái vòng đó đều được ngọc sét cả (kẻ cả cái con Demon Hunter)
----> như vậy là sao? Trigger hoạt động bị lỗi à?
 
bạn có xem kĩ điều kiện chưa
cũng có thể bạn xài chung varibles nên nhiều trigger hoạt động cùng lúc
muốn dùng chung trigger chỉ nên dùng lúc có wait thôi
 
đâu có chung var gì đâu bạn
event : unit enter region "cái vòng"
condition: unit # demon hunter
unit ko có ngọc sét
triggering unit is a hero eaqual to TRUE
Act:
give ngọc sét cho trigering unit

tóm lại là lần trước work tốt, sau khi save map, test nhiều lần thì sau đó nó lại ko work
Tui hỏi thêm nữa nè:
TRIGGER lúc nào cũng hoạt động đúng theo những gì mình thiết kế hay ko?
Theo tui thấy, tui đã làm 3 map, đều gặp tình trạng chung như thế (lúc đầu chạy tốt, sau đó thì hoạt động lỗi dù ko đụng gì đến cái trigger đó)
 
đâu bạn post hết cái đoạn code đó lên đây cho mình xem
mấy bữa nay rảnh nên giúp đc
 
hic, bây giờ đang làm cái map khác. Vướng ở chỗ coputer hero ko chơi phép (shockwave, stormbolt...) vo con hero enemy máu ít nhất.
ý tưởng thế này:con computer hero được set var là AI và add vô AIGROUP
mỗi con hero thì được set là hero và add vô HEROGROUP

Mã:
Unit Group - Pick every unit in AIgroup and do (Actions)
    Loop - Actions
        Set i = (Player number of (Owner of (Picked unit)))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                chayve[i] Equal to False
                (Percentage life of AI[i]) Greater than or equal to 36.00
            Then - Actions
                Trigger - Run Tim hero it mau nhat <gen> (ignoring conditions)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Percentage life of heromauitnhat) Less than or equal to 34.00
                        (AI[i] belongs to an enemy of (Owner of heromauitnhat)) Equal to True
                        heromauitnhat Not equal to No unit
                        (heromauitnhat is alive) Equal to True
                    Then - Actions
                        Trigger - Run Dap con hero it mau nhat <gen> (ignoring conditions)
                    Else - Actions
                        Set herotancong[i] = False
            Else - Actions
                Do nothing



cái này là "tim hero mau it nhat"
Mã:
Actions
    Set mauitnhat = 999999.00
    Set heromauitnhat = No unit
    Unit Group - Pick every unit in (Units in (Region centered at (Position of AI[i]) with size (1600.00, 1200.00))) and do (Actions)
        Loop - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                If - Conditions
                    ((Picked unit) belongs to an enemy of (Owner of AI[i])) Equal to True
                    ((Picked unit) is in HeroGroup) Equal to True
                    ((Picked unit) is alive) Equal to True
                    (Life of (Picked unit)) Less than or equal to mauitnhat
                    (Picked unit) Not equal to AI[i]
                Then - Actions
                    Set mauitnhat = (Life of (Picked unit))
                    Set heromauitnhat = (Picked unit)
                Else - Actions
                    Do nothing

cái này là triger chơi phép vô enemy hero
Mã:
Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of AI[i]) Equal to Mountain King
        Then - Actions
            Unit - Order AI[i] to Human Mountain King - Storm Bolt heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            Or - Any (Conditions) are true
                Conditions
                    (Unit-type of AI[i]) Equal to Paladin
                    (Unit-type of AI[i]) Equal to Blood Mage
        Then - Actions
            Unit - Order AI[i] to Human Paladin - Holy Light heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of AI[i]) Equal to Keeper of the Grove
        Then - Actions
            Unit - Order AI[i] to Night Elf Keeper Of The Grove - Entangling Roots heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of AI[i]) Equal to Priestess of the Moon
        Then - Actions
            Unit - Order AI[i] to Neutral - Firebolt heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of AI[i]) Equal to Warden
        Then - Actions
            Unit - Order AI[i] to Night Elf Demon Hunter - Mana Burn heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            Or - Any (Conditions) are true
                Conditions
                    (Unit-type of AI[i]) Equal to Tauren Chieftain
                    (Unit-type of AI[i]) Equal to Blademaster (Possessed)
                    (Unit-type of AI[i]) Equal to Blood Mage
        Then - Actions
            Unit - Order AI[i] to Orc Tauren Chieftain - Shockwave (Position of heromauitnhat)
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of AI[i]) Equal to Dreadlord
        Then - Actions
            Unit - Order AI[i] to Undead Dreadlord - Carrion Swarm (Position of heromauitnhat)
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            Or - Any (Conditions) are true
                Conditions
                    (Unit-type of AI[i]) Equal to Death Knight
        Then - Actions
            Unit - Order AI[i] to Undead Death Knight - Death Coil heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            Or - Any (Conditions) are true
                Conditions
                    (Unit-type of AI[i]) Equal to Avatar of Vengeance
        Then - Actions
            Unit - Order AI[i] to Orc Far Seer - Chain Lightning heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            Or - Any (Conditions) are true
                Conditions
                    (Unit-type of AI[i]) Equal to Lich
                    (Unit-type of AI[i]) Equal to Frost Queen
        Then - Actions
            Unit - Order AI[i] to Undead Lich - Frost Nova heromauitnhat
        Else - Actions
            Do nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        If - Conditions
            (Unit-type of AI[i]) Equal to Crypt Lord
        Then - Actions
            Unit - Order AI[i] to Undead Crypt Lord - Impale heromauitnhat
        Else - Actions
            Do nothing

xin cái YM để chat :D
 
cái trigger đi tìm hero máu ít nhất ấy
tui chả thấy action nào là đi tìm con hero máu ít nhất cả :-s
và bạn có để 2 trigger kia off ko?
 
init ON hết mà
giải thuật tìm Hero ít máu nhất của tui nè:
ban đầu set heromauitnhat=no unit
set mauitnhat=999999
sau đó mới tì những unit xung quanh con AI
nếu -pick unit nằm trong HEROGROUP
-HP của pick unit <= mauitnhat
-pick unit là enemy
thì mình set var mauitnhat=life của (pick unit)
set var heromauitnhat=pickunit

Trong trường hợp ko tìm thấy hero enemy ít máu nhất thì cái var heromauitnhat vẫn là no unit
hiểu ý tui ko?

Nhưng vấn đề ở đây lthì khác 1 tí: việc tìm hero máu ít nhất tốt, tìm ra rồi đánh tốt, nhưng lại ko cast spell vô hero enemy máu ít nhất. Kì lạ ghê. Dường như là nó ko hoạt động hay sao í. (dù casting range của spell thỏa mãn)
 
thế cái event đâu ?
event của cast spell đó
mặc dù là turn on trigger cast spell
nhưng ko có event sao hoạt động? ít nhất cũng phải add event cho nó chứ
 
cần phải event nữa à?
tại vì khi tìm ra được con ít máu thì gọi cái triger cast spell chạy mà
 
bó tay bạn luôn
1 trigger phải có event mới chạy đc chứ
giống như ko có tiếng súng của trọng tài thằng nào dám chạy :))
 
đâu có, đã có lệnh gọi cái trigger cast spell rồi.
Lúc đầu thiết kế, là tui cho những lệnh cast nằm ngay sau lệnh attack hero máu ít (nhưng chỉ attack chư sau đó nhất định ko cast spell). Bây giờ tách ra làm 1 trigger cast riêng, khi nào cần thì call nó.
 
đâu có, đã có lệnh gọi cái trigger cast spell rồi.
Lúc đầu thiết kế, là tui cho những lệnh cast nằm ngay sau lệnh attack hero máu ít (nhưng chỉ attack chư sau đó nhất định ko cast spell). Bây giờ tách ra làm 1 trigger cast riêng, khi nào cần thì call nó.

Nếu bạn ko thể đưa full code thì tui ko thể giúp gì cho bạn .
 
hic. Bỏ qua mấy cái đó đi.Sao cái điều quan trọng tui hỏi mà ko ai trả lời hết vậy?
CÓ PHẢI TRIGGER LÚC NÀO CŨNG HOẠT ĐỘNG ĐÚNG VÀ CHÍNH XÁC 100% THEO NHỮNG CÂU LỆNH MÌNH THIẾT KẾ HAY KO?
HAY LÀ CÓ ĐÔI LÚC DÙNG MÌNH THIẾT KẾ TRIGGER ĐÚNG MÀ MAP LẠI CHẠY KO THEO ĐÚNG THEO THIẾT KẾ????
(vì tui làm chạy đúng rồi, sửa object, rồi save tới save lui nhiều lần, phát hiện nó chạy sai, dù ko đụng tới nữa)
 
Back
Top