• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

can anyone find my mistake

Status
Not open for further replies.
Level 3
Joined
Jul 5, 2004
Messages
38
if you like a story about why i made this topic read the whole text, if you dont then skip the italic part

I got a map here that has seen some games allready on b.net ( wonderous what a name like "dutch here!" can do isnt it? ). anyways we were playing the map with the 8 of us and most of us agreed they liked it, and i was allready halfway to heaven of so much compliments when someone replied: hu? my hero doesnt respawn?? and that moment i was thrown back to earth... auch.

so after the game, i opened up WE and examined what went wrong. i soon figured i better make individual triggers for herorespawning. so i did. after that i hosted another game: "free amstel (dutch beer) here".

and the game was full again within seconds. i started it and it went great untill 2 minutes before winning some1 came again with: he ! my hero doesnt respawn!
Bang... smashed through the ground right to hell...even more auch.


so my question: can anyone tell me what i am doing wrong with the hero respawning? It seems to work alright most of the time, and i think it cant be player related anymore.

so could anyone look into my map and tell me whats wrong? the map can be found here: http://www.wc3sear.ch/index.php?p=Maps&ID=2304&sid=3c13609e994a307b53311d40fe5edc22 you can find the triggers under "reviving heros" map.

if you think DL'ing the map is too much work, i could also post the triggers here if you want. but since i dont think its related to the trigger itself but other triggers around it i thought i better post the map itself.
 
Level 8
Joined
Apr 3, 2004
Messages
507
I'm not going to download and examine the map, with the other projects that I've got going on right now, but I'd love to help you out. Maybe we can brainstorm a bit here and figure out what you need to do, and what might be getting in the way.

Each player has only one hero, right? If that's the case, for ease of triggering you'll probably want to make a unit array variable where you store the hero for each player in an index by that player's number, if you're not already. For example, unitArrayHero[1] would be Player 1 (Red)'s hero, unitArrayHero[4] would be Player 4 (Purple)'s hero, etc.

Thus, when a hero dies, you don't need to store it in a new variable ever, and if you need to refer to it somewhere else, it's handily available.

Does the hero respawn after a certain time, or is he revived at a building? Tell me about the situation.
 
Level 3
Joined
Jul 5, 2004
Messages
38
they respawn after 30 seconds in a region, at their homebase, since the heros aint on the map at the start of the game ( got a dialogbox herochooser, yeh me :p ) i cant refer them to them as heroxxx<gen> too.

anyways i am going to look into what you showed and i hope it will help. thanks for responding quickly.
 
Level 8
Joined
Apr 3, 2004
Messages
507
Well, as soon as you choose the hero via dialog box and it's created, set unitArrayHero[(Player number of (Triggering Player))] = (Last created Unit)

Do you have a periodic event or repeating timer? Or do you spawn each hero exactly 30 seconds from its death?
 
Level 3
Joined
Jul 5, 2004
Messages
38
well the trigger looks a bit like this:

event: a unit from playerX dies
condition: triggering unit is A hero equal to true
actions: - pick everyplayerin[Allplayers] and if triggering equal to pickedplayer then do game- msg
else do nothing
- wait for 30 seconds
- revive triggering unit in a random spot at Team1start<gen> and show revival graphics.
- camera - pan in 2 seconds to triggering unit.

so youre suggesting instead of revive triggering hero i should use an array for the player, so it would look more like "revive X hero" ?
 
Level 9
Joined
Sep 8, 2004
Messages
633
zontar, you should try Panto's approach.
In Age of Summoners, another map of mine, the respawn system works like that aswel, when a hero is chosen, that hero is assigned a variable Heroofplayer(player number of triggering player)
That's the best system i know of that will always work.
Due to the 1.17 patch, that didn't work for a while either, but the bug there was that the heroes did respawn, but just for the wrong players.
Try it :)

goodluck
 
Level 8
Joined
Apr 3, 2004
Messages
507
zontar, I can already see the problem with your trigger.

Okay, let's see, how to explain this.

There's such a thing as a trigger queue. When a trigger is, uh, triggered (when an event occurs) it gets placed on the trigger queue. Usually there aren't many triggers lying around waiting, because processing a trigger is very easy. If there is a trigger in-process when another one is triggered, the new one starts immediately after the old one finishes. They do not overlap at all.

However, there is an exception.

Whenever you put a Wait of any kind into a trigger, it stops worrying about that trigger until the wait has elapsed, and executes other triggers during that time.

The most likely reason that your trigger is not working is that you refer to (Triggering Unit) after the Game-Wait. Since the trigger has been sitting around for 30.00 seconds, there's been plenty of time for (Triggering Unit) to be overwritten by any of a billion other triggers' events. Thus, when the time comes to revive, it doesn't.

What you ought to do is this. Make a timer array variable indexed by player number. Make one trigger for when a hero dies, and another for when a timer expires. Put all 12 indices of the timer array variable on the events list of the "timer expires" trigger.

In the "hero dies" trigger, print your message, and then start timerArrayRevive[(Player Number of (Owner of (Dying Unit)))] as a one-shot 30.00-second timer.

In the "timer expires" trigger, do a For Loop 1 to 12; inside it have an If with the condition (Expiring Timer) is equal to timerArrayRevive[(For Loop Integer A)] and the action Revive unitArrayHero[(For Loop Integer A)] at position yada yada.

(Expiring Timer) might only be available in Jass. If you can't find it in GUI, I'll give you the jass to custom-text it.

At any rate, this is the best method that I can imagine to make a revive trigger for your purposes.

If any of your heroes have a Reincarnation-style ability, I recommend that you check if the hero is dead before reviving it in the "timer expires" trigger.

(BTW, use the most specific event response that you can, whenever possible. In this case, use (Dying Unit) instead of (Triggering Unit).)
 
Level 3
Joined
Jul 5, 2004
Messages
38
uhm yeh i think i will just stick with the (dying unit) instead of all that above :p

i could try to understand it, but not today... i have an ICT-exam tomorrow, and i am filled up with SQL. :wink:
 
Status
Not open for further replies.
Top