Troll-Brain
You can change this now in User CP.
- Reaction score
- 85
JASS:
library SetUnitSelection initializer init
// save your map, leave it, reopen it and then comment the line below
//! external ObjectMerger w3a AOre Ires anam "Dummy Instant Ressurect Ability" achd 0 Ore1 1 0 aeat "" aher 0 aeff 1 ""
function SetUnitSelection takes unit u , boolean leftButtonOfMouse , boolean dragSelection returns boolean
if not leftButtonOfMouse and not dragSelection then
call UnitAddAbility(u,039;Aloc039;)
if UnitRemoveAbility(u,039;Aloc039;) then
call SetUnitPathing(u,true) // or the unit doesn't follow anymore theses pathing rules (can go trought any terrain)
return true
endif
return false
elseif not leftButtonOfMouse and dragSelection then
call UnitAddAbility(u,039;Aloc039;)
if UnitRemoveAbility(u,039;Aloc039;) then
call ShowUnit(u,false)
call ShowUnit(u,true)
return true
endif
return false
elseif leftButtonOfMouse and not dragSelection then
// I can't figure a way yet.
// It can be done if you deactivate the drag selection for the players.
// But it will affect all units ofc.
return false
elseif leftButtonOfMouse and dragSelection then
// A morph ability , hide/unhide the unit doesn't seems to help here.
// I've found only one way, kill and ressurect the unit.
// An unit which has never get the ability 'Aloc', is already totally selectable.
// This stuff is for units which had already get the ability 'Aloc'.
// Even if the unit hasn't it anymore you must do that, or the unit won't be
// selectable with the left boutton of the mouse.
call UnitAddAbility(u,039;Ires039;)
call KillUnit(u)
if UnitRemoveAbility(u,039;Ires039;) then // yes this ability is damn instant <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite9" alt=":eek:" title="Eek! :eek:" loading="lazy" data-shortname=":eek:" />
return true
endif
endif
return false
endfunction
private function init takes nothing returns nothing
endfunction
endlibrary
First, it is not finished, i know it can fail if you hide/unhide units.
I would need to keep the track of units and create a custom ShowUnit function, and use a remove detection for avoid leaks, but i will do it after, that's not a problem.
I just want some feedbacks and if you know some better ways.