I have a dialog containing a Race's research. When a research is clicked, it checks if the triggering player has enough resources, subtracts the resources, applies the upgrade, hides the old button, then shows the next upgrade button.
For example, if I select Air Armor L1 (seen below) it would charge me the resources, give me the upgrade, then show a button for Air Armor L2.
This works perfectly in a local game.
However, on Bnet there is some lag in between clicking on the research button and receiving the upgrade. Meaning, if you double click quickly, you will be charged double, since the button didnt have time to hide!
Have you tried saving buttons state in global variable, for example have a global boolean which turns true when you press button. (and checking that boolean before subtracting cost/running trigger)
click research
check if boolean "halt" = false
set halt = true
do the research upgrade
wait 1 game sec
set halt = false.
however I didn't like having to use a Wait command.
Initially I thought Ahli's visibility suggestion was perfect; just add into the conditions "used dialog item is visible for (trig player) == true", but it was throwing a trigger error "couln't find property."
Turns out that although buttons are by default visible, they aren't defined as visible, so I had to put somewhere earlier "show ProtossResearch[x] for all players"
Another suggestion: use Timers as cooldowns when buttons are clicked and in the trigger attached to the button, add a Condition to ensure the Timer has expired.
I had a very similar issue to this in one of my triggers. i just made it so the first thing the trigger does is hide the button. it works fine for me like that but haven't had any real issues with lag so i guess it still may be possible to charge twice. an other possible option would be the trigger stop option but i don't know how your trigger is intended so that could cause problems.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I have a dialog containing a Race's research. When a research is clicked, it checks if the triggering player has enough resources, subtracts the resources, applies the upgrade, hides the old button, then shows the next upgrade button.
For example, if I select Air Armor L1 (seen below) it would charge me the resources, give me the upgrade, then show a button for Air Armor L2.
This works perfectly in a local game.
However, on Bnet there is some lag in between clicking on the research button and receiving the upgrade. Meaning, if you double click quickly, you will be charged double, since the button didnt have time to hide!
Any ideas on how to solve this?
Unverify a condition.
-> Add something of these:
visibility, check if it still exists, check if upgrade was already given to the player, etc...
@Ahli634:
Doesn't work. Maybe it's just an inherent problem of latency?
Have you tried saving buttons state in global variable, for example have a global boolean which turns true when you press button. (and checking that boolean before subtracting cost/running trigger)
Ok turns out both of your suggestions worked.
I got the boolean working,
click research
check if boolean "halt" = false
set halt = true
do the research upgrade
wait 1 game sec
set halt = false.
however I didn't like having to use a Wait command.
Initially I thought Ahli's visibility suggestion was perfect; just add into the conditions "used dialog item is visible for (trig player) == true", but it was throwing a trigger error "couln't find property."
Turns out that although buttons are by default visible, they aren't defined as visible, so I had to put somewhere earlier "show ProtossResearch[x] for all players"
Now it works, thanks guys
Another suggestion: use Timers as cooldowns when buttons are clicked and in the trigger attached to the button, add a Condition to ensure the Timer has expired.
I had a very similar issue to this in one of my triggers. i just made it so the first thing the trigger does is hide the button. it works fine for me like that but haven't had any real issues with lag so i guess it still may be possible to charge twice. an other possible option would be the trigger stop option but i don't know how your trigger is intended so that could cause problems.