[Snippet] AutoFly

TriggerHappy

Spell Moderator
Level 37
Joined
Jun 23, 2007
Messages
4,027
I thought Azlier had posted his script here, but I guess not (I know Nestharus had a version at one point).

This basically removes the overhead of adding crow form to units before applying a custom fly-height.

Requires UnitDex.

JASS:
library AutoFly initializer onInit requires UnitDex
/***************************************************************
*
*   v1.0, by TriggerHappy
*   ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
*   AutoFly adds & removes crow of upon any unit entering the map. This
*   allows modifying of the units height without having to do it manually.
*
*   Credits go to azlier for the orginal idea.
*
****************************************************************/

    globals
        private constant integer CROW_FORM = 'Amrf'
    endglobals
    
    private function AddFly takes nothing returns boolean
        return UnitAddAbility(GetIndexedUnit(), CROW_FORM) and UnitRemoveAbility(GetIndexedUnit(), CROW_FORM)
    endfunction
    
    private function onInit takes nothing returns nothing
        call RegisterUnitIndexEvent(Filter(function AddFly), EVENT_UNIT_INDEX)
    endfunction

endlibrary
 
Last edited:
Top