Một dạng Multiboard đơn giản

langthangbairac

T.E.T.Я.I.S
Multiboard là một loại bảng nâng cao của LeaderBoard. Nó cho phép hiện nhiều giá trị hơn với các hàng, các cột.
Sau đây là một dang multiboard đơn giản nhất.
1. Các biến mình dùng :
Mul_Number_Player (Integer)
Playe_Int (Integer)
Death (Integer[array(12)])
Kills (Integer[array(12)])
Score (Integer[array(12)])
Multiboard (Multiboard)
Mul_Group (Player Group)
Player_Color (String)
Hero (Unit[Array(12)])
2. Các code :
a) Tạo bảng :
Tạo bảng cần chú ý :
Rows : Số hàng ngang
Columns : Số cột
_ Ở đây số Rows mình viết là (Mul_Number_PLayer + 4) có nghĩa là Mul_Number_Player là số player tham gia game ( được mình check bên trên ) còn 4 là các hàng có sẵn cần thiết phải có .
_ Multiboard - Set the text for (Last created multiboard) item in column 1, row (3 + Playe_int) to |cff00ff00Team 2|r
Đoạn này có nghĩa là Tọa độ của |cff00ff00Team 2|r phụ thuộc vào số Playe_int ( Hàm số lượng player team 1 tham gia trò chơi )

Code hoàn chỉnh :
[spoil]
Create Multiboard
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Set Mul_Group = (All players matching ((((Matching player) controller) Equal to (==) User) and (((Matching player) slot status) Equal to (==) Is playing)))
Player Group - Pick every player in Mul_Group and do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Multiple ConditionsOr - Any (Conditions) are true
Conditions
(Picked player) Equal to (==) Player 1 (Red)
((Picked player) is an ally of Player 1 (Red)) Equal to (==) True
Then - Actions
Set Playe_int = (Playe_int + 1)
Else - Actions
Set Mul_Number_Player = (Number of players in Mul_Group)
-------- Test code --------
Player Group - Pick every player in (All players matching (((Matching player) is in Mul_Group) Equal to (==) False)) and do (Actions)
Loop - Actions
Player Group - Add (Picked player) to Mul_Group
Set Playe_int = 5
Set Mul_Number_Player = 10
-------- END Test code --------
Multiboard - Create a multiboard with 5 columns and (Mul_Number_Player + 4) rows, titled Multiboard by |cff0...
Do Multiple ActionsFor each (Integer A) from 1 to (Mul_Number_Player + 4), do (Actions)
Loop - Actions
Multiboard - Set the display style for (Last created multiboard) item in column 1, row (Integer A) to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 2, row (Integer A) to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 3, row (Integer A) to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 4, row (Integer A) to Show text and Hide icons
Multiboard - Set the display style for (Last created multiboard) item in column 5, row (Integer A) to Show text and Hide icons
Multiboard - Set the width for (Last created multiboard) item in column 1, row 0 to 10.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 2, row 0 to 4.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 3, row 0 to 4.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 4, row 0 to 4.00% of the total screen width
Multiboard - Set the width for (Last created multiboard) item in column 5, row 0 to 10.00% of the total screen width
Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Name
Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to Lv
Multiboard - Set the text for (Last created multiboard) item in column 3, row 1 to K
Multiboard - Set the text for (Last created multiboard) item in column 4, row 1 to D
Multiboard - Set the text for (Last created multiboard) item in column 5, row 1 to Score
Multiboard - Set the text for (Last created multiboard) item in column 1, row 2 to |cffff0000Team 1|r
Multiboard - Set the text for (Last created multiboard) item in column 2, row 2 to 0
Multiboard - Set the text for (Last created multiboard) item in column 3, row 2 to 0
Multiboard - Set the text for (Last created multiboard) item in column 1, row (3 + Playe_int) to |cff00ff00Team 2|r
Multiboard - Set the text for (Last created multiboard) item in column 2, row (3 + Playe_int) to 0
Multiboard - Set the text for (Last created multiboard) item in column 3, row (3 + Playe_int) to 0
Do Multiple ActionsFor each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero[(Integer A)] Not equal to (!=) No unit
Then - Actions
Set Mul_Cols[(Integer A)] = ((Integer A) + 2)
Multiboard - Set the text for (Last created multiboard) item in column 1, row Mul_Cols[(Integer A)] to (Player_Color[(Integer A)] + ((Name of (Player((Integer A)))) + |r))
Multiboard - Set the text for (Last created multiboard) item in column 2, row Mul_Cols[(Integer A)] to 0
Multiboard - Set the text for (Last created multiboard) item in column 3, row Mul_Cols[(Integer A)] to 0
Multiboard - Set the text for (Last created multiboard) item in column 4, row Mul_Cols[(Integer A)] to 0
Multiboard - Set the text for (Last created multiboard) item in column 5, row Mul_Cols[(Integer A)] to 0
Else - Actions
Do Multiple ActionsFor each (Integer A) from 6 to 10, do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero[(Integer A)] Not equal to (!=) No unit
Then - Actions
Set Mul_Cols[(Integer A)] = ((Integer A) + 3)
Multiboard - Set the text for (Last created multiboard) item in column 1, row Mul_Cols[(Integer A)] to (Player_Color[(Integer A)] + ((Name of (Player((Integer A)))) + |r))
Multiboard - Set the text for (Last created multiboard) item in column 2, row Mul_Cols[(Integer A)] to 0
Multiboard - Set the text for (Last created multiboard) item in column 3, row Mul_Cols[(Integer A)] to 0
Multiboard - Set the text for (Last created multiboard) item in column 4, row Mul_Cols[(Integer A)] to 0
Multiboard - Set the text for (Last created multiboard) item in column 5, row Mul_Cols[(Integer A)] to 0
Else - Actions
Multiboard - Minimize (Last created multiboard)
Set Multiboard = (Last created multiboard)
Custom script: call DestroyForce(udg_Mul_Group)

[/spoil]
b) Change Value
Mình làm 2 cái thay đổi value : Thay đổi các value trong Multiboard và cái thay đổi title. Để dễ hiểu mình tách hai cái thành hai trigger.
Trong đó, Cái thay đổi các giá trị trong multiboard chỉ cần dùng lệnh
Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to <Empty String>
là được còn cái thay đổi title thì cần tới phần Local Player
Code hoàn chỉnh :
Trigger 1 :
[spoil]
Change Value
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero[(Integer A)] Not equal to (!=) No unit
Then - Actions
Multiboard - Set the text for Multiboard item in column 2, row Mul_Cols[(Integer A)] to (String((Level of Hero[(Integer A)])))
Multiboard - Set the text for Multiboard item in column 3, row Mul_Cols[(Integer A)] to (String(Kills[(Integer A)]))
Multiboard - Set the text for Multiboard item in column 4, row Mul_Cols[(Integer A)] to (String(Death[(Integer A)]))
Multiboard - Set the text for Multiboard item in column 5, row Mul_Cols[(Integer A)] to (String(Score[(Integer A)]))
Else - Actions

[/spoil]
[spoil]
Change Title
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Hero[(Integer A)] Not equal to (!=) No unit
Then - Actions
Custom script: if GetLocalPlayer() == ConvertedPlayer(GetForLoopIndexA()) then
Multiboard - Change the title of Multiboard to (Multiboard by |cff00ff00langthangbairac|r ( + (((String(Kills[(Integer A)])) + / ) + ((String(Death[(Integer A)])) + ( / + ((String(Score[(Integer A)])) + ))))))
Custom script: endif
Else - Actions

[/spoil]
Đối với trigger 1 thì ta có thể thay đổi giá trị trong trigger hồi sinh Hero của map bạn.


Kết thúc !
 

Attachments

Chỉnh sửa cuối:
Set Multiboard = (Last created multiboard) nên đặt ngay sau "Multiboard - Create..." và các lệnh ở dưới nên dùng biến Multiboard thay vì Last created multiboard

nên dùng biến loop riêng, ko nên dùng Integer A hay B.

---

mục đích của topic này là gì?
 
Back
Top