HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Sophisticated Hero Respawning

02-11-2003, 09:51 AM#1
Hakujin
Well, I recoded the Hero respawn system in my map and it simply doesn't work. However I am at a loss to explain why. Instead of using wait and revive triggering unit I tried to implement timers and unit arrays. Here's what I did:

==========Variables=============
timer array HeroRespawnTimer (for delaying hero respawn in consistent manner)
unit array DeadHeroList (for storing and recalling dead heroes)
===========Hero Death=============
[Event]
Unit belonging to player 1 dies
''
Unit belonging to player 12 dies

[Condition]
Unit type = Hero

[Action]
(some hero penalties)
(some player messages)
Start HeroRespawnTimer[(Player Number of(Owner of Dying Unit))] as a one-shot timer which lasts 20 seconds
Set DeadHeroList[(Player Number of(Owner of Dying Unit))] = Dying Unit


===========Hero Respawn========= (one for each player number)
[Event]
Time - HeroRespawnTimer[1] expires

[Condition]

[Action]
Hero - Instantly revive DeadHeroList[1] at ~unrelated location variable~
Camera - Pan camera for Player 1 to position of DeadHeroList[1] over 1.00 seconds
02-12-2003, 02:24 PM#2
Hakujin
bump (this is a release-stopping bug)
02-12-2003, 02:46 PM#3
Electromancer
They are on different parts of the array, right? cuz if you got em all going on 1. And wait works much better, since timers can get annoying. Basicly, go with waiting, it works better. Heres what i would use to keep track of the units. And have the unit pre-set, because it will sometimes mess up otherwise.
02-12-2003, 02:52 PM#4
Hakujin
I have 12 triggers for player-specific repawning. Each trigger has this event:

[Event]
HeroRespawnTimer[x*] expires

[Action]
Revive DeadHeroList[x*] at ~position~

*for numbers 1-12
-----------------------------------

But you think I should just revert back to wait? What about the wait bug?
02-12-2003, 03:17 PM#5
Aiursrage2k
I think its a timer problem, for using multiple timers you have to initalize the array, using set udg_TimerArray[1] = CreateTimer()
set udg_TimerArray[2] = CreateTimer(), etc. I cant remember but think that they are only good in the local trigger, so you will need to put the eventTriggerRegister in this trigger.
02-12-2003, 03:45 PM#6
Electromancer
Yea, theres some kinda problem with arrays of timers. It seems that sometimes they dont go unless the others do too. But the thing is, arrays are best for keeping track of things, not for really playing too heavy of a part in triggers, like yours do. Thats best to have multiple variables, since if one has a problem, you dont have to go through them all and check them.
02-12-2003, 03:58 PM#7
Aiursrage2k
I dont think there is any problem with array of timers, rather I dont think you initalized each instance of the array timer. In the case of a single timer, the program will initalize it for you, but it would not make sense for it to initalize 1024 instances for the timer array, so you must do this yourself.
02-12-2003, 07:23 PM#8
BoddoZerg
You also shouldn't try to shuffle around Timer arrays, since they are pointer arrays.