Bitterstone
New Member
- Reaction score
- 1
Hi there, i got a rather weird problem... I want to add heroes with a dialog, the thing that happens is that first it adds the selected hero then it add everyone else asweell, so i get all the heroes when i push one button. I followed AceHart's guide and I have exactly the same triggers and codes etc etc, except: i've added some heroes, instead of 8 heroes i have 16 so i have 4 dialogs instead of 2. I have double-checked the code SEVERAL times and as i can see i have the same code as AceHart showed in the Guide.
Ok, this is the code I have in my trigger:
(Dia means Dialog)
Heroes (the Heroes is being set)
DiaHeroes (the dialog with the Heroes)
DoDiaHeroes (Activating the Buttons in the Dialog)
And here is the variables i'm using:
HeroBtn - Dialog Button Array (20) - - none -
HeroDia1 - Dialog - New Dialog (Default)
HeroDia2 - Dialog - New Dialog (Default)
HeroDia3 - Dialog - New Dialog (Default)
HeroDia4 - Dialog - New Dialog (Default)
Heroes - Unit-Type Array (20) - - none -
Oh mi gosh, its alot of code... I REALLY hope someone will bother reading this and try to help me .
Well well, thanks for reading and trying to help (If you did).
Ok, this is the code I have in my trigger:
(Dia means Dialog)
Heroes (the Heroes is being set)
Code:
Events -
Map initialization
Conditions -
Actions -
Set Heroes[1] = Paladin
Set Heroes[2] = Archmage
Set Heroes[3] = Mountain King
Set Heroes[4] = Blood Mage
Set Heroes[5] = No unit-type
Set Heroes[6] = Blademaster
Set Heroes[7] = Far Seer
Set Heroes[8] = Tauren Chieftain
Set Heroes[9] = Shadow Hunter
Set Heroes[10] = No unit-type
Set Heroes[11] = Death Knight
Set Heroes[12] = Lich
Set Heroes[13] = Dreadlord
Set Heroes[14] = Crypt Lord
Set Heroes[15] = No unit-type
Set Heroes[16] = Keeper of the Grove
Set Heroes[17] = Priestess of the Moon
Set Heroes[18] = Demon Hunter
Set Heroes[19] = Warden
Set Heroes[20] = No unit-type
Code:
Events -
Dialog - A dialog button is clicked for MyDialog
Conditions -
((Clicked dialog button) Equal to DiaBtn[3]) or ((Clicked dialog button) Equal to DiaBtn[4])
Actions -
Dialog - Clear HeroDia1
Dialog - Change the title of HeroDia1 to Choose a Hero (1/4)
Dialog - Create a dialog button for HeroDia1 labelled Paladin
Set HeroBtn[1] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia1 labelled Archmage
Set HeroBtn[2] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia1 labelled Mountain King
Set HeroBtn[3] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia1 labelled Blood Mage
Set HeroBtn[4] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia1 labelled to page 2
Set HeroBtn[5] = (Last created dialog Button)
Dialog - Clear HeroDia2
Dialog - Change the title of HeroDia2 to Choose a Hero (2/4)
Dialog - Create a dialog button for HeroDia2 labelled Blademaster
Set HeroBtn[6] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia2 labelled Far Seer
Set HeroBtn[7] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia2 labelled Tauren Chieftain
Set HeroBtn[8] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia2 labelled Shadow Hunter
Set HeroBtn[9] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia2 labelled to page 3
Set HeroBtn[10] = (Last created dialog Button)
Dialog - Clear HeroDia3
Dialog - Change the title of HeroDia3 to Choose a Hero (3/4)
Dialog - Create a dialog button for HeroDia3 labelled Death Knight
Set HeroBtn[11] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia3 labelled Lich
Set HeroBtn[12] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia3 labelled Dreadlord
Set HeroBtn[13] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia3 labelled Crypt Lord
Set HeroBtn[14] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia3 labelled to page 4
Set HeroBtn[15] = (Last created dialog Button)
Dialog - Clear HeroDia4
Dialog - Change the title of HeroDia4 to Choose a Hero (4/4)
Dialog - Create a dialog button for HeroDia4 labelled Keeper of the Grove
Set HeroBtn[16] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia4 labelled Priestess of the Mo...
Set HeroBtn[17] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia4 labelled Demon Hunter
Set HeroBtn[18] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia4 labelled Warden
Set HeroBtn[19] = (Last created dialog Button)
Dialog - Create a dialog button for HeroDia4 labelled to page 1
Set HeroBtn[20] = (Last created dialog Button)
Player Group - Pick every player in (All players controlled by a User player) and do (Actions)
Loop - Actions
Dialog - Show HeroDia1 for (Picked player)
Code:
Events -
Dialog - A dialog button is clicked for HeroDia1
Dialog - A dialog button is clicked for HeroDia2
Dialog - A dialog button is clicked for HeroDia3
Dialog - A dialog button is clicked for HeroDia4
Conditions -
Actions -
-------- Switch to page 2 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to HeroBtn[5]
Then - Actions
Dialog - Change the title of HeroDia2 to Choose a Hero (2/4)
Dialog - Show HeroDia2 for (Triggering player)
Skip remaining actions
Else - Actions
-------- Switch to page 3 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to HeroBtn[10]
Then - Actions
Dialog - Change the title of HeroDia3 to Choose a Hero (3/4)
Dialog - Show HeroDia3 for (Triggering player)
Skip remaining actions
Else - Actions
-------- Switch to page 4 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to HeroBtn[15]
Then - Actions
Dialog - Change the title of HeroDia4 to Choose a Hero (4/4)
Dialog - Show HeroDia4 for (Triggering player)
Skip remaining actions
Else - Actions
-------- Switch to page 1 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to HeroBtn[20]
Then - Actions
Dialog - Change the title of HeroDia1 to Choose a Hero (1/4)
Dialog - Show HeroDia1 for (Triggering player)
Skip remaining actions
Else - Actions
-------- Hero Selection --------
For each (Integer A) from 1 to 20, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to HeroBtn[(Integer A)]
Then - Actions
Unit - Create 1 Heroes[(Integer A)] for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
Selection - Select (Last created unit) for (Triggering player)
Game - Display to (Player group((Triggering player))) the text: (Name of (Last created unit))
Else - Actions
HeroBtn - Dialog Button Array (20) - - none -
HeroDia1 - Dialog - New Dialog (Default)
HeroDia2 - Dialog - New Dialog (Default)
HeroDia3 - Dialog - New Dialog (Default)
HeroDia4 - Dialog - New Dialog (Default)
Heroes - Unit-Type Array (20) - - none -
Oh mi gosh, its alot of code... I REALLY hope someone will bother reading this and try to help me .
Well well, thanks for reading and trying to help (If you did).