Ayanami
칼리
- Reaction score
- 288
Well, I saw the post by saw792 and read J4L's Tutorial on unit groups. And I decided to use that. However, I noticed that by using 1 dummy, not all units are put to sleep. Sometimes only one unit is affected, and sometimes, only a few. My dummy unit has 0.00 casting time, etc. My dummy sleep spell has no casting time and should be instant. Anything wrong here?
JASS:
library MassSleep initializer InitTrig
globals
private constant integer BMS_ID = 039;ABMS039;
private constant integer MS1_ID = 039;AMS1039;
private constant integer DUMMY_ID = 039;h001039;
private constant real AOE = 500.00
endglobals
globals
private unit dummy
private filterfunc ff
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == BMS_ID
endfunction
private function Execute takes nothing returns boolean
if not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_DEAD) and IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) then
call IssueTargetOrder(dummy, "sleep", GetFilterUnit())
endif
return false
endfunction
private function Actions takes nothing returns nothing
call SetUnitOwner(dummy, GetOwningPlayer(GetTriggerUnit()), false)
call GroupEnumUnitsInRange(GROUP, GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), AOE, ff)
endfunction
//===========================================================================
private function InitTrig takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
set ff = Filter(function Execute)
set dummy = CreateUnit(Player(0), DUMMY_ID, 0, 0, 0)
call UnitAddAbility(dummy, MS1_ID)
endfunction
endlibrary