• 🏆 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!

[General] Game over trigger event

Status
Not open for further replies.
Level 7
Joined
Apr 26, 2015
Messages
125
Hey there, just looking for a little help with a Game over trigger event.

I have it so when all the main characters die, it ends the game....

The problem i'm running into is, if one of the heroes is holding a Ankh of Reincarnation it still gives the game over while the hero is being revived....

I need it to be so it ignores the game over event if the hero is being revived :/ I'm sure it's simple but i'm just to tired to figure it out :p

I have the trigger as..
*A unit owned by player1 red dies

* Hero 1 is dead equal to true
* Hero 2 is dead equal to true

*Then Defeat player 1 red with game over message..

I'm looking for a condition that says something like " If hero owned by player1 red is being revived" Or "If unit owend by player 1 red has an Ankh of Reincarnation" then skip remaining events...But I can't find an option for those..:/
 
Last edited:
Level 7
Joined
Apr 26, 2015
Messages
125
Then why dont you check if dying unit has ankh of reincarnation ?
Oh hey thanks for the reply.
Sadly I've already tried that, and it doesn't work because if say Both heroes die around the same time, and only one of them has an ankh of reincarnation, if the one holding that item dies first and is being revived, and the one without it dies next it will give the game over because the last dying unit doesn't have that item.. Hehe it's a little confusing :p
 
Why don't you try doing it consequently?
if hero1 dies and he has no ankh of reincarnation then
if hero2 is dead = true then
end the game​

same if hero2 dies first

If this doesn't work, then create boolean array of 2
heroHasAnkh[2] = true
and when a hero dies just set his ankh boolean to false, skipping end game
if its already false then proceed to end the game

if you can buy or loot ankhs in the game then instead of boolean use integer to count how many he has and decrement it when he dies, then check count..

if a hero drops his ankh then check if he has any more ankhs, if not then set his boolean to false
 
Last edited:
Level 8
Joined
May 21, 2019
Messages
435
Pseudo-code could be something like:

A unit dies

If(Triggering unit is in unit group UnitsHoldingAnkhs = false)
Then{
(If AliveHeroes = 1){
End Game
}
Else{
AliveHeroes = Aliveheroes - 1
}
Else{
Wait X amount of seconds to allow ankh to work
Check if hero still has an ankh, if not, remove from UnitsHoldingAnkhs group
}

This should work, if you track whenever someone acquires, drops, or sells an Ankh. It'd make sense to have an Ankh checking trigger that you can run from whatever context you need.

There may be an easier solution, but this should work.
 
Level 6
Joined
Mar 7, 2011
Messages
124
it might be easier to break the event down into 2 pieces

event - a hero dies
action - if all heroes are dead then start a timer global for the ankh respawn time + 1 second (buffer) as a non recurring timer

event - the above timer expires
action - if all heroes are still dead the end the game

this should work even if multiple players die / start reviving in the same time frame, as starting a timer that's already running should reset it (it'll only expire once total). this is also compatible with reincarnate
 
Status
Not open for further replies.
Top