Trước hết là mình xin sorry về bài spam hồi hôm qua.
Hôm nay mình xin giới thiệu "Cách tạo quỹ đạo cho skill - Sứ dụng MUI và Custom Value Unit" qua demo skill Wild Axe.
1/ Trước hết tui sẽ mô tả 2 trigger cần đó là wild axe và wild axe move.
Đây là trigger wild axe. Trước hết chúng ta sẽ tạo 2 temp_loc để cho xác định các phần cơ bản của quỹ đạo bay của cái búa.
Lưu ý: cái phần đầu tiên
là dùng để tạo giá trị MUI luôn tăng và không tăng quá 1000.
Tiếp theo chúng ta sẽ tạo ra 1 dummy (wildaxe_dummy).
Chúng ta sẽ set customvalue cho unit vừa tạo và add nó vào group wa_g (group lưu trữ các unit sẽ bay theo quỹ đạo)
Giá trị custom value sẽ đc gán vào dummy.
Còn kái phần nầy
Nói chung ở phần này chúng ta sẽ tạo ra các biến cần để có 1 quỹ đạo parabol cho dummy.
Tiếp theo sẽ là trigger 2 wild axe move
Trong trigger này chúng ta cần chú ý phần check điều kiện ở đầu actions cái này để cho không lag.
Tiếp theo ta sẽ tìm giá trị y = công thức: y = -a*x*x + dy
Do trong WE cái set point k cho đi theo đường xéo (k phải k mà là khó) nên tui dùng 2 kái temp_loc. temp_loc thứ nhất từ vị trí wa_p đến wa_x trước mặt với wa_d độ.
Temp_loc2 là đi sang ngang từ temp_loc đến vị trí wa_y trước mặt với wa_d + wa_di độ.
Tiếp theo là move unit đến vị trí đó là xong.
Còn kái phần này:
Khi mà dummy bay wa giới hạn thì biến wa_t sẽ false và wa_s,wa_di có giá trị âm
Các giá trị này sẽ làm dummy bay ngược lại.
Tiếp theo là đoạn code cuối
Khi mà dummy về đến chỗ cũ sẽ bỏ dummy ra khỏi group và remove dummy.
Bài này hơi khó hiểu mong quý vị thông cảm
Map [Demo] Nàk
http://www.2shared.com/file/W_ICx3K1/DemoWild_Axe.html
có chỗ nào hk hiểu pm mình : [email protected]
Hôm nay mình xin giới thiệu "Cách tạo quỹ đạo cho skill - Sứ dụng MUI và Custom Value Unit" qua demo skill Wild Axe.
1/ Trước hết tui sẽ mô tả 2 trigger cần đó là wild axe và wild axe move.
PHP:
Wild Axe
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Wild Axe
Actions
Set MUI = (MUI + 1)
If (MUI Greater than or equal to 1000) then do (Set MUI = 1) else do (Do nothing)
Set temp_loc = (Position of (Casting unit))
Set temp_loc2 = (Target point of ability being cast)
Unit - Create 1 Wild Axe Dummy for (Owner of (Casting unit)) at temp_loc facing Default building facing degrees
Unit - Turn collision for (Last created unit) Off
Unit - Set the custom value of (Last created unit) to MUI
Unit Group - Add (Last created unit) to wa_g
Set wa_d[MUI] = (Facing of (Casting unit))
Set wa_dis[MUI] = (Distance between temp_loc and temp_loc2)
Set wa_dy[MUI] = (wa_dis[MUI] / 6.00)
Set wa_p[MUI] = (Position of (Last created unit))
Set wa_x[MUI] = (-1.00 x (wa_dis[MUI] / 2.00))
Set wa_s[MUI] = (wa_dis[MUI] / 40.00)
Set wa_t[MUI] = True
Set wa_a[MUI] = (wa_dy[MUI] / (wa_x[MUI] x wa_x[MUI]))
Set wa_di[MUI] = 90.00
Set wa_lv[MUI] = (Level of Wild Axe for (Casting unit))
Trigger - Turn on Wild Axe Move <gen>
Custom script: call RemoveLocation(udg_temp_loc)
Custom script: call RemoveLocation(udg_temp_loc2)
Lưu ý: cái phần đầu tiên
PHP:
Set MUI = (MUI + 1)
If (MUI Greater than or equal to 1000) then do (Set MUI = 1) else do (Do nothing)
Tiếp theo chúng ta sẽ tạo ra 1 dummy (wildaxe_dummy).
Chúng ta sẽ set customvalue cho unit vừa tạo và add nó vào group wa_g (group lưu trữ các unit sẽ bay theo quỹ đạo)
PHP:
Unit - Create 1 Wild Axe Dummy for (Owner of (Casting unit)) at temp_loc facing Default building facing degrees
Unit - Turn collision for (Last created unit) Off
Unit - Set the custom value of (Last created unit) to MUI
Unit Group - Add (Last created unit) to wa_g
Còn kái phần nầy
PHP:
Set wa_d[MUI] = (Facing of (Casting unit)) // Degree của casting unit
Set wa_dis[MUI] = (Distance between temp_loc and temp_loc2) // khoảng cách từ casting unit đến target của ability.
Set wa_dy[MUI] = (wa_dis[MUI] / 6.00) // Khoảng cách max y (sr giải thích khó hiểu)
Set wa_p[MUI] = (Position of (Last created unit)) // Vị trí ban đầu của unit
Set wa_x[MUI] = (-1.00 x (wa_dis[MUI] / 2.00)) // Giá trị x ban đầu
Set wa_s[MUI] = (wa_dis[MUI] / 40.00) // Tốc độ bay của dummy
Set wa_t[MUI] = True // Cái này là biến boolean để biết là dummy đang bay tới hay bay lui
Set wa_a[MUI] = (wa_dy[MUI] / (wa_x[MUI] x wa_x[MUI])) // Hehe cái giá trị này là dùng để tạo ra quỹ đạo parabol (hệ số a)
Set wa_di[MUI] = 90.00 (còn giá trị này là giá trị để biết là búa cần lệch sang trái hay sang phải)
Set wa_lv[MUI] = (Level of Wild Axe for (Casting unit))
Tiếp theo sẽ là trigger 2 wild axe move
PHP:
Wild Axe Move
Events
Time - Every 0.02 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in wa_g) Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Unit Group - Pick every unit in wa_g and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
wa_t[(Custom value of (Picked unit))] Equal to True
Then - Actions
Set wa_x[(Custom value of (Picked unit))] = (wa_x[(Custom value of (Picked unit))] + wa_s[(Custom value of (Picked unit))])
Set wa_y[(Custom value of (Picked unit))] = (wa_a[(Custom value of (Picked unit))] x (wa_x[(Custom value of (Picked unit))] x wa_x[(Custom value of (Picked unit))]))
Set wa_y[(Custom value of (Picked unit))] = (-1.00 x wa_y[(Custom value of (Picked unit))])
Set wa_y[(Custom value of (Picked unit))] = (wa_y[(Custom value of (Picked unit))] + wa_dy[(Custom value of (Picked unit))])
Set temp_loc = (wa_p[(Custom value of (Picked unit))] offset by (wa_x[(Custom value of (Picked unit))] + (wa_dis[(Custom value of (Picked unit))] / 2.00)) towards wa_d[(Custom value of (Picked unit))] degrees)
Set temp_loc2 = (temp_loc offset by wa_y[(Custom value of (Picked unit))] towards (wa_d[(Custom value of (Picked unit))] + wa_di[(Custom value of (Picked unit))]) degrees)
Unit - Move (Picked unit) instantly to temp_loc2
Unit - Create 1 Wild Axe Dummy for (Owner of (Picked unit)) at temp_loc2 facing Default building facing degrees
Unit - Set level of Wild Axe Blood for (Last created unit) to wa_lv[(Custom value of (Picked unit))]
Unit - Add a 0.30 second Generic expiration timer to (Last created unit)
Animation - Change (Last created unit)'s animation speed to 200.00% of its original speed
Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
Destructible - Pick every destructible within 200.00 of temp_loc2 and do (Actions)
Loop - Actions
Destructible - Kill (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
wa_x[(Custom value of (Picked unit))] Greater than or equal to (wa_dis[(Custom value of (Picked unit))] / 2.00)
Then - Actions
Set wa_t[(Custom value of (Picked unit))] = False
Set wa_di[(Custom value of (Picked unit))] = -90.00
Set wa_s[(Custom value of (Picked unit))] = (-1.00 x wa_s[(Custom value of (Picked unit))])
Else - Actions
Else - Actions
Set wa_x[(Custom value of (Picked unit))] = (wa_x[(Custom value of (Picked unit))] + wa_s[(Custom value of (Picked unit))])
Set wa_y[(Custom value of (Picked unit))] = (wa_a[(Custom value of (Picked unit))] x (wa_x[(Custom value of (Picked unit))] x wa_x[(Custom value of (Picked unit))]))
Set wa_y[(Custom value of (Picked unit))] = (-1.00 x wa_y[(Custom value of (Picked unit))])
Set wa_y[(Custom value of (Picked unit))] = (wa_y[(Custom value of (Picked unit))] + wa_dy[(Custom value of (Picked unit))])
Set temp_loc = (wa_p[(Custom value of (Picked unit))] offset by (wa_x[(Custom value of (Picked unit))] + (wa_dis[(Custom value of (Picked unit))] / 2.00)) towards wa_d[(Custom value of (Picked unit))] degrees)
Set temp_loc2 = (temp_loc offset by wa_y[(Custom value of (Picked unit))] towards (wa_d[(Custom value of (Picked unit))] + wa_di[(Custom value of (Picked unit))]) degrees)
Unit - Move (Picked unit) instantly to temp_loc2
Unit - Create 1 Wild Axe Dummy for (Owner of (Picked unit)) at temp_loc2 facing Default building facing degrees
Unit - Set level of Wild Axe Blood for (Last created unit) to wa_lv[(Custom value of (Picked unit))]
Unit - Add a 0.30 second Generic expiration timer to (Last created unit)
Animation - Change (Last created unit)'s animation speed to 200.00% of its original speed
Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
Destructible - Pick every destructible within 200.00 of temp_loc2 and do (Actions)
Loop - Actions
Destructible - Kill (Picked destructible)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
wa_t[(Custom value of (Picked unit))] Equal to False
wa_x[(Custom value of (Picked unit))] Less than or equal to (-1.00 x (wa_dis[(Custom value of (Picked unit))] / 2.00))
Then - Actions
Unit - Remove (Picked unit) from the game
Unit Group - Remove (Picked unit) from wa_g
Else - Actions
Custom script: call RemoveLocation(udg_temp_loc)
Custom script: call RemoveLocation(udg_temp_loc2)
Tiếp theo ta sẽ tìm giá trị y = công thức: y = -a*x*x + dy
Do trong WE cái set point k cho đi theo đường xéo (k phải k mà là khó) nên tui dùng 2 kái temp_loc. temp_loc thứ nhất từ vị trí wa_p đến wa_x trước mặt với wa_d độ.
Temp_loc2 là đi sang ngang từ temp_loc đến vị trí wa_y trước mặt với wa_d + wa_di độ.
Tiếp theo là move unit đến vị trí đó là xong.
Còn kái phần này:
PHP:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
wa_x[(Custom value of (Picked unit))] Greater than or equal to (wa_dis[(Custom value of (Picked unit))] / 2.00)
Then - Actions
Set wa_t[(Custom value of (Picked unit))] = False
Set wa_di[(Custom value of (Picked unit))] = -90.00
Set wa_s[(Custom value of (Picked unit))] = (-1.00 x wa_s[(Custom value of (Picked unit))])
Các giá trị này sẽ làm dummy bay ngược lại.
Tiếp theo là đoạn code cuối
PHP:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
wa_t[(Custom value of (Picked unit))] Equal to False
wa_x[(Custom value of (Picked unit))] Less than or equal to (-1.00 x (wa_dis[(Custom value of (Picked unit))] / 2.00))
Then - Actions
Unit - Remove (Picked unit) from the game
Unit Group - Remove (Picked unit) from wa_g
Bài này hơi khó hiểu mong quý vị thông cảm

Map [Demo] Nàk
http://www.2shared.com/file/W_ICx3K1/DemoWild_Axe.html
có chỗ nào hk hiểu pm mình : [email protected]