Apa itu index?
diketahui sebuah variable bernama "a[1]". Bilangan "1" adalah yang dimaksud dengan index.
Langkah-langkah:
1. Saya langsung masuk ke bagian triggering. Pertama tentukan dulu variabel2 yang berhubungan dengan spell yang anda buat. Misal "caster, target, damage, dll."
Contoh:
Code
Cast Event
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to TempAbility
Actions
Set TempIndexMax = (TempIndexMax + 1) // IndexMax adalah nilai index tertinggi yang saat ini akan digunakan
Set TempIndexBoolean [TempIndexMax]= True // Tandai index tersebut karena akan kita gunakan. True = sedang digunakan, False = nganggur
Set TempCaster [TempIndexMax]= (Triggering Unit)
Set TempTarget [TempIndexMax]= (Target of ability being cast)
Set TempDamage [TempIndexMax]= 100.00
Unit - Turn collision for TempCaster [TempIndexMax]Off
Trigger - Turn on Loop <gen> // Idupin loopnya
2. Kemudian kita buat "looping trigger" nya
Code
Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
For each (Integer TempLoop) from 1 to TempIndexMax, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempIndexBoolean [TempLoop]Equal to True // Kalau index tersebut ada "isi"nya maka akan diproses
Then - Actions
Set TempPoint[1] = Position of (TempCaster[TempLoop])
Set TempPoint[2] = TempPoint[2] offset by 15.00 facing (Facing of TempCaster[TempLoop])
Set TempPoint[3] = Position of (TempTarget[TempLoop])
Move TempCaster [TempLoop]to TempPoint[2] facing TempPoint[3]
Set TempGroup = Unit within 100.00 from TempPoint[2] matching (Matching unit) equal to TempTarget
[TempLoop]If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Number of units in TempGroup greater than 0
Then - Actions
Unit - Cause TempCaster [TempLoop]to damage TempCaster[TempLoop], dealing TempDamage [TempLoop]damage of attack type Spells and damage type Normal
Set TempIndexBoolean = False // Jika sudah mengenai target maka caster tidak akan diproses lagi
Else - Actions
Custom Script: call RemoveLocation(udg_TempPoint[1])
Custom Script: call RemoveLocation(udg_TempPoint[2])
Custom Script: call RemoveLocation(udg_TempPoint[3])
Custom Script: call DestroyGroup(udg_TempGroup)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempLoop Not equal to TempIndexMax
Then - Actions
Set TempIndexBoolean [TempLoop]= True
Set TempDamage [TempLoop]= TempDamage
[TempIndexMax]Set TempDamageSource [TempLoop]= TempDamageSource
[TempIndexMax]Set TempDamageTarget [TempLoop]= TempDamageTarget
[TempIndexMax]Set TempDelay [TempLoop]= TempDelay
[TempIndexMax]Set TempDelayTimer [TempLoop]= TempDelayTimer
[TempIndexMax]Set TempDurationTimer [TempLoop]= TempDurationTimer
[TempIndexMax]Set TempIndexBoolean [TempIndexMax]= False
Else - Actions
Set TempIndexMax = (TempIndexMax - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TempIndexMax Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Silahkan mencoba Maaf jika ada kesalahan karena kode diatas tidak dibuat langsung di Trigger Editor
Grr susah amat ngatur code nya, mending langsung lihat contoh ny aja dah :3
Download Contoh