make a jass triger able to affect air

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

projecttemp
Junior Member
Posts: 40
Joined: November 26th, 2007, 6:09 pm

make a jass triger able to affect air

Post by projecttemp »

ok so i found a spell, but i want it to affect EVERYTHING in the area, however currently it only affect ground units so how do i make it afeect "EVERYTHING"
Spoiler:
function Trig_XXX_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01B' ) ) then
return false
endif
return true
endfunction

function GetXXX takes integer level returns integer
if level == 1 then
return 'h004'
endif

if level == 2 then
return 'h004'
endif
return 0
endfunction

function CastAbility takes integer abil, integer level, string order, unit caster, unit target, location loc, real h returns nothing
call CreateNUnitsAtLoc(1,'h003', GetOwningPlayer(caster), loc,bj_UNIT_FACING)
call SetUnitPathing( GetLastCreatedUnit(), false )
call SetUnitPositionLoc( GetLastCreatedUnit(), loc )
if h > 40 then
call SetUnitFlyHeightBJ( GetLastCreatedUnit(), h, 10000.00 )
endif
call UnitAddAbilityBJ( abil, GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( abil, GetLastCreatedUnit(), level )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), order, target )
endfunction

function Trig_XXX_Func007002003001 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_GROUND) == true )
endfunction

function Trig_XXX_Func007002003002 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('Aloc', GetFilterUnit()) == 0 and GetUnitTypeId(GetFilterUnit()) != 'h004')
endfunction

function Trig_XXX_Func007002003 takes nothing returns boolean
return GetBooleanAnd( Trig_XXX_Func007002003001(), Trig_XXX_Func007002003002() )
endfunction

function Trig_XXX_Func008A takes nothing returns nothing
local location loc
local location loc1 = GetUnitLoc(GetEnumUnit())
//call UnitAddAbilityBJ( 'Aloc', GetEnumUnit() )
call SetUnitPathing( GetEnumUnit(), false )
//call SetUnitFlyHeightBJ( GetEnumUnit(), ( GetRandomReal(300.00, 400.00) - DistanceBetweenPoints(loc1, udg_temploc) ), 350.00 )
set loc = PolarProjectionBJ(loc1, ( DistanceBetweenPoints(loc1, udg_temploc) / 4.00 ), AngleBetweenPoints(loc1, udg_temploc))
call SetUnitPositionLoc( GetEnumUnit(), loc )
call PauseUnitBJ( true, GetEnumUnit() )
call SetUnitInvulnerable( GetEnumUnit(), true )
call SetUnitVertexColorBJ( GetEnumUnit(), 0.00, 60.00, 100, 0 )
call SetUnitTimeScalePercent( GetEnumUnit(), 0.00 )
call RemoveLocation(loc)
call RemoveLocation(loc1)
set loc1 = null
set loc = null
endfunction

function Trig_XXX_Func010A takes nothing returns nothing
//call UnitRemoveAbilityBJ( 'Aloc', GetEnumUnit() )
call PauseUnitBJ( false, GetEnumUnit() )
call SetUnitTimeScalePercent( GetEnumUnit(), 100.00 )
//call SetUnitFlyHeightBJ( GetEnumUnit(), 0.00, 600.00 )
call SetUnitPathing( GetEnumUnit(), true )
call SetUnitVertexColorBJ( GetEnumUnit(), 100.00, 100.00, 100, 0 )
call SetUnitInvulnerable( GetEnumUnit(), false )
endfunction

function Trig_XXX_SetAnimSpeed takes nothing returns nothing
call SetUnitTimeScalePercent( GetEnumUnit(), 0 )
call PauseUnitBJ( true, GetEnumUnit() )
call SetUnitPathing( GetEnumUnit(), false )
call SetUnitVertexColorBJ( GetEnumUnit(), 0.00, 60.00, 100, 0 )
call SetUnitInvulnerable( GetEnumUnit(), true )
endfunction

function Trig_XXX_Actions takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local unit u
local real i = 0
local unit array iceblocks
local group targets
local destructable d
local integer level = GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit())
call CreateNUnitsAtLoc( 1, 'h001', Player(PLAYER_NEUTRAL_PASSIVE), loc, GetRandomDirectionDeg() )
call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
call PolledWait( 1.00 )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 30
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_temploc = PolarProjectionBJ(loc, 960.00, ( 12.00 * I2R(GetForLoopIndexA()) ))
call CreateNUnitsAtLoc( 1, 'h002', Player(PLAYER_NEUTRAL_PASSIVE), udg_temploc , GetRandomDirectionDeg() )
set iceblocks[bj_forLoopAIndex] = GetLastCreatedUnit()
call SetUnitPathing( GetLastCreatedUnit(), false )
call SetUnitPositionLoc( GetLastCreatedUnit(), udg_temploc )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
call RemoveLocation(udg_temploc)
endloop
call CreateNUnitsAtLoc( 1, GetXXX(level), Player(PLAYER_NEUTRAL_PASSIVE), loc, GetRandomDirectionDeg() )
set u = GetLastCreatedUnit()
call SetUnitPathing( u, false )
call SetUnitPositionLoc( u, loc )

set targets = GetUnitsInRangeOfLocMatching(1120.00, loc, Condition(function Trig_XXX_Func007002003))
set udg_temploc = loc
call ForGroupBJ(targets, function Trig_XXX_Func008A )
call CastAbility('A011',1,"frostarmor",GetTriggerUnit(),u,loc,0)
loop
exitwhen ( IsUnitAliveBJ(u) == false )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))

call DestroyGroup(targets)
set targets = GetUnitsInRangeOfLocMatching(1000.00, loc, Condition(function Trig_XXX_Func007002003))
call ForGroupBJ(targets, function Trig_XXX_SetAnimSpeed)

endloop
call RemoveUnit(u)
call ForGroupBJ(targets, function Trig_XXX_Func010A )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 30
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call RemoveUnit(iceblocks[bj_forLoopAIndex])
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DestroyGroup(targets)
call RemoveLocation(loc)
set targets = null
set loc = null
endfunction

//===========================================================================
function InitTrig_XXX takes nothing returns nothing
set gg_trg_XXX = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_XXX, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_XXX, Condition( function Trig_XXX_Conditions ) )
call TriggerAddAction( gg_trg_XXX, function Trig_XXX_Actions )
endfunction
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: make a jass triger able to affect air

Post by Aero »

k
projecttemp wrote:ok so i found a spell, but i want it to affect EVERYTHING in the area, however currently it only affect ground units so how do i make it afeect "EVERYTHING"
Spoiler:
function Trig_XXX_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A01B' ) ) then
return false
endif
return true
endfunction

function GetXXX takes integer level returns integer
if level == 1 then
return 'h004'
endif

if level == 2 then
return 'h004'
endif
return 0
endfunction

function CastAbility takes integer abil, integer level, string order, unit caster, unit target, location loc, real h returns nothing
call CreateNUnitsAtLoc(1,'h003', GetOwningPlayer(caster), loc,bj_UNIT_FACING)
call SetUnitPathing( GetLastCreatedUnit(), false )
call SetUnitPositionLoc( GetLastCreatedUnit(), loc )
if h > 40 then
call SetUnitFlyHeightBJ( GetLastCreatedUnit(), h, 10000.00 )
endif
call UnitAddAbilityBJ( abil, GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( abil, GetLastCreatedUnit(), level )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
call IssueTargetOrderBJ( GetLastCreatedUnit(), order, target )
endfunction

function Trig_XXX_Func007002003002 takes nothing returns boolean
return ( GetUnitAbilityLevelSwapped('Aloc', GetFilterUnit()) == 0 and GetUnitTypeId(GetFilterUnit()) != 'h004')
endfunction

function Trig_XXX_Func008A takes nothing returns nothing
local location loc
local location loc1 = GetUnitLoc(GetEnumUnit())
//call UnitAddAbilityBJ( 'Aloc', GetEnumUnit() )
call SetUnitPathing( GetEnumUnit(), false )
//call SetUnitFlyHeightBJ( GetEnumUnit(), ( GetRandomReal(300.00, 400.00) - DistanceBetweenPoints(loc1, udg_temploc) ), 350.00 )
set loc = PolarProjectionBJ(loc1, ( DistanceBetweenPoints(loc1, udg_temploc) / 4.00 ), AngleBetweenPoints(loc1, udg_temploc))
call SetUnitPositionLoc( GetEnumUnit(), loc )
call PauseUnitBJ( true, GetEnumUnit() )
call SetUnitInvulnerable( GetEnumUnit(), true )
call SetUnitVertexColorBJ( GetEnumUnit(), 0.00, 60.00, 100, 0 )
call SetUnitTimeScalePercent( GetEnumUnit(), 0.00 )
call RemoveLocation(loc)
call RemoveLocation(loc1)
set loc1 = null
set loc = null
endfunction

function Trig_XXX_Func010A takes nothing returns nothing
//call UnitRemoveAbilityBJ( 'Aloc', GetEnumUnit() )
call PauseUnitBJ( false, GetEnumUnit() )
call SetUnitTimeScalePercent( GetEnumUnit(), 100.00 )
//call SetUnitFlyHeightBJ( GetEnumUnit(), 0.00, 600.00 )
call SetUnitPathing( GetEnumUnit(), true )
call SetUnitVertexColorBJ( GetEnumUnit(), 100.00, 100.00, 100, 0 )
call SetUnitInvulnerable( GetEnumUnit(), false )
endfunction

function Trig_XXX_SetAnimSpeed takes nothing returns nothing
call SetUnitTimeScalePercent( GetEnumUnit(), 0 )
call PauseUnitBJ( true, GetEnumUnit() )
call SetUnitPathing( GetEnumUnit(), false )
call SetUnitVertexColorBJ( GetEnumUnit(), 0.00, 60.00, 100, 0 )
call SetUnitInvulnerable( GetEnumUnit(), true )
endfunction

function Trig_XXX_Actions takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local unit u
local real i = 0
local unit array iceblocks
local group targets
local destructable d
local integer level = GetUnitAbilityLevelSwapped(GetSpellAbilityId(),GetTriggerUnit())
call CreateNUnitsAtLoc( 1, 'h001', Player(PLAYER_NEUTRAL_PASSIVE), loc, GetRandomDirectionDeg() )
call UnitApplyTimedLifeBJ( 5.00, 'BTLF', GetLastCreatedUnit() )
call PolledWait( 1.00 )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 30
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set udg_temploc = PolarProjectionBJ(loc, 960.00, ( 12.00 * I2R(GetForLoopIndexA()) ))
call CreateNUnitsAtLoc( 1, 'h002', Player(PLAYER_NEUTRAL_PASSIVE), udg_temploc , GetRandomDirectionDeg() )
set iceblocks[bj_forLoopAIndex] = GetLastCreatedUnit()
call SetUnitPathing( GetLastCreatedUnit(), false )
call SetUnitPositionLoc( GetLastCreatedUnit(), udg_temploc )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
call RemoveLocation(udg_temploc)
endloop
call CreateNUnitsAtLoc( 1, GetXXX(level), Player(PLAYER_NEUTRAL_PASSIVE), loc, GetRandomDirectionDeg() )
set u = GetLastCreatedUnit()
call SetUnitPathing( u, false )
call SetUnitPositionLoc( u, loc )

set targets = GetUnitsInRangeOfLocMatching(1120.00, loc, Condition(function Trig_XXX_Func007002003002))
set udg_temploc = loc
call ForGroupBJ(targets, function Trig_XXX_Func008A )
call CastAbility('A011',1,"frostarmor",GetTriggerUnit(),u,loc,0)
loop
exitwhen ( IsUnitAliveBJ(u) == false )
call TriggerSleepAction(RMaxBJ(bj_WAIT_FOR_COND_MIN_INTERVAL, 0.10))

call DestroyGroup(targets)
set targets = GetUnitsInRangeOfLocMatching(1000.00, loc, Condition(function Trig_XXX_Func007002003))
call ForGroupBJ(targets, function Trig_XXX_SetAnimSpeed)

endloop
call RemoveUnit(u)
call ForGroupBJ(targets, function Trig_XXX_Func010A )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 30
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call RemoveUnit(iceblocks[bj_forLoopAIndex])
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call DestroyGroup(targets)
call RemoveLocation(loc)
set targets = null
set loc = null
endfunction

//===========================================================================
function InitTrig_XXX takes nothing returns nothing
set gg_trg_XXX = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_XXX, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_XXX, Condition( function Trig_XXX_Conditions ) )
call TriggerAddAction( gg_trg_XXX, function Trig_XXX_Actions )
endfunction