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:
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.
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 và
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à:
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!