What my spell is supposed to do:
Group Units around target location and cause a random effect every 0.50 to 1 second for as long as the spell duration i.e ( count * GetUnitAbilityLevel() )
Pretty simple actually, I just don't know how to make it MUI >.<"
EDIT: AND make the count = count - 1 run every second, not every 0.50 to 1 second
Ok... so.. the problem is... how do i make my global "private integer count" MUI? Does it have to be private or public or just "integer count" ?
Also, when the Timer() function is called, the trigger waits for "count" to reach 0 before proceeding to the unitgroup loop... Bleh... Im clueless How do I do this properly?
Do I need to use an attachment system?
Any help will be appreciated much, thx ^^
Group Units around target location and cause a random effect every 0.50 to 1 second for as long as the spell duration i.e ( count * GetUnitAbilityLevel() )
Pretty simple actually, I just don't know how to make it MUI >.<"
EDIT: AND make the count = count - 1 run every second, not every 0.50 to 1 second
JASS:
scope FieldOfChaos initializer Init
globals
private integer count
endglobals
function Timer takes nothing returns nothing
set count = GetUnitAbilityLevel(GetTriggerUnit(), 039;A05N039;) * 5
call TriggerSleepAction(1.00)
loop
exitwhen count == 0
set count = count - 1
call TriggerSleepAction(1.00)
endloop
endfunction
function GroupFilter takes nothing returns boolean
return GetWidgetLife( GetFilterUnit() ) > 0.405 and IsUnitType( GetFilterUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false
endfunction
function Cond takes nothing returns boolean
return GetSpellAbilityId() == 039;A05N039;
endfunction
function Act takes nothing returns nothing
local integer i
local location l = GetSpellTargetLoc()
local real x = GetLocationX(l)
local real y = GetLocationY(l)
local unit c = GetTriggerUnit()
local unit d
local group g = CreateGroup()
local unit temp
call Timer()
loop
set count = count - 1
call BJDebugMsg( I2S(count))
exitwhen count == 0
call GroupEnumUnitsInRange( g, x, y, 250, null)
set temp = GroupPickRandomUnit(g)
if temp != null then
set i = GetRandomInt(1, 6)
set d = CreateUnit( Player(15), Dummy(), x + GetRandomReal( -150, 150) , y + GetRandomReal( -150, 150) , 0)
call SetUnitFlyHeight( d, 300, 900)
call UnitAddAbility(d, udg_FieldOfChaosSpells2<i>)
call IssueTargetOrder( d, udg_FieldOfChaosStrings2<i>, temp)
call UnitApplyTimedLife( d, 039;BTLF039;, 1)
call GroupRemoveUnit(g, temp)
call GroupClear(g)
endif
call TriggerSleepAction( GetRandomReal(0.50, 1.))
endloop
set i = 0
call RemoveLocation(l)
set l = null
set c = null
set d = null
call DestroyGroup(g)
set g = null
set temp = null
endfunction
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition( t, Condition( function Cond) )
call TriggerAddAction(t,function Act)
endfunction
endscope</i></i>
Ok... so.. the problem is... how do i make my global "private integer count" MUI? Does it have to be private or public or just "integer count" ?
Also, when the Timer() function is called, the trigger waits for "count" to reach 0 before proceeding to the unitgroup loop... Bleh... Im clueless How do I do this properly?
Do I need to use an attachment system?
Any help will be appreciated much, thx ^^