HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

timer Troubles

08-13-2006, 07:32 AM#1
refl3ction
well u guessed it, heres my trouble... when i play on the first team the revive timer works, but when i play on the second team it doesnt work as shown in the picture

wrong timer:
Click image for larger version

Name:	Timer.jpg
Views:	19
Size:	19.9 KB
ID:	10851
the correct timer:
Click image for larger version

Name:	Correct Timer.jpg
Views:	16
Size:	20.2 KB
ID:	10852

well heres my triggers:
Trigger:
Make Timer
Collapse Events
Unit - A unit Dies
Collapse Conditions
((Dying unit) is A Hero) Equal to True
Collapse Actions
Set Hero_Revive_Time_Factor = 5.00
Set Dead_Hero = (Dying unit)
Set TempReal = (((Real((Hero level of (Dying unit)))) x Hero_Revive_Time_Factor) + 5.00)
Countdown Timer - Start ReviveTimers[(Player number of (Owner of Dead_Hero))] as a One-shot timer that will expire in TempReal seconds
Countdown Timer - Create a timer window for (Last started timer) with title ((Proper name of Dead_Hero) + revives in: )
Countdown Timer - Show (Last created timer window) for (Owner of Dead_Hero)
Set ReviveTimers[(Player number of (Owner of Dead_Hero))] = (Last started timer)
Set Timer = (Last created timer window)

Trigger:
Timer Expires
Collapse Events
Time - ReviveTimers[1] expires
Time - ReviveTimers[2] expires
Time - ReviveTimers[3] expires
Time - ReviveTimers[4] expires
Time - ReviveTimers[5] expires
Time - ReviveTimers[6] expires
Time - ReviveTimers[7] expires
Time - ReviveTimers[8] expires
Time - ReviveTimers[10] expires
Time - ReviveTimers[11] expires
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Remaining time for ReviveTimers[(Player number of (Owner of Dead_Hero))]) Less than 1.00
Collapse Then - Actions
Countdown Timer - Destroy Timer
Countdown Timer - Hide Timer
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of Dead_Hero) is in North) Equal to True
Collapse Then - Actions
Hero - Instantly revive Dead_Hero at (Center of North Start <gen>), Show revival graphics
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of Dead_Hero) is in South) Equal to True
Collapse Then - Actions
Hero - Instantly revive Dead_Hero at (Center of South Start <gen>), Show revival graphics
Else - Actions
Camera - Pan camera for (Owner of Dead_Hero) to (Position of Dead_Hero) over 0.00 seconds

thanks in advance
Attached Images
File type: jpgTimer.jpg (19.9 KB)
File type: jpgCorrect Timer.jpg (20.2 KB)
08-13-2006, 07:58 AM#2
DioD
Check vars values...
Only created timers can be started.
08-13-2006, 08:31 AM#3
blu_da_noob
Set the 'size' of the array in the variable editor to 12.
08-13-2006, 10:35 AM#4
Fireeye
I also see another Problem in your second Trigger, you use a variable, what happen if 2 heros dies at the same time?
Because only 1 hero can be Dead_Hero.
And @ DioD you can start a timer without a created timer window, i use them pretty often for background events.
08-13-2006, 11:24 AM#5
The)TideHunter(
Ya, i think everybody does, common sense, 75% of my CF stuff uses timers.
But who says i gotta use a window?
08-13-2006, 11:30 AM#6
blu_da_noob
He wasn't saying that you need a timer window for a timer, he was saying that the timer windows aren't working because the timers in the array don't exist (they haven't been created). That's why the size needs to be set to 12 in the variable editor.
08-13-2006, 11:41 AM#7
The)TideHunter(
I though he would already have the array at 12, its pretty much common sense.
If you have 12 players, your going to need 12 timers.
08-13-2006, 11:44 AM#8
blu_da_noob
Most arrays don't need to have any size value set, but when using GUI things like timers do need it, because that's what makes WE create the timers for you (which you can't do otherwise in GUI).
08-13-2006, 06:28 PM#9
refl3ction
well theres only 10 players and 2 comps and comps dont have heroes
so what should i do about the dead_hero variable

Edit: well i got the timer to work (by work i mean countdown) but when i gests to zero it stops and it doesnt revive my hero
08-13-2006, 07:10 PM#10
MeanMachine
First, why do you use a single dead_hero variable. Having 2 heroes waiting for revival will totally mess it up.

Second, it doesn't work because you revive the hero on Else - Action. Which means it will Revive the hero if the timer has more than 1 seconds remaining(and your event is timer expired). Do this :
Trigger:
Timer Expires
Collapse Events
Time - ReviveTimers[1] expires
Time - ReviveTimers[2] expires
Time - ReviveTimers[3] expires
Time - ReviveTimers[4] expires
Time - ReviveTimers[5] expires
Time - ReviveTimers[6] expires
Time - ReviveTimers[7] expires
Time - ReviveTimers[8] expires
Time - ReviveTimers[10] expires
Time - ReviveTimers[11] expires
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Remaining time for ReviveTimers[(Player number of (Owner of Dead_Hero))]) Less than 1.00
Collapse Then - Actions
Countdown Timer - Destroy Timer
Countdown Timer - Hide Timer
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of Dead_Hero) is in North) Equal to True
Collapse Then - Actions
Hero - Instantly revive Dead_Hero at (Center of North Start <gen>), Show revival graphics
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of Dead_Hero) is in South) Equal to True
Collapse Then - Actions
Hero - Instantly revive Dead_Hero at (Center of South Start <gen>), Show revival graphics
Else - Actions
Else - Actions
Camera - Pan camera for (Owner of Dead_Hero) to (Position of Dead_Hero) over 0.00 seconds
Else - Actions

I wan't even begin talking about optimizing the triggers ...
08-13-2006, 07:21 PM#11
Captain Griffen
Why destroy the timer afterwards?
08-13-2006, 07:35 PM#12
MeanMachine
Quote:
Originally Posted by Captain Griffen
Why destroy the timer afterwards?
Hmm,yes indeed.But AFAIK there's no such GUI function. But I won't talk about optimizing the trigger. I just don't want to waste an hour of my life :P
08-13-2006, 07:41 PM#13
refl3ction
Trigger:
Make Timer
Collapse Events
Unit - A unit Dies
Collapse Conditions
((Dying unit) is A Hero) Equal to True
Collapse Actions
Set Hero_Revive_Time_Factor = 5.00
Set Dead_Hero[(Player number of (Owner of (Dying unit)))] = (Dying unit)
Set TempReal = (((Real((Hero level of (Dying unit)))) x Hero_Revive_Time_Factor) + 5.00)
Countdown Timer - Start (Last started timer) as a One-shot timer that will expire in TempReal seconds
Countdown Timer - Create a timer window for (Last started timer) with title ((Name of (Dying unit)) + :)
Countdown Timer - Show (Last created timer window) for (Owner of (Dying unit))
Set ReviveTimers[(Player number of (Owner of (Dying unit)))] = (Last started timer)
Set Timer = (Last created timer window)

thats my updated trigger for making it, which it does and the timer begins but wen it reaches zero it doesnt revive the hero on either team

Trigger:
Timer Expires
Collapse Events
Time - ReviveTimers[1] expires
Time - ReviveTimers[2] expires
Time - ReviveTimers[3] expires
Time - ReviveTimers[4] expires
Time - ReviveTimers[5] expires
Time - ReviveTimers[6] expires
Time - ReviveTimers[7] expires
Time - ReviveTimers[8] expires
Time - ReviveTimers[9] expires
Time - ReviveTimers[10] expires
Time - ReviveTimers[11] expires
Time - ReviveTimers[12] expires
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Remaining time for ReviveTimers[(Player number of (Owner of (Dying unit)))]) Less than 1.00
Collapse Then - Actions
Countdown Timer - Destroy Timer
Countdown Timer - Hide Timer
Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of Dead_Hero[(Player number of (Owner of (Dying unit)))]) is in North) Equal to True
Collapse Then - Actions
Hero - Instantly revive Dead_Hero[(Player number of (Owner of (Dying unit)))] at (Center of North Start <gen>), Show revival graphics
Collapse Else - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of Dead_Hero[(Player number of (Owner of (Dying unit)))]) is in South) Equal to True
Collapse Then - Actions
Hero - Instantly revive Dead_Hero[(Player number of (Owner of (Dying unit)))] at (Center of South Start <gen>), Show revival graphics
Else - Actions
Camera - Pan camera for (Owner of (Dying unit)) to (Position of Dead_Hero[(Player number of (Owner of (Dying unit)))]) over 0.00 seconds

as you can see i made the 'Dead_hero' variable into an array
08-13-2006, 07:55 PM#14
MeanMachine
No you propably didn't understand. For changing the Dead_Hero will have to change the system itself. Make the trigger like mine for now and it will work.Believe me, writing a new trigger will be easier than changing your current one. If you want, I can write you one.
08-13-2006, 08:11 PM#15
refl3ction
alright, than if you have the time could you write on up for me?
thanks