Đây, 2 spell co dummy mà mình nói (Poison Attack và shadow Strike). Tiện thể chỉ cho các bạn newbie lun

Spell: Poisonous Gale
Stun mấy enemy đứng kế bên rồi shadow strike bọn nó
Mã:
Poisonous Gale
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Poisonous Gale
Actions
Set PoiCaster = (Triggering unit)
Set PoiIndex = (PoiIndex + 1)
Set PoiLevel[PoiIndex] = (Level of Poisonous Gale for PoiCaster)
Set PoiGroup[PoiIndex] = (Units within 400.00 of (Position of PoiCaster) 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 (O
Unit Group - Pick every unit in PoiGroup[PoiIndex] and do (Actions)
Loop - Actions
Unit - Create 1 Dummy Unit 2 for (Owner of PoiCaster) at (Position of PoiCaster) facing Default building facing degrees
Unit - Add Vine Poison to (Last created unit)
Unit - Set level of Vine Poison for (Last created unit) to (Level of Poisonous Gale for PoiCaster)
Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike (Picked unit)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Set PoiLevel[PoiIndex] = PoiLevel[(PoiIndex + 1)]
Set PoiGroup[PoiIndex] = PoiGroup[(PoiIndex + 1)]
Set PoiIndex = (PoiIndex - 1)
Custom script: call DestroyGroup (udg_PoiGroup[udg_PoiIndex])
Giải thích nhé, biến
PoiCaster là để xác định người cast spell này,
PoiLevel là level của skill này (đặc làm biến trứoc vì để nếu có làm những con số như
damage,
distance hay gì đó thì mình sẽ ấn nhanh hơn, đỡ mỏi tay).
PoiGroup là dùng để "
chọn" ra những unit tuy theo cái
condition mà mình đặc ra. Ở đây, mình cho nó là: không phải là nhà, không phải là unit đang được kháng phép, unit đó chưa chết và nó là đối thủ của mình (như thế thì số dummy tạo ra sẽ
không bị dư thừa,
ít leak hơn. Mà thật ra tớ còn đặc thiếu condition như unit đó không bị hide,v...vv. Phần này các bạn có thể thêm condition tùy thích để phù hợp với spell của mình)
Sau khi cọn xong, ở phần
loop action, những action mà các bạn thêm vào đây sẽ
tác động lên từng unit bị chọn (VD: tạo effect thunder clap trong phần loop action này thì mỗi unit bị chọn tương đương với 1 effect thunder clap => 6 picked unit = 6 effect thunder clap)
Ở trong trigger này, mình tạo ra các dummy, add spell vào cho nó,
set level cho spell bằng với level của spell chính (Poisonous Gale) rồi
order cho nó cast vào
từng picked unit.
Add thêm timed life cho nó để kill dummy sau khi sử dụng xong (
remove leak)
Phần này:
Mã:
Set PoiLevel[PoiIndex] = PoiLevel[(PoiIndex + 1)]
Set PoiGroup[PoiIndex] = PoiGroup[(PoiIndex + 1)]
Set PoiIndex = (PoiIndex - 1)
Là dùng để dẹp bớt variable (nghĩa là làm cho spell này MUI, thực ra, MUI là cho các biến có array và có PoiIndex tăng theo mỗi lần cast)
Nói vậy thì thật là khó hiểu, để mình explain hơn 1 tý
VD: Các bạn tạo 1 biến có tên là MyFood có array. Để set cho từng loại food của mình.
Mã:
Set MyFood[1] = Apple
Set MyFood[2] = Banana
Set MyFood[3] = Strawberries
Và khi làm action như sau:
Mã:
Unit - Order MyMom to Night Elf Warden - Million Slice (MyFood[1])
Trigger sẽ hiều rằng nó
phải order MyMom để cast spell Million Slice vào Apple, khi tằng số này
lên theo thứ tự từ 1 -> 3 thì nó sẽ
order MyMom cast Million Slice vào Apple rồi đến Banana và Strawberies.
Có nghĩa là, nếu như bạn cho 1 biến như mình ở phía trên (PoiLevel) có array là PoiIndex.
PoiIndex tăng theo từng lần cast => Các
action có PoiLevel sẽ được thực hiện 1 cách riêng biệt =>
Spell sẽ MUI
Dẹp bớt là khi action của spell này đã được thực hiện hết (cứ hiểu là finished casting spell) thì trừ cái index xuống (nếu không thì 100 đứng cast thì có index là 100, sau đó thêm 1000 đứa khác cast thì index lại là 1100 và không bao giờ giảm xuống. Nếu như có thêm phần loại bới số như trên thì con số này sẽ quay lại là 0 sau khi tất cả các spell đã cast xong) BTW, phần này cũng quan trọng là làm để dừng 1 trigger có event là every x second (mình sẽ nói vào spell sau).
Spell: Toxic Spread
Tạo ra 1 làn khí độc bay ra từ caster, slow, deal damage per second vào mấy unit kế bên
Trigger 1:
Mã:
Toxic Spread
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Toxic Spread
Actions
Set ToxCaster = (Triggering unit)
Set ToxIndex = (ToxIndex + 1)
Set ToxLevel[ToxIndex] = (Level of Toxic Spread for ToxCaster)
Set ToxDistance[ToxIndex] = 0.00
Set ToxCount[ToxIndex] = 0
Set ToxGroup[ToxIndex] = (Units within 400.00 of (Position of ToxCaster) 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 (O
Unit Group - Pick every unit in ToxGroup[ToxIndex] and do (Actions)
Loop - Actions
Unit - Create 1 Dummy Unit for (Owner of ToxCaster) at (Position of (Picked unit)) facing Default building facing degrees
Unit - Add Normal Poison to (Last created unit)
Unit - Set level of Normal Poison for (Last created unit) to (Level of Toxic Spread for ToxCaster)
Unit - Order (Last created unit) to Attack (Picked unit)
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Trigger 1 thì cũng như trên thôi, như trigger của skill Poisonous Gale ấy.
Trigger 2:
Mã:
Toxic Spread Effect
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to ToxIndex, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
ToxDistance[(Integer A)] Greater than or equal to 375.00
Then - Actions
Custom script: call DestroyGroup (udg_PoiGroup[GetForLoopIndexA()])
For each (Integer B) from (Integer A) to (ToxIndex - 1), do (Actions)
Loop - Actions
Set ToxLevel[(Integer A)] = ToxLevel[((Integer A) + 1)]
Set ToxGroup[(Integer A)] = ToxGroup[((Integer A) + 1)]
Set ToxIndex = (ToxIndex - 1)
Else - Actions
Set ToxDistance[(Integer A)] = (ToxDistance[(Integer A)] + 30.00)
For each (Integer B) from 1 to 20, do (Actions)
Loop - Actions
Special Effect - Create a special effect at ((Position of ToxCaster) offset by ToxDistance[(Integer A)] towards ((360.00 / 20.00) x (Real((Integer B)))) degrees) using Abilities\Weapons\LocustMissile\LocustMissile.mdl
Special Effect - Destroy (Last created special effect)
Đây là phần effect của skill này (1 loạt cái đỏ đỏ bay ra từ caster)
Để làm 1 hiệu ứng gồm nhiều SFX được sắp xếp đều nhau thành 1 hình tròn thì ta làm 1 dòng như thế này
Mã:
For each (Integer B) from 1 to 20, do (Actions)
Loop - Actions
Special Effect - Create a special effect at ((Point của bạn) offset by Dítance bạn muốn towards [B]((360.00 / 20.00) x (Real((Integer B))))[/B] degrees) using Abilities\Weapons\LocustMissile
Phần bôi đen mớ là wa trọng vì nó là cái angel sắp xếp các effect thành 1 hình tròn.
Mã:
((360.00 / 20.00) x (Real((Integer B))))
360 là 360 độ (1 vòng quay).
Chia cho 20 nghĩa là sắp xếp đều cho 20 vị trí trong 1 vòng 360 độ đó. Nhân với loop interger (Ngay chỗ For each (Integer B)
from 1 to 20, do (Actions) thì cái from 1 to 20 là 1 con số được tăng lên liên tục (1, 2, 3, 4,.....) Khi nhân với nó,
effect sẽ được create trên số vòng đó ngược chiều khim đồng hồ (nếu nhân thêm với -1 thì xuôi theo kim đồng hồ).
Map mình attach ở phía dưới, các bạn down về xem
