Добавлен , опубликован
Раздел:
4. Триггеры

Простое Создание Мультиборда

Итак, нам понадобилось создать простой мультиборд в Starcraft 2.
Сделать это довольно просто.
Внимание! Данная статья в принципе не является обучающей, т.к. не объясняет принципов работы триггеров, хотя и она сможет кое-чему вас научить. :)

Собственно создание

Создавать мы будем мультиборд, состоящий из текста в левом столбике и чисел в правой.
В данной заготовке 9 рядов и 2 колонки, а также простая и понятная система смены расстояния между составляющими мультиборда (тексты, числа и т.д.).

Глобальные переменные

        Variables
            Player Group
                <Your Player Group> = (Empty player group) <Player Group>
            Dialog
                Dialog - Initial Dialog = No Dialog <Dialog[14]>
                Dialog - Dialog Items = No Dialog Item <Dialog Item[14][14]>
                Dialog - <Right Column Integers> = 0 <Integer[14][8]>
            Technologies
                <Left Column Text - Row 1> = 0 <Integer[14]>
                <Left Column Text - Row 2> = 0 <Integer[14]>
                <Left Column Text - Row 3> = 0 <Integer[14]>
                <Left Column Text - Row 4> = 0 <Integer[14]>
                <Left Column Text - Row 5> = 0 <Integer[14]>
                <Left Column Text - Row 6> = 0 <Integer[14]>
                <Left Column Text - Row 7> = 0 <Integer[14]>
                <Left Column Text - Row 8> = 0 <Integer[14]>

Триггер создания диалога

Dialog - Dialog Creation
    Events
        Timer - Elapsed time is 6.0 Game Time seconds
    Local Variables
        Loop Integer A = 0 <Integer>
        Loop Integer B = 0 <Integer>
        Dialog Text Set 01 = No Text <Text[10]>
        ------- -
        Dialog Colums (X) Cordinate = 0 <Integer[8]>
        Dialog Rows (Y) Cordinate = 0 <Integer[8]>
        ------- -
        Dialog Number of Active  Rows = 8 <Integer>
        ------- (Active Rows = the rows I want to update later on, the rows used by Dialog Text Set 01[9] & [10] is static and won't be changed.)
        Dialog Number of Columns = 2 <Integer>
    Conditions
    Actions
        ------- Set Variables
        General - If (Conditions) then do (Actions) else do (Actions)
            If
            Then
                Variable - Set Dialog Text Set 01[1] = "<Left Column Text - Row 2>"
                Variable - Set Dialog Text Set 01[2] = "<Left Column Text - Row 3>"
                Variable - Set Dialog Text Set 01[3] = "<Left Column Text - Row 4>"
                Variable - Set Dialog Text Set 01[4] = "<Left Column Text - Row 5>"
                Variable - Set Dialog Text Set 01[5] = "<Left Column Text - Row 6>"
                Variable - Set Dialog Text Set 01[6] = "<Left Column Text - Row 7>"
                Variable - Set Dialog Text Set 01[7] = "<Left Column Text - Row 8>"
                Variable - Set Dialog Text Set 01[8] = "<Left Column Text - Row 9>"
                Variable - Set Dialog Text Set 01[9] = "<Left Column Topic - Row 1>"
                Variable - Set Dialog Text Set 01[10] = "<Left Column Topic - Row 2>"
                ------- -
                General - For each integer Loop Integer A from 1 to (Number of players in <Your Player Group>) with increment 1, do (Actions)
                    Actions
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][1] = <Left Column Text - Row 1>[Loop Integer A]
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][2] = <Left Column Text - Row 2>[Loop Integer A]
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][3] = <Left Column Text - Row 3>[Loop Integer A]
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][4] = <Left Column Text - Row 4>[Loop Integer A]
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][5] = <Left Column Text - Row 5>[Loop Integer A]
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][6] = <Left Column Text - Row 6>[Loop Integer A]
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][7] = <Left Column Text - Row 7>[Loop Integer A]
                        Variable - Set Dialog - <Right Column Integers>[Loop Integer A][8] = <Left Column Text - Row 8>[Loop Integer A]
                ------- Set Cordinate for Columns (X)
                ------- -
                Variable - Set Dialog Colums (X) Cordinate[1] = 50
                Variable - Set Dialog Colums (X) Cordinate[2] = 225
                ------- -
                ------- Set Cordinate for Rows (Y)
                General - For each integer Loop Integer A from 1 to Dialog Number of Active  Rows with increment 1, do (Actions)
                    Actions
                        Variable - Set Dialog Rows (Y) Cordinate[Loop Integer A] = (50 + (25 * Loop Integer A))
            Else

Триггер обновления диалога

Dialog - Dialog Refresh
    Events
        Timer - Every 0.5 seconds of Game Time
    Local Variables
        Loop Integer A = 0 <Integer>
        Loop Integer B = 0 <Integer>
        Dialog Text Set 01 = No Text <Text[14]>
        ------- -
        Dialog Colums (X) Cordinate = 0 <Integer[8]>
        Dialog Rows (Y) Cordinate = 0 <Integer[8]>
        ------- Comment
        Dialog Number of Rows = 8 <Integer>
        Dialog Number of Columns = 2 <Integer>
    Conditions
    Actions
        General - For each integer Loop Integer A from 1 to (Number of players in <Your Player Group>) with increment 1, do (Actions)
            Actions
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][1] = <Left Column Text - Row 1>[Loop Integer A]
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][2] = <Left Column Text - Row 2>[Loop Integer A]
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][3] = <Left Column Text - Row 3>[Loop Integer A]
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][4] = <Left Column Text - Row 4>[Loop Integer A]
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][5] = <Left Column Text - Row 5>[Loop Integer A]
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][6] = <Left Column Text - Row 6>[Loop Integer A]
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][7] = <Left Column Text - Row 7>[Loop Integer A]
                Variable - Set Dialog - <Right Column Integers>[Loop Integer A][8] = <Left Column Text - Row 8>[Loop Integer A]
        ------- SET TEXT LABEL
        Player Group - For each player Loop Integer A in <Your Player Group> do (Actions)
            Actions
                ------- Set Text = Integers
                General - For each integer Loop Integer B from 1 to Dialog Number of Rows with increment 1, do (Actions)
                    Actions
                        Dialog - Set Dialog - Dialog Items[Loop Integer A][Loop Integer B] text to (Text(Dialog - <Right Column Integers>[Loop Integer A][Loop Integer B])) for (Player group(Loop Integer A))

Post Scriptum

К сожалению, данный мультиборд не идеален, т.к. не является полностью оптимизированным, но надеюсь, что вы все же что-то вынесете для себя из этой статьи :)
Удачи в создании мультиборда!
Оригинал: Ice_bane
Перевод: Пиначет
`
ОЖИДАНИЕ РЕКЛАМЫ...