Dota-2 – How to Bind a Key for Multiple Units to Use Same Spell

dota-2

Is there a way for me to bind a key that will allow multiple units in my control group to all use the same spell at once?

For example, if I have 3 centaurs as chen, and I have them all selected. Can I press one key to make them all warstomp at the same time?

Or if I have 3 familiars as Visage. When I have all three selected, is there a button I can press to have them all stun at the same time?

Best Answer

I built a few variants of your desired script:

Preamble:

alias "Qdefault" "dota_ability_execute 0"

I did this because it is more readable for me. If you don't want to use that alias you need to change Qdefault below to dota_ability_execute 0 !

Hero + 3 units in 1 group:

Assumes that you selected your hero + units (in this case 3x familiars) and switches to the first, casts a spell and switches to the next until it reaches to the hero again.

alias "heroAndUnits" "dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected;"

Unit selected

Like the first but starts at the first familiar

alias "unitSelected" "Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected;"

Only units

Group of units only

alias "unitsOnly" "Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected;"

Manually

This script switches to the next unit and uses a spell. This enables you to time your stuns (chainstun) the enemy.

alias "manually" "dota_cycle_selected; Qdefault"

Final binding

You need to bind any of those aliases (you can have them all in your exec file, aliases wont be executed if not used/binded!)

bind "B" "heroAndUnits"

Afterword:

Those scripts (execpt "manually") assume that the group consist of 3 units. I did not find a way to count the units of a group. Otherwise i may be able to adjust that script a bit.

Extra:

Additionally i wrote a script that lets you cycle through a script from above (in this case heroAndUnits1-4) depending on your unitcount! Feel free to ask me about it since this is pretty advanced.

alias "heroAndUnits1" "dota_cycle_selected; Qdefault; dota_cycle_selected"
alias "heroAndUnits2" "dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected"
alias "heroAndUnits3" "dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected;"
alias "heroAndUnits4" "dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected; Qdefault; dota_cycle_selected;"

alias groupSpellToggle "oneUnit" 
alias oneUnit "bind B heroAndUnits1; say_team "Script for 1 unit selected";  alias groupSpellToggle twoUnit" 
alias twoUnit "bind B heroAndUnits2; say_team "Script for 2 units selected"; alias groupSpellToggle threeUnit"
alias threeUnit "bind B heroAndUnits3; say_team "Script for 3 units selected"; alias groupSpellToggle fourUnit"
alias fourUnit "bind B heroAndUnits4; say_team "Script for 4 units selected"; alias groupSpellToggle oneUnit"

bind "N" groupSpellToggle

Pressing N in this case cycles through heroAndUnits1-4 and then back to 1. Each cycle rebinds "B" (you can change this if you want) to execute the groupspell.

To realize which number is currently active as a user i added a say_team which is a normal ingame-chat to your teammates.