Im trying to setup a RPG map where a player presses the button corresponding to the hero they want to choose, this action brings up an information window about the hero. If they choose another one, another window pops up and brings up information on that hero.
My problem is, is that when I click on one hero to bring up the information, then I click on another one, the old window stays up and the new one goes over it.
If you want to destroy it, you can set the dialog created to a variable then destroy it after. Then re-save your new dialog to the same variable and display it.
Hide the first one, show the new one. Here's a snippet of my dialog management, with some instructions on what you should do. It may be a little advanced, sorry for that, and it's also just a incomplete copy paste, but hopefully it's enough to give you a general idea on how to manage it.
Track your dialogs inside variables along with all the buttons.
When map initializes, create your dialog items and set them into variables, (one for the dialog itself, and another (ideally an array) for your buttons.
Example:
Variable - Set x = -150
--- Make Dialog then put it in "Hero" dialog variable
Dialog - Create a Modal dialog of size (500, 700) at (0, 0) relative to Center of screen
Variable - Set Hero Dialog = (Last created dialog)
Dialog - Create a Button for dialog Hero Dialog
Dialog - Move (Last created dialog item) to (0, x) relative to Center of dialog for (All players)
Dialog - Set (Last created dialog item) size to (325, 50) for (All players)
Dialog - Set (Last created dialog item) text to "Odin (Tank)" for (All players)
Dialog - Set (Last created dialog item) tooltip to "Normal - +0% HP" for (All players)
Variable - Set x = (x + 50)
Variable - Set HeroType[0] = Hero - Odin
--- put Btn in "Hero" Btn array variable
Variable - Set HeroBtn[0] = (Last created dialog item)
Dialog - Create a Button for dialog Hero Dialog
Dialog - Move (Last created dialog item) to (0, x) relative to Center of dialog for (All players)
Dialog - Set (Last created dialog item) size to (325, 50) for (All players)
Dialog - Set (Last created dialog item) text to "Nova (Ranged)" for (All players)
Dialog - Set (Last created dialog item) tooltip to "Easy - -15% HP" for (All players)
Variable - Set x = (x + 50)
Variable - Set HeroType[1] = Hero - Nova
Variable - Set HeroBtn[1] = (Last created dialog item)
Then, Use this event:
Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
To track back what was pressed and what to do with it. Use these actions:
Dialog - Show <DialogVar> for (Player group((Triggering player)))
Dialog - Hide <DialogVar> for (Player group((Triggering player)))
Example of button management (with an event triggered with the dialog item is used):
General - For each integer x from 0 to 9 with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Used dialog item) == HeroBtn[x]
Then
------- Create hero if it's unique, otherwise error user to pick another.
General - For each integer y from 1 to 13 with increment 1, do (Actions)
Actions
------- Find out if hero is picked
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of xHero[y]) == HeroType[x]
Then
Variable - Set HeroExists = true
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
HeroExists == true
Then
UI - Display ((Name of player y) + " already picked this hero, choose a...") for (Player group((Triggering player))) to Subtitle area
Else
UI - Display ((Name of player (Triggering player)) + (" chose " + (Text of (Used dialog item) for (Triggering player)))) for (All players) to Subtitle area
------ Hide Dialog for player
Dialog - Hide Hero Dialog for (Player group((Triggering player)))
Unit - Create 1 HeroType[x] for player (Triggering player) at (Random point in HeroEntry) facing 180.0 degrees (No Options)
Variable - Set xHero[(Triggering player)] = (Last created unit)
Camera - Pan the camera for player (Triggering player) to (Position of (Last created unit)) over 0.0 seconds with Existing Velocity% initial velocity, 0% deceleration, and Do Not use smart panning
Unit Selection - Add (Last created unit) to control group 1 for player (Triggering player)
Unit Selection - Select (Last created unit) for player (Triggering player)
I didnt do anything advanced or anything for my fix. I just created another trigger to run when a dialog item was clicked to hide the dialogs in a certain array. Now I need to figure out how to make a portrait appear over the dialog box :P
Anyone know how to fix that? I dont really want to make another topic.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey all,
Im trying to setup a RPG map where a player presses the button corresponding to the hero they want to choose, this action brings up an information window about the hero. If they choose another one, another window pops up and brings up information on that hero.
My problem is, is that when I click on one hero to bring up the information, then I click on another one, the old window stays up and the new one goes over it.
Is there anyway to fix this?
Thanks!
Hide the first one, show the new one. Here's a snippet of my dialog management, with some instructions on what you should do. It may be a little advanced, sorry for that, and it's also just a incomplete copy paste, but hopefully it's enough to give you a general idea on how to manage it.
Track your dialogs inside variables along with all the buttons.
When map initializes, create your dialog items and set them into variables, (one for the dialog itself, and another (ideally an array) for your buttons.
Example:
Variable - Set x = -150
--- Make Dialog then put it in "Hero" dialog variable
Dialog - Create a Modal dialog of size (500, 700) at (0, 0) relative to Center of screen
Variable - Set Hero Dialog = (Last created dialog)
Dialog - Create a Button for dialog Hero Dialog
Dialog - Move (Last created dialog item) to (0, x) relative to Center of dialog for (All players)
Dialog - Set (Last created dialog item) size to (325, 50) for (All players)
Dialog - Set (Last created dialog item) text to "Odin (Tank)" for (All players)
Dialog - Set (Last created dialog item) tooltip to "Normal - +0% HP" for (All players)
Variable - Set x = (x + 50)
Variable - Set HeroType[0] = Hero - Odin
--- put Btn in "Hero" Btn array variable
Variable - Set HeroBtn[0] = (Last created dialog item)
Dialog - Create a Button for dialog Hero Dialog
Dialog - Move (Last created dialog item) to (0, x) relative to Center of dialog for (All players)
Dialog - Set (Last created dialog item) size to (325, 50) for (All players)
Dialog - Set (Last created dialog item) text to "Nova (Ranged)" for (All players)
Dialog - Set (Last created dialog item) tooltip to "Easy - -15% HP" for (All players)
Variable - Set x = (x + 50)
Variable - Set HeroType[1] = Hero - Nova
Variable - Set HeroBtn[1] = (Last created dialog item)
Then, Use this event:
Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
To track back what was pressed and what to do with it. Use these actions:
Dialog - Show <DialogVar> for (Player group((Triggering player)))
Dialog - Hide <DialogVar> for (Player group((Triggering player)))
Example of button management (with an event triggered with the dialog item is used):
General - For each integer x from 0 to 9 with increment 1, do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Used dialog item) == HeroBtn[x]
Then
------- Create hero if it's unique, otherwise error user to pick another.
General - For each integer y from 1 to 13 with increment 1, do (Actions)
Actions
------- Find out if hero is picked
General - If (Conditions) then do (Actions) else do (Actions)
If
(Unit type of xHero[y]) == HeroType[x]
Then
Variable - Set HeroExists = true
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
HeroExists == true
Then
UI - Display ((Name of player y) + " already picked this hero, choose a...") for (Player group((Triggering player))) to Subtitle area
Else
UI - Display ((Name of player (Triggering player)) + (" chose " + (Text of (Used dialog item) for (Triggering player)))) for (All players) to Subtitle area
------ Hide Dialog for player
Dialog - Hide Hero Dialog for (Player group((Triggering player)))
Unit - Create 1 HeroType[x] for player (Triggering player) at (Random point in HeroEntry) facing 180.0 degrees (No Options)
Variable - Set xHero[(Triggering player)] = (Last created unit)
Camera - Pan the camera for player (Triggering player) to (Position of (Last created unit)) over 0.0 seconds with Existing Velocity% initial velocity, 0% deceleration, and Do Not use smart panning
Unit Selection - Add (Last created unit) to control group 1 for player (Triggering player)
Unit Selection - Select (Last created unit) for player (Triggering player)
Thanks for the replies!
I didnt do anything advanced or anything for my fix. I just created another trigger to run when a dialog item was clicked to hide the dialogs in a certain array. Now I need to figure out how to make a portrait appear over the dialog box :P
Anyone know how to fix that? I dont really want to make another topic.