• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Hero Creation Dialogs

Status
Not open for further replies.
Level 2
Joined
Jul 21, 2007
Messages
28
Doesn't seem to be working for multiple people. I haven't triggered in a long time so this may be a mess, if so, help me fix it! Haha.

Basically it pops up a dialog and asks each player to pick either a Mage or Lich. Then another that asks them to pick a first skill, and then a third for a second skill (it is set up as a skill tree).

  • WhatHero
    • Events
      • Time - Elapsed game time is 0.05 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Dialog - Clear HeroCreateDialogue[(Integer A)]
          • Dialog - Change the title of HeroCreateDialogue[(Integer A)] to Select Hero Type
          • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Mage
          • Set MageButton[(Integer A)] = (Last created dialog Button)
          • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Lich
          • Set LichButton[(Integer A)] = (Last created dialog Button)
          • Dialog - Show HeroCreateDialogue[(Integer A)] for (Player((Integer A)))
  • HeroSelect
    • Events
      • Dialog - A dialog button is clicked for HeroCreateDialogue[1]
      • Dialog - A dialog button is clicked for HeroCreateDialogue[2]
      • Dialog - A dialog button is clicked for HeroCreateDialogue[3]
      • Dialog - A dialog button is clicked for HeroCreateDialogue[4]
      • Dialog - A dialog button is clicked for HeroCreateDialogue[5]
      • Dialog - A dialog button is clicked for HeroCreateDialogue[6]
      • Dialog - A dialog button is clicked for HeroCreateDialogue[7]
      • Dialog - A dialog button is clicked for HeroCreateDialogue[8]
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to LichButton[(Integer A)]
            • Then - Actions
              • Unit - Create 1 Lich for (Player((Integer A))) at (Center of HeroStart <gen>) facing (Random angle) degrees
              • Set PlayerHero[(Integer A)] = (Last created unit)
              • Dialog - Clear HeroCreateDialogue[(Integer A)]
              • Dialog - Change the title of HeroCreateDialogue[(Integer A)] to Select First Skill
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Life
              • Set LifeButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Nature
              • Set NatureButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Death
              • Set DeathButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Arcane
              • Set ArcaneButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Show HeroCreateDialogue[(Integer A)] for (Player((Integer A)))
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to MageButton[(Integer A)]
            • Then - Actions
              • Unit - Create 1 Mage for (Player((Integer A))) at (Center of HeroStart <gen>) facing (Random angle) degrees
              • Set PlayerHero[(Integer A)] = (Last created unit)
              • Dialog - Clear HeroCreateDialogue[(Integer A)]
              • Dialog - Change the title of HeroCreateDialogue[(Integer A)] to Select First Skill
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Life
              • Set LifeButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Nature
              • Set NatureButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Death
              • Set DeathButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Arcane
              • Set ArcaneButton[(Integer A)] = (Last created dialog Button)
              • Dialog - Show HeroCreateDialogue[(Integer A)] for (Player((Integer A)))
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to LifeButton[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WhatSkillFirst[(Integer A)] Equal to <Empty String>
                • Then - Actions
                  • Unit - Add Holy Light to PlayerHero[(Integer A)]
                  • Set WhatSkillFirst[(Integer A)] = Life
                  • Dialog - Clear HeroCreateDialogue[(Integer A)]
                  • Dialog - Change the title of HeroCreateDialogue[(Integer A)] to Select Second Skill
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Life
                  • Set LifeButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Nature
                  • Set NatureButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Death
                  • Set DeathButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Arcane
                  • Set ArcaneButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Show HeroCreateDialogue[(Integer A)] for (Player((Integer A)))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Life
                    • Then - Actions
                      • Unit - Add Divine Shield to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Nature
                    • Then - Actions
                      • Unit - Add Rejuvenation to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Death
                    • Then - Actions
                      • Unit - Add Life Drain to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Arcane
                    • Then - Actions
                      • Unit - Add Mana Shield to PlayerHero[(Integer A)]
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DeathButton[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WhatSkillFirst[(Integer A)] Equal to <Empty String>
                • Then - Actions
                  • Unit - Add Death Coil to PlayerHero[(Integer A)]
                  • Set WhatSkillFirst[(Integer A)] = Death
                  • Dialog - Clear HeroCreateDialogue[(Integer A)]
                  • Dialog - Change the title of HeroCreateDialogue[(Integer A)] to Select Second Skill
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Life
                  • Set LifeButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Nature
                  • Set NatureButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Death
                  • Set DeathButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Arcane
                  • Set ArcaneButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Show HeroCreateDialogue[(Integer A)] for (Player((Integer A)))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Life
                    • Then - Actions
                      • Unit - Add Banish to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Nature
                    • Then - Actions
                      • Unit - Add Frost Nova to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Death
                    • Then - Actions
                      • Unit - Add Unholy Frenzy to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Arcane
                    • Then - Actions
                      • Unit - Add Siphon Mana to PlayerHero[(Integer A)]
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to ArcaneButton[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WhatSkillFirst[(Integer A)] Equal to <Empty String>
                • Then - Actions
                  • Unit - Add Immolation to PlayerHero[(Integer A)]
                  • Set WhatSkillFirst[(Integer A)] = Arcane
                  • Dialog - Clear HeroCreateDialogue[(Integer A)]
                  • Dialog - Change the title of HeroCreateDialogue[(Integer A)] to Select Second Skill
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Life
                  • Set LifeButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Nature
                  • Set NatureButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Death
                  • Set DeathButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Arcane
                  • Set ArcaneButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Show HeroCreateDialogue[(Integer A)] for (Player((Integer A)))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Life
                    • Then - Actions
                      • Unit - Add Blink to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Nature
                    • Then - Actions
                      • Unit - Add Blizzard to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Death
                    • Then - Actions
                      • Unit - Add Mana Burn to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Arcane
                    • Then - Actions
                      • Unit - Add Flame Strike to PlayerHero[(Integer A)]
                    • Else - Actions
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to NatureButton[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • WhatSkillFirst[(Integer A)] Equal to <Empty String>
                • Then - Actions
                  • Unit - Add Entangling Roots to PlayerHero[(Integer A)]
                  • Set WhatSkillFirst[(Integer A)] = Nature
                  • Dialog - Clear HeroCreateDialogue[(Integer A)]
                  • Dialog - Change the title of HeroCreateDialogue[(Integer A)] to Select Second Skill
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Life
                  • Set LifeButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Nature
                  • Set NatureButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Death
                  • Set DeathButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Create a dialog button for HeroCreateDialogue[(Integer A)] labelled Arcane
                  • Set ArcaneButton[(Integer A)] = (Last created dialog Button)
                  • Dialog - Show HeroCreateDialogue[(Integer A)] for (Player((Integer A)))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Life
                    • Then - Actions
                      • Unit - Add Anti-magic Shell to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Nature
                    • Then - Actions
                      • Unit - Add Cyclone (Hero) to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Death
                    • Then - Actions
                      • Unit - Add Carrion Swarm to PlayerHero[(Integer A)]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • WhatSkillFirst[(Integer A)] Equal to Arcane
                    • Then - Actions
                      • Unit - Add Chain Lightning to PlayerHero[(Integer A)]
                    • Else - Actions
            • Else - Actions
 
Level 11
Joined
Feb 22, 2006
Messages
752
Wow, that hurts my eyes lol. This could be a perfect example of how JASS is way better than GUI.

Anyway...can you give me more information on what exactly doesn't work? That's seriously more lines of code than most of the complex vJASS custom spells in my maps and it would take me a *while* to find the problem without knowing where to look.
 
Level 2
Joined
Jul 21, 2007
Messages
28
Wow, that hurts my eyes lol. This could be a perfect example of how JASS is way better than GUI.

Anyway...can you give me more information on what exactly doesn't work? That's seriously more lines of code than most of the complex vJASS custom spells in my maps and it would take me a *while* to find the problem without knowing where to look.

Rofl, I'm sorry. I told my cousin when we were testing that nobody is even going to look at this thing. Basically this is what happens.

The game is set for 8 players (all of the variables are then arrays of size 8, 1 for each player). It should set up a dialog for player A (1 through 8) and let that player choose a hero, either Lich or Mage (which is then set in a unit variable array). It then creates another menu with 4 options (Life, Nature, Death, or Arcane) and allows the player to pick one of these. It will then check to see if one has already been picked or not. On the first run through this should turn up no and give the player's Lich or Mage either Holy Light, Entangling Roots, Death Coil, or Immolation respectively. Then it will create another dialog with the same options (Life, Nature, Death, Arcane) and upon choosing on of those will see that a previous one has been chosen and will give the player's hero 1 out of 4 skills depending on what the player picked originally.

The problem is that the second player's hero (and I'm assuming others beyond the first) doesn't spawn if I choose mine first. It worked fine when I waited and let him choose his stuff and then I went, but it failed when I did it at the same time.

EDIT: It's times like these I wish I had other people on this project. Even if it isn't terribly advanced, I'm much better with design ideas and terraining, haha.
 
Level 11
Joined
Feb 22, 2006
Messages
752
Well, if it's a problem with multiple players, chances are it's the loop that's causing the issue.

Try this:

In the second trigger (where you detect button click), instead of having the trigger loop through each array index 1 thru 8, put this in the actions:

Custom Script: if ( GetClickedDialog() == udg_HeroCreateDialogue[1] ) then
Custom Script: elseif ( GetClickedDialog() == udg_HeroCreateDialogue[2] ) then
...
Custom Script: elseif ( GetClickedDialog() == udg_HeroCreateDialogue[8] ) then
Custom Script: endif

Then, just in between those lines copy paste the actions you already have (except replace all the instances of <Integer A> with the appropriate constant integers).

If you don't like the JASS, or if you think all those actions in one trigger will get messy, then just create 8 separate triggers to detect a clicked button, one for each player/dialogue.

Either way, you get rid of the loop.
 
Level 2
Joined
Jul 21, 2007
Messages
28
Well, if it's a problem with multiple players, chances are it's the loop that's causing the issue.

Try this:

In the second trigger (where you detect button click), instead of having the trigger loop through each array index 1 thru 8, put this in the actions:

Custom Script: if ( GetClickedDialog() == udg_HeroCreateDialogue[1] ) then
Custom Script: elseif ( GetClickedDialog() == udg_HeroCreateDialogue[2] ) then
...
Custom Script: elseif ( GetClickedDialog() == udg_HeroCreateDialogue[8] ) then
Custom Script: endif

Then, just in between those lines copy paste the actions you already have (except replace all the instances of <Integer A> with the appropriate constant integers).

If you don't like the JASS, or if you think all those actions in one trigger will get messy, then just create 8 separate triggers to detect a clicked button, one for each player/dialogue.

Either way, you get rid of the loop.

Well the idea was sort of to not have a huge trigger of repeating code (haha, irony), and I was trying to avoid having 8 separate triggers for it. But I guess if that's what needs to be done!

Either way I cannot test this tonight as all my friends have gone to sleep.
 
Level 5
Joined
Dec 17, 2007
Messages
145
You seriously need to code this fucker in JASS, that's the biggest strand of If/Thens in a GUI trigger I've ever seen in my life.

Either learn JASS or have someone do it for you, because this thing is slow, inefficient, and probably won't work right without JASS.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
First problem:

An array starts at index 0. If you have an array of size 8, it ranges from 0 to 7.

Therefor, your first trigger needs to be changed into
For integer A from 0 to 7
Then you must carefully remember that player 1 will take index 0, player 2 takes index 1, etc.
Second problem, again in trigger 1: you create a "magebutton" (as well as a lichbutton) for EACH player. All you need to do is create ONE dialog (and one only, not one for each player) and make it show up for each player. In other words: do something like this (pseudo-gui)

Events:
Map Initialisation
Conditions:
None
Actions
Clear Dialog
change title of Dialog into "Choose your Hero"
Create a button For Dialog and set "Magebutton" = last created button
For each integer A from 0 to 7 do actions: Show Dialog



Your second trigger is... quite inefficient, to say the least.
You loop while you don't have to loop. What you need to do INSTEAD of the for loop is simply replace "integer A" in the indexes with "player number of (triggering player) - 1". Again, do not forget the "- 1".

Try fixing your triggers so there's only one dialog. In fact, I don't think you need any arrays in these triggers at all, on the exception for variables such as PlayerHero.
 
Level 2
Joined
Jul 21, 2007
Messages
28
Nope, if you go with array from 1-8 it will go from 1-8.

And your problem is the buttons.
You have set the 4 skills buttons to Integar[A] meaning they are pretty much the same button and it bugs it all (I wonder if it crashes ?).

No, because there is an array for each of the buttons. Death [1] isn't the same as Nature [1]. Also, no, it doesn't crash.

You seriously need to code this fucker in JASS, that's the biggest strand of If/Thens in a GUI trigger I've ever seen in my life.

Either learn JASS or have someone do it for you, because this thing is slow, inefficient, and probably won't work right without JASS.

I'd love for someone to code this thing for me, because I don't have any experience with Jass except when I tried to learn it once and failed, haha. I'm sure I could pick it up pretty quickly as I do have programming experience with 2 scripting languages and 1 programming language, but I don't know if I really feel up to it.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Right, I was probably half a sleep to write that >.<

Anyway, I didn't really notice any problem but you should make all of this in like 1-2 short loops, using variables as skills.

"If clicked button equal to Integer[A] add blabla Skill[Integer[A]]" but since you have only 4 skills you should add a small loop inside the main loop.

And Eleandor I really wonderd for some time now If there is a need to show each player a diffrent table+buttons.

Do you KNOW we don't need or do you think ?
 
Level 2
Joined
Jul 21, 2007
Messages
28
Right, I was probably half a sleep to write that >.<

Anyway, I didn't really notice any problem but you should make all of this in like 1-2 short loops, using variables as skills.

"If clicked button equal to Integer[A] add blabla Skill[Integer[A]]" but since you have only 4 skills you should add a small loop inside the main loop.

And Eleandor I really wonderd for some time now If there is a need to show each player a diffrent table+buttons.

Do you KNOW we don't need or do you think ?

There are 20 skills not 4. There are 4 different skill trees, each with 5 skills in it (1 basic + 4 that branch off).

So I'm not sure now, do I need arrays or not? I'm really confused.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Of course, you can only use arrays in loops for this kind of stuff :)
You could make 4 arrayed integars and set the to the "skill tree" level for each player (at the start all of them will be worth to 0) and then when a player clicks on a button it will add one, now you can either choose to add the skill to the unit, or do nothing and continue the selecting and then at the end add it all together.

This would be done with using arrayed variables that will be the skills.

For example:
Event: A player clicks on last button
Actions: If Life[index[number of triggering player]] equal to 1, then add blabla to Hero[index[number of triggering unit]].

And so on.
I think this would be a bit easier.
 
Level 2
Joined
Jul 21, 2007
Messages
28
Of course, you can only use arrays in loops for this kind of stuff :)
You could make 4 arrayed integars and set the to the "skill tree" level for each player (at the start all of them will be worth to 0) and then when a player clicks on a button it will add one, now you can either choose to add the skill to the unit, or do nothing and continue the selecting and then at the end add it all together.

This would be done with using arrayed variables that will be the skills.

For example:
Event: A player clicks on last button
Actions: If Life[index[number of triggering player]] equal to 1, then add blabla to Hero[index[number of triggering unit]].

And so on.
I think this would be a bit easier.

Oh, I meant for the dialogs. Do I need 1 dialog for everyone? Or 1 for each player? I don't understand now.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Nope, if you go with array from 1-8 it will go from 1-8.
Nope, an array of 8 ranges from 0 (ZERO) to 7. Discussion ends here.

You only need to make one dialog, and each button only needs 1 assigned variable.

As an example:
You create 1 dialog with 2 buttons.

Clear Dialog
Change title of Dialog into "Choose your Skills"
Button - create a new button for Dialog labelled Button 1
set ButtonVar1 = last created button
Button - create a new button for Dialog labelled Button 2
set ButtonVar2 = last created button


Finally, you make sure the dialog shows up to every player. To do so, loop through each player in the game. For instance: use the action

For each integer A from 1 to 8 do actions:
Dialog - show Dialog to player[integer A]

In that trigger, you clearly see there's one dialog, but you "show" it to each player, allowing each player to choose an option.

In your "button" triggers, you can detect which player pressed a button. For instance:

Events:
player 1 presses a dialog button
player 2 presses a dialog button
etc.
Conditions:
Dialog button = ButtonVar1
Actions
Unit - create 1 Footman for triggering player

If you still don't understand how dialogs work, try reading some dialog tutorials on the Hive or another website. Alternativelly, try to see how dialogs work by opening a map in which you know dialogs are used.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
From what you said at your previous comment it seems to me that multiple dialogs are more easy to manipulate for multiple players.

And about the loop, here is the code for a loop that starts from 1 to 10.

--------------------------------------------------------------------
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 10
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set bj_forLoopAIndex = bj_forLoopAIndex + 1
-------------------------------------------------------------------

So does it start from 1 or 0 ? >.<

And just a example, if you set a variable in the loop, when the loop hits 1 it will take 1 in the variable not 0 Etc.
 
Level 2
Joined
Jul 21, 2007
Messages
28
that's not what I said. In a for loop you literally SET integer A = initial value (as in A = 1). However, ARRAYS start at index 0. There's a difference between indexes and a variable that is used as a dummy for a loop

I am aware that they start at 0, but for simplicity I just pretend they start at 1, haha.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Sorry, I was almost sure that was a reply of Ghostwolf :p

Anyway: If you create an array with size N it ranges from 0 to (n-1). So if you decide NOT to use index 0, your array only works for players 1 to n-1, in this case 7. Player 8 would try to get index 8, but there is no index 8, so nothing happens when player 8 tries to click the dialog.
 
Level 5
Joined
Dec 17, 2007
Messages
145
Oh and then you need to create an array of 9. Wasting resources too... Not recommended.
Common mis-conception. When you make an array, it always creates a variable with all 8192 slots, no matter what you declare its value to be in the editor. Anyone who's used local arrays / Free Global Declaration (vJASS) would know this, but for those who don't, the size of your array means very little. I'm sure; the GUI may automatically limit the array variable, but in JASS, when making an array, it creates a variable with 8192 slots... And since GUI is just shitty jass with pictures, I'd imagine it would do the same.
 
Level 14
Joined
Nov 25, 2004
Messages
1,185
Common mis-conception. When you make an array, it always creates a variable with all 8192 slots, no matter what you declare its value to be in the editor. Anyone who's used local arrays / Free Global Declaration (vJASS) would know this, but for those who don't, the size of your array means very little. I'm sure; the GUI may automatically limit the array variable, but in JASS, when making an array, it creates a variable with 8192 slots... And since GUI is just shitty jass with pictures, I'd imagine it would do the same.
stop playing smart

can you see section title? "Triggers (GUI)", people post it to get help with GUI, because probably they don't need/don't like/didn't learn JASS. So stop saying non-stop how GUI is shitty and how JASS is better and just help them, if not, just stay silent.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Nope, I almost always start arrays from 1 (just for not making all the time [ArrayNum-1] :p) and it was never bugged.

I think it just ignores the [0] if you don't set it to something.

Nope, arrays start from 0.

Oh and Darkwulfv, how do you know? Anyway, if it's true then Jass seriously has problems. The whole point of an array is to make triggers "easier" without wasting memory. I really doubt that a variable automatically reserves 8192 spots.
 
Level 14
Joined
Nov 25, 2004
Messages
1,185
he is right, arrays have a size of 8192 no matter what. I guess blizzard just neglected it, because 8000+ array elements is more than enough for all uses, and values don't take a lot of memory space. (8192 array of numbers would take at most 50 KB of memory).
 
Status
Not open for further replies.
Top