I am working on a map which will be very dialog button heavy. I have a "Any Dialog Item is used by Any Player" trigger with a Switch statement inside to determine which button was pressed (out of all the dialog buttons) and take appropriate action. Immediately within the Switch statement is an action to disable the pressed dialog button for the triggering player. My problem is that somehow a player can spam the mouse to press the dialog button multiple times before it can be disabled causing the actions that should only run once to run multiple times. I have tried putting a "Disable (current trigger)" at the start and a "Enable (current trigger)" at the end, but this has done nothing. Any suggestions??
Example:
Global Variable:
X= Button X Pressed = 0 <Integer [15]>
<<Set this to an array of 15, for 15 players on your map>>
Trigger: Dialog Button Pressed
Event: Any Dialog Item is used by Any Player
Condition: Button X Pressed[(Triggering Player)] == 0
Action:
Set variable Button X Pressed[(Triggering Player)] = 1
<<your actions>>
Wait x Game Time seconds
Set variable Button X Pressed[(Triggering Player)] = 0
I wouldn't rely on disabling the button as a means to stop a player from pressing it, instead I would do as redconfusion notes and create a "flag" to disable the action once triggered if you don't want it repeatable.
Can you show me how you implemented this procedure into multiple buttons using multiple variables? I can't seem to be able to get this to work - only in the example provided in this thread, yes - but I can't seem to be able to disable each button seperately.
What I do is:
I create my buttons:
Dialog - Display button MDG_Selection_01_Player_01 of size (250, 60) with text "4 Hydralisk + 3 Roach" at Top Left of screen with offset (50, 140) (run No Trigger when button is clicked)
Dialog - Display button MDG_Selection_02_Player_01 of size (250, 60) with text "4 Marauder + 6 Marine" at Top Left of screen with offset (50, 210) (run No Trigger when button is clicked)
Dialog - Display button MDG_Selection_03_Player_01 of size (250, 60) with text "1 Immortal + 4 Stalker + 1 Sentry" at Top Left of screen with offset (50, 280) (run No Trigger when button is clicked)
The variables:
MDG_Selection_01_Player_01 = 17 <Integer>
MDG_Selection_02_Player_01 = 18 <Integer>
MDG_Selection_03_Player_01 = 19 <Integer>
As you can see, I am using the initial value to identify my button. But now when I try to implement the suggestion above:
Events
Dialog - (Screen button 17) is used by Player Any Player with event type Clicked
Conditions
MDG_Selection_01_Player_01 == 0
Actions
Variable - Set MDG_Selection_01_Player_01 = 1
TRIGGERSTUFF
General - Wait 1.0 Game Time seconds
Variable - Set MDG_Selection_01_Player_01 = 0
the game treats every pressed button the same and runs my trigger. I am not very good with variables, can you tell me what I am doing wrong?
you can't do it client side.
everything in starcraft is server side. you will never be able to stop people spamming a button before battle.net realises they've pressed it the first time.
Well, that's not entirely correct. Redconfusions example does work (see third post). The trigger he creates in this example only fires its actions once, I tried it with a test message, no matter how often you spam the button (until it is reset ofc).
Problem is I don't understand how to implement this in my setup using different buttons. My buttons call a trigger - and that is the problem I suppose, because there needs to be a trigger that checks if a specific button is pressed using variables (my problem) - and then fires the trigger (the trigger that does what you want the button to do) while the variable has disabled the button itself.
I am working on a map which will be very dialog button heavy. I have a "Any Dialog Item is used by Any Player" trigger with a Switch statement inside to determine which button was pressed (out of all the dialog buttons) and take appropriate action. Immediately within the Switch statement is an action to disable the pressed dialog button for the triggering player. My problem is that somehow a player can spam the mouse to press the dialog button multiple times before it can be disabled causing the actions that should only run once to run multiple times. I have tried putting a "Disable (current trigger)" at the start and a "Enable (current trigger)" at the end, but this has done nothing. Any suggestions??
@HuntGather98: Go
bump plz
Variable probably the best way to handle this.
Example:
Global Variable:
X= Button X Pressed = 0 <Integer [15]>
<<Set this to an array of 15, for 15 players on your map>>
Trigger: Dialog Button Pressed
Event: Any Dialog Item is used by Any Player
Condition: Button X Pressed[(Triggering Player)] == 0
Action:
Set variable Button X Pressed[(Triggering Player)] = 1
<<your actions>>
Wait x Game Time seconds
Set variable Button X Pressed[(Triggering Player)] = 0
I wouldn't rely on disabling the button as a means to stop a player from pressing it, instead I would do as redconfusion notes and create a "flag" to disable the action once triggered if you don't want it repeatable.
buttons are a bit laggy, use variables, and pls booleans instead of integers :)
Thanks everyone. It worked but I'm gonna have to create a variable for each button I have, about 20 of them, but it will work.
Can you show me how you implemented this procedure into multiple buttons using multiple variables? I can't seem to be able to get this to work - only in the example provided in this thread, yes - but I can't seem to be able to disable each button seperately.
What I do is:
I create my buttons: Dialog - Display button MDG_Selection_01_Player_01 of size (250, 60) with text "4 Hydralisk + 3 Roach" at Top Left of screen with offset (50, 140) (run No Trigger when button is clicked)
Dialog - Display button MDG_Selection_02_Player_01 of size (250, 60) with text "4 Marauder + 6 Marine" at Top Left of screen with offset (50, 210) (run No Trigger when button is clicked)
Dialog - Display button MDG_Selection_03_Player_01 of size (250, 60) with text "1 Immortal + 4 Stalker + 1 Sentry" at Top Left of screen with offset (50, 280) (run No Trigger when button is clicked)
The variables: MDG_Selection_01_Player_01 = 17 <Integer>
MDG_Selection_02_Player_01 = 18 <Integer>
MDG_Selection_03_Player_01 = 19 <Integer>
As you can see, I am using the initial value to identify my button. But now when I try to implement the suggestion above:
Events
Dialog - (Screen button 17) is used by Player Any Player with event type Clicked
Conditions
MDG_Selection_01_Player_01 == 0
Actions
Variable - Set MDG_Selection_01_Player_01 = 1
TRIGGERSTUFF
General - Wait 1.0 Game Time seconds
Variable - Set MDG_Selection_01_Player_01 = 0
the game treats every pressed button the same and runs my trigger. I am not very good with variables, can you tell me what I am doing wrong?
If the first solution worked just do:
Event: A button is pressed
Condition: AButtonIsPressed[Player] == false
Action: AButtonIsPressed[Player] = true
stuff
AButtonIsPressed[Player = false
@ubermikeleet: Go
Hmm, I am trying this now - it's a global trigger that should prevent any button from being spammed:
Events
Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
Conditions
Button pressed[0] == 0
Actions
Variable - Set Button pressed[0] = 1
Dialog - Disable (Used dialog item) for (All players)
UI - Display "button pressed" for (All players) to Subtitle area
General - Wait 1.0 Game Time seconds
Dialog - Enable (Used dialog item) for (All players)
Variable - Set Button pressed[0] = 0
But I am unsure if this will be rendered useless once published because of the battle.net lag... gotta try it first.
Nope, doesn't work... as soon as it's live on battle.net the buttons are so laggy, i can even press them thrice. Totally out of ideas.
@Namsom: Go
you can't do it client side. everything in starcraft is server side. you will never be able to stop people spamming a button before battle.net realises they've pressed it the first time.
@maverck: Go
Well, that's not entirely correct. Redconfusions example does work (see third post). The trigger he creates in this example only fires its actions once, I tried it with a test message, no matter how often you spam the button (until it is reset ofc).
Problem is I don't understand how to implement this in my setup using different buttons. My buttons call a trigger - and that is the problem I suppose, because there needs to be a trigger that checks if a specific button is pressed using variables (my problem) - and then fires the trigger (the trigger that does what you want the button to do) while the variable has disabled the button itself.