I am rather new to triggers. For one of my projects, one of my biggest obstacles as of lately has been getting a proper faction selection screen. I followed this tutorial up till 1.47, but also attempted going through the entire thing:
At somewhere around 1.47, it says that if all of these steps were done properly, then an empty box should appear in the middle of the screen. This has not happened with me. I was using a Mac so I thought it might be a problem with the trigger editor, then I tried the pc editor and it was not working either. After this, I tried publishing it as a test to see if the results would be different. Results were the same. I had also gone through the entire tutorial to see if anything might work. No avail. One last attempt was that I tried to alter the triggers on a regular map vs an extension mod. Same result. I've seen many mods and arcade games with working trigger ui, so I assume that I must be doing something wrong here. I am rather new to triggers so I can't be sure what I am doing wrong. This is a picture of what I have done so far.
It should be noted that I am trying to do this with an extension mod. It has liberty, swarm and void dependency data loaded as well as campaign data selected when I first set it up. I'd like to know how to get working dialog buttons that a player can choose between.
First you have the "Dialog" which is a big container. What it contains are "Dialog Item". If you create a new dialog you have to make sure to "Show/Hide Dialog" to show it which is what you are missing. You can also hide the background of the "Dialog" to only show what it contains.
Second you have to create "Dialog Item" and also save a variable like the dialog but as a "Dialog Item" variable. This will allow to track click Events and add a condition to know which dialog item was clicked.
Third, when creating dialog and dialog items the size, offset, etc. numbers are in pixels. So for your example, your dialog's scale is 500 pixels by 400 pixels. You can copy paste dialog items you created, like buttons, but remember to change the offset or it will be created behind the other button you copied.
Here is an example:
A more advanced way that would save you time is by using variable position when creating your dialogs. It's a bit more complicated and you have to use what is called "Array" where you can find by clicking on your variable then checking the Array box and giving it a size.
That gives you this:
Then you can do whatever with it by adding a condition to your Event checking for which button got clicked. Here I did a simple thing that cycle through the variable and check if it's that one that got clicked and then it sends a text message based on it.
This Thank you so much for responding! The advice you have given me has solved the issue of the Dialog UI not showing up and I now have a general idea of how to get other kinds of buttons set up with the images and UI. This faction select portion has been something I've been trying to figure out for such a long while. I do still have a few questions if you don't mind. I'll stick to the most important ones right now. My next question is about how someone would properly go about setting up a dialog item to change the starting items for a player. There is about 15 factions I am trying to set up for the mod I am building and 9 of them are mostly done right now. What I really need to know is how to set up starting items and also set it up so that when all the players pick a faction, the game will automatically start with a timer that will automatically pick one for them if they don't select one in time. Currently I have one dialog button that is select to select amon's brood, but for some reason its not working. It just does nothing. One thing I should point out is that I am doing this on the test map. Here is how I have my trigger data set up:
This part is meant to set up all the buttons when the game starts as well as images and icons.
This part is the trigger that is meant to select Amon's Brood if the player picks it. If there is anymore info you need or info specified just let me know.
You must make sure that you firstcreate the dialog or dialog item and only thenset the variable to last created dialog or dialog item (or any action at all like showing it; the dialog must be created first). Dialog item like images are not necessarily needed to be set as a variable. Variables are there mostly to be able to track what is happening with what specefic dialog. For example it's very usefull to set a button as a variable, but not an image or a label (text). If you hide the dialog containing dialog items, they all get hide, so no need to hide all of them individually.
So first, create the "Dialog". Set it's variable. Then do any action on it like hiding its background, changing scale, etc. Then create your dialog item like an image, label, etc. and only if needed (if you need to keep track of it, say if you want to change the image, or the text, or the values of the dialog item, you have to save it as a variable, if you don't need to keep track of it for futur changes, you can just create it and leave it there all fine. When the time comes to destroy the "Dialog" all the dialog items it contain will be deleted as well.
Then create your button and set a variable to it (after your created it). Then your other trigger will be able to work because the condition will have a valid reference of what is "Amon Zerg[1]".
The use of array is to prevent having many many variables for the same kind of stuff. For example, say you want a variable that changes based on "is player alive". (for whatever "is alive" mean like still having structure or whatever).
The long way would be variables:
Is player 1 alive
Is player 2 alive
Is player 3 alive...
And using array for this woudl be:
Is player alive [integer]
Where integer is from 0 to the number you set the size of the array. Then you can use stuff like:
For eatch Int from 1 to 8:
If: Is player alive [Int] == true
Then: this player is alive
Else: this player is dead
Instead of having to check eatch variable individually.
Maybe you would not have to use array in your situation although, you said you have 15 different faction, so you could use an array for that, like variable integer with array size 15: "Faction [15]" (depending on what you want to do of course). You could also create what is called a "Preset" which basicly changes an integer into text, kind of.
You could create a Preset and add a value for eatch faction with their name.
Then when you want to get the race picked as an integer, you can choose "preset" and find the preset you created. For you visually it will be the text, for the editor it gives an integer.
I am not sure where I went wrong. Right here I tried to indicate a variable for the dialog item and set it appropriately. From what it looks like I seem to have created followed the proper procedure to get the button as mentioned working. Sadly it is not working yet. Here is what the variables I have look like so far:
This is the set variable.
This is the variable the to indicate the dialog item.
So far whenever I click on the dialog item, nothing happens at all, but one thing to note is that it could be due to a complication with the map I am testing it on. I was noticing in the test map that when I tried to set starting locations(which is what I want these to apply to, no bases are appearing). Of course I eventually want to set this up in an extension mod. Its been one major obstacle after another.
Ah! Brilliant! Now I have a have more of a clear idea what is going on. My mistake was not realizing that the order of the actions under the event was important. Its working in game and the I even got the new race's base to show up. I also follow what you said about presets. I tried both arrays and presets. Still debating which one of them to use moving forward from here. I'll move onto the next questions though. There is a few important things that need to be done next for this to work. How can I do the following:
1. First thing is that the regular bases for each race are still showing up. How would I go about preventing these bases automatically set up so that player's can instead get the new bases placed at their starting locations.
2. How can I set up a system where every player needs to have clicked on the correct faction select button for the game to begin starting? If no button is pressed by a certain player after such and such time, then they will get randomly assigned a race. I have a few ideas of how to keep the game paused or stalled while during this, process although I am not sure what the best method of doing this would be.
1: If something is created, it means you might still have on map initialization the actions that creates the starting structures for all players (you know the default triggers you can see when making a new map) Then, if nothing appears other than your dialogs to pick a faction / race, you create the unit for it when voting is finish.
2: There are many ways of doing this, the examples I give might not be the "optimal" ones, but ones that can work. There are always better or different ways of doing thing based on your needs. To make what you wish here you need at least:
Some sort of Timer. Can be the default one that can be found in the action list about timers or you can make your own using dialogs and dialog items Label and variables and some basic mathematics such as
Set X = 30
Repeat forever: (Note: Could also be repeat X number of times)
If: X > 30
Then: set the dialog item text to X
wait 1 sec
set variable X -1.
Else: Timer is over.
A condition that checks if all players voted when a player votes. So the last player that votes will make the game starts. Using variable, like an Boolean (True/False) Array "Player has voted". When a player votes it sets that player to true. Then you run a loop to check if eatch value is an active player (to prevent leavers) and if it's set to true. Then this means all players voted and the trigger can continue on making the game start.
About the end of the timer, you check if eatch player is an active player, and if it has voted to true, if not, you can do a simple local variable integer that you can do "Set variable random integer between X and Y" based on the number of races you have. Then you assign that race based on the random int.
Note:
You might enconter some minor bugs. For example: make sure that if all players votes and the game starts, to stop the timer, otherwise it will keep going down and spawn once again the starting structures.
You might want to have an action that disables the triggers about winning/losing conditions for example if a player has no building end game. Since during voting in the beginning no players have structure it would end right there.
You will most likely go through some stupid / annoying bugs just like anyone ;) If you need a more specefic example using the editor just ask. But I think you might be able to understand the idea. Hopefully my explainations are clear enough.
About 1. Here is the thing though. I am trying to get this implemented on an extension mod. I know that when you bring up maps under melee initialization, you will get a number of actions setting base resources for players. I don't see these though under the melee initialization trigger and the regular bases still show up. Maybe I am missing missing or something, or do I need to do something else to clear them out? This is what my current melee initialization trigger looks like:
Part 2. I am working on right now.
Also. Yes I have discord, but not on this computer. I just have to re download it. I will do this soon.
Np. I will try to figure out what is wrong with that for a little while first. I wondered if you might be able to elaborate a bit more on this part:
A condition that checks if all players voted when a player votes. So the last player that votes will make the game starts. Using variable, like an Boolean (True/False) Array "Player has voted". When a player votes it sets that player to true. Then you run a loop to check if eatch value is an active player (to prevent leavers) and if it's set to true. Then this means all players voted and the trigger can continue on making the game start.
I understand the timer and even got a working timer up with UI countdown showing, but this part I am kind of confused on. I set up a Boolean variable with its array set to 9(since there is 9 factions). I am not sure though if I should be setting up based on that. Its meant to check for active players if I understand right and return true when they use such and such a dialog item. Now what confuses me is if I should set the timers up alongside a new trigger from the map initialization or in the same one and what kind of condition would I be using? What sort of action would I use also to check for if all players voted?
Also. Thank you for that tip about the basically duplicate dialog actions. I'll keep that in mind.
The variable Player has voted would be the number of players for your map.
So now, you have a new triggers, let's call it "Player choosing". As event you would have, dialog item used, as condition which dialog item was used (the button).
In the actions, you would have a set variable for "Player has voted [triggering player]" == true.
Then something along the lines of a For eatch int from 1 to (your number of players). (You could add a local variable for temporary counting, say "Votes")
If Player has voted [int] == true
Then set variable votes +1
Else (nothing)
Then another if then else:
If number of active players == Votes (which means all active players voted)
Then do the actions to start the game and stop the timer.
So everytime a player votes, it will cycle through the array and see if everyone voted. It probably not "the most efficient way" but its not a big enough trigger to have any noticeable lags or issues. It's not trying to cycle through thousands of stuff you know...
This is much better. I think I am getting a clearer idea of this. Currently Blizzard is under maintaince and I am not sure how long it will be until its done, so I am going to answer a bit early. There is still a fewquestions I have so here is what I gather about what you have said so far. I believe I understand this in that I need to have a variable that tallies up votes from all active players as the dialog is used. Before I get to the randomization of if nobody picks anything I am going to try and get the basic system set up first. Here are the more further questions I have about what you posted:
1. What type of variable would "Player has voted" be? My guess is that it is an integer, but I wanted to make sure.
2. "(You could add a local variable for temporary counting, say "Votes")
If Player has voted [int] == true
Then set variable votes +1"
After reading through this again multiple times throughout today, I think I might understand this now I wanted to check 2 things again. What type of variable and does it include an array?
__________________________
I think I am close to getting it working soon. Just need to keep testing and learning all these triggers well. I think that I understand what to do to keep the game paused during selection and all the necessary things to properly start it once everyone has voted. Sadly I can't post pictures of the progress yet cause the game is down for maintenance.
I made one example of how you could do it. There are probably better ways, more efficient, etc. But it still gives you a first glimpse and can improve it as you go.
Thank you very much! This example turned out to be absolutely invaluable and has helped so much. After studying the example rigorously in the past day, I figured out all the areas I went wrong in and now have a basis for a solid faction select system set up. I'll be sure to credit you when I released the mod. Its going to be quite a decent mod I think. I think with the example you provided I might be able to get everything else figured out over time. I'll just ask if there is something I am really stuck on.
With this example with the trigger Game Initialization you can then pick eatch player and create their unit based on the race they choosed (the variable "Player Has Choosed")
Feel free to PM me if you need so. You can also write back here and hopefully I'll get the notice. Dialogs is one part in the triggers that I'm very familiar with, except for custom dialogs appearance. But I guess at that point it would be easy to learn.
That is the point of them after all. Unfortunately my dialog one is not yet fully completed and still lacks several features I intend to implement before official release.
I am rather new to triggers. For one of my projects, one of my biggest obstacles as of lately has been getting a proper faction selection screen. I followed this tutorial up till 1.47, but also attempted going through the entire thing:
At somewhere around 1.47, it says that if all of these steps were done properly, then an empty box should appear in the middle of the screen. This has not happened with me. I was using a Mac so I thought it might be a problem with the trigger editor, then I tried the pc editor and it was not working either. After this, I tried publishing it as a test to see if the results would be different. Results were the same. I had also gone through the entire tutorial to see if anything might work. No avail. One last attempt was that I tried to alter the triggers on a regular map vs an extension mod. Same result. I've seen many mods and arcade games with working trigger ui, so I assume that I must be doing something wrong here. I am rather new to triggers so I can't be sure what I am doing wrong. This is a picture of what I have done so far.
It should be noted that I am trying to do this with an extension mod. It has liberty, swarm and void dependency data loaded as well as campaign data selected when I first set it up. I'd like to know how to get working dialog buttons that a player can choose between.
Hey, Dialogs work like this:
First you have the "Dialog" which is a big container. What it contains are "Dialog Item". If you create a new dialog you have to make sure to "Show/Hide Dialog" to show it which is what you are missing. You can also hide the background of the "Dialog" to only show what it contains.
Second you have to create "Dialog Item" and also save a variable like the dialog but as a "Dialog Item" variable. This will allow to track click Events and add a condition to know which dialog item was clicked.
Third, when creating dialog and dialog items the size, offset, etc. numbers are in pixels. So for your example, your dialog's scale is 500 pixels by 400 pixels. You can copy paste dialog items you created, like buttons, but remember to change the offset or it will be created behind the other button you copied.
Here is an example:
A more advanced way that would save you time is by using variable position when creating your dialogs. It's a bit more complicated and you have to use what is called "Array" where you can find by clicking on your variable then checking the Array box and giving it a size.
That gives you this:
Then you can do whatever with it by adding a condition to your Event checking for which button got clicked. Here I did a simple thing that cycle through the variable and check if it's that one that got clicked and then it sends a text message based on it.
Working on projects:
This Thank you so much for responding! The advice you have given me has solved the issue of the Dialog UI not showing up and I now have a general idea of how to get other kinds of buttons set up with the images and UI. This faction select portion has been something I've been trying to figure out for such a long while. I do still have a few questions if you don't mind. I'll stick to the most important ones right now. My next question is about how someone would properly go about setting up a dialog item to change the starting items for a player. There is about 15 factions I am trying to set up for the mod I am building and 9 of them are mostly done right now. What I really need to know is how to set up starting items and also set it up so that when all the players pick a faction, the game will automatically start with a timer that will automatically pick one for them if they don't select one in time. Currently I have one dialog button that is select to select amon's brood, but for some reason its not working. It just does nothing. One thing I should point out is that I am doing this on the test map. Here is how I have my trigger data set up:
This part is meant to set up all the buttons when the game starts as well as images and icons.
This part is the trigger that is meant to select Amon's Brood if the player picks it. If there is anymore info you need or info specified just let me know.
You must make sure that you first create the dialog or dialog item and only then set the variable to last created dialog or dialog item (or any action at all like showing it; the dialog must be created first). Dialog item like images are not necessarily needed to be set as a variable. Variables are there mostly to be able to track what is happening with what specefic dialog. For example it's very usefull to set a button as a variable, but not an image or a label (text). If you hide the dialog containing dialog items, they all get hide, so no need to hide all of them individually.
So first, create the "Dialog". Set it's variable. Then do any action on it like hiding its background, changing scale, etc. Then create your dialog item like an image, label, etc. and only if needed (if you need to keep track of it, say if you want to change the image, or the text, or the values of the dialog item, you have to save it as a variable, if you don't need to keep track of it for futur changes, you can just create it and leave it there all fine. When the time comes to destroy the "Dialog" all the dialog items it contain will be deleted as well.
Then create your button and set a variable to it (after your created it). Then your other trigger will be able to work because the condition will have a valid reference of what is "Amon Zerg[1]".
The use of array is to prevent having many many variables for the same kind of stuff. For example, say you want a variable that changes based on "is player alive". (for whatever "is alive" mean like still having structure or whatever).
The long way would be variables:
And using array for this woudl be:
Where integer is from 0 to the number you set the size of the array. Then you can use stuff like:
For eatch Int from 1 to 8:
If: Is player alive [Int] == true
Then: this player is alive
Else: this player is dead
Instead of having to check eatch variable individually.
Maybe you would not have to use array in your situation although, you said you have 15 different faction, so you could use an array for that, like variable integer with array size 15: "Faction [15]" (depending on what you want to do of course). You could also create what is called a "Preset" which basicly changes an integer into text, kind of.
You could create a Preset and add a value for eatch faction with their name.
Then when you want to get the race picked as an integer, you can choose "preset" and find the preset you created. For you visually it will be the text, for the editor it gives an integer.
Working on projects:
In reply to Scbroodsc2:
I am not sure where I went wrong. Right here I tried to indicate a variable for the dialog item and set it appropriately. From what it looks like I seem to have created followed the proper procedure to get the button as mentioned working. Sadly it is not working yet. Here is what the variables I have look like so far:
This is the set variable.
This is the variable the to indicate the dialog item.
So far whenever I click on the dialog item, nothing happens at all, but one thing to note is that it could be due to a complication with the map I am testing it on. I was noticing in the test map that when I tried to set starting locations(which is what I want these to apply to, no bases are appearing). Of course I eventually want to set this up in an extension mod. Its been one major obstacle after another.
Are you sure the Set variable is After the create button action? The variable itself is fine, it just has to be dialog item which is correct here.
Working on projects:
In reply to Scbroodsc2:
1: If something is created, it means you might still have on map initialization the actions that creates the starting structures for all players (you know the default triggers you can see when making a new map) Then, if nothing appears other than your dialogs to pick a faction / race, you create the unit for it when voting is finish.
2: There are many ways of doing this, the examples I give might not be the "optimal" ones, but ones that can work. There are always better or different ways of doing thing based on your needs. To make what you wish here you need at least:
Note:
You will most likely go through some stupid / annoying bugs just like anyone ;) If you need a more specefic example using the editor just ask. But I think you might be able to understand the idea. Hopefully my explainations are clear enough.
Note: Are you on discord? I'm Fenix there. https://www.sc2mapster.com/forums/general/general-chat/184298-sc2mapster-discord
Working on projects:
In reply to Scbroodsc2:
It's kind of tricky to know why the default units spawn without seeing the triggers.
I want to point out though that in the trigger you show here there is:
You could simply keep one of those two and it should still work fine.
Working on projects:
In reply to Scbroodsc2:
I'll elaborate a bit.
The variable Player has voted would be the number of players for your map.
So now, you have a new triggers, let's call it "Player choosing". As event you would have, dialog item used, as condition which dialog item was used (the button).
In the actions, you would have a set variable for "Player has voted [triggering player]" == true.
Then something along the lines of a For eatch int from 1 to (your number of players). (You could add a local variable for temporary counting, say "Votes")
If Player has voted [int] == true
Then set variable votes +1
Else (nothing)
Then another if then else:
If number of active players == Votes (which means all active players voted)
Then do the actions to start the game and stop the timer.
So everytime a player votes, it will cycle through the array and see if everyone voted. It probably not "the most efficient way" but its not a big enough trigger to have any noticeable lags or issues. It's not trying to cycle through thousands of stuff you know...
Is that better?
Working on projects:
In reply to Scbroodsc2:
If Player has voted [int] == true
Then set variable votes +1"
After reading through this again multiple times throughout today, I think I might understand this now I wanted to check 2 things again. What type of variable and does it include an array?
__________________________
I think I am close to getting it working soon. Just need to keep testing and learning all these triggers well. I think that I understand what to do to keep the game paused during selection and all the necessary things to properly start it once everyone has voted. Sadly I can't post pictures of the progress yet cause the game is down for maintenance.
I made one example of how you could do it. There are probably better ways, more efficient, etc. But it still gives you a first glimpse and can improve it as you go.
Map example:
https://ufile.io/cuhi3
Working on projects:
In reply to Scbroodsc2:
With this example with the trigger Game Initialization you can then pick eatch player and create their unit based on the race they choosed (the variable "Player Has Choosed")
Feel free to PM me if you need so. You can also write back here and hopefully I'll get the notice. Dialogs is one part in the triggers that I'm very familiar with, except for custom dialogs appearance. But I guess at that point it would be easy to learn.
Working on projects:
In reply to sc2ggamer:
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
In reply to DrSuperEvil:
Thank you very much for this demo map. I am going to have a look at it soon as well. These demo map examples are really helping me learn this fast.
That is the point of them after all. Unfortunately my dialog one is not yet fully completed and still lacks several features I intend to implement before official release.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Working on projects: