Doomhammer
Bob Kotick - Gamers' corporate spoilsport No. 1
- Reaction score
- 67
As mentioned in a thread a few days ago, and as suggested by Mr. Zero,
I'd like to submit a snippet of code that can be helpful at times:
For some reason it can be useful to add the locust ability to units, to make them unselectable. But once locust is on, it can't be taken off again. To get the units back to normal nonetheless, they have to be replaced, and that's where my few lines set in:
as a further little annotation: the units have to be grouped before adding locust.
I'd like to submit a snippet of code that can be helpful at times:
For some reason it can be useful to add the locust ability to units, to make them unselectable. But once locust is on, it can't be taken off again. To get the units back to normal nonetheless, they have to be replaced, and that's where my few lines set in:
JASS:
function ReplaceUnit takes nothing returns nothing
local unit u=GetEnumUnit()
call CreateUnit(GetOwningPlayer(u), GetUnitTypeId(u), GetUnitX(u), GetUnitY(u), GetUnitFacing(u))
call RemoveUnit(u)
set u=null
endfunction
as a further little annotation: the units have to be grouped before adding locust.