- Joined
- Jun 25, 2009
- Messages
- 427
Hey guys, i wanted to ask you how to make Countdown timers MUI, to destroy it after and etc, should i make 10 timers (vars), because array doesn't work on this thing
Waiting for help.
Tiche3

Tiche3

scope blast initializer i
private struct kbDat
unit pushee
real degDirection
integer power
endstruct
globals
private constant integer BLASTID='A004'
private unit tempCaster
private timer time=CreateTimer()
private integer dbIndex=-1
private group grp=CreateGroup()
private kbDat array kbDB
endglobals
private function p takes nothing returns nothing
local integer index=0
local kbDat tempDat
local real x
local real y
loop
exitwhen index>dbIndex
set tempDat=kbDB[index]
set x=GetUnitX(tempDat.pushee)+tempDat.power*Cos(tempDat.degDirection*bj_DEGTORAD)
set y=GetUnitY(tempDat.pushee)+tempDat.power*Sin(tempDat.degDirection*bj_DEGTORAD)
if IsTerrainWalkable(x,y) then
call SetUnitX(tempDat.pushee,x)
call SetUnitY(tempDat.pushee,y)
else
set tempDat.power=1
endif
set tempDat.power=tempDat.power-1
if tempDat.power<1 then
call tempDat.destroy()
set kbDB[index]=kbDB[dbIndex]
set dbIndex=dbIndex-1
if dbIndex==-1 then
call PauseTimer(time)
endif
endif
set index=index+1
endloop
endfunction
private function f takes nothing returns boolean
local kbDat tempDat
if IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(tempCaster)) then
set tempDat=kbDat.create()
set tempDat.pushee=GetFilterUnit()
set tempDat.degDirection=bj_RADTODEG*Atan2(GetUnitY(GetFilterUnit())-GetUnitY(tempCaster),GetUnitX(GetFilterUnit())-GetUnitX(tempCaster))
set tempDat.power=20
set dbIndex=dbIndex+1
set kbDB[dbIndex]=tempDat
if dbIndex==0 then
call TimerStart(time,.03,true,function p)
endif
endif
return false
endfunction
private function c takes nothing returns boolean
if GetSpellAbilityId()==BLASTID then
set tempCaster=GetSpellAbilityUnit()
call GroupEnumUnitsInRange(grp,GetUnitX(GetSpellAbilityUnit()),GetUnitY(GetSpellAbilityUnit()),500,Filter(function f))
endif
return false
endfunction
private function i takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function c))
endfunction
endscope
Is this a map where each player has only 1 hero?
Then you can simply make it MPI and not MUI
Simply make a timer array and timer dialog array, and then refer to each one using their player's ID (0-11)
Could you show us the code you used please? I'd rather explain to you what's wrong with yours and how to fix it than make it for you.
Timers need to be created before they can be used.