Need help with adding heroes with dialogs

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)

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
DiaHeroes (the dialog with the Heroes)

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)
DoDiaHeroes (Activating the Buttons in the Dialog)

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
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).
 

rodead

Active Member
Reaction score
42
first of all what is your problem i don't really get it second use code tags and tird you can copy trigger as text so it is easy to show someone else.
 

Bitterstone

New Member
Reaction score
1
lawl stupid me

first of all what is your problem i don't really get it second use code tags and tird you can copy trigger as text so it is easy to show someone else.

Well, i was kinda tired yesterday so... well the problem is that when i push a button in the dialog it firstly adds the selected hero then it adds everone else... And with the code, i did actually copy as text and just pasted it in!
 

Exide

I am amazingly focused right now!
Reaction score
448
Code:
    -------- 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
Not sure about using a loop and Integer A here.. Looks like it could cause trouble for you, when clicking a button.
Could you give us a link to AceHart's Guide?
 

Exide

I am amazingly focused right now!
Reaction score
448
After reading the tutorial in the link, I can't see anything wrong with your triggers. You should double-check your variables, though. Make sure they have an array of 20, and not 10, like in the Tutorial. Other than that I don't know.

Does your trigger show the name of ALL your heroes as well, or just the last one?

Maybe this trigger wasn't tested before becoming a Tutorial.. I doubt that, though.

If all else fails, you could do a looong trigger like: If Clicked Dialog button was DiaBtn1 then add Paladin, If blabla was DiaBtn2 then add Archmage .. and so on..

EDIT: Also make sure that you show the dialog after map init. Like; 'Elapsed game time is 1.00 seconds.', so that the Hero Index is set properly.
 

Bitterstone

New Member
Reaction score
1
After reading the tutorial in the link, I can't see anything wrong with your triggers. You should double-check your variables, though. Make sure they have an array of 20, and not 10, like in the Tutorial. Other than that I don't know.

Does your trigger show the name of ALL your heroes as well, or just the last one?

Maybe this trigger wasn't tested before becoming a Tutorial.. I doubt that, though.

If all else fails, you could do a looong trigger like: If Clicked Dialog button was DiaBtn1 then add Paladin, If blabla was DiaBtn2 then add Archmage .. and so on..

EDIT: Also make sure that you show the dialog after map init. Like; 'Elapsed game time is 1.00 seconds.', so that the Hero Index is set properly.

I've checked the variables, they are set to 20.
The trigger shows all heroes, not just the last one.
The trigger is tested for the guide, s/he attached a demo file for the trigger aswell, and in that demo the trigger works.
The Hero Index is properly set.

I geuss i'll have to make the looooong one then
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top