• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Selections from possibilities

Status
Not open for further replies.
Level 4
Joined
Jul 25, 2014
Messages
57
So I´ve seen few maps, where you can choose from possibilities, for example one of footman maps, you can choose between random heroes and in manually selecting heroes, but not in chat, but like an option. But all of this maps that i found were protected , so i can´t watch, that how can i do this, so can anyone help in that?

I might explain something wrong, ask if you don´t understand something.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Do be aware that just because the dialog is hidden does not mean the buttons cannot be pressed. The UI will stop you double pressing however a hack could still allow the button to be pressed as many times as desired.

Proof of this is noticeable in multiplayer. If you hide a dialog after a player presses it (so it disappears off his screen) and before the button response event fires it will still fire even though in theory the dialog should be hidden at that point in time so no one should logically have been able to press it. This means that there is no deterministic check on if a dialog is visible for a player to press at the time a press response event is received. In theory a third party program could me made to inject fake button press commands to the host server and so allow a player to press any button at any time as much as he wants.

For this reason you need to add your own deterministic check. In the case of a hero selection dialog simply use a boolean array which maps to player slot number. Only respond to button press events if this boolean is false for the pressing player and always set the boolean true after responding to the button press.

Another approach is a transaction response to the button, so if it is pressed many times it undoes the previous presses. Eg if a player hits random hero and choose hero he gets which ever he pressed last and not both. This is harder to do and there may still possibly be exploitable results.
 
Level 15
Joined
Aug 7, 2013
Messages
1,338
In theory a third party program could me made to inject fake button press commands to the host server and so allow a player to press any button at any time as much as he wants.

Wow I didn't know about this hack.

Very interesting.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Wow I didn't know about this hack.

Very interesting.
No one bothered making one since it obviously cannot be used in Melee or DotA Allstars as they lack major control dialog elements. However the reality is it does exist so you should script with it in mind.

SC2 Dialogs suffer the exact same problem except in their case it can be abused without any modifications since there is no automatic hide in response to a press like WC3 dialogs. In both cases it is the result of a failure to test if a button could have been pressed before firing a button event. In SC2 the test is as simple as checking if the dialog is visible for the player and the button is visible and the button is enabled (for some reason it does keep track of dialog visibility as deterministic state, just it never validates it). In WC3 using boolean globals to keep track of intended visibility works.
 
Status
Not open for further replies.
Top