Topic post, bàn luận, đóng góp ý kiến, thắc mắc, giải đáp, bình phẩm về Custom Spell.

  • Thread starter Thread starter raivor
  • Ngày gửi Ngày gửi
@fantom2409:

1, custom value để đánh dấu của 1 unit nó cũng giống như handle
2, cái đó nhờ xài integer Loop ví dụ 36x8 Loop tạo 1 unit ở 36 hướng (thiếu chi tiết!)
3,
4, hide unit để ẩn unit đó tồn tại trong bản đồ vào mục đích nào đó theo ý mình
( điều kiện ảnh hưởng unit bị hide)
Unselectable
Uncontrollable
5, nó không giúp tăng độ cao, nó giúp unit A trở hành unit B và unit B đó điểm Height cao!!!
6, X Y là trực trong GUI là location còn gọi là Point , Point lưu giữ vị trí X Y. nhưng nó có thể gây ra Leak vì thế đa số jass sử dụng X và Y, X Y là điểm Real
 
1. Đánh dấu thế nào?
2. Chi tiết tí dc không? Chỉ không hiểu cái angle thôi

3. Nghe anh Leo nói x,y dùng làm tọa độ parabol trong We nhưng không hiểu phải dùng thế nào! Bạn giải thích giùm dc không?
Vd: con gấu đất trong map của ông đấy

---------- Post added at 20:49 ---------- Previous post was at 20:40 ----------

Hỏi thêm cái nữa là tạo quỹ đạo cho 1 unit thế nào? (vd như hình ngôi sao hay tam giác ấy)
Ps/ sorry anh raivor nhưng đọc tut của anh em không hỉu
 
1, ví dụ thế nhé tôi tạo 1 Variables ( Variable Name: TempUnit , Variable Type: Unit , đánh dấu array)
Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
đánh dấu sử dụng Unit - Set the custom value of (Last created unit) to (Index + 1) Index là 1 variable Integer cứ set như thế để đánh dấu.. khi set xong thì unit Footman đã được đánh dấu số 1 và cách lấy lại giá trị đó bằng
Set TempUnit[(Custom value of (Last created unit))] = (Last created unit)

cái này có thể sử dụng mục đích rất tốt. nhưng hiện đây đa số sử dụng Unit Indexing đó là 1 system đánh dấu kiểu Custom hay là Handle.


2, chịu mình không thể chi tiết dc cái đó. (không phải hok giúp mà hok bít cách diễn tả :()
3,con gấu đất trong map tôi là có spell liên quan đến knocback,

đa số người ta muốn dịch chuyển 1 unit thì hay dùng
Unit - Move (Triggering unit) instantly to (Center of (Playable map area))
nhưng cái này sẽ khiến unit không thực hiện order trước của nó ví dụ lúc unit đang channel thì bị Move sẽ là Stop còn nếu đang click skill vào 1 target mà bị Move cũng là Stop mình cần đặt 2 trigger
đây là cách set vị trí X và Y của unit
udg_TempUnit là giá trị TempUnit(= gui) của unit cần Move
udg_TempLoc là giá trị TempLoc(= gui) của vị trí cần Move
call SetUnitX(udg_TempUnit,GetLocationX(udg_TempLoc))
call SetUnitY(udg_TempUnit,GetLocationY(udg_TempLoc))
 
Ah mà này, sao ông làm dc cái camera thế vậy?

---------- Post added at 22:18 ---------- Previous post was at 22:14 ----------

Con myrmidon naga royal guard sao k destroy destructives?(skill wave form)
 
Ah mà này, sao ông làm dc cái camera thế vậy?

---------- Post added at 22:18 ---------- Previous post was at 22:14 ----------

Con myrmidon naga royal guard sao k destroy destructives?(skill wave form)

camera nào cơ ?

à tại vì nghĩ không cần destroy destructives :|
 
Cái camera của nhân vật ấy? Làm sao khi di chuyển nó mượt mà vậy
 
Cái camera của nhân vật ấy? Làm sao khi di chuyển nó mượt mà vậy

à cái đó là do trigger

Camera - Change camera smoothing factor to 1.00, set thành 28 điểm thì sẽ rất mượt. nhưng cũng gây ra khó chịu với "game thủ" :-??

nếu tôi đoán không sai cái map bạn đang test là một dự án bỏ của tôi. và tôi đang thực hiện lại dự án đó trên 1 nền tảng vjass trong map này :">
http://www.mediafire.com/?bs76zbo81kuyng4
 
Cho mình xin 1 code về trigger bay dc không ? (có xin rồi nhưng không hiểu)
 
Her her.
Lâu quá không làm spell, trình vẫn lởm như xưa.
Để topic tự nhiên xem có ai vào post spell không mà thấy hẩm hiu quá, thôi thì ta tự sướng một mình vậy.

Spell có tên là:
Lightning Trap
Tên có vẻ dở, nhưng không quan trọng ;)).

Spell sẽ trông như này:

attachment.php

Chúng ta cần có:

- 1 spell với target type là point target. Dùng spell Channel chỉnh sửa cho tiện.
- 1 mớ biến:
--Biến chính:
+ Unit: LTCaster[], LTFeralSpirit[], LTFeralSpirit(01~06)[](tức là LTFeralSpirit01,02....).
+ Point: LTCastPoint[], LTFeralSpiritPoint, LTFeralSpiritPointS, LTFeralSpiritE, LTEnemyPoint01, LTEnemyPoint02.
+ Real: LTAngle[], LTDistance[], LTSpeed[].
+ Integer: LTInt, LTInteger(01~05).
+ UnitGroup: LTGroup.
+ Lightning: LTLightningEffect[], LTLightningEffect(01~06)[].
--Biến phụ:
+ Unit: LTCasterS.
+ Point: LTCastPointS.
+ Real: LTAngleS, LTDistanceS, LTSpeedS.
- 2 Trigger, 1 on 1 off.
- Hero: Thrall.
- Dummy: Spirit Wolf.
- Walk Animation Index của dummy : 2
Hết.

Đầu tiên là edit spell Channel cái đã:
Art - Button Position - Normal (X) : 0 // nằm ở ô đầu tiên.
Art - Button Position - Normal (Y) : 2 // hàng thứ 3.
Art - Caster : bỏ trống // không sử dụng effect cho caster.
Art - Caster Attachment Point 1 : bỏ trống // không dùng effect thì khỏi attach.
Art - Effect : bỏ trống // không dùng effect.
Art - Icon Normal : ReplaceableTextures\CommandButtons\BTNStasisTrap.blp // đổi icon lúc bình thường.
Art - Icon Research :ReplaceableTextures\CommandButtons\BTNStasisTrap.blp // đổi icon lúc học skill.
Art - Target : bỏ trống // không dùng effect lên target.
Data - Art Duration : 2.73 // Animation spell của thrall thực hiện trong 2.73s.
Data - Disable Other Abilities : False // không làm "disable" các skill khác.
Data - Follow Through Time : 1 // chỉ thực hiện động tác giơ búa 1 lần.
Data - Options : Visible // hiển thị icon skill
Data - Target Type : Point Target // kiểu "target"
Stats - Cast Range : 800 // khoảng cách để sử dụng skill.
Stats - Level : 1 // skill có 1 level.
Xong cái Channel.

Đến dummy:

Abilities - Normal : Locust, Invulnerable (Neutral) // Locust làm mất thanh máu và không cho người chơi target hay điều khiển dummy nữa. Invulnerable giúp dummy bất tử.
Art - Death Time (seconds) : 0.10 // Thời gian chết 0.1s.
Art - Shadow Image (Unit) : None // không đổ bóng của unit.
Combat - Attack 1 - Attack Type : None
Combat - Attack Enabled : None // unit không thể tấn công.
Movement - Type : None // không đi chuyển được.
Pathing - Collision Size : 0.00 // cái này thực chất không cần thiết vì đã add locust, nhưng tiện tay sửa luôn, làm cho unit không bị cản, đi xuyên mọi địa hình.
Stats - Sight Radius (Day, Night) : 0 // unit không cho sight.
Xong dummy.

Bắt đầu tới code.
Đầu tiên, với spell này, event chúng ta sử dụng không khác gì các spell active bình thường.

Trigger 1:
Mã:
Events
    Unit - A unit Starts the effect of an ability

Khi unit bắt đầu cast spell. Đây là sự kiện để trigger chạy, không có thì khỏi chạy.
Mã:
Conditions
    (Ability being cast) Equal to Lightning Trap

Spell được cast phải là Lightning Trap, vì sự kiện có tính chung chung, tức là khi một unit cast bất kì spell nào thì sự kiện trên đều xảy ra và làm cho trigger chạy, nếu không có điều kiện spell đó là spell nào thì loạn.

Tiếp theo là phần khai báo biến.

Mã:
Set LTInt = (LTInt + 1)

Cái này nếu thông minh tí thì hiểu ngay, còn dốt hơn thì đại khái là như này:
Ta có biến LTInt là một biến đại diện cho số nguyên, gọi là x cho dễ.
Ta có x = 0.
Vì thế, khi x = x + 1 thì ta sẽ có:
x = 0 + 1 (chú ý là x vẫn là x, không thế 0 vào. Vì sao à? vì đây là code)
0 + 1 = 1 => x = 1
Tiếp tục, khi x = x + 1 thì ta sẽ có:
x = 1 + 1
1 + 1 = 2 => x = 2
Cứ như vậy, mỗi lần phép tính được thực hiện, x sẽ tăng lên 1.

Tiếp theo.
Mã:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        LTInt Greater than 100
    Then - Actions
        Set LTInt = 0
    Else - Actions

Nếu LTInt tăng lên quá 100, tức là 101+ thì ta sẽ trả LTInt lại = 0.
Ta có điều kiện:
x > 100 => x = 0

Mã:
Set LTCaster[LTInt] = (Triggering unit)

Gán Triggering unit vào biến LTCaster[LTInt].
Chi tiết hơn thì đọc phần dưới.
[spoil]Ở đây có 2 phần cần phải chú ý.
Đầu tiên:
- Triggering unit nghĩa là unit đã tạo ra sự kiện.
VD: bạn mở cửa, thì bạn là người đã tạo ra sự kiện là "cửa mở", tức là bạn là "Triggering unit".
Ở đây, trong spell này, Triggering unit là người đã cast spell.
- Tiếp theo có thể thấy, biến LTCaster[LTInt], đây là một biến unit, nó dùng để gán một unit, như bạn gán một số vào một biến x,y hoặc z. Biến này có array. Như bạn thấy, array là kiểu mảng, nói mảng hơi khó hiểu nên bạn cứ hiểu như thế này. LTCaster là MỘT biến.
Giả sử unit là các con số.
Ta gán số 1 vào LTCaster, vậy lúc này, LTCaster = số 1.
Sau đó ta gán số 2 vào LTCaster, LTCaster KHÔNG CÒN là số 1 nữa mà là số 2.
Vậy nếu bạn vừa muốn LTCater là số 1 vừa là số 2 thì phải làm sao.
Bạn sẽ tạo 2 biến LTCaster01 = số 1 và LTCaster02 = số 2.
Rất đơn giản nhưng nếu có 100 số thì sao? tạo 100 LTCaster(01~100)?
Thật là bất khả thi. Thế nên người ta mới thêm cái array vào, tức là bây giờ bạn chả phải tạo thêm một biến nào nữa, chỉ cần 1 biến có array, bạn sẽ có 100 hoặc nhiều hơn thế với công dụng như trên.
Bạn chỉ cần điền số vào giữa 2 dấu ngoặc vuông là bạn có một biến LTCaster mới không bị đè lên LTCaster khác.
VD: LTCaster[1] = số 1, LTCaster[2] = số 2,... như thế LTCaster[1] vẫn = số 1, LTCaster[2] vẫn = số 2, không bị hiện tượng LTCaster = số 1, sau khi gán vào nó số 2 thì LTCaster chỉ = số 2.
Nhưng có một vấn đề ở đây. Như trên, nếu có 100 số cần gán, bạn sẽ phải khai báo:
LTCaster[1] = số 1, LTCaster[2] = số 2,.... rất mất thời gian. Vậy giải pháp ở đây là gì.
Đó là LTCaster[LTInt] với LTInt sẽ tăng 1 khi sự kiện được thực hiện.
Như vậy với 3 unit A, B, C cast spell lần lượt. Bạn sẽ hình dung như thế này.
A tạo ra sự kiện ----> LTInt tăng 1 => LTInt = 1 ----> LTCaster[1] = A (A là triggering unit)
B tạo ra sự kiện ----> LTInt tăng 1 => LTInt = 2 ----> LTCaster[2] = B
C tạo ra sự kiện ----> LTInt tăng 1 => LTInt = 3 ----> LTCaster[3] = C
v.v....
Nếu bạn hiểu và sử dụng tốt array thì bạn sẽ có thể làm spell MUI dễ dàng hơn.[/spoil]

Mã:
Set LTCastPoint[LTInt] = (Target point of ability being cast)

Gán vị trí cast spell cho LTCastPoint[LTInt].

Mã:
Set LTSpeed[LTInt] = 0.00
Set LTAngle[LTInt] = 60.00

Gán giá trị cho biến số thực thôi, không có gì khó hiểu đâu ha.

Mã:
For each (Integer LTInteger01) from 1 to 6, do (Actions)
    Loop - Actions
        Set LTFeralSpiritPoint = (LTCastPoint[LTInt] offset by 500.00 towards (LTAngle[LTInt] x (Real(LTInteger01))) degrees)
        Unit - Create 1 Spirit Wolf (Level 1) for (Owner of LTCaster[LTInt]) at LTFeralSpiritPoint facing LTCastPoint[LTInt]
        Set LTFeralSpirit[LTInteger01] = (Last created unit)

Ở đây ta tạo vòng lặp từ 1 - 6 ( lặp 6 lần).
Gán LTFeralSpiritPoint = cách vị trí cast spell 500 range với một góc 60 x (LTInteger01)
Đây cũng là một kiểu của dạng x = x + 1.
x ở đây là LTInteger01.
Vòng lặp này có nghĩa là các code trong vòng lặp sẽ chạy 6 lần, từ trên xuống, rồi lại từ trên xuống. Thay vì phải có tới 6 dòng create unit, nhờ vòng lặp mà chúng ta chỉ cần 1, rất tiện.
Vòng lặp này giúp chúng ta tạo 6 dummy xếp thành vòng tròn cách vị trí cast spell 500 range. Tại sao lại xếp thành vòng tròn? Như các bạn thấy, ta có (LTAngle[LTInt] x (Real(LTInteger01))), ban đầu ta gán

LTAngle[LTInt] = 60, LTInteger01 tăng lên sau mỗi lần lặp. Các bạn tưởng tượng, vị trí của 2 dummy + vị trí cast spell, thế là chúng ta có 3 điểm tạo thành một góc. Tại sao lại là 60 độ mà không phải là một con số khác? đó là do ta tạo ra 6 dummy, mà 360/6 = 60, như vậy ta mới được 6 dummy xếp đều thành vòng tròn.
(Owner of LTCaster[LTInt]) Dummy được tạo ra thuộc player của unit cast spell.
facing LTCastPoint[LTInt] có nghĩa là dummy sẽ hướng về vị trí cast spell sau khi được "create".
Set LTFeralSpirit[LTInteger01] = (Last created unit) gán các dummy vừa được tạo cho LTFeralSpirit[LTInteger01]. Ở đây, LTInteger01 như LTInt, nhưng LTInteger01 sẽ tăng lên 1 sau mỗi vòng lặp, còn LTInt chỉ tăng khi sự kiện xảy ra và trigger chạy. Tự hình dung nhé.

Mã:
Set LTFeralSpirit01[LTInt] = LTFeralSpirit[1]
Set LTFeralSpirit02[LTInt] = LTFeralSpirit[2]
Set LTFeralSpirit03[LTInt] = LTFeralSpirit[3]
Set LTFeralSpirit04[LTInt] = LTFeralSpirit[4]
Set LTFeralSpirit05[LTInt] = LTFeralSpirit[5]
Set LTFeralSpirit06[LTInt] = LTFeralSpirit[6]

Gán lại các dummy được đã gán cho LTFeralSpirit[1~6] cho LTFeralSpirit(01~06)[LTInt], bước này là để MUI. Nếu không có bước này thì các dummy mới sẽ gán đè lên dummy cũ trong biến LTFeralSpirit.
Vậy tại sao lại phải rắc rối như vậy, sao không gán trực tiếp LTFeralSpirit(01~06)[LTInt] trong bước trên luôn. Đây là câu trả lời:

Mã:
For each (Integer LTInteger01) from 1 to 6, do (Actions)
    Loop - Actions
        Set LTFeralSpiritPoint = (LTCastPoint[LTInt] offset by 500.00 towards (LTAngle[LTInt] x (Real(LTInteger01))) degrees)
        Unit - Create 1 Spirit Wolf (Level 1) for (Owner of LTCaster[LTInt]) at LTFeralSpiritPoint facing LTCastPoint[LTInt]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                LTInteger01 Equal to 1
            Then - Actions
                Set LTFeralSpirit01[LTInt] = (Last created unit)
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        LTInteger01 Equal to 2
                    Then - Actions
                        Set LTFeralSpirit02[LTInt] = (Last created unit)
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                LTInteger01 Equal to 3
                            Then - Actions
                                Set LTFeralSpirit03[LTInt] = (Last created unit)
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        LTInteger01 Equal to 4
                                    Then - Actions
                                        Set LTFeralSpirit04[LTInt] = (Last created unit)
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                LTInteger01 Equal to 5
                                            Then - Actions
                                                Set LTFeralSpirit05[LTInt] = (Last created unit)
                                            Else - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        LTInteger01 Equal to 6
                                                    Then - Actions
                                                        Set LTFeralSpirit06[LTInt] = (Last created unit)
                                                    Else - Actions

Như bạn thấy, nếu gán trực tiếp, bạn phải dùng đến 6 hàm if để gán cho từng cái. Khá bất tiện.

Mã:
Trigger - Turn on LightningTrapTimer <gen>

Cho chạy trigger 2.

Trigger 2:

Mã:
Events
    Time - Every (0.10 / 4.00) seconds of game time

Trigger sẽ chạy trong mỗi 0.025s.

Mã:
For each (Integer LTInteger02) from 1 to LTInt, do (Actions)
    Loop - Actions

Đây là vòng lặp, từ 1 đến LTInt. Vòng lặp này dùng để MUI, bạn thử tưởng tượng, ta có 10 hero cast spell cùng 1 lúc, event trên kia sẽ được chạy 10 lần và LTInt sẽ tăng lên 10. Vì thế, vòng lặp sẽ lặp 10 lần trong mỗi 0.025s. Việc làm này cũng giống như việc bạn cho chạy 10 trigger cùng một lúc, nó sẽ làm cho 10 spell được cast ra hoạt động độc lập, không ảnh hưởng lên nhau, đó gọi là MUI.

Mã:
Set LTCasterS = LTCaster[LTInteger02]
Set LTAngleS = LTAngle[LTInteger02]
Set LTCastPointS = LTCastPoint[LTInteger02]
Set LTSpeed[LTInteger02] = (LTSpeed[LTInteger02] + 10.00) // mỗi 0.025s LTSpeed lại tăng lên 10.
Set LTSpeedS = LTSpeed[LTInteger02]
Set LTDistance[LTInteger02] = (500.00 - LTSpeedS) // mỗi 0.025s LTDistance sẽ giảm dần.
Set LTDistanceS = LTDistance[LTInteger02]
Set LTFeralSpirit[1] = LTFeralSpirit01[LTInteger02]
Set LTFeralSpirit[2] = LTFeralSpirit02[LTInteger02]
Set LTFeralSpirit[3] = LTFeralSpirit03[LTInteger02]
Set LTFeralSpirit[4] = LTFeralSpirit04[LTInteger02]
Set LTFeralSpirit[5] = LTFeralSpirit05[LTInteger02]
Set LTFeralSpirit[6] = LTFeralSpirit06[LTInteger02]

Gán vào biến phụ cho gọn.

Mã:
For each (Integer LTInteger03) from 1 to 6, do (Actions)
    Loop - Actions

Tiếp theo ta sử dụng thêm một vòng lặp nữa.

Mã:
Set LTFeralSpiritPoint = (LTCastPointS offset by LTDistanceS towards (LTAngleS x (Real(LTInteger03))) degrees)

LTFeralSpiritPoint = vị trí cách cast spell LTDistanceS, LTDistanceS sẽ bị giảm mỗi 0.025s, nó giúp LTFeralSpiritPoint ngày càng gần LTCastPointS hơn.

Mã:
Unit - Move LTFeralSpirit[LTInteger03] instantly to LTFeralSpiritPoint, facing LTCastPointS

Slide dummy.

Mã:
Custom script:   call SetUnitAnimationByIndex(udg_LTFeralSpirit[udg_LTInteger03], 2)

Chạy animation walk.

Mã:
Custom script:   call RemoveLocation(udg_LTFeralSpiritPoint)

Remove leak.

Mã:
Custom script:   set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within LTDistanceS of LTCastPointS matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching unit) is 

dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner of LTCasterS) Equal True) and do (Actions)
    Loop - Actions

Pick các unit trong range với điều kiện:
-((Matching unit) is A structure) Equal to False : không phải là công trình.
-((Matching unit) is Magic Immune) Equal to False : không phải là unit kháng phép.
-((Matching unit) is dead) Equal to False : còn sống.
-((Matching unit) belongs to an enemy of (Owner of LTCasterS)) Equal True : phải là kẻ thù của caster.

Mã:
Unit Group - Add (Picked unit) to LTGroup

Add các unit được pick vào LTGroup.

Mã:
Set LTEnemyPoint01 = (Position of (Picked unit))

Gán vị trí của unit được pick vào biến.

Mã:
Set LTEnemyPoint02 = (LTEnemyPoint01 offset by 20.00 towards (Angle from LTEnemyPoint01 to LTCastPointS) degrees)

Gán vị trí cách unit được pick 20 range với góc từ unit được pick tới vị trí cast spell.

Mã:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        Or - Any (Conditions) are true
            Conditions
                LTDistanceS Greater than ((Distance between LTCastPointS and LTEnemyPoint01) + 100.00)
                LTDistanceS Less than 100.00
    Then - Actions
        Unit Group - Remove (Picked unit) from LTGroup

Nếu LTDistanceS lớn hơn khoảng cách từ vị trí caster spell tới vị trí của unit được pick + 100 hoặc LTDistanceS nhỏ hơn 100 thì ta sẽ xóa unit được pick khỏi LTGroup.

Mã:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        LTDistanceS Less than ((Distance between LTCastPointS and LTEnemyPoint01) + 100.00)
        ((Picked unit) is in LTGroup) Equal to True
    Then - Actions
        Custom script:   call SetUnitX(GetEnumUnit(), GetLocationX(udg_LTEnemyPoint02))
        Custom script:   call SetUnitY(GetEnumUnit(), GetLocationY(udg_LTEnemyPoint02))
    Else - Actions

Mặt khác, nếu LTDistanceS nhỏ hơn khoảng cách giữa vị trí cast spell và vị trí của unit được pick +100 và unit được pick phải có trong LTGroup thì ta sẽ move unit được pick tới vị trí được gán vào biến LTEnemyPoint02. Ở đây mình dùng SetUnitX SetUnitY vì làm như vậy animation của unit sẽ không bị "stop".

Mã:
Custom script:   call RemoveLocation(udg_LTEnemyPoint01)
Custom script:   call RemoveLocation(udg_LTEnemyPoint02)

Remove leak.

Mã:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        LTDistanceS Less than or equal to 100.00

Nếu LTDistanceS nhỏ hơn hoặc bằng 100 thì....

Mã:
For each (Integer LTInteger04) from 1 to 6, do (Actions)
    Loop - Actions
        Unit - Remove LTFeralSpirit[LTInteger04] from the game

Xóa 6 con dummy đi.

Mã:
Custom script:   call RemoveLocation(udg_LTCastPoint[udg_LTInteger02])
Custom script:   call RemoveLocation(udg_LTCastPointS)

Remove leak.

Mã:
Set LTAngle[LTInteger02] = LTAngle[LTInt]
Set LTCastPoint[LTInteger02] = LTCastPoint[LTInt]
Set LTDistance[LTInteger02] = LTDistance[LTInt]
Set LTSpeed[LTInteger02] = LTSpeed[LTInt]
Set LTFeralSpirit01[LTInteger02] = LTFeralSpirit01[LTInt]
Set LTFeralSpirit02[LTInteger02] = LTFeralSpirit02[LTInt]
Set LTFeralSpirit03[LTInteger02] = LTFeralSpirit03[LTInt]
Set LTFeralSpirit04[LTInteger02] = LTFeralSpirit04[LTInt]
Set LTFeralSpirit05[LTInteger02] = LTFeralSpirit05[LTInt]
Set LTFeralSpirit06[LTInteger02] = LTFeralSpirit06[LTInt]

Đây là bước khá quan trọng trong MUI. Khi điều kiện kết thúc spell được thỏa, tức là lúc các biến hiện tại đang sử dụng không còn tác dụng nữa, ta sẽ gán giá trị của các biến thuộc mảng cuối cùng vào thay thế.
Ở đây, mảng mà các biến đang dùng đó là LTInteger02, và mảng cuối cùng là LTInt.
Ví dụ, ta có 10 hero cast 1 lúc, trong trường hợp hero cast thứ 5, có LTDistanceS = LTDistance[5] nhỏ hơn hoặc bằng 100 đầu tiên, tức là trong 10 hero cast thì hero cast lần thứ 5 thỏa điều kiện để kết thúc spell đầu tiên, vì là hero cast lần thứ 5 nên LTInteger02 = 5, và có 10 hero cast spell nên LTInt = 10, lúc này khi spell của hero cast lần thứ 5 kết thúc, thì giá trị của các biến thuộc mảng thứ 10 (mảng cuối cùng) sẽ được

gán vào mảng thứ 5 như code trên.

Tiếp theo là:

Mã:
Set LTInt = (LTInt - 1)

Khi các biến thuộc mảng cuối cùng đã được thay thế bằng các biến ở mảng LTInteger02 thì ta sẽ giảm LTInt xuống.
Ví dụ, giá trị các biến thuộc mảng 10 (mảng cuối cùng) được gán vào mảng thứ 5, tức là các biến ở mảng thứ 5 thay đã có giá trị của các biến ở mảng cuối. Thì ta sẽ loại bỏ mảng thứ 10 đi, lúc này ta chỉ còn 9 mảng.

Vậy nếu tiếp theo, hero cast lần thứ 7 kết thúc spell. Thì giá trị của các biến thuộc mảng 9 sẽ được gán cho các biến thuộc mảng 7, và mảng thứ 9 sẽ bị loại bỏ, giờ đây ta chỉ còn 8 mảng, cứ tiếp tục thế cho tới khi không còn mảng nào nữa. Tuy nhiên, nếu trong lúc các spell còn lại vẫn chưa kết thúc, mà lại có thêm hero cast spell thì số mảng lại tăng lên.
Ở đây số mảng đang sử dụng chính là giá trị của LTInt, giá trị của LTInt càng lớn thì số mảng càng nhiều và ngược lại.

Mã:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    If - Conditions
        LTInt Less than or equal to 0
    Then - Actions
        Trigger - Turn off (This trigger)
    Else - Actions

Nếu LTInt nhỏ hơn hoặc bằng 0 thì tắt trigger đi.
Đây là toàn bộ các phần cơ bản, ở trigger đầy đủ dưới đây, sẽ có thêm phần code thêm effect.

Trigger 1:
Mã:
LightningTrap
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Lightning Trap 
    Actions
        Set LTInt = (LTInt + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                LTInt Greater than 100
            Then - Actions
                Set LTInt = 0
            Else - Actions
        Set LTCaster[LTInt] = (Triggering unit)
        Set LTCastPoint[LTInt] = (Target point of ability being cast)
        Set LTSpeed[LTInt] = 0.00
        Set LTAngle[LTInt] = 60.00
        For each (Integer LTInteger01) from 1 to 6, do (Actions)
            Loop - Actions
                Set LTFeralSpiritPoint = (LTCastPoint[LTInt] offset by 500.00 towards (LTAngle[LTInt] x (Real(LTInteger01))) degrees)
                Unit - Create 1 Spirit Wolf (Level 1) for (Owner of LTCaster[LTInt]) at LTFeralSpiritPoint facing LTCastPoint[LTInt]
                Set LTFeralSpirit[LTInteger01] = (Last created unit)
        For each (Integer LTInteger05) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        LTInteger05 Less than or equal to 5
                    Then - Actions
                        Set LTFeralSpiritPointS = (Position of LTFeralSpirit[LTInteger05])
                        Set LTFeralSpiritPointE = (Position of LTFeralSpirit[(LTInteger05 + 1)])
                    Else - Actions
                        Set LTFeralSpiritPointS = (Position of LTFeralSpirit[6])
                        Set LTFeralSpiritPointE = (Position of LTFeralSpirit[1])
                Lightning - Create a Finger of Death lightning effect from source LTFeralSpiritPointE to target LTFeralSpiritPointS
                Set LTLightningEffect[LTInteger05] = (Last created lightning effect)
        Set LTFeralSpirit01[LTInt] = LTFeralSpirit[1]
        Set LTFeralSpirit02[LTInt] = LTFeralSpirit[2]
        Set LTFeralSpirit03[LTInt] = LTFeralSpirit[3]
        Set LTFeralSpirit04[LTInt] = LTFeralSpirit[4]
        Set LTFeralSpirit05[LTInt] = LTFeralSpirit[5]
        Set LTFeralSpirit06[LTInt] = LTFeralSpirit[6]
        Set LTLightningEffec01[LTInt] = LTLightningEffect[1]
        Set LTLightningEffec02[LTInt] = LTLightningEffect[2]
        Set LTLightningEffec03[LTInt] = LTLightningEffect[3]
        Set LTLightningEffec04[LTInt] = LTLightningEffect[4]
        Set LTLightningEffec05[LTInt] = LTLightningEffect[5]
        Set LTLightningEffec06[LTInt] = LTLightningEffect[6]
        Trigger - Turn on LightningTrapTimer <gen>

Trigger 2:

Mã:
LightningTrapTimer
    Events
        Time - Every (0.10 / 4.00) seconds of game time
    Conditions
    Actions
        For each (Integer LTInteger02) from 1 to LTInt, do (Actions)
            Loop - Actions
                Set LTCasterS = LTCaster[LTInteger02]
                Set LTAngleS = LTAngle[LTInteger02]
                Set LTCastPointS = LTCastPoint[LTInteger02]
                Set LTSpeed[LTInteger02] = (LTSpeed[LTInteger02] + 10.00)
                Set LTSpeedS = LTSpeed[LTInteger02]
                Set LTDistance[LTInteger02] = (500.00 - LTSpeedS)
                Set LTDistanceS = LTDistance[LTInteger02]
                Set LTFeralSpirit[1] = LTFeralSpirit01[LTInteger02]
                Set LTFeralSpirit[2] = LTFeralSpirit02[LTInteger02]
                Set LTFeralSpirit[3] = LTFeralSpirit03[LTInteger02]
                Set LTFeralSpirit[4] = LTFeralSpirit04[LTInteger02]
                Set LTFeralSpirit[5] = LTFeralSpirit05[LTInteger02]
                Set LTFeralSpirit[6] = LTFeralSpirit06[LTInteger02]
                Set LTLightningEffect[1] = LTLightningEffec01[LTInteger02]
                Set LTLightningEffect[2] = LTLightningEffec02[LTInteger02]
                Set LTLightningEffect[3] = LTLightningEffec03[LTInteger02]
                Set LTLightningEffect[4] = LTLightningEffec04[LTInteger02]
                Set LTLightningEffect[5] = LTLightningEffec05[LTInteger02]
                Set LTLightningEffect[6] = LTLightningEffec06[LTInteger02]
                For each (Integer LTInteger03) from 1 to 6, do (Actions)
                    Loop - Actions
                        Set LTFeralSpiritPoint = (LTCastPointS offset by LTDistanceS towards (LTAngleS x (Real(LTInteger03))) degrees)
                        Unit - Move LTFeralSpirit[LTInteger03] instantly to LTFeralSpiritPoint, facing LTCastPointS
                        Custom script:   call SetUnitAnimationByIndex(udg_LTFeralSpirit[udg_LTInteger03], 2)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                LTInteger03 Less than or equal to 5
                            Then - Actions
                                Set LTFeralSpiritPointS = (Position of LTFeralSpirit[LTInteger03])
                                Set LTFeralSpiritPointE = (Position of LTFeralSpirit[(LTInteger03 + 1)])
                            Else - Actions
                                Set LTFeralSpiritPointS = (Position of LTFeralSpirit[6])
                                Set LTFeralSpiritPointE = (Position of LTFeralSpirit[1])
                        Lightning - Move LTLightningEffect[LTInteger03] to source LTFeralSpiritPointS and target LTFeralSpiritPointE
                        Custom script:   call RemoveLocation(udg_LTFeralSpiritPoint)
                        Custom script:   call RemoveLocation(udg_LTFeralSpiritPointS)
                        Custom script:   call RemoveLocation(udg_LTFeralSpiritPointE)
                Custom script:   set bj_wantDestroyGroup = true
                Unit Group - Pick every unit in (Units within LTDistanceS of LTCastPointS matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and ((((Matching 

unit) is dead) Equal to False) and (((Matching unit) belongs to an enemy of (Owner o and do (Actions)
                    Loop - Actions
                        Unit Group - Add (Picked unit) to LTGroup
                        Set LTEnemyPoint01 = (Position of (Picked unit))
                        Set LTEnemyPoint02 = (LTEnemyPoint01 offset by 20.00 towards (Angle from LTEnemyPoint01 to LTCastPointS) degrees)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Or - Any (Conditions) are true
                                    Conditions
                                        LTDistanceS Greater than ((Distance between LTCastPointS and LTEnemyPoint01) + 100.00)
                                        LTDistanceS Less than 100.00
                            Then - Actions
                                Unit Group - Remove (Picked unit) from LTGroup
                            Else - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        LTDistanceS Less than ((Distance between LTCastPointS and LTEnemyPoint01) + 100.00)
                                        ((Picked unit) is in LTGroup) Equal to True
                                    Then - Actions
                                        Custom script:   call SetUnitX(GetEnumUnit(), GetLocationX(udg_LTEnemyPoint02))
                                        Custom script:   call SetUnitY(GetEnumUnit(), GetLocationY(udg_LTEnemyPoint02))
                                    Else - Actions
                        Custom script:   call RemoveLocation(udg_LTEnemyPoint01)
                        Custom script:   call RemoveLocation(udg_LTEnemyPoint02)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        LTDistanceS Less than or equal to 100.00
                    Then - Actions
                        For each (Integer LTInteger04) from 1 to 6, do (Actions)
                            Loop - Actions
                                Unit - Remove LTFeralSpirit[LTInteger04] from the game
                                Lightning - Destroy LTLightningEffect[LTInteger04]
                        Custom script:   call RemoveLocation(udg_LTCastPoint[udg_LTInteger02])
                        Custom script:   call RemoveLocation(udg_LTCastPointS)
                        Set LTAngle[LTInteger02] = LTAngle[LTInt]
                        Set LTCastPoint[LTInteger02] = LTCastPoint[LTInt]
                        Set LTDistance[LTInteger02] = LTDistance[LTInt]
                        Set LTSpeed[LTInteger02] = LTSpeed[LTInt]
                        Set LTFeralSpirit01[LTInteger02] = LTFeralSpirit01[LTInt]
                        Set LTFeralSpirit02[LTInteger02] = LTFeralSpirit02[LTInt]
                        Set LTFeralSpirit03[LTInteger02] = LTFeralSpirit03[LTInt]
                        Set LTFeralSpirit04[LTInteger02] = LTFeralSpirit04[LTInt]
                        Set LTFeralSpirit05[LTInteger02] = LTFeralSpirit05[LTInt]
                        Set LTFeralSpirit06[LTInteger02] = LTFeralSpirit06[LTInt]
                        Set LTLightningEffec01[LTInteger02] = LTLightningEffec01[LTInt]
                        Set LTLightningEffec02[LTInteger02] = LTLightningEffec02[LTInt]
                        Set LTLightningEffec03[LTInteger02] = LTLightningEffec03[LTInt]
                        Set LTLightningEffec04[LTInteger02] = LTLightningEffec04[LTInt]
                        Set LTLightningEffec05[LTInteger02] = LTLightningEffec05[LTInt]
                        Set LTLightningEffec06[LTInteger02] = LTLightningEffec06[LTInt]
                        Set LTInt = (LTInt - 1)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                LTInt Less than or equal to 0
                            Then - Actions
                                Trigger - Turn off (This trigger)
                            Else - Actions
                    Else - Actions

Trong phần Lightning effect, nếu các bạn thấy hơi khó hiểu thì có thể hỏi.
Ngoài ra, mình có một yêu cầu nho nhỏ, đó là các bạn sẽ cải tiến spell này, ví dụ thêm effect, hiệu ứng vật lí, deal dmg, v.v...
Chúc thành công!
 

Attachments

Cho mình hỏi làm sao để cho một unit khi chạy vào một vùng thì không ra được nữa!
Có ai thật sự rảnh add y!h của mình để hứơng dẫn mình về góc độ của we được không và cách dùng custom valve không???
[email protected]
 
chào anh raivor trở lại, em post skill ké cho xôm tụ. Skill agility bonus: gần giống skill 3 của con cóc trong dota nhưng imba hơn. đánh lính +1 agi, đánh hero +random 1->2 agi or str or int. duration: 15-20-45-60s, có MUI (skill mui đầu tiên mà em làm được ấy)

skill dành cho agi hero có chỉ số agi thấp( con hero của em 25 lv(max) mới có 50agi thôi)
chuẩn bị 1skill nào đó (tùy), 1 dummy unit y như trên bài của anh raivor, tạo sẵn các biến:agilityman(là mình đó),agilitytarget(thằng bị mình bắn) kiểu unit array,agilitygroup kiểu unit group, agilityrandom và agilitycountdown kiểu interger array .ok bắt đầu:
code1
Mã:
agility1
    Events
        Unit - A unit Is attacked
    Conditions
        ((Level of Agility Bonus  for (Attacking unit)) Greater than 0) and (((Triggering unit) is A structure) Equal to False)[B]//lv skill >0, unit bị đánh k0 phải nhà[/B]
    Actions
        Set mui = (mui + 1)
        Unit - Create 1 dummyAgility for (Owner of (Attacking unit)) at (Position of (Triggering unit)) facing Default building facing degrees[B]// tạo 1con dummy để mà mui[/B]
        Unit - Set the custom value of (Last created unit) to mui[B]// add custom value để tí còn mui[/B]
       Unit Group - Add (Last created unit) to agilityGroup[B]//cho nó vào group[/B]
        Set agilitytarget[mui] = (Triggering unit)
        Set agilityman[mui] = (Attacking unit)
        Hero - Modify Agility of agilityman[mui]: Add 1[B]//cộng 1 agi cho mình[/B]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) is A Hero) Equal to True[B]// nếu là hero thì....[/B]
            Then - Actions
                Set agilityRandom[mui] = (Random integer number between 1 and 6)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        agilityRandom[mui] Less than or equal to 2
                    Then - Actions
                        Hero - Modify Strength of agilityman[mui]: Add agilityRandom[mui]
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                agilityRandom[mui] Less than or equal to 4
                            Then - Actions
                                Hero - Modify Agility of agilityman[mui]: Add (agilityRandom[mui] - 2)
                            Else - Actions
                                Hero - Modify Intelligence of agilityman[mui]: Add (agilityRandom[mui] - 4)
            Else - Actions[B]// cả đoạn if có nghĩa như sau: nếu thằng bị đánh là hero thì cho agility ramdom từ 1 đến 6, random<= 2 thì cộng random str( random ra 1 thì cộng 1, ra 2 thì cộng 2), nếu random<= 4 thì cộng random-2 agi (random ra 3 thì trừ 2 còn 1,ra 4 thì trừ 2 còn 2), còn lại thì cộng random-4 int (tương tự)[/B]
        Set agilitycountdown[mui] = ((Level of Agility Bonus  for (Attacking unit)) x 15)[B]//đặt thời gian hiệu lực +agi =lvskill*15[/B]
        Trigger - Turn on agility2 <gen>[B]//chuyển sang code 2[/B]
        Memory Leak - Remove (Position of (Triggering unit))[B]// xóa leak[/B]
code 2
Mã:
agility2
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in agilityGroup and do (Actions)[B][B]//chọn mấy con hồi nãy mình add vào group ấy[/B][/B]
            Loop - Actions
                Set agilitycountdown[(Custom value of (Picked unit))] = (agilitycountdown[(Custom value of (Picked unit))] - 1)[B]//cứ sau mỗi giây thì thời gian hiệu lực giảm 1( tất nhiên)[/B]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        agilitycountdown[(Custom value of (Picked unit))][B]// Equal to 0nếu nó giảm về 0 thì.....[/B]
                    Then - Actions
                        Hero - Modify Agility of agilityman[(Custom value of (Picked unit))]: Subtract 1
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (agilitytarget[(Custom value of (Picked unit))] is A Hero) Equal to True
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        agilityRandom[(Custom value of (Picked unit))] Less than or equal to 2
                                    Then - Actions
                                        Hero - Modify Strength of agilityman[(Custom value of (Picked unit))]: Subtract agilityRandom[(Custom value of (Picked unit))]
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                agilityRandom[(Custom value of (Picked unit))] Less than or equal to 4
                                            Then - Actions
                                                Hero - Modify Agility of agilityman[(Custom value of (Picked unit))]: Subtract (agilityRandom[(Custom value of (Picked unit))] - 2)
                                            Else - Actions
                                                Hero - Modify Intelligence of agilityman[(Custom value of (Picked unit))]: Subtract (agilityRandom[(Custom value of (Picked unit))] - 4)
                            Else - Actions[B]//trừ những gì đã cộng[/B]
                        Unit - Add a 1.00 second Generic expiration timer to (Picked unit)
                        Unit Group - Remove (Picked unit) from agilityGroup//xóa con dummy để đề phòng bất trắc
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Number of units in agilityGroup) Equal to 0
                            Then - Actions
                                Trigger - Turn off (This trigger)
                            Else - Actions[B]// nếu trong group k0 còn con nào cần phải trừ thì ta tắt trigger cho nhẹ máy[/B]
                    Else - Actions
xong!!! nó khá dễ! và các bạn có thể thêm bớt gì đó vào nó như thằng bị bắn bị trừ random chỉ số chẳng hạn(super imba...!) vì đây là skill MUI đầu tiên mình làm nên hơi...( bựa+lỗi+some else)....mong mọi người ủng hộ
 
Unit - A unit Is attacked fail <-- spam "stop"
 
Ai cho em hỏi có cách nao copy biến(Vairable) một cách nhanh chóng không. Vô copy spell qua map khác mà thấy mấy cái biến khong copy được, mà copy một đống đó ôi thôi !!!!!!
 
Làm sao để cho một unit khi vào một vùng mà không ra được
 
Ai cho em hỏi có cách nao copy biến(Vairable) một cách nhanh chóng không. Vô copy spell qua map khác mà thấy mấy cái biến khong copy được, mà copy một đống đó ôi thôi !!!!!!
Chọn File/ Preferences/ Automatically create unknown variables while pasting trigger data.

---------- Post added at 19:05 ---------- Previous post was at 19:03 ----------

Làm sao để cho một unit khi vào một vùng mà không ra được
Tạo 1 region ở chỗ đó rồi dùng trigger khi unit đi ra khỏi region đó sẽ move instantly lại region.
 
Đây là topic về spell, không phải nơi các bạn vào hỏi copy spell hay là các trigger liên quan tới gameplay nhé. Muốn hỏi thì lên topic hỏi đáp mà hỏi.
[spoil]chào anh raivor trở lại, em post skill ké cho xôm tụ. Skill agility bonus: gần giống skill 3 của con cóc trong dota nhưng imba hơn. đánh lính +1 agi, đánh hero +random 1->2 agi or str or int. duration: 15-20-45-60s, có MUI (skill mui đầu tiên mà em làm được ấy)

skill dành cho agi hero có chỉ số agi thấp( con hero của em 25 lv(max) mới có 50agi thôi)
chuẩn bị 1skill nào đó (tùy), 1 dummy unit y như trên bài của anh raivor, tạo sẵn các biến:agilityman(là mình đó),agilitytarget(thằng bị mình bắn) kiểu unit array,agilitygroup kiểu unit group, agilityrandom và agilitycountdown kiểu interger array .ok bắt đầu:
code1
Mã:
agility1
    Events
        Unit - A unit Is attacked
    Conditions
        ((Level of Agility Bonus  for (Attacking unit)) Greater than 0) and (((Triggering unit) is A structure) Equal to False)[B]//lv skill >0, unit bị đánh k0 phải nhà[/B]
    Actions
        Set mui = (mui + 1)
        Unit - Create 1 dummyAgility for (Owner of (Attacking unit)) at (Position of (Triggering unit)) facing Default building facing degrees[B]// tạo 1con dummy để mà mui[/B]
        Unit - Set the custom value of (Last created unit) to mui[B]// add custom value để tí còn mui[/B]
       Unit Group - Add (Last created unit) to agilityGroup[B]//cho nó vào group[/B]
        Set agilitytarget[mui] = (Triggering unit)
        Set agilityman[mui] = (Attacking unit)
        Hero - Modify Agility of agilityman[mui]: Add 1[B]//cộng 1 agi cho mình[/B]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) is A Hero) Equal to True[B]// nếu là hero thì....[/B]
            Then - Actions
                Set agilityRandom[mui] = (Random integer number between 1 and 6)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        agilityRandom[mui] Less than or equal to 2
                    Then - Actions
                        Hero - Modify Strength of agilityman[mui]: Add agilityRandom[mui]
                    Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                agilityRandom[mui] Less than or equal to 4
                            Then - Actions
                                Hero - Modify Agility of agilityman[mui]: Add (agilityRandom[mui] - 2)
                            Else - Actions
                                Hero - Modify Intelligence of agilityman[mui]: Add (agilityRandom[mui] - 4)
            Else - Actions[B]// cả đoạn if có nghĩa như sau: nếu thằng bị đánh là hero thì cho agility ramdom từ 1 đến 6, random<= 2 thì cộng random str( random ra 1 thì cộng 1, ra 2 thì cộng 2), nếu random<= 4 thì cộng random-2 agi (random ra 3 thì trừ 2 còn 1,ra 4 thì trừ 2 còn 2), còn lại thì cộng random-4 int (tương tự)[/B]
        Set agilitycountdown[mui] = ((Level of Agility Bonus  for (Attacking unit)) x 15)[B]//đặt thời gian hiệu lực +agi =lvskill*15[/B]
        Trigger - Turn on agility2 <gen>[B]//chuyển sang code 2[/B]
        Memory Leak - Remove (Position of (Triggering unit))[B]// xóa leak[/B]
code 2
Mã:
agility2
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in agilityGroup and do (Actions)[B][B]//chọn mấy con hồi nãy mình add vào group ấy[/B][/B]
            Loop - Actions
                Set agilitycountdown[(Custom value of (Picked unit))] = (agilitycountdown[(Custom value of (Picked unit))] - 1)[B]//cứ sau mỗi giây thì thời gian hiệu lực giảm 1( tất nhiên)[/B]
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        agilitycountdown[(Custom value of (Picked unit))][B]// Equal to 0nếu nó giảm về 0 thì.....[/B]
                    Then - Actions
                        Hero - Modify Agility of agilityman[(Custom value of (Picked unit))]: Subtract 1
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (agilitytarget[(Custom value of (Picked unit))] is A Hero) Equal to True
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        agilityRandom[(Custom value of (Picked unit))] Less than or equal to 2
                                    Then - Actions
                                        Hero - Modify Strength of agilityman[(Custom value of (Picked unit))]: Subtract agilityRandom[(Custom value of (Picked unit))]
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                agilityRandom[(Custom value of (Picked unit))] Less than or equal to 4
                                            Then - Actions
                                                Hero - Modify Agility of agilityman[(Custom value of (Picked unit))]: Subtract (agilityRandom[(Custom value of (Picked unit))] - 2)
                                            Else - Actions
                                                Hero - Modify Intelligence of agilityman[(Custom value of (Picked unit))]: Subtract (agilityRandom[(Custom value of (Picked unit))] - 4)
                            Else - Actions[B]//trừ những gì đã cộng[/B]
                        Unit - Add a 1.00 second Generic expiration timer to (Picked unit)
                        Unit Group - Remove (Picked unit) from agilityGroup//xóa con dummy để đề phòng bất trắc
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Number of units in agilityGroup) Equal to 0
                            Then - Actions
                                Trigger - Turn off (This trigger)
                            Else - Actions[B]// nếu trong group k0 còn con nào cần phải trừ thì ta tắt trigger cho nhẹ máy[/B]
                    Else - Actions
xong!!! nó khá dễ! và các bạn có thể thêm bớt gì đó vào nó như thằng bị bắn bị trừ random chỉ số chẳng hạn(super imba...!) vì đây là skill MUI đầu tiên mình làm nên hơi...( bựa+lỗi+some else)....mong mọi người ủng hộ[/spoil]

Map demo đâu bạn?
À còn một điều nữa, nếu các bạn post spell GUI, không cần phải type code đâu, các bạn chỉ cần click chuột phải vào đoạn code rồi chọn copy as text là được.
 
Chỉnh sửa cuối:
Cho mình h óikill Omniattack này của mình sao thế?
Mã:
Omniattack 1
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Omniattack 
    Actions
        Set Caster = (Casting unit)
        Set Target = (Target unit of ability being cast)
        Set Temp_Loc = (Position of (Target unit of ability being cast))
        Unit - Pause Caster
        Unit - Make Caster Invulnerable
        Unit - Hide Caster
        For each (Integer A) from 1 to 15, do (Actions)
            Loop - Actions
                Wait 0.25 seconds
                Set Temp_Group = (Units within 550.00 of Temp_Loc matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an enemy of (Owner of Caster)) Equal to True) and (((Matching unit) is alive) Equal to True))))
                Set Temp_Group2 = (Random 1 units from Temp_Group)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of units in Temp_Group) Greater than 0
                    Then - Actions
                        Unit Group - Pick every unit in Temp_Group2 and do (Actions)
                            Loop - Actions
                                Set Temp_Loc2 = (Position of (Picked unit))
                                Unit - Create 1 Dummy Omniattack for (Owner of Caster) at Temp_Loc2 facing Default building facing degrees
                                Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 45.00% transparency
                                Unit - Move (Last created unit) instantly to Temp_Loc2
                                Animation - Play (Last created unit)'s attack animation
                                Special Effect - Create a special effect attached to the chest of (Last created unit) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
                                Unit - Cause (Last created unit) to damage (Picked unit), dealing (Random real number between 100.00 and 600.00) damage of attack type Spells and damage type Normal
                                Special Effect - Destroy (Last created special effect)
                                Unit - Remove (Last created unit) from the game
                                EGUI Leak - Destroy Temp_Group
                                EGUI Leak - Destroy Temp_Group2
                                EGUI Leak - Remove Temp_Loc2
                                EGUI Leak - Remove Temp_Loc
                    Else - Actions
                        EGUI Leak - Destroy Temp_Group
                        EGUI Leak - Destroy Temp_Group2
                        EGUI Leak - Remove Temp_Loc2
                        EGUI Leak - Remove Temp_Loc
                        Unit - Unhide Caster
                        Unit - Unpause Caster
                        Unit - Make Caster Vulnerable
                        Animation - Change Caster's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
 
Hỏi thì cụ thể tí đi bạn, nói thế biết đường đâu mà lần 8->.
 
Cụ thể là: ko tạo ra dummy ở 1 point của random unit trog Temp group
 
Back
Top