What am I doing wrong?

Equivalent

New Member
Reaction score
0
I'm trying to make a dialog box which asks the owner of the unit if they would like to move to a city. I get the box and everything, but the hero doesn't teleport. Here are my trigger codes:

Trigger 1:
Code:
Dialog to City
    Events
        Unit - A unit comes within 100.00 of Admiral Proudmoore 0081 <gen>
    Conditions
    Actions
        Dialog - Clear To_City
        Dialog - Change the title of To_City to Travel to the City ...
        Dialog - Create a dialog button for To_City labelled Yes
        Set ToCity_Answer_Yes[1] = (Last created dialog Button)
        Dialog - Create a dialog button for ToVictoriaIsland labelled No
        Set To_City_Answer_No[2] = (Last created dialog Button)
        Dialog - Show To_City for (Owner of (Triggering unit))

Trigger 2

Code:
Button Yes
    Events
        Dialog - A dialog button is clicked for To_City
    Conditions
        (Clicked dialog button) Equal to ToCity_Answer_Yes[1]
    Actions
        Unit - Move (Triggering unit) instantly to (Center of City Start Region <gen>)

Trigger 3

Code:
Button No
    Events
        Dialog - A dialog button is clicked for To_City
    Conditions
        (Clicked dialog button) Equal to ToCity_Answer_Yes[2]
    Actions
        Dialog - Hide To_City for (Triggering player)


What am I doing wrong? Also, how can I make it so that the player has to pay a certain amount of gold if they choose Yes.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
There is no Triggering Unit when you click a dialog button. You need to set a variable to the unit you want to move. And if they choose yes, you should have an if/then/else to see if [((Triggering Player) Current Gold) greater than or equal to (However much they need to have)], and if so move the unit.
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
You can compress Triggers 2 and 3 into 1 trigger as follows:

Code:
To City Dialog Button Clicked
    Events
        Dialog - A dialog button is clicked for To_City_Dialog
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Clicked dialog button) Equal to To_City_Dialog_Button[1]
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Player 1 (Red) Current gold) Greater than or equal to 100
                    Then - Actions
                        Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) - 100)
                        Dialog - Hide To_City_Dialog for Player 1 (Red)
                        Unit - Move (Triggering unit) instantly to (Center of City Start Region <gen>)
                    Else - Actions
                        Dialog - Hide To_City_Dialog for Player 1 (Red)
                        Game - Display to Player Group - Player 1 (Red) the text: You don't have enou...
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Clicked dialog button) Equal to To_City_Dialog_Button[2]
            Then - Actions
                Dialog - Hide To_City_Dialog for Player 1 (Red)
            Else - Actions

NB: To_City_Dialog_Button[1] represents 'Yes' and To_City_Dialog_Button[2] represents 'No'. Also, you got to remember to hide the dialog when you press 'Yes' as well haha.

And as KaerfNomekop said, you have to create a unit variable and set the unit you want to teleport to that variable.

Also as KaerfNomekop said, you must use an If/Else/Then statement to check whether the player has enough gold. I've used 100 gold as an example in my trigger above, but you can use whatever value you want.
 

Equivalent

New Member
Reaction score
0
And as KaerfNomekop said, you have to create a unit variable and set the unit you want to teleport to that variable.

Wait, so if I create the unit variable, how would I attach it to something? Sorry, I'm kind of new :)
 

Equivalent

New Member
Reaction score
0
I got it to work, but I had to set the variable to equal to a specific unit in the game. What if the unit isn't existing and is made when the game starts?

Here's the code though:


Code:
To City Buttons
    Events
        Dialog - A dialog button is clicked for To_City
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Clicked dialog button) Equal to ToCity_Answer_Yes[1]
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Triggering player) Current gold) Greater than or equal to 150
                    Then - Actions
                        Player - Add -150 to (Triggering player) Current gold
                        Set Teleporting_Unit = Map Tester 0005 <gen>
                        Unit - Move Teleporting_Unit instantly to (Center of City Start Region <gen>)
                        Dialog - Hide To_City for (Triggering player)
                    Else - Actions
                        Dialog - Hide To_City for (Triggering player)
                        Game - Display to (All players) the text: You don't have enou...
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Clicked dialog button) ToCity_Answer_No[2]
                    Then - Actions
                        Dialog - Hide To_City for (Triggering player)
                    Else - Actions

Teleporting_Unit = Unit Variable
 

NeuroToxin

New Member
Reaction score
46
You shouldn't use specific unit. In your beginning trigger, A unit comes within range of Proudmoore, set the teleporting unit equal to the triggering unit. Then you can use that for your dialog.
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
Equivalent: if the unit doesn't exist when the map starts, then you can set the unit variable to 'Last created unit' when you get around to creating it. But NeuroToxin's suggestion is probably better
 

Ioannes

Oh man, I shot Marvin in the face.
Reaction score
49
to begin with, the title of the thread is fail, because it doesn't mention anything about the problem
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • 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 Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top