I used a concept from some of my other maps that work perfectly to spawn a unit when a player clicks a button on my dialog. However, it keeps scrolling right through it as though the conditions are not met, and never spawns the unit because it flows all the way through the if statements without ever finding a true value.
Additionally, I want to make a timer to count down how long you have to pick from the dialog. I literally copied a working one from my other map I made, and it doesn't work either.
Here's the code for that:
Timer-StartUI.CharacterSelectionTimerasaOneShottimerthatwillexpirein60.0GameTimesecondsVariable-SetUI.CharacterSelectionTimer=(Laststartedtimer)Timer-CreateatimerwindowforUI.CharacterSelectionTimer,withthetitle"Time to Pick",usingRemainingtime(initiallyVisible)Variable-SetUI.CharacterSelectionTimerWindow=(Lastcreatedtimerwindow)Timer-MoveUI.CharacterSelectionTimerWindowto(50,50)Timer-SettimerforUI.CharacterSelectionTimerWindowtoUI.CharacterSelectionTimerTimer-ShowUI.CharacterSelectionTimerWindowfor(Allplayers)
Ok here is the code for the dialog. its in the same trigger as the timer, which is run after the map starts.
Dialog-CreateaModaldialogofsize(900,785)at(0,0)relativetoCenterofscreenVariable-SetUI.CharacterSelection=(Lastcreateddialog)Dialog-HidethebackgroundimageofUI.CharacterSelectionDialog-CreateanimagefordialogUI.CharacterSelectionwiththedimensions(900,785)anchoredtoCenterwithanoffsetof(0,0)settingthetooltipto""usingtheimageAssets\Textures\ui_glue_dropdownmenuframe_protoss.ddsasaHorizontalBordertypewithtiledsettoFalsetintcolorWhiteandblendmodeNormalDialog-CreatealabelfordialogUI.CharacterSelectionwiththedimensions(200,50)anchoredtoTopLeftwithanoffsetof(15,15)withthetext"Select your character."colorsettoAutomatictextwriteoutsettoFalsewithawriteoutdurationof2.0-------Dialog-CreateanimagefordialogUI.CharacterSelectionwiththedimensions(200,200)anchoredtoTopLeftwithanoffsetof(Colum1,Row1)settingthetooltipto""usingtheimageAssets\Textures\war3_btnbronzedragon.ddsasaNormaltypewithtiledsettoFalsetintcolorWhiteandblendmodeNormalVariable-SetUI.CharacterSelectionItems3[0]=(Lastcreateddialogitem)Dialog-CreateabuttonfordialogUI.CharacterSelectionwiththedimensions(200,200)anchoredtoTopLeftwithanoffsetof(Colum1,Row1)settingthetooltipto"Bronze Dragon"withbuttontext""andthehoverimagesetto""Variable-SetUI.CharacterSelectionItems[0]=(Lastcreateddialogitem)Dialog-FadeUI.CharacterSelectionItems[0]toatransparencyof0.0%overaperiodof0.0secondsfor(Allplayers)
can you set the tooltip of the button to BUTTON1 and print the tooltip of the pressed button to screen whenever a button is pressed. i assume you are assigning the variable somewhere else again. use text combination "ButtonText: " + tooltiptext of dialog used
now i am totally confused. so it does go into the then statement (try with text msg) ? if so then the creation of the unit fails, maybe the region is not set.
I'm sorry, everything in here is duplicated 4 times to take into account the 4 areas that you can spawn in. I just only included the first one, because the other 3 are exactly the same, just attached to the else slot, and it would take up a lot of unnecessary room on the page.
Turns out, I'm an idiot. Everything was working properly, however the event to create the units was "any dialog clicked", so when you clicked the "done picking" button, it removed the unit thinking it was about to create a new selection. I fixed it. The way I found this was because I noticed that there was a circle in the fog of war where there used to be vision, so I realized it was being created, but was being deleted before I could see it.
So now that this is solved, I still had one more issue in this post. The timer. How do I get the timer to work? I always have this problem in all my maps, and I never know why.
I used a concept from some of my other maps that work perfectly to spawn a unit when a player clicks a button on my dialog. However, it keeps scrolling right through it as though the conditions are not met, and never spawns the unit because it flows all the way through the if statements without ever finding a true value.
Here's my code:
Additionally, I want to make a timer to count down how long you have to pick from the dialog. I literally copied a working one from my other map I made, and it doesn't work either.
Here's the code for that:
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
can you show us the trigger where you create the dialog?
@FunkyUserName: Go
Ok here is the code for the dialog. its in the same trigger as the timer, which is run after the map starts.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
can you set the tooltip of the button to BUTTON1 and print the tooltip of the pressed button to screen whenever a button is pressed. i assume you are assigning the variable somewhere else again. use text combination "ButtonText: " + tooltiptext of dialog used
@FunkyUserName: Go
I tried
if dialog used == character selection 0.
and it returned true, so thats why im confused.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
now i am totally confused. so it does go into the then statement (try with text msg) ? if so then the creation of the unit fails, maybe the region is not set.
@FunkyUserName: Go
ok so I did this:
and the text message runs, however the unit does not spawn.
Edit: I think you're right, it may be the region. But I do not know why.
Here is what the region trigger looks like:
]
The "1" does not display when i run the map.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
i dont get your trigger, what happens if random is not 1? there is no else case and the region is not set.
@FunkyUserName: Go
I'm sorry, everything in here is duplicated 4 times to take into account the 4 areas that you can spawn in. I just only included the first one, because the other 3 are exactly the same, just attached to the else slot, and it would take up a lot of unnecessary room on the page.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
keep going!
spawn a different unit, does it spawn?
spawn at different region, does it spawn?
@FunkyUserName: Go
Turns out, I'm an idiot. Everything was working properly, however the event to create the units was "any dialog clicked", so when you clicked the "done picking" button, it removed the unit thinking it was about to create a new selection. I fixed it. The way I found this was because I noticed that there was a circle in the fog of war where there used to be vision, so I realized it was being created, but was being deleted before I could see it.
So now that this is solved, I still had one more issue in this post. The timer. How do I get the timer to work? I always have this problem in all my maps, and I never know why.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
@fishy77: Go
Ok so I modified my trigger to make it more efficient, and for some reason, now the timer works. so problem solved!
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here