Hi, im new to vJass and i got some problems
I wanna do an ability, that gives nearby enemies a 100% miss chance for a certain time. for that, i want to create a dummy that casts the curse ability on all enemies in range.
I encountered some problems:
1. "TriggerRegisterAnyUnitEventBJ" how do i create that without the bj, because the TriggerRegisterPlayerUnitEvent works only for 1 selected player (maybe with a loop?)
2. The dummy unit wont cast curse on enemies
3.
i would need to also check the IsUnitHostile function, how do i connect them with "AND"?
4. Any other improvements?
thanks
I wanna do an ability, that gives nearby enemies a 100% miss chance for a certain time. for that, i want to create a dummy that casts the curse ability on all enemies in range.
JASS:
function Trig_Sand_Pulse_Conditions takes nothing returns boolean
if ( GetSpellAbilityId() == 'A019' ) then
return true
endif
return false
endfunction
function IsUnitAlive takes nothing returns boolean
return GetWidgetLife(GetFilterUnit()) > 0.405
endfunction
function IsUnitHostile takes nothing returns boolean
return (IsUnitEnemy(GetFilterUnit(), GetFilterPlayer()) == true)
endfunction
function UseAbility takes nothing returns nothing
call IssueTargetOrder(bj_lastCreatedUnit, "curse", GetEnumUnit())
endfunction
function Trig_Sand_Pulse_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local location l = GetUnitLoc(u)
local group g = CreateGroup()
call CreateUnitAtLoc(p, 'h00B', l, 0)
call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 1.00)
call GroupEnumUnitsInRange(g, 0, 0, 325.00, Filter(function IsUnitAlive))
call ForGroup(g, function UseAbility)
set u = null
set p = null
set l = null
set g = null
endfunction
//===========================================================================
function InitTrig_Sand_Pulse takes nothing returns nothing
set gg_trg_Sand_Pulse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Sand_Pulse, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Sand_Pulse, Condition( function Trig_Sand_Pulse_Conditions ) )
call TriggerAddAction( gg_trg_Sand_Pulse, function Trig_Sand_Pulse_Actions )
endfunction
I encountered some problems:
1. "TriggerRegisterAnyUnitEventBJ" how do i create that without the bj, because the TriggerRegisterPlayerUnitEvent works only for 1 selected player (maybe with a loop?)
2. The dummy unit wont cast curse on enemies
3.
JASS:
call GroupEnumUnitsInRange(g, 0, 0, 325.00, Filter(function IsUnitAlive))
4. Any other improvements?
thanks