- Joined
- Feb 3, 2009
- Messages
- 3,292
Hello, i'm trying to make a spell in JASS. It works almost perfectly...
The spell is based of Haunt from Spectre in Dota. Here is the problem:
It works perfectly exept that 3 or 2 illusions always stay by caster, and the others do the job the way they should...
The JASS trigger:
The map (if you can fix, fix in the map and post please):
EDIT: Ahh ffs it doesn't let me upload, gues i'll need the trigger in JASS tags then and i'll copy paste...
The spell is based of Haunt from Spectre in Dota. Here is the problem:
It works perfectly exept that 3 or 2 illusions always stay by caster, and the others do the job the way they should...
The JASS trigger:
JASS:
globals
unit x
unit illusion
group done
endglobals
function SpectralKill takes nothing returns nothing
call RemoveUnit(GetEnumUnit())
endfunction
function Group2E takes nothing returns boolean
return ( IsUnitIllusionBJ(GetFilterUnit()) == true )
endfunction
function Group2D takes nothing returns boolean
return ( GetUnitTypeId(GetFilterUnit()) == 'E000' )
endfunction
function Group2A takes nothing returns boolean
return GetBooleanAnd( Group2E (), Group2D ())
endfunction
function Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A006' ) ) then
return false
endif
return true
endfunction
function Group1A takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(x)) == true )
endfunction
function Group1B takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_HERO) == true)
endfunction
function Group1 takes nothing returns boolean
return GetBooleanAnd( Group1A (), Group1B () )
endfunction
function Actions takes nothing returns nothing
local group illusions
local group heroes
local integer count
local unit dummy
local unit y
local real yx
local real yy
set x = GetTriggerUnit()
set heroes = GetUnitsInRectMatching(GetEntireMapRect(), Condition(function Group1))
set count = CountUnitsInGroup(heroes)
loop
exitwhen count <= 0
call TriggerSleepAction(0.01)
set dummy = CreateUnitAtLoc( GetOwningPlayer(x), 'h001' , GetRectCenter(GetPlayableMapRect()), 0.00 )
call IssueTargetOrderById(dummy, 852274, x)
call UnitApplyTimedLifeBJ( 5.00, 'BTLF', dummy )
set dummy = null
set count = count - 1
endloop
call TriggerSleepAction(0.01)
set illusions = GetUnitsInRectMatching(GetEntireMapRect(), Condition(function Group2A))
set count = CountUnitsInGroup(heroes)
loop
exitwhen count <= 0
call TriggerSleepAction(0.01)
set y = FirstOfGroup(heroes)
set illusion = FirstOfGroup(illusions)
set yx = GetUnitX(y)
set yy = GetUnitY(y)
call SetUnitPosition(illusion, yx, yy)
call IssueTargetOrderBJ( illusion, "attack", y )
call UnitApplyTimedLifeBJ( 5.00, 'BTLF', illusion )
call GroupRemoveUnit(heroes, y)
call GroupRemoveUnit(illusions, illusion)
set y = null
set dummy = null
set count = count - 1
endloop
set y = null
set x = null
set dummy = null
call DestroyGroup (illusions)
call DestroyGroup (heroes)
call DestroyGroup (done)
endfunction
//===========================================================================
function InitTrig_Haunt takes nothing returns nothing
local trigger Haunt = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Haunt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Haunt, Condition(function Conditions ) )
call TriggerAddAction( Haunt, function Actions )
endfunction
The map (if you can fix, fix in the map and post please):
EDIT: Ahh ffs it doesn't let me upload, gues i'll need the trigger in JASS tags then and i'll copy paste...
Last edited: