• 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.

How to make TWO winning condtions

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
I have deleted the Melee Initialization - Enfore Victory/Defeat conditions

Instead I want all players to win in this way:


First player who levels his Hero to Level X Wins the game.


OR:

First player who looses all his buildings looses the game!!




Can BOTH these conditoins be added?
 
Level 8
Joined
Aug 21, 2009
Messages
333
yeah, you can do this.

just write 2 separate triggers:

one has event hero levels up; condition is level is X; action is victory for owner of that unit and defeat for all others.

the other trigger has event unit dies; action counts how many buildings each player has and if any count 0 then gives that player defeat.
 
Level 13
Joined
Sep 14, 2008
Messages
1,408
sure :D

Every condition needs 1 trigger:

1.

Events: Every 1 sec of gametime
Condition: -
Actions:
Pick every player in "player playing" and do actions:
If(number of units in "units owned by player matching condition(matching unit is a building = true AND matching unit is alive = true) > 0)
Then: nothing
Else: Game - show defeat dialog to picked player


That one will check if a player has 0 buildings eveyr 1 sec. Thats enough and everything else could cause lag.



2.

Events: Unit - unit gains level
Condition: Integer - Level of triggering unit = "Level X"
Action:
Pick every player in "player playing" and do actions:
If(picked player not equal owner of triggering unit)
Show defeat dialog
Else
Show win dialog
 
Level 10
Joined
Nov 5, 2008
Messages
536
This sounds wonderful!

But when the game starts, no player starts with any building (They select it and the building spawns after a few seconds) how do I do so players do not lose during the first second of the game?
 
Level 7
Joined
Jun 23, 2009
Messages
297
  • First Trigger
  • Events
  • Time - Every 1 second of gametime
  • Conditions
  • Time - Elapsed time is 30
  • Actionss
  • Player Group - Pick every player in "player playing" and do actions:
  • If (number of units in (units owned by (player matching condition)) (matching unit is a building = true AND (matching unit) is alive = true) > 0)
  • Then
  • Do nothing
  • Else
  • Game - show defeat dialog to picked player

  • Second Trigger
  • Events
  • Unit - unit gains level
  • Conditions
  • Integer - Level of triggering unit = "Level X"
  • Time - Elapsed time is 30
  • Actions
  • Player Group - Pick every player in "player playing" and do actions:
  • If - If ((picked player) not equal (owner of (triggering unit))
  • Dialog - Show defeat dialog
  • Else
  • Dialog - Show win dialog
 
Level 5
Joined
Nov 7, 2007
Messages
134
Correct me if I'm wrong, but isn't Baintastics solution much simpler? And with it, there's no possibility that the players will lose during game start-up.
 
Level 10
Joined
Nov 5, 2008
Messages
536
  • Loosing the Game
    • Events
      • Time - Elapsed game time is 30.00 seconds
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in PlayerPlaying 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) and (((Triggering unit) is alive) Equal to True)))) Less than or equal to 0
        • Then - Actions
          • Do nothing
        • Else - Actions
          • Game - Defeat (Picked player) with the message: Defeat!


I have made the trigger like this. Does it work like this you think?
 
Level 8
Joined
Aug 21, 2009
Messages
333
that won't work.

you should just trigger it off of a unit dying instead of a periodic timer and that way you only have to check if all buildings are dead for the player that just lost a unit (less code involved).

Try this:

Event: a Unit Dies

Condition: (Number of units in (Units owned by (Owner of (Dying Unit)) matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)))) equal to 0

Action: Game - Defeat (Owner of (Dying Unit)) with the message: Defeat!
 
Level 7
Joined
Jun 23, 2009
Messages
297
No, the players will lose past 1 seconds. This is because a trigger only need one event to start, so past a second one event will ocurr: every 2 seconds of game time, the trigger will run and all players who do not have a structure will lose... make it like this:

  • Loosing the Game
  • Events
  • Time - Every 2.00 seconds of game time
  • Conditions
  • Time - Elapsed game time is 30.00 seconds
  • Actions
  • Player Group - Pick every player in PlayerPlaying 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) and (((Triggering unit) is alive) Equal to True)))) Less than or equal to 0
  • Then - Actions
  • Do nothing
  • Else - Actions
  • Game - Defeat (Picked player) with the message: Defeat!

That way the trigger will only start when 30 seconds have passed
 
Level 5
Joined
Nov 7, 2007
Messages
134
that won't work.

you should just trigger it off of a unit dying instead of a periodic timer and that way you only have to check if all buildings are dead for the player that just lost a unit (less code involved).

Try this:

Event: a Unit Dies

Condition: (Number of units in (Units owned by (Owner of (Dying Unit)) matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)))) equal to 0

Action: Game - Defeat (Owner of (Dying Unit)) with the message: Defeat!

I still believe this would be the best solution, I'm surprised it still appears to be ignored by everyone :/
 
Level 12
Joined
Mar 10, 2008
Messages
869
No, the players will lose past 1 seconds. This is because a trigger only need one event to start, so past a second one event will ocurr: every 2 seconds of game time, the trigger will run and all players who do not have a structure will lose... make it like this:

  • Loosing the Game
  • Events
    • Time - Every 2.00 seconds of game time
  • Conditions
    • (Elapsed game time is (30.00) seconds)
  • Actions
    • Player Group - Pick every player in PlayerPlaying 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) and (((Triggering unit) is alive) Equal to True)))) Less than or equal to 0
          • Then - Actions
          • Else - Actions
            • Game - Defeat (Picked player) with the message: Defeat!

That way the trigger will only start when 30 seconds have passed
Try and do your [ trigger ]'s properly.
And don't use Do Nothing, it just wastes processing time.
 
Level 5
Joined
Nov 7, 2007
Messages
134
No, the players will lose past 1 seconds. This is because a trigger only need one event to start, so past a second one event will ocurr: every 2 seconds of game time, the trigger will run and all players who do not have a structure will lose... make it like this:

  • Loosing the Game
  • Events
  • Time - Every 2.00 seconds of game time
  • Conditions
  • Time - Elapsed game time is 30.00 seconds
  • Actions
  • Player Group - Pick every player in PlayerPlaying 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) and (((Triggering unit) is alive) Equal to True)))) Less than or equal to 0
  • Then - Actions
  • Do nothing
  • Else - Actions
  • Game - Defeat (Picked player) with the message: Defeat!

That way the trigger will only start when 30 seconds have passed

Also, is there really a condition that checks elapsed game time? I think there's only events that can do that.
 
Level 10
Joined
Nov 5, 2008
Messages
536
Now it is time for the final!

Are these triggers correct and leakless and effective?

("PlayerPlaying" is a PlayerGroup Variable)

  • Winning the Game 1
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Player Group - Pick every player in PlayerPlaying 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) and (((Triggering unit) is alive) Equal to True)))) Less than or equal to 0
        • Then - Actions
        • Else - Actions
          • Game - Defeat (Picked player) with the message: Defeat!
  • Winning the Game 2
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Level of (Triggering unit)) Equal to 8
    • Actions
      • Game - Victory (Owner of (Triggering unit)) (Show dialogs, Show scores)
      • Player Group - Pick every player in (All players matching ((Matching player) Not equal to (Owner of (Triggering unit)))) and do (Actions)
        • Loop - Actions
          • Game - Defeat (Picked player) with the message: Defeat!
 
Level 5
Joined
Nov 7, 2007
Messages
134
No, the "Losing"-trigger will not work, because:

1. You didn't put the "If/Then/Else"-action in the "Pick every player"-loop.

2. In the condition, where you have selected "(((Triggering unit) is alive) Equal to True)))" you should use "Matching unit" instead of "Triggering unit".

3. I think the "Game - Defeat"-action should be in the "Then - Actions" and not in the "Else - Actions

Otherwise I think it's okay.
 
Level 8
Joined
Aug 21, 2009
Messages
333
I don't know why I have to keep saying this, but this is what it should be:

  • Winning the Game 1
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Number of units in (Units owned by (Owner of (Dying Unit)) matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)))) equal to 0
    • Actions
      • Game - Defeat (Owner of (Dying Unit)) with the message: Defeat!
  • Winning the Game 2
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Level of (Leveling Hero)) Equal to 8
    • Actions
      • Game - Victory (Owner of (Leveling Hero)) (Show dialogs, Show scores)
      • Player Group - Pick every player in (All players matching ((Matching player) Not equal to (Owner of (Leveling Hero)))) and do (Actions)
        • Loop - Actions
          • Game - Defeat (Picked player) with the message: Defeat!
Hopefully no more explanation is needed :D
 
Level 5
Joined
Nov 7, 2007
Messages
134
I don't know why I have to keep saying this, but this is what it should be:

  • Winning the Game 1
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Number of units in (Units owned by (Owner of (Dying Unit)) matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is alive) Equal to True)))) equal to 0
    • Actions
      • Game - Defeat (Owner of (Dying Unit)) with the message: Defeat!
  • Winning the Game 2
    • Events
      • Unit - A unit Gains a level
    • Conditions
      • (Level of (Leveling Hero)) Equal to 8
    • Actions
      • Game - Victory (Owner of (Leveling Hero)) (Show dialogs, Show scores)
      • Player Group - Pick every player in (All players matching ((Matching player) Not equal to (Owner of (Leveling Hero)))) and do (Actions)
        • Loop - Actions
          • Game - Defeat (Picked player) with the message: Defeat!
Hopefully no more explanation is needed :D

You seem to be a poor, misunderstood soul :p
 
Status
Not open for further replies.
Top