Google Translate:

Script by 3ICE.

Categories

Archives

Affiliates

  • 12Oct

    Screenshot of the final product
    Select Difficulty Dialog Example

    We are going to create a dialog similar to the one you can see above. A dialog requires two separate triggers, one for initializing (setting up variables, adding a title, showing it to the desired player, etc) and an other for handling clicks on our buttons (Event: Dialog Button is Clicked).

    Lets start with variables! We will need an array of Dialog Buttons, I named it var_DialogButtonArray. We will also need a Dialog variable, let's call it var_Dialog. Of course you can use shorter variable names if you want. I for example always use one letter variables like b or d.

    Now all there is left is creating two triggers. You can download the example map from here. (or RoC version)

    The first trigger creates the dialog:

    The second trigger handles the Dialog Button Click Events:

    Replace the comments Easy, Medium and Hard with actual trigger functions, for example change Handicaps, Give extra gold, you name it.

    This tutorial was written by 3ICE. http://www.3ice.hu/blog/diffdiag/

    Posted by 3ICE @ 2:10 am

16 Responses

WP_Cloudy
  • 3ICE Says:

    Updated!
    I have added a RoC demo map.

    –3ICE

  • Polar Says:

    Thanks a lot! This helped me a lot with trigger variables in general.

    Edited by 3ICE: Corrected spellings of "alot", removed "you", removed "out", added "with".

  • OnlyWarCanDie Says:

    Nice :)

    I will think about using this one day :)

  • 3ICE Says:

    Well, hurry up, because as soon as StarCraft 2 comes out, WarCraft 3 will receive a population drop of about 75%!

  • George Says:

    Does anyone know how to do this in the starcraft 2 editor?

    Edited by 3ICE: Fixed capitalization ("does" -> "Does") and punctuation ("editor ??" -> "editor?").

  • 3ICE Says:

    Sure. Same principle, bit more complex triggering. Dialogs are more powerful in SC2, so they require a little more settings to be usable. (Like specifying height and position) Here are some screenshots and a downloadable demo map to get you started:

    Variables:
    http://img.3ice.hu/DiffdiagSC2_variables.png

    Trigger 1:
    http://img.3ice.hu/DiffdiagSC2_create.png

    Trigger 2:
    http://img.3ice.hu/DiffdiagSC2_click.png

    Download demo map:
    http://download.3ice.hu/Difficulty_Dialog_for_StarCraft_2.SC2Map

  • Vince Says:

    does that work in starcraft 2 too ?

  • 3ICE Says:

    Spammer down! Vince, I have removed your website, as it clearly isn't yours. As for your question, read the comment above yours for the answer.

  • QuSo Says:

    Thanks for the tutorial man, I know it's a bit late to be starting on wc3 editing, but regardless, this probably saved me at least a few hours trying to figure this out. ^^

  • 3ICE Says:

    You are welcome.

    It is never too late, in fact I just recently started working again on my Fastest Map Possible.


    The rest of this comment was moved to my forum: forum.3ice.hu/viewtopic.php?t=727.

    Edited by 3ICE: Fuck imageshack.us they deleted my pictures. Changing to my own host…

  • 3ICE Says:

    Note: JASS is superior to GUI. It requires half as much work to create and store the button handles, because you can put the assign and create lines together:

    call DialogSetMessage("Difficulty", var_Dialog)
    set var_DialogButtonArray[0] = DialogAddButton("Easy", var_Dialog)
    set var_DialogButtonArray[1] = DialogAddButton("Medium", var_Dialog)
    set var_DialogButtonArray[2] = DialogAddButton("Hard", var_Dialog)
    call DialogDisplay(Player(0), var_Dialog)

    The above JASS code was not syntax checked, I probably got the number and order of parameters wrong. But it will do, for demonstration purposes only.

  • Draghici Andrei Says:

    Very nice, is very helpful but i want to make a button clicked by more then 3 players like if 5 players from 9 click easy then go easy. Please help! Thanks again for tutorial!

  • 3ICE Says:

    That's a vote system. On each click you increment the respective difficulty vote counter variable: easy_clicked, medium_clicked, or hard_clicked and also keep track of total_clicked. Once total_clicked equals the number of players in the game or 30 seconds have passed (protection from AFK players) you tally up the results, choosing the difficulty level that most players voted on.

  • Daniel "3ICE" Berezvai Says:

    Old code:

    Difficulty Dialog = No Dialog
    Difficulty Buttons = No Dialog Item

    Difficulty Dialog create and show
    Events
    Game - Map initialization
    Local Variables
    Conditions
    Actions
    Dialog - Create a Modal dialog of size (350, 300) at (0, 0) relative to Center of screen
    ——-
    Dialog - Create a Button for dialog Difficulty Dialog
    Variable - Set Difficulty Buttons[0] = (Last created dialog item)
    Dialog - Set Difficulty Buttons[0] text to "Easy" for (Player group(1))
    Dialog - Set Difficulty Buttons[0] size to (200, 50) for (Player group(1))
    Dialog - Move Difficulty Buttons[0] to (150, 75) relative to Top Left of dialog for (Player group(1))
    ——-
    Dialog - Create a Button for dialog Difficulty Dialog
    Variable - Set Difficulty Buttons[1] = (Last created dialog item)
    Dialog - Set Difficulty Buttons[1] text to "Medium" for (Player group(1))
    Dialog - Set Difficulty Buttons[1] size to (200, 50) for (Player group(1))
    Dialog - Move Difficulty Buttons[1] to (150, 175) relative to Top Left of dialog for (Player group(1))
    ——-
    Dialog - Create a Button for dialog Difficulty Dialog
    Variable - Set Difficulty Buttons[2] = (Last created dialog item)
    Dialog - Set Difficulty Buttons[2] text to "Hard" for (Player group(1))
    Dialog - Set Difficulty Buttons[2] size to (200, 50) for (Player group(1))
    Dialog - Move Difficulty Buttons[2] to (150, 275) relative to Top Left of dialog for (Player group(1))
    ——-
    Dialog - Show Difficulty Dialog for (Player group(1))

    Difficulty Dialog handle clicks
    Events
    Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
    Local Variables
    Conditions
    Actions
    ——- First we hide it, to prevent multiple difficulties being selected
    Dialog - Hide Difficulty Dialog for (Player group(1))
    ——- Then we find out which button they clicked on
    General - If (Conditions) then do (Actions) else do (Actions)
    If
    (Used dialog item) == Difficulty Buttons[0]
    Then
    ——- Do stuff that makes the game easy, like set enemy handicap to 50%
    Debug - Display "Dialog button clicked: Easy" as debug output using Type 01, and Do display it in the game window
    Else
    General - If (Conditions) then do (Actions) else do (Actions)
    If
    (Used dialog item) == Difficulty Buttons[1]
    Then
    ——- Normal difficulty
    Debug - Display "Dialog button clicked: Normal" as debug output using Type 01, and Do display it in the game window
    Else
    General - If (Conditions) then do (Actions) else do (Actions)
    If
    (Used dialog item) == Difficulty Buttons[2]
    Then
    ——- Do stuff that makes the game hard, like set enemy handicap to 200%
    Debug - Display "Dialog button clicked: Hard" as debug output using Type 01, and Do display it in the game window
    Else

  • Alexandre Lohez Says:

    Hello really good help but how to modify handicap im really bad for this can anyone help me :(

  • Daniel "3ICE" Berezvai Says:

    In warcraft 3:
    Player - Set Player 1 (Red) handicap to 75.00%

    (You search for handicap)

    WC3 JASS (fastest):
    call SetPlayerHandicap(Player(0), 0.75)
    //Or BJ version:
    call SetPlayerHandicapBJ( Player(0), 75 )

    In starcraft 2 it's harder to find, but possible:
    Player - Modify player 1 Handicap: Set To 75

    (You have to search for "property", click `Modify Player Property (Integer)` and then change the property keyword from "minerals" to "handicap".)

    SC2 Galaxy code:
    PlayerModifyPropertyInt(1,c_playerPropHandicap,c_playerPropOperSetTo,75)

    –3ICE

Leave a Comment

Please note: If you post more than 5 URLs, then automated moderation will delay your comment for investigation. There is no need to resubmit the comment as it will be approved if found to be appropriate.