Azlier
Old World Ghost
- Reaction score
- 461
This simple, efficient script makes it so that [lJASS]SetUnitFlyHeight[/lJASS] automatically works on the units in your map. It should be more efficient than adding and removing Crow Form each time a spell is cast.
AIDS version. Credit goes to kenny!.
Non-vJass version.
JASS:
// AutoFly - by Azlier
// Requires a vJass preprocessor
// How to import:
// 1. Create a new trigger called AutoFly.
// 2. Convert the trigger to custom script, and replace all the code inside with this.
library_once AutoFly
private function Actions takes nothing returns boolean
return UnitAddAbility(GetFilterUnit(), 039;Amrf039;) and UnitRemoveAbility(GetFilterUnit(), 039;Amrf039;)
endfunction
private struct Hack extends array
static method onInit takes nothing returns nothing
local region r = CreateRegion()
local rect re = GetWorldBounds()
local group g = CreateGroup()
local integer i = 15
call RegionAddRect(r, re)
call TriggerRegisterEnterRegion(CreateTrigger(), r, Filter(function Actions))
call RemoveRect(re)
set re = null
loop
call GroupEnumUnitsOfPlayer(g, Player(i), Filter(function Actions))
exitwhen i == 0
set i = i - 1
endloop
call DestroyGroup(g)
set g = null
endmethod
endstruct
endlibrary
AIDS version. Credit goes to kenny!.
JASS:
// AutoFly - by Azlier, AIDS version by Jesus4Lyf
// Requires a vJass preprocessor, AIDS
// How to import:
// 1. Create a new trigger called AutoFly.
// 2. Convert the trigger to custom script, and replace all the code inside with this.
// 3. Import AIDS if it is not in your map already.
library AutoFly requires AIDS
private struct Hack extends array
private static method AIDS_filter takes unit u returns boolean
return UnitAddAbility(u, 039;Amrf039;) and UnitRemoveAbility(u, 039;Amrf039;)
endmethod
//! runtextmacro AIDS()
endstruct
endlibrary
Non-vJass version.
JASS:
// AutoFly - by Azlier
// How to import:
// 1. Create a new trigger called AutoFly.
// 2. Convert the trigger to custom script, and replace all the code inside with this.
function AutoFly__Actions takes nothing returns boolean
return UnitAddAbility(GetFilterUnit(), 039;Amrf039;) and UnitRemoveAbility(GetFilterUnit(), 039;Amrf039;)
endfunction
function InitTrig_AutoFly takes nothing returns nothing
local region r = CreateRegion()
local rect re = GetWorldBounds()
local group g = CreateGroup()
local integer i = 15
call RegionAddRect(r, re)
call TriggerRegisterEnterRegion(CreateTrigger(), r, Filter(function AutoFly__Actions))
call RemoveRect(re)
set re = null
loop
call GroupEnumUnitsOfPlayer(g, Player(i), Filter(function AutoFly__Actions))
exitwhen i == 0
set i = i - 1
endloop
call DestroyGroup(g)
set g = null
endfunction