• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Stupid Victory/Defeat Ignoring me!

Status
Not open for further replies.
Level 2
Joined
Dec 24, 2008
Messages
11
Okay so I looked at every post about this subject, and I did not find a solution. One guy posted script that had the actual JASS form of victory/defeat and it made my map crash lol.

I have a map of custom races, and for some reason, any time one building gets destroyed (doesn't matter whose or what type of building) EVERY player becomes "Revealing in 2:00."

So I disabled victory/defeat conditions and wrote my own simple trigger for this, however it does not include when ppl leave. (Don't know how to do that one yet).

  • Lose
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A structure) Equal to True
    • Actions
      • Player Group - Pick every player in (All allies of (Owner of (Dying unit)))
  • and do (If ((Number of units in (Units owned by (Picked player) matching
  • (((Matching unit) is A structure) Equal to True))) Equal to 0) then do (Game -
  • Defeat (Picked player) with the message: Defeat!) else do (Do nothing))
    • Player Group - Pick every player in (All enemies of (Owner of (Killing unit))) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Number of units in (Units owned by (Picked player) matching (((Matching unit) is A structure) Equal to True))) Equal to 0
          • Then - Actions
            • Game - Victory (Picked player) (Show dialogs, Show scores)
          • Else - Actions
            • Do nothing

This does NOTHING.
 
Last edited by a moderator:
Level 5
Joined
Aug 24, 2008
Messages
199
This might not help you but when you play a normal melee game and loose all your main Buildings that timer shows up. So maybe this has to do something with your problem. What are your custom buildings based on?

I don't thing the trigger is your problem since revealing has nothing to do with defeat.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
I avoided those complicated jass scripts (I've seen them too, but thought it could be done a lot easier) by doing the following:

Whenever a custom race is selected, create its starting units but also create a human town hall at the left upper corner of the map (at a place nobody can come). Hide the unit so nobody can see it, including the owner.

Whenever a custom "main" is destroyed or canceled, check if the # of mains of the player is 0. In that case, remove the human town hall.

Whenever a custom "main" is constructed, again check if the # of mains of the player is (now) 1. In that case, construct a new human town hall at the upper left corner and hide it.

Note: I don't remember if "hidden" units still count in the victory conditions, so if they don't you simply make the human town hall use "no" model, locust, no visibility, no sounds, no collosion, etc. Now the humans no longer have a town hall, so you create a new custom town hall for the humans and do the same with the human race as you would do with the custom races.

That way you basically simulate the victory conditions without messing with the jass code.

If you still want to use jass, the easiest way to solve it is a simple copy/paste of all those functions and adding your race buildings to them...
 
Level 2
Joined
Dec 24, 2008
Messages
11
okay this is what I changed based on what terradont said, and it caused the person killing the structure to win, even if there were other players in the game who are his enemies. and Defeat works the same way. here's what I did:

Lose
Events
Unit - A unit Dies
Conditions
((Dying unit) is A structure) Equal to True
Actions
Player Group - Pick every player in (All allies of (Owner of (Dying unit))) and do (If ((Number of units in (Units owned by (Picked player) matching ((((Matching unit) is A structure) Equal to True) and ((Life of (Matching unit)) Greater than 0.00)))) Equal to 0) then do (Game - Defeat (Picked player) with the message: Defeat!) else do (Do
Player Group - Pick every player in (All enemies of (Owner of (Killing unit))) and do (Actions)
Loop - Actions
If ((Count structures controlled by (Picked player) (Include incomplete structures)) Equal to 0) then do (Game - Victory (Owner of (Killing unit)) (Show dialogs, Show scores)) else do (Do nothing)


But I am gonna try what Eleandor said and tell you how it goes
 
Level 17
Joined
Jan 21, 2007
Messages
2,014
Lose
Events
Unit - A unit Dies
Conditions
((Dying unit) is A structure) Equal to True
Actions
Player Group - Pick every player in (All allies of (Owner of (Dying unit))) and do (If ((Number of units in (Units owned by (Picked player) matching ((((Matching unit) is A structure) Equal to True) and ((Life of (Matching unit)) Greater than 0.00)))) Equal to 0) then do (Game - Defeat (Picked player) with the message: Defeat!) else do (Do
Player Group - Pick every player in (All enemies of (Owner of (Killing unit))) and do (Actions)
Loop - Actions
If ((Count structures controlled by (Picked player) (Include incomplete structures)) Equal to 0) then do (Game - Victory (Owner of (Killing unit)) (Show dialogs, Show scores)) else do (Do nothing)

What is the highlighted section supposed to mean?
 
Level 2
Joined
Dec 24, 2008
Messages
11
it's referrring to the number of units owned by that player, which should be zero. Well it should be referring to ALL ENEMIES but it only considers the one being attacked as the only enemy.

Also, I tried what Eleandor said, and when I killed the computers ziggurat, even though I KNOW i had a town hall in the upper left corner, it said you will be revealed. And I found those JASS scripts you are talking about, but how do I edit them without screwing up the game? wont it mess up battlenet and stuff? I tried making a trigger with the functions but it had a million errors.
 
Level 2
Joined
Dec 24, 2008
Messages
11
how do you trigger tag?

This is so frustrating I can't have any progress on my map because I can't even do exactly what a melee map is supposed to do!
 
Level 2
Joined
Dec 24, 2008
Messages
11
  • Lose
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A structure) Equal to True
    • Actions
      • Player Group - Pick every player in (All allies of (Owner of (Dying unit))) and do (If ((Number of units in (Units owned by (Picked player) matching ((((Matching unit) is A structure) Equal to True) and ((Life of (Matching unit)) Greater than 0.00)))) Equal to 0) then do (Game - Defeat (Picked player) with the message: Defeat!) else do (Do
      • Player Group - Pick every player in (All enemies of (Owner of (Killing unit))) and do (Actions)
        • Loop - Actions
          • If ((Count structures controlled by (Picked player) (Include incomplete structures)) Equal to 0) then do (Game - Victory (Owner of (Killing unit)) (Show dialogs, Show scores)) else do (Do nothing)
lol there are no numbers being considered true.

Good News! The defeat condition works perfectly for multiple people, including if you have an ally. Excellent...
 
Last edited by a moderator:
Level 2
Joined
Dec 24, 2008
Messages
11
nope... still can't figure out how to win. I can only defeat people, but nobody can win. For some reason the computer doesn't know how to count the enemies of a player so there's nothing I can do. If that simple function won't work then this map will fail.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Try because (All allies of (Owner of (Dying unit))) is the same as (All enemies of (Owner of (Killing unit))) . One you get the allies of the dead unit. The other you get the enemies of the killing unit which includes the dying unit's owner and possiably his allies.

How you are using them makes little sense.
As defeated players can not win, it fails.
 
Level 2
Joined
Dec 24, 2008
Messages
11
Try because (All allies of (Owner of (Dying unit))) is the same as (All enemies of (Owner of (Killing unit))) . One you get the allies of the dead unit. The other you get the enemies of the killing unit which includes the dying unit's owner and possiably his allies.

How you are using them makes little sense.
As defeated players can not win, it fails.

well, when you get defeated, it asks about all of your allies, and it works efficiently. However, when you kill someone, it asks about all of your enemies. Now this might be ONLY the dying unit and his allies, but it is a 12-person map so it could refer to 2 other teams and so on. So all allies of owner of dying unit does not equal all enemies of owner of killing unit.

so, that's why it makes no sense that it is giving the killng unit victory when he kills an individual team, or player, when there are other enemies remaining.

  • Lose
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A structure) Equal to True
    • Actions
      • [I]Player Group - Pick every player in (All allies of (Owner of (Dying unit))) and do (If ((Number of units in (Units owned by (Picked player) matching ((((Matching unit) is A structure) Equal to True) and ((Life of (Matching unit)) Greater than 0.00)))) Equal to 0) then do (Game - Defeat (Picked player) with the message: Defeat!) else do (Do [/I]
      • Player Group - Pick every player in (All players matching (((Matching player) is an enemy of (Owner of (Killing unit))) Equal to True)) and do (If ((Number of units in (Units owned by (Picked player) matching ((((Matching unit) is A structure) Equal to True) and ((Life of (Matching unit)) Greater than 0.00)))) Equal to 0) then do (Game - Victory (Owner of (Killing unit)) (Show dialogs, Show scores))
Does somebody wanna just WRITE me a trigger? lol one that works? the part with "i's" works. hopefully i can figure out a similar function for when ppl have left.
 
Level 2
Joined
Dec 24, 2008
Messages
11
I think I've got it...

I added each individual player to a player group called p1enemies, p2enemies, p3enemies, etc. and then when someone was defeated, I picked every player in allies of owner of dying unit... you know the same group for deciding if they got beat, well here just look at it. it's long but its the way i think:
  • Lose
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is A structure) Equal to True
    • Actions
      • Player Group - Pick every player in (All allies of (Owner of (Dying unit))) and do (If ((Number of units in (Units owned by (Picked player) matching ((((Matching unit) is A structure) Equal to True) and ((Life of (Matching unit)) Greater than 0.00)))) Equal to 0) then do (Game - Defeat (Picked player) with the message: Defeat!) else do (Do
      • Player Group - Pick every player in (All allies of (Owner of (Dying unit))) and do (If ((Number of units in (Units owned by (Picked player) matching ((((Matching unit) is A structure) Equal to True) and ((Life of (Matching unit)) Greater than 0.00)))) Equal to 0) then do (Set teamdefeat = True) else do (Do nothing))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • teamdefeat Equal to True
        • Then - Actions
          • Player Group - Pick every player in (All allies of (Owner of (Dying unit))) and do (Actions)
            • Loop - Actions
              • Player Group - Remove (Picked player) from p1enemies
              • Player Group - Remove (Picked player) from p2enemies
              • Player Group - Remove (Picked player) from p3enemies
              • Player Group - Remove (Picked player) from p4enemies
              • Player Group - Remove (Picked player) from p5enemies
              • Player Group - Remove (Picked player) from p6enemies
              • Player Group - Remove (Picked player) from p7enemies
              • Player Group - Remove (Picked player) from p8enemies
              • Player Group - Remove (Picked player) from p9enemies
              • Player Group - Remove (Picked player) from p10enemies
              • Player Group - Remove (Picked player) from p11enemies
              • Player Group - Remove (Picked player) from p12enemies
        • Else - Actions
          • Do nothing
      • Set teamdefeat = False
      • If ((Number of players in p1enemies) Equal to 0) then do (Game - Victory Player 1 (Red) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p2enemies) Equal to 0) then do (Game - Victory Player 2 (Blue) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p3enemies) Equal to 0) then do (Game - Victory Player 3 (Teal) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p4enemies) Equal to 0) then do (Game - Victory Player 4 (Purple) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p5enemies) Equal to 0) then do (Game - Victory Player 5 (Yellow) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p6enemies) Equal to 0) then do (Game - Victory Player 6 (Orange) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p7enemies) Equal to 0) then do (Game - Victory Player 7 (Green) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p8enemies) Equal to 0) then do (Game - Victory Player 8 (Pink) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p9enemies) Equal to 0) then do (Game - Victory Player 9 (Gray) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p10enemies) Equal to 0) then do (Game - Victory Player 10 (Light Blue) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p11enemies) Equal to 0) then do (Game - Victory Player 11 (Dark Green) (Show dialogs, Show scores)) else do (Do nothing)
      • If ((Number of players in p12enemies) Equal to 0) then do (Game - Victory Player 12 (Brown) (Show dialogs, Show scores)) else do (Do nothing)
i also remove an individual player from a player group if they leave. Please tell me if there's anything crucial im missing? I MIGHT write the code for revealing a person but maybe not. Hope this helps anyone else who is trying to find this answer...
 
Status
Not open for further replies.
Top