Bind a key for multiple units to use the same spell

Solution 1:

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.