DestroyAllEnemyUnits help

Started by DeSangre, October 11, 2017, 02:05:44 AM

Previous topic - Next topic

DeSangre

Hello guys,
I want DestroyAllEnemyUnits to trigger when the unit in which this script is running gets destroyed.

Currently it's not working, although GetCellOccupiedCount  worked for me in other examples.
Anything I'm missing? :)

CurrentCoords GetCellOccupiedCount 1 lt if
once
DestroyAllEnemyUnits(0)
endonce
endif

GoodMorning

Well, the short answer is that after the unit is destroyed, the script is not run.

Fortunately, there's a function for exactly this:

When a unit is destroyed, it runs any :destroyed functions in attached scripts.

You will want:


:destroyed
    0 DestroyAllEnemyUnits
A narrative is a lightly-marked path to another reality.

DeSangre

Thanks GoodMorning, I'm so dumb lol! :(